本文整理匯總了PHP中erLhcoreClassModelChatOnlineUser::detectLocation方法的典型用法代碼示例。如果您正苦於以下問題:PHP erLhcoreClassModelChatOnlineUser::detectLocation方法的具體用法?PHP erLhcoreClassModelChatOnlineUser::detectLocation怎麽用?PHP erLhcoreClassModelChatOnlineUser::detectLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類erLhcoreClassModelChatOnlineUser
的用法示例。
在下文中一共展示了erLhcoreClassModelChatOnlineUser::detectLocation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getAdjustment
public static function getAdjustment($geo_adjustment, $onlineUserVid = '', $widgetMode = false, $onlineUserDefined = false)
{
$responseStatus = array('status' => 'normal');
$onlineUser = false;
if (isset($geo_adjustment['use_geo_adjustment']) && $geo_adjustment['use_geo_adjustment'] == true) {
if ($widgetMode === true && $geo_adjustment['apply_widget'] == 0) {
return $responseStatus;
}
if (is_object($onlineUserDefined)) {
$onlineUser = $onlineUserDefined;
} elseif (!empty($onlineUserVid)) {
$onlineUser = erLhcoreClassModelChatOnlineUser::fetchByVid($onlineUserVid);
}
if ($onlineUser === false) {
$onlineUser = new erLhcoreClassModelChatOnlineUser();
// Just to pass instance
$onlineUser->ip = erLhcoreClassIPDetect::getIP();
erLhcoreClassModelChatOnlineUser::detectLocation($onlineUser);
}
$countriesAvailableFor = array();
if ($geo_adjustment['available_for'] != '') {
$countriesAvailableFor = explode(',', $geo_adjustment['available_for']);
}
if (!in_array($onlineUser->user_country_code, $countriesAvailableFor)) {
if ($geo_adjustment['other_countries'] == 'all') {
if ($geo_adjustment['other_status'] == 'offline') {
$responseStatus = array('status' => 'offline');
} else {
$responseStatus = array('status' => 'hidden');
}
} else {
if ($geo_adjustment['hide_for'] != '') {
$countrieshideFor = explode(',', $geo_adjustment['hide_for']);
if (in_array($onlineUser->user_country_code, $countrieshideFor)) {
if ($geo_adjustment['other_status'] == 'offline') {
$responseStatus = array('status' => 'offline');
} else {
$responseStatus = array('status' => 'hidden');
}
} else {
if ($geo_adjustment['rest_status'] == 'offline') {
$responseStatus = array('status' => 'offline');
} elseif ($geo_adjustment['rest_status'] == 'normal') {
$responseStatus = array('status' => 'normal');
} else {
$responseStatus = array('status' => 'hidden');
}
}
} else {
if ($geo_adjustment['rest_status'] == 'offline') {
$responseStatus = array('status' => 'offline');
} elseif ($geo_adjustment['rest_status'] == 'normal') {
$responseStatus = array('status' => 'normal');
} else {
$responseStatus = array('status' => 'hidden');
}
}
}
}
// Normal status
}
return $responseStatus;
}