You are here

function device_geolocation_check_geolocation_attempt in Smart IP 6

Same name and namespace in other branches
  1. 6.2 modules/device_geolocation/device_geolocation.module \device_geolocation_check_geolocation_attempt()
  2. 7.2 modules/device_geolocation/device_geolocation.module \device_geolocation_check_geolocation_attempt()
  3. 7 modules/device_geolocation/device_geolocation.module \device_geolocation_check_geolocation_attempt()

Check Geolocation attempt.

2 calls to device_geolocation_check_geolocation_attempt()
device_geolocation_check_geolocation_attempt_ajax in modules/device_geolocation/device_geolocation.module
Check Geolocation attempt ajax callback.
device_geolocation_init in modules/device_geolocation/device_geolocation.module
Implements hook_init().

File

modules/device_geolocation/device_geolocation.module, line 311
Provides visitor's geographical location using client device location source that implements W3C Geolocation API and Google Geocoding service.

Code

function device_geolocation_check_geolocation_attempt() {
  if (_device_geolocation_check_allowed_page($_GET['q']) && is_null(smart_ip_session_get('device_geolocation')) || !is_null(smart_ip_session_get('device_geolocation'))) {
    if (is_null(smart_ip_session_get('device_geolocation_attempt')) || variable_get('device_geolocation_check_frequency', 0) < time() - smart_ip_session_get('device_geolocation_attempt')) {
      smart_ip_session_set('device_geolocation_attempt', time());
      return TRUE;
    }
  }
  return FALSE;
}