本文整理汇总了PHP中SEFTools::GetLangLongCode方法的典型用法代码示例。如果您正苦于以下问题:PHP SEFTools::GetLangLongCode方法的具体用法?PHP SEFTools::GetLangLongCode怎么用?PHP SEFTools::GetLangLongCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SEFTools
的用法示例。
在下文中一共展示了SEFTools::GetLangLongCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _determineLanguage
//.........这里部分代码省略.........
}
// Check the referer to see if we should redirect
$shouldRedir = false;
if (isset($_SERVER['HTTP_REFERER'])) {
$refUri = new JURI($_SERVER['HTTP_REFERER']);
$uri = JURI::getInstance();
$refHost = $refUri->getHost();
$host = $uri->getHost();
if ($refHost != $host) {
$shouldRedir = true;
}
} else {
$shouldRedir = true;
}
if ($shouldRedir) {
if (!empty($lang) && $sc != $lang || empty($lang) && $sc != $sefConfig->mainLanguage) {
// Redirect to correct site
$mainframe =& JFactory::getApplication();
$href = JRoute::_('index.php?lang=' . $sc, false);
$mainframe->redirect($href);
exit;
}
}
}
// Check if language is selected
if (empty($lang) && !$jfrouterEnabled) {
// If route and query string are empty, use the main language
// note: removed && $redir - it was not possible to switch language to main language
// on other page than homepage (let's see if it causes any other problem)
// note: added $useMainLang - now it should work for both the VM checkout and using
// main language with component's own router
if ($useMainLang && (empty($code) || !JLanguage::exists($code))) {
if ($sefConfig->mainLanguage != '0') {
$code = SEFTools::GetLangLongCode($sefConfig->mainLanguage);
}
}
// Try to get language code from JF cookie
if (empty($code) || !JLanguage::exists($code)) {
if (isset($cookieCode)) {
$code = $cookieCode;
}
}
// Try to get language from browser if needed
if (empty($code) || !JLanguage::exists($code)) {
if (isset($browserCode)) {
$code = $browserCode;
}
}
// Get language from configuration if needed
if (empty($code) || !JLanguage::exists($code)) {
if ($sefConfig->mainLanguage != '0') {
$code = SEFTools::GetLangLongCode($sefConfig->mainLanguage);
}
}
// Get default language if needed
if (empty($code) || !JLanguage::exists($code)) {
$code = $registry->getValue('config.language');
}
}
// get language long code if needed
if (empty($code)) {
if (empty($lang)) {
return;
}
$code = SEFTools::getLangLongCode($lang);
}