本文整理汇总了PHP中JApplicationCms::setLanguageFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationCms::setLanguageFilter方法的具体用法?PHP JApplicationCms::setLanguageFilter怎么用?PHP JApplicationCms::setLanguageFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplicationCms
的用法示例。
在下文中一共展示了JApplicationCms::setLanguageFilter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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');
}
}
示例2: __construct
/**
* 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');
}
}
示例3: __construct
/**
* 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');
}
}