本文整理汇总了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;
}