You are here

public function IpGeoLocGlobal::samePath in IP Geolocation Views & Maps 8

Returns true if the previous page was reloaded.

File

src/Services/IpGeoLocGlobal.php, line 566

Class

IpGeoLocGlobal
Class IpGeoLocGlobal.

Namespace

Drupal\ip_geoloc\Services

Code

public function samePath() {
  if (empty($_SERVER['HTTP_REFERER'])) {
    return FALSE;
  }
  $referer = $_SERVER['HTTP_REFERER'];
  global $base_url;
  if (strpos($referer, $base_url) === 0) {
    $prev_path = Unicode::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;
}