You are here

function ip_geoloc_debug_flag in IP Geolocation Views & Maps 8

Same name and namespace in other branches
  1. 7 ip_geoloc.module \ip_geoloc_debug_flag()

Returns whether debug is on for the current user.

@global type $user

1 call to ip_geoloc_debug_flag()
ip_geoloc_debug in ./ip_geoloc.module
Special debug function: messages selected user names only.

File

./ip_geoloc.module, line 785
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_debug_flag() {
  global $user;
  $config = \Drupal::config('ip_geoloc.settings');
  $user_names = explode(',', SafeMarkup::checkPlain($config
    ->get('ip_geoloc_debug')));
  foreach ($user_names as $user_name) {
    $user_name = Unicode::strtolower(trim($user_name));
    $match = isset($user->name) ? $user_name == Unicode::strtolower(trim($user->name)) : $user_name == 'anon' || $user_name == 'anonymous';
    if ($match) {
      return TRUE;
    }
  }
  return FALSE;
}