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


PHP Kwf_Trl::generateBuildFileName方法代碼示例

本文整理匯總了PHP中Kwf_Trl::generateBuildFileName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Kwf_Trl::generateBuildFileName方法的具體用法?PHP Kwf_Trl::generateBuildFileName怎麽用?PHP Kwf_Trl::generateBuildFileName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Kwf_Trl的用法示例。


在下文中一共展示了Kwf_Trl::generateBuildFileName方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _build

 protected function _build()
 {
     if (!file_exists('build/trl')) {
         mkdir('build/trl');
     }
     foreach (glob('build/trl/*') as $f) {
         unlink($f);
     }
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $langs[] = $lang;
         }
     }
     try {
         if (Kwf_Component_Data_Root::getComponentClass()) {
             foreach (Kwc_Abstract::getComponentClasses() as $c) {
                 if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
                     foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
                         if (!in_array($i, $langs)) {
                             $langs[] = $i;
                         }
                     }
                 }
             }
         }
     } catch (Kwf_Trl_BuildFileMissingException $e) {
         $originatingException = $e->getSettingsNonStaticTrlException();
         if ($originatingException) {
             throw $originatingException;
         }
         throw $e;
     }
     foreach ($langs as $l) {
         if ($l != $config->webCodeLanguage) {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, false), serialize($c));
         }
         if ($l != 'en') {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, false), serialize($c));
         }
     }
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:52,代碼來源:Trl.php

示例2: _loadTrlElements

 public function _loadTrlElements($source, $target, $plural)
 {
     if ($source == self::SOURCE_WEB) {
         $codeLanguage = $this->getWebCodeLanguage();
     } else {
         $codeLanguage = "en";
     }
     if ($codeLanguage == $target) {
         $this->_trlElements[$source][$target] = array();
         return;
     }
     $buildFileName = Kwf_Trl::generateBuildFileName($source, $target);
     if (file_exists($buildFileName)) {
         $c = unserialize(file_get_contents($buildFileName));
     } else {
         throw new Kwf_Trl_BuildFileMissingException("{$buildFileName} was not created in build");
     }
     $this->_trlElements[$source][$target . ($plural ? '_plural' : '')] = $c;
     return $c;
 }
開發者ID:koala-framework,項目名稱:koala-framework,代碼行數:20,代碼來源:Trl.php

示例3: _build

 protected function _build()
 {
     if (!file_exists('build/trl')) {
         mkdir('build/trl');
     }
     foreach (glob('build/trl/*') as $f) {
         unlink($f);
     }
     $config = Zend_Registry::get('config');
     $langs = array();
     if ($config->webCodeLanguage) {
         $langs[] = $config->webCodeLanguage;
     }
     if ($config->languages) {
         foreach ($config->languages as $lang => $name) {
             $langs[] = $lang;
         }
     }
     try {
         if (Kwf_Component_Data_Root::getComponentClass()) {
             foreach (Kwc_Abstract::getComponentClasses() as $c) {
                 if (Kwc_Abstract::getFlag($c, 'hasAvailableLanguages')) {
                     foreach (call_user_func(array($c, 'getAvailableLanguages'), $c) as $i) {
                         if (!in_array($i, $langs)) {
                             $langs[] = $i;
                         }
                     }
                 }
             }
         }
     } catch (Kwf_Exception $e) {
         $exceptionLocation = null;
         foreach ($e->getTrace() as $trace) {
             if (strpos($trace['file'], 'Kwf/Trl.php') === false && ($trace['function'] == 'trlKwf' || $trace['function'] == 'trl' || $trace['function'] == 'trlcKwf' || $trace['function'] == 'trlc' || $trace['function'] == 'trlpKwf' || $trace['function'] == 'trlp' || $trace['function'] == 'trlcpKwf' || $trace['function'] == 'trlcp')) {
                 $exceptionLocation = $trace;
                 break;
             }
         }
         if ($exceptionLocation) {
             $file = $exceptionLocation['file'];
             $line = $exceptionLocation['line'];
             throw new Kwf_Exception("In getSettings-method only static version of trl is allowed {$file}:{$line}");
         } else {
             throw $e;
         }
     }
     foreach ($langs as $l) {
         if ($l != $config->webCodeLanguage) {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_WEB, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_WEB, $l, false), serialize($c));
         }
         if ($l != 'en') {
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, true);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, true), serialize($c));
             $c = $this->_loadTrlArray(Kwf_Trl::SOURCE_KWF, $l, false);
             file_put_contents(Kwf_Trl::generateBuildFileName(Kwf_Trl::SOURCE_KWF, $l, false), serialize($c));
         }
     }
 }
開發者ID:nsams,項目名稱:koala-framework,代碼行數:61,代碼來源:Trl.php


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