protected function _bootstrapTranslations() { $translate = new Zend_Translate('Array', ENGINEBLOCK_FOLDER_ROOT . '/languages/en.php', 'en'); $translate->addTranslation(array('content' => ENGINEBLOCK_FOLDER_ROOT . '/languages/nl.php', 'locale' => 'nl')); // If the URL has &lang=nl in it or the lang var is posted, or a lang cookie was set, then use that locale $cookieLang = $this->_httpRequest->getCookie('lang'); $getLang = $this->_httpRequest->getQueryParameter('lang'); $postLang = $this->_httpRequest->getPostParameter('lang'); $lang = null; if ($getLang) { $lang = strtolower($getLang); } else { if ($postLang) { $lang = strtolower($postLang); } else { $lang = strtolower($cookieLang); } } $langCookieConfig = $this->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->_httpResponse->setCookie('lang', $lang, $cookieExpiry, '/', $cookieDomain); } else { $translate->setLocale('en'); $this->_httpResponse->setCookie('lang', 'en', $cookieExpiry, '/', $cookieDomain); } $this->_translator = $translate; }
/** * @param EngineBlock_Http_Request $httpRequest * @return string * @throws Exception */ private function getParameterFromHttpRequest(EngineBlock_Http_Request $httpRequest) { $parameter = $httpRequest->getQueryParameter('SAMLRequest'); if (empty($parameter)) { throw new Exception('No SAMLRequest parameter'); } return $parameter; }