本文整理汇总了PHP中erLhcoreClassModelChatOnlineUser::getUserData方法的典型用法代码示例。如果您正苦于以下问题:PHP erLhcoreClassModelChatOnlineUser::getUserData方法的具体用法?PHP erLhcoreClassModelChatOnlineUser::getUserData怎么用?PHP erLhcoreClassModelChatOnlineUser::getUserData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类erLhcoreClassModelChatOnlineUser
的用法示例。
在下文中一共展示了erLhcoreClassModelChatOnlineUser::getUserData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: detectLocation
public static function detectLocation(erLhcoreClassModelChat &$instance)
{
$geoData = erLhcoreClassModelChatConfig::fetch('geo_data');
$geo_data = (array) $geoData->data;
if (isset($geo_data['geo_detection_enabled']) && $geo_data['geo_detection_enabled'] == 1) {
$params = array();
if ($geo_data['geo_service_identifier'] == 'mod_geoip2') {
$params['country_code'] = $geo_data['mod_geo_ip_country_code'];
$params['country_name'] = $geo_data['mod_geo_ip_country_name'];
$params['mod_geo_ip_city_name'] = $geo_data['mod_geo_ip_city_name'];
$params['mod_geo_ip_latitude'] = $geo_data['mod_geo_ip_latitude'];
$params['mod_geo_ip_longitude'] = $geo_data['mod_geo_ip_longitude'];
} elseif ($geo_data['geo_service_identifier'] == 'locatorhq') {
$params['username'] = $geo_data['locatorhqusername'];
$params['api_key'] = $geo_data['locatorhq_api_key'];
} elseif ($geo_data['geo_service_identifier'] == 'ipinfodbcom') {
$params['api_key'] = $geo_data['ipinfodbcom_api_key'];
} elseif ($geo_data['geo_service_identifier'] == 'max_mind') {
$params['detection_type'] = $geo_data['max_mind_detection_type'];
$params['city_file'] = isset($geo_data['max_mind_city_location']) ? $geo_data['max_mind_city_location'] : '';
}
$location = erLhcoreClassModelChatOnlineUser::getUserData($geo_data['geo_service_identifier'], $instance->ip, $params);
if ($location !== false) {
$instance->country_code = $location->country_code;
$instance->country_name = $location->country_name;
$instance->lat = $location->lat;
$instance->lon = $location->lon;
$instance->city = $location->city;
}
}
}
示例2: array
$filledAPIData = true;
if ($form->hasValidData('ipinfodbAPIKey') && $form->ipinfodbAPIKey != '') {
$data['ipinfodbcom_api_key'] = $form->ipinfodbAPIKey;
} else {
$filledAPIData = false;
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Please enter the API key!');
}
if ($filledAPIData == true) {
$responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('ipinfodbcom', erLhcoreClassIPDetect::getServerAddress(), array('api_key' => $data['ipinfodbcom_api_key']));
if ($responseDetection == false || !isset($responseDetection->country_code)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Setting service provider failed, please check that your service provider allows you to make requests to remote pages and your API key is correct!');
}
}
} elseif ($form->UseGeoIP == 'php_geoip') {
$data['geo_service_identifier'] = 'php_geoip';
$responseDetection = erLhcoreClassModelChatOnlineUser::getUserData('php_geoip', '94.23.200.91');
if ($responseDetection == false || !isset($responseDetection->country_code)) {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Setting service provider failed, please check that you have installed php-GeoIP module and GeoIPCity.dat file is available!');
}
}
} else {
$Errors[] = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/onlineusers', 'Please choose a service provider!');
}
}
if (count($Errors) == 0) {
$geoData->value = serialize($data);
$geoData->saveThis();
$tpl->set('updated', 'done');
} else {
$tpl->set('errors', $Errors);
}