本文整理匯總了PHP中Seitenbau\Registry::set方法的典型用法代碼示例。如果您正苦於以下問題:PHP Registry::set方法的具體用法?PHP Registry::set怎麽用?PHP Registry::set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Seitenbau\Registry
的用法示例。
在下文中一共展示了Registry::set方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
// Uebersetzung vorhanden?
if (!Registry::isRegistered('Zend_Translate')) {
// Locale erweitern; Lade Uebersetzungen und speichere Translate Objekt in der Registry
$lang = 'de';
$locale = new \Zend_Locale();
$locale->setLocale($lang);
$langFile = APPLICATION_PATH . '/translations/' . $lang . '.php';
Registry::set('Zend_Translate', new \Zend_Translate('array', $langFile, $locale->getLanguage()));
}
}
示例2: _initTranslator
protected function _initTranslator()
{
$this->bootstrap('locale');
$locale = $this->getResource('locale');
$translationConfig = Registry::getConfig()->translation;
if (isset($translationConfig->route)) {
$route = $translationConfig->route->toArray();
} else {
$route = array();
}
$defaultLocale = Registry::getLocale();
foreach (array_keys($route) as $routeLangFrom) {
if (strtolower($routeLangFrom) == strtolower($defaultLocale->toString()) || strtolower($routeLangFrom) == strtolower($defaultLocale->getLanguage())) {
unset($route[$routeLangFrom]);
}
}
$translate = new \Zend_Translate(array('adapter' => 'Zend_Translate_Adapter_Array', 'content' => $translationConfig->directory, 'scan' => Zend_Translate::LOCALE_DIRECTORY, 'locale' => $locale, 'disableNotices' => APPLICATION_ENV === 'testing' ? false : true, 'route' => $route));
Registry::set('Zend_Translate', $translate);
}