本文整理匯總了PHP中ET::language_filename方法的典型用法代碼示例。如果您正苦於以下問題:PHP ET::language_filename方法的具體用法?PHP ET::language_filename怎麽用?PHP ET::language_filename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ET
的用法示例。
在下文中一共展示了ET::language_filename方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: loadLanguage
/**
* Load a language and its definition files, depending on what plugins are enabled.
*
* @param string $language The name of the language.
* @return void
*/
public static function loadLanguage($language = "")
{
if (isset(ET::$languageInfo[$language])) {
return;
}
$narr = ET::$cache->filenames;
if ($narr !== false && isset($narr["language_filename"])) {
self::$language_filename = $narr["language_filename"];
}
//while $narr is empty create an new array
if (empty($narr)) {
$narr = array();
}
// Clear the currently loaded definitions.
self::$definitions = array();
// If the specified language doesn't exist, use the default language.
self::$language = file_exists(PATH_LANGUAGES . "/" . sanitizeFileName($language) . "/definitions.php") ? $language : C("esoTalk.language");
// Load the main definitions file.
$languagePath = PATH_LANGUAGES . "/" . sanitizeFileName(self::$language);
self::loadDefinitions("{$languagePath}/definitions.php");
// Set the locale.
if (isset(ET::$languageInfo[self::$language]["locale"])) {
setlocale(LC_ALL, ET::$languageInfo[self::$language]["locale"]);
}
// Loop through the loaded plugins and include their definition files, if they exist.
foreach (C("esoTalk.enabledPlugins") as $plugin) {
if (empty(self::$language_filename) || self::$language_filename[$plugin] == false) {
if (file_exists($file = "{$languagePath}/definitions." . sanitizeFileName($plugin) . ".php")) {
self::loadDefinitions($file);
self::$language_filename[$plugin] = $file;
$narr["language_filename"] = self::$language_filename;
//ET::$cache->store("language_filename" , self::$language_filename);
//ET::$cache->store(ET::$cache->fname_key , $narr);
ET::$cache->filenames = $narr;
ET::$cache->fnamechanged = true;
}
} else {
$file = self::$language_filename[$plugin];
self::loadDefinitions($file);
}
}
//var_dump($narr);//exit();
unset($narr);
// Re-define runtime definitions.
foreach (self::$runtimeDefinitions as $k => $v) {
ET::define($k, $v);
}
}