本文整理汇总了PHP中WoW_Locale::SetLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP WoW_Locale::SetLocale方法的具体用法?PHP WoW_Locale::SetLocale怎么用?PHP WoW_Locale::SetLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoW_Locale
的用法示例。
在下文中一共展示了WoW_Locale::SetLocale方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: isset
WoW::SelfTests();
// Try to catch some operations (login, logout, etc.)
$locale_loaded = false;
WoW::CatchOperations($locale_loaded);
// locale from page controller
$wow_locale_cms = isset($_COOKIE['wow_locale']) ? $_COOKIE['wow_locale'] : WoWConfig::$DefaultLocale;
if (!isset($_COOKIE['wow_locale'])) {
setcookie('wow_locale', $wow_locale_cms, strtotime('NEXT YEAR'), '/');
$_COOKIE['wow_locale'] = $wow_locale_cms;
}
$pController = new PageController();
if ($pController->GetLocale() != null && $pController->GetLocale() != $_COOKIE['wow_locale']) {
//$_SESSION['wow_locale'] = $pController->GetLocale();
WoW_Locale::SetLocale($pController->GetLocale(), WoW_Locale::GetLocaleIDForLocale($pController->GetLocale()), true);
} else {
WoW_Locale::SetLocale($_COOKIE['wow_locale'], WoW_Locale::GetLocaleIDForLocale($_COOKIE['wow_locale']));
}
// Initialize account (if user already logged in we need to re-build his info from session data)
WoW_Account::Initialize();
if (isset($_COOKIE['wow_session']) && !WoW_Account::IsLoggedIn()) {
WoW_Account::loadFromCookieSession();
}
// Initialize auction handler
WoW_Auction::InitAuction();
// TODO: this initialization should be moved in some other place.
// Display wow revision (if required; do not remove).
if (isset($_GET['_DISPLAYVERSION_'])) {
die('WOW_REVISION: ' . WOW_REVISION);
}
// RunOnce
define('__RUNONCE__', true);
示例4: 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);
}
}
}
}
示例5: 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);
}