function msgQueryLocale($aRequest) { global $gLocale; global $gGame; loadGameSettings(); $EncodedLocale = array(); $LocaleName = getLocaleName(); $Flags = PHP_VERSION_ID >= 50400 ? ENT_COMPAT | ENT_XHTML : ENT_COMPAT; $Flags = PHP_VERSION_ID >= 50300 ? $Flags | ENT_IGNORE : $Flags; // Hardcoded strings foreach ($gLocale as $Key => $Value) { if ($Value != null) { $Encoded = getUTF8($Value); //htmlentities(getUTF8($Value), $Flags, 'UTF-8'); $EncodedLocale[$Key] = $Encoded; } } // Game based strings if (isset($gGame['Locales'][$LocaleName])) { foreach ($gGame['Locales'][$LocaleName] as $Key => $Value) { if ($Value != null) { $Encoded = getUTF8($Value); //htmlentities(getUTF8($Value), $Flags, 'UTF-8'); $EncodedLocale[$Key] = $Encoded; } } } Out::getInstance()->pushValue('locale', $EncodedLocale); }
function xmlentities($aString, $aCompat, $aCharset) { $ValidString = htmlentities(getUTF8($aString), $aCompat, $aCharset); // if the given charset did not work use fallback $Flags = PHP_VERSION_ID >= 50300 ? $aCompat | ENT_IGNORE : $aCompat; if ($ValidString == '') { $ValidString = htmlentities($aString, $Flags, 'ISO8859-15'); } $HtmlTranslationTable = get_html_translation_table(HTML_ENTITIES, $aCompat); $TranslationTable = array(); $TranslationTable['@'] = xmlSpecialChar('@'); $TranslationTable['['] = xmlSpecialChar('['); $TranslationTable[']'] = xmlSpecialChar(']'); $TranslationTable['\''] = xmlSpecialChar('\''); foreach ($HtmlTranslationTable as $Key => $Value) { $TranslationTable[$Value] = xmlSpecialChar($Key); } $Translated = strtr($ValidString, $TranslationTable); if ($Translated === false) { return $ValidString; } return $Translated; }