本文整理汇总了PHP中EngineBlock_ApplicationSingleton::getHttpResponse方法的典型用法代码示例。如果您正苦于以下问题:PHP EngineBlock_ApplicationSingleton::getHttpResponse方法的具体用法?PHP EngineBlock_ApplicationSingleton::getHttpResponse怎么用?PHP EngineBlock_ApplicationSingleton::getHttpResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EngineBlock_ApplicationSingleton
的用法示例。
在下文中一共展示了EngineBlock_ApplicationSingleton::getHttpResponse方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _bootstrapTranslations
protected function _bootstrapTranslations()
{
$translationFiles = array('en' => ENGINEBLOCK_FOLDER_ROOT . 'languages/en.php', 'nl' => ENGINEBLOCK_FOLDER_ROOT . 'languages/nl.php');
$translationCacheProxy = new EngineBlock_Translate_CacheProxy($translationFiles, $this->_application->getDiContainer()->getApplicationCache());
$translate = $translationCacheProxy->load();
// If the URL has &lang=nl in it or the lang var is posted, or a lang cookie was set, then use that locale
$httpRequest = $this->_application->getHttpRequest();
$cookieLang = $httpRequest->getCookie('lang');
$getLang = $httpRequest->getQueryParameter('lang');
$postLang = $httpRequest->getPostParameter('lang');
$lang = null;
if ($getLang) {
$lang = strtolower($getLang);
} else {
if ($postLang) {
$lang = strtolower($postLang);
} else {
$lang = strtolower($cookieLang);
}
}
$langCookieConfig = $this->_application->getConfigurationValue('cookie')->lang;
$cookieDomain = $langCookieConfig->domain;
$cookieExpiry = null;
if (isset($langCookieConfig->expiry) && $langCookieConfig->expiry > 0) {
$cookieExpiry = time() + $langCookieConfig->expiry;
}
if ($lang && $translate->getAdapter()->isAvailable($lang)) {
$translate->setLocale($lang);
$this->_application->getHttpResponse()->setCookie('lang', $lang, $cookieExpiry, '/', $cookieDomain);
} else {
$translate->setLocale('en');
$this->_application->getHttpResponse()->setCookie('lang', 'en', $cookieExpiry, '/', $cookieDomain);
}
$this->_application->setTranslator($translate);
}