本文整理汇总了PHP中MY_Controller::currentLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP MY_Controller::currentLocale方法的具体用法?PHP MY_Controller::currentLocale怎么用?PHP MY_Controller::currentLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MY_Controller
的用法示例。
在下文中一共展示了MY_Controller::currentLocale方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentLocale
/**
* get current locale
* @return type
*/
public static function getCurrentLocale()
{
$ci = get_instance();
if (self::$currentLocale) {
return self::$currentLocale;
}
if (preg_match('/^\\/install/', $ci->input->server('PATH_INFO'))) {
return;
}
$lang_id = $ci->config->item('cur_lang');
if ($lang_id) {
$query = $ci->db->query("SELECT `identif` FROM `languages` WHERE `id`={$lang_id}")->result();
if ($query) {
self::$currentLocale = $query[0]->identif;
} else {
$defaultLanguage = self::getDefaultLanguage();
self::$currentLocale = $defaultLanguage['identif'];
}
} else {
self::$currentLocale = chose_language();
}
return self::$currentLocale;
}
示例2: getCurrentLocale
/**
* get current locale
* @return type
*/
public static function getCurrentLocale()
{
if (self::$currentLocale) {
return self::$currentLocale;
}
if (strstr($_SERVER['PATH_INFO'], 'install')) {
return;
}
$ci = get_instance();
$lang_id = $ci->config->item('cur_lang');
if ($lang_id) {
$query = $ci->db->query("SELECT `identif` FROM `languages` WHERE `id`={$lang_id}")->result();
if ($query) {
self::$currentLocale = $query[0]->identif;
} else {
$defaultLanguage = self::getDefaultLanguage();
self::$currentLocale = $defaultLanguage['identif'];
}
} else {
self::$currentLocale = chose_language();
}
return self::$currentLocale;
}