You are here

function ip_geoloc_same_path in IP Geolocation Views & Maps 7

Same name and namespace in other branches
  1. 8 ip_geoloc.module \ip_geoloc_same_path()

Returns true if the previous page was reloaded.

1 call to ip_geoloc_same_path()
ip_geoloc_context_reaction_locate_visitor::execute in plugins/ip_geoloc_context_reaction_locate_visitor.inc

File

./ip_geoloc.module, line 897
IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported. and available through this module. Using a number of optional sources IPGV&M also retrieves…

Code

function ip_geoloc_same_path() {
  if (empty($_SERVER['HTTP_REFERER'])) {
    return FALSE;
  }
  $referer = $_SERVER['HTTP_REFERER'];
  global $base_url;
  if (strpos($referer, $base_url) === 0) {
    $prev_path = drupal_substr($referer, drupal_strlen($base_url) + 1);
    if (empty($prev_path) && drupal_is_front_page()) {
      return TRUE;
    }
    return $prev_path == current_path() || $prev_path == drupal_get_path_alias();
  }
  return FALSE;
}