Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 361 → Rev 362

/trunk/oidplus.min.js.php
47,24 → 47,10
}
}
 
$translation_array = array();
foreach (OIDplus::getAllPluginManifests('language') as $pluginManifest) {
$xmldata = $pluginManifest->getRawXml();
$lang = $xmldata->language->code->__toString();
$translation_array[$lang] = array();
if (strpos($lang,'/') !== false) return $str; // prevent attack (but actually, the sanitization above should work)
if (strpos($lang,'\\') !== false) return $str; // prevent attack (but actually, the sanitization above should work)
if (strpos($lang,'..') !== false) return $str; // prevent attack (but actually, the sanitization above should work)
$translation_file = __DIR__.'/plugins/language/'.$lang.'/messages.xml';
if (!file_exists($translation_file)) continue;
$xml = @simplexml_load_string(file_get_contents($translation_file));
if (!$xml) continue; // if there is an UTF-8 or parsing error, don't output any errors, otherwise the JavaScript is corrupt and the page won't render correctly
foreach ($xml->message as $msg) {
$src = trim($msg->source->__toString());
$dst = trim($msg->target->__toString());
$translation_array[$lang][$src] = $dst;
}
}
$files[] = 'var DEFAULT_LANGUAGE = '.json_encode(OIDplus::DEFAULT_LANGUAGE).';';
 
OIDplus::registerAllPlugins('language', 'OIDplusLanguagePlugin', null);
$translation_array = OIDplus::getTranslationArray();
$files[] = 'var language_messages = '.json_encode($translation_array).';';
 
//$tbl_prefix = OIDplus::baseConfig()->getValue('OIDPLUS_TABLENAME_PREFIX','');