本文整理汇总了PHP中WoW_Locale::IsLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP WoW_Locale::IsLocale方法的具体用法?PHP WoW_Locale::IsLocale怎么用?PHP WoW_Locale::IsLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoW_Locale
的用法示例。
在下文中一共展示了WoW_Locale::IsLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
public function main()
{
header('Content-type: text/plain');
WoW_Template::SetTemplateTheme('wow');
if (isset($_GET['locale']) && WoW_Locale::IsLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']))) {
WoW_Locale::SetLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']));
}
$searchQuery = isset($_GET['term']) ? $_GET['term'] : null;
if ($searchQuery != null && mb_strlen($searchQuery) < 3 || $searchQuery == null) {
die('{"reason":"A term parameter is required.","status":"nok"}');
}
WoW_Search::SetSearchQuery($searchQuery);
WoW_Search::PerformItemsSearch(10);
WoW_Template::LoadTemplate('page_ta_lookup');
}
示例2: CatchOperations
public static function CatchOperations(&$loaded)
{
// Perform log in (if required)
if (isset($_GET['login']) || preg_match('/\\?login/', $_SERVER['REQUEST_URI'])) {
// $_SERVER['REQUEST_URI'] check is required for mod_rewrited URL cases.
header('Location: ' . WoW::GetWoWPath() . '/login/');
exit;
}
// Perform logout (if required)
if (isset($_GET['logout']) || preg_match('/\\?logout/', $_SERVER['REQUEST_URI'])) {
// $_SERVER['REQUEST_URI'] check is required for mod_rewrited URL cases.
WoW_Account::PerformLogout();
header('Location: ' . WoW::GetWoWPath() . '/');
exit;
}
// Locale
if (isset($_GET['locale']) && !preg_match('/lookup/', $_SERVER['REQUEST_URI'])) {
if (WoW_Locale::IsLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']))) {
WoW_Locale::SetLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']));
$loaded = true;
setcookie('wow_locale', WoW_Locale::GetLocale(), strtotime('NEXT YEAR'), '/');
if (isset($_SERVER['HTTP_REFERER'])) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit;
} else {
header('Location: ' . WoW::GetWoWPath() . '/');
exit;
}
}
}
}
示例3: SetPowerLocale
protected static function SetPowerLocale()
{
if (strpos(WoW::GetRawPageAction(), '&pl')) {
$data = explode('&', WoW::GetRawPageAction());
foreach ($data as $it) {
$tmp = explode('=', $it);
if ($tmp[0] == 'pl') {
if (!$tmp[1] || !WoW_Locale::IsLocale($tmp[1], WoW_Locale::GetLocaleIDForLocale($tmp[1]))) {
$tmp[1] = 'enus';
}
WoW_Locale::SetLocale($tmp[1], WoW_Locale::GetLocaleIDForLocale($tmp[1]), true);
}
}
}
}
示例4: strtolower
//prevent error when mailer classes are loaded
$className = strtolower(str_replace('WoW_', null, $className));
if (!file_exists(CLASSES_DIR . 'class.' . $className . '.php')) {
die('<strong>Autoload Fatal Error:</strong> unable to autoload class ' . $className . '!');
}
include CLASSES_DIR . 'class.' . $className . '.php';
}
// Locale
if (isset($_GET['locale'])) {
if (WoW_Locale::IsLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']))) {
WoW_Locale::SetLocale($_GET['locale'], WoW_Locale::GetLocaleIDForLocale($_GET['locale']));
if (isset($_SERVER['HTTP_REFERER'])) {
header('Location: ' . $_SERVER['HTTP_REFERER']);
exit;
} else {
WoW::RedirectTo();
exit;
}
}
}
// Load locale
if (isset($_COOKIE['wow_locale'], $_COOKIE['wow_locale_id']) && WoW_Locale::IsLocale($_COOKIE['wow_locale'], $_COOKIE['wow_locale_id'])) {
WoW_Locale::SetLocale($_COOKIE['wow_locale'], $_COOKIE['wow_locale_id']);
} else {
WoW_Locale::SetLocale(WoWConfig::$DefaultLocale, WoWConfig::$DefaultLocaleID);
}
// Initialize debug log
WoW_Log::Initialize(WoWConfig::$UseLog, WoWConfig::$LogLevel);
if (isset($_GET['_DISPLAYVERSION_'])) {
die(WOW_REVISION);
}