本文整理汇总了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));
}
}
}
示例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;
}
示例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));
}
}
}