当前位置: 首页>>代码示例>>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;未经允许,请勿转载。