You are here

function better_messages_process_visibility in Better Messages 7

Same name and namespace in other branches
  1. 6.2 better_messages.module \better_messages_process_visibility()
  2. 6 better_messages.module \better_messages_process_visibility()
2 calls to better_messages_process_visibility()
better_messages_preprocess_page in ./better_messages.module
theme_better_messages in ./better_messages.module

File

./better_messages.module, line 161

Code

function better_messages_process_visibility() {
  $settings = better_messages_get_settings();
  global $user;
  if (!$settings['extra']['admin'] && $user->uid == 1) {
    return FALSE;
  }
  global $theme;
  if (!empty($settings['extra']['themes']) && empty($settings['extra']['themes'][$theme])) {
    return FALSE;
  }
  if ($settings['extra']['pages']) {
    $path = drupal_get_path_alias($_GET['q']);
    $page_match = drupal_match_path($path, $settings['extra']['pages']);
    if ($path != $_GET['q']) {
      $page_match = $page_match || drupal_match_path($_GET['q'], $settings['extra']['pages']);
    }
    $page_match = !($settings['extra']['visibility'] xor $page_match);
  }
  else {
    $page_match = TRUE;
  }
  return $page_match;
}