本文整理匯總了PHP中VmConfig::defaultLang方法的典型用法代碼示例。如果您正苦於以下問題:PHP VmConfig::defaultLang方法的具體用法?PHP VmConfig::defaultLang怎麽用?PHP VmConfig::defaultLang使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類VmConfig
的用法示例。
在下文中一共展示了VmConfig::defaultLang方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (self::$jDefLang = self::get('vmDefLang', false)) {
self::$jDefLang = strtolower(strtr(self::$jDefLang, '-', '_'));
} else {
self::$jDefLang = strtolower(strtr($defaultLang, '-', '_'));
}
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
self::$vmLangSelected = $siteLang;
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
self::$vmlangTag = $siteLang;
if (count($langs) > 1) {
$lfbs = self::get('vm_lfbs');
vmdebug('my lfbs ' . $lfbs);
if (!empty($lfbs)) {
$pairs = explode(';', $lfbs);
if ($pairs and count($pairs) > 0) {
$fbsAssoc = array();
foreach ($pairs as $pair) {
$kv = explode('~', $pair);
if ($kv and count($kv) === 2) {
$fbsAssoc[$kv[0]] = $kv[1];
}
}
if (isset($fbsAssoc[$siteLang])) {
$defaultLang = $fbsAssoc[$siteLang];
}
self::set('fbsAssoc', $fbsAssoc);
}
}
// this code is uses logic derived from language filter plugin in j3 and should work on most 2.5 versions as well
if (class_exists('JLanguageHelper') && method_exists('JLanguageHelper', 'getLanguages')) {
$languages = JLanguageHelper::getLanguages('lang_code');
$ltag = JFactory::getLanguage()->getTag();
self::$vmlangSef = $languages[$ltag]->sef;
}
}
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$vmlangSef: ' . self::$vmlangSef . ' self::$_jpConfig->lang ' . self::$vmlang . ' DefLang ' . self::$defaultLang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}
示例2: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
self::$vmlangTag = $siteLang;
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$_jpConfig->lang ' . self::$vmlang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}
示例3: setdbLanguageTag
public static function setdbLanguageTag()
{
if (self::$vmlang) {
return self::$vmlang;
}
$langs = (array) self::get('active_languages', array());
self::$langCount = count($langs);
$siteLang = vRequest::getString('vmlang', false);
$params = JComponentHelper::getParams('com_languages');
$defaultLang = $params->get('site', 'en-GB');
//use default joomla
if (JFactory::getApplication()->isSite()) {
if (!$siteLang) {
jimport('joomla.language.helper');
$siteLang = JFactory::getLanguage()->getTag();
}
} else {
if (!$siteLang) {
$siteLang = $defaultLang;
}
}
self::$vmLangSelected = $siteLang;
if (!in_array($siteLang, $langs)) {
if (count($langs) === 0) {
$siteLang = $defaultLang;
} else {
$siteLang = $langs[0];
}
}
if (count($langs) > 1) {
$lfbs = self::get('vm_lfbs');
vmdebug('my lfbs ' . $lfbs);
if (!empty($lfbs)) {
$fbsAssoc = false;
$pairs = explode(';', $lfbs);
if ($pairs and count($pairs) > 0) {
$fbsAssoc = array();
foreach ($pairs as $pair) {
$kv = explode('~', $pair);
if ($kv and count($kv) === 2) {
$fbsAssoc[$kv[0]] = $kv[1];
}
}
if (isset($fbsAssoc[$siteLang])) {
$defaultLang = $fbsAssoc[$siteLang];
}
}
}
}
self::$vmlangTag = $siteLang;
self::$vmlang = strtolower(strtr($siteLang, '-', '_'));
self::$defaultLang = strtolower(strtr($defaultLang, '-', '_'));
vmdebug('$siteLang: ' . $siteLang . ' self::$_jpConfig->lang ' . self::$vmlang . ' fb ' . self::$defaultLang);
//@deprecated just fallback
defined('VMLANG') or define('VMLANG', self::$vmlang);
return self::$vmlang;
}