當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ET::language_filename方法代碼示例

本文整理匯總了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);
     }
 }
開發者ID:ky0ncheng,項目名稱:esotalk-for-sae,代碼行數:54,代碼來源:ET.class.php


注:本文中的ET::language_filename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。