/** * Constructor. * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->app = JFactory::getApplication(); if ($this->app->isSite()) { // Setup language data. $router = $this->app->getRouter(); $this->mode_sef = $router->getMode() == JROUTER_MODE_SEF; $this->sefs = JLanguageHelper::getLanguages('sef'); $this->lang_codes = JLanguageHelper::getLanguages('lang_code'); $levels = JFactory::getUser()->getAuthorisedViewLevels(); foreach ($this->sefs as $sef => $language) { if (!in_array($language->access, $levels)) { unset($this->lang_codes[$language->lang_code]); unset($this->sefs[$language->sef]); } } $this->app->setLanguageFilter(true); // Detect browser feature. $this->app->setDetectBrowser($this->params->get('detect_browser', '1') == '1'); } }
/** * Constructor. * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->app = JFactory::getApplication(); if ($this->app->isSite()) { // Setup language data. $this->mode_sef = $this->app->get('sef', 0); $this->sefs = JLanguageHelper::getLanguages('sef'); $this->lang_codes = JLanguageHelper::getLanguages('lang_code'); $levels = JFactory::getUser()->getAuthorisedViewLevels(); foreach ($this->sefs as $sef => $language) { // @todo: In Joomla 2.5.4 and earlier access wasn't set. Non modified Content Languages got 0 as access value if ($language->access && !in_array($language->access, $levels)) { unset($this->lang_codes[$language->lang_code]); unset($this->sefs[$language->sef]); } } $this->app->setLanguageFilter(true); // Detect browser feature. $this->app->setDetectBrowser($this->params->get('detect_browser', '1') == '1'); } }
/** * Constructor. * * @param object &$subject The object to observe * @param array $config An optional associative array of configuration settings. * * @since 1.6 */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->app = JFactory::getApplication(); if ($this->app->isSite()) { // Setup language data. $this->mode_sef = $this->app->get('sef', 0); $this->sefs = JLanguageHelper::getLanguages('sef'); $this->lang_codes = JLanguageHelper::getLanguages('lang_code'); $this->default_lang = JComponentHelper::getParams('com_languages')->get('site', 'en-GB'); $levels = JFactory::getUser()->getAuthorisedViewLevels(); foreach ($this->sefs as $sef => $language) { // @todo: In Joomla 2.5.4 and earlier access wasn't set. Non modified Content Languages got 0 as access value // we also check if frontend language exists and is enabled if ($language->access && !in_array($language->access, $levels) || !array_key_exists($language->lang_code, JLanguageMultilang::getSiteLangs())) { unset($this->lang_codes[$language->lang_code]); unset($this->sefs[$language->sef]); } } $this->app->setLanguageFilter(true); // Detect browser feature. $this->app->setDetectBrowser($this->params->get('detect_browser', '1') == '1'); } }