You are here

function _device_geolocation_check_allowed_page in Smart IP 7

Same name and namespace in other branches
  1. 6 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) {
  $pages = variable_get('device_geolocation_allowed_pages', '');
  if (empty($pages)) {

    // No pages specified then all pages are allowed
    return TRUE;
  }
  else {

    // Convert the Drupal path to lowercase
    $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));

    // Compare the lowercase internal and lowercase path alias (if any).
    $page_match = drupal_match_path($path, $pages);
    if ($path != $_GET['q']) {
      $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
    }
    return $page_match;
  }
}