You are here

function _device_geolocation_check_allowed_page in Smart IP 6

Same name and namespace in other branches
  1. 7 modules/device_geolocation/device_geolocation.module \_device_geolocation_check_allowed_page()

Check page URL in allowed geolocate list.

1 call to _device_geolocation_check_allowed_page()
device_geolocation_check_geolocation_attempt in modules/device_geolocation/device_geolocation.module
Check Geolocation attempt.

File

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

Code

function _device_geolocation_check_allowed_page($url) {
  $urls = variable_get('device_geolocation_allowed_pages', array());
  if (empty($urls)) {

    // No pages specified then all pages are allowed
    return TRUE;
  }
  elseif (drupal_is_front_page()) {
    $url = '<front>';
    return in_array($url, $urls);
  }
  else {
    $url_wildcard = preg_replace('#/[0-9]+#', '/*', $url);
    return in_array($url, $urls) | in_array($url_wildcard, $urls);
  }
}