/**
     * Updates the language items of a language category.
     * 
     * @param	array		$items
     * @param	integer		$categoryID
     * @param	integer		$packageID
     * @param 	array		$useCustom
     */
    public function easyUpdateItems($categoryString, $items, $packageID = null)
    {
        $packageID = $packageID === null ? WCF::getPackageID('de.easy-coding.wcf.contest') : $packageID;
        $language = new LanguageEditor($this->languageID);
        $xmlString = '<?xml version="1.0" encoding="' . CHARSET . '"?>
		<language languagecode="' . $this->getLanguageCode() . '">
			<category name="' . $categoryString . '">';
        foreach ($items as $key => $val) {
            if ($val === null) {
                continue;
            }
            $xmlString .= '<item name="' . $key . '"><![CDATA[' . $val . ']]></item>';
        }
        $xmlString .= '
			</category>
		</language>';
        $xml = new XML();
        $xml->loadString($xmlString);
        $language->updateFromXML($xml, $packageID);
    }
예제 #2
0
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once WCF_DIR . 'lib/system/language/LanguageEditor.class.php';
require_once WCF_DIR . 'lib/util/XML.class.php';
$std = 'english';
$languages = WCF::getCache()->get('languages');
foreach ($languages as $languageID => $languageArray) {
    $editor = new LanguageEditor($languageID);
    if (file_exists('lang/' . $languageArray['languageCode'] . '.xml')) {
        $xml = new XML('lang/' . $languageArray['languageCode'] . '.xml');
    } else {
        $string = file_get_contents('lang/' . $std . '.xml');
        $string = preg_replace('/languagecode="' . $std . '"/i', 'languagecode="' . $std . '"', $string, 1);
        $xml = new XML();
        $xml->loadString($string);
    }
    $editor->updateFromXML($xml);
}
예제 #3
0
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with WOT Game.  If not, see <http://www.gnu.org/licenses/>.
*/
define('INSIDE', true);
$ugamela_root_path = '../';
include $ugamela_root_path . 'extension.inc';
include $ugamela_root_path . 'common.' . $phpEx;
if (!check_user()) {
    header("Location: login.php");
    die;
}
require_once WCF_DIR . 'lib/system/language/LanguageEditor.class.php';
require_once WCF_DIR . 'lib/util/XML.class.php';
$std = 'de-informal';
$languageCache = WCF::getCache()->get('languages');
$languages = $languageCache['languages'];
foreach ($languages as $languageID => $languageArray) {
    $editor = new LanguageEditor($languageID);
    if (file_exists('lang/' . $languageArray['languageCode'] . '.xml')) {
        $xml = new XML('lang/' . $languageArray['languageCode'] . '.xml');
    } else {
        $string = file_get_contents('lang/' . $std . '.xml');
        $string = preg_replace('/languagecode="' . $std . '"/i', 'languagecode="' . $std . '"', $string, 1);
        $xml = new XML();
        $xml->loadString($string);
    }
    $editor->updateFromXML($xml, PACKAGE_ID);
}