You are here

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

Returns whether debug is on for the current user.

1 call to IpGeoLocGlobal::debugFlag()
IpGeoLocGlobal::debug in src/Services/IpGeoLocGlobal.php
Special debug function: messages selected user names only.

File

src/Services/IpGeoLocGlobal.php, line 528

Class

IpGeoLocGlobal
Class IpGeoLocGlobal.

Namespace

Drupal\ip_geoloc\Services

Code

public function debugFlag() {
  global $user;
  $current_user = \Drupal::service('current_user');
  $ip_geoloc_debug = $this->config
    ->get('ip_geoloc_debug');
  $user_names = explode(',', $ip_geoloc_debug);
  foreach ($user_names as $user_name) {
    $user_name = mb_strtolower(trim($user_name));
    $match = isset($user->name) ? $user_name == mb_strtolower(trim($user->name)) : $user_name == 'anon' || $user_name == 'anonymous';
    if ($match) {
      return TRUE;
    }
  }
  return FALSE;
}