function device_geolocation_contents in Smart IP 6
Same name and namespace in other branches
- 6.2 modules/device_geolocation/device_geolocation.module \device_geolocation_contents()
- 7.2 modules/device_geolocation/device_geolocation.module \device_geolocation_contents()
- 7 modules/device_geolocation/device_geolocation.module \device_geolocation_contents()
Device geolocation block content function.
1 call to device_geolocation_contents()
- device_geolocation_block in modules/
device_geolocation/ device_geolocation.module - Implements hook_block()
File
- modules/
device_geolocation/ device_geolocation.module, line 51 - Provides visitor's geographical location using client device location source that implements W3C Geolocation API and Google Geocoding service.
Code
function device_geolocation_contents() {
$location = array();
$smart_ip_session = smart_ip_session_get('smart_ip');
// Smart IP user $_SESSION
if (!is_null($smart_ip_session)) {
$location = $smart_ip_session['location'];
}
else {
global $user;
$user_data = unserialize($user->data);
if (isset($user_data['geoip_location'])) {
$smart_ip_session['location'] = $user_data['geoip_location'];
smart_ip_session_set('smart_ip', $smart_ip_session);
$location = $smart_ip_session['location'];
}
}
return theme('device_geolocation_visitor_info', $location);
}