You are here

function _simplemenu_page_visibility in SimpleMenu 6.2

Same name and namespace in other branches
  1. 6 simplemenu.module \_simplemenu_page_visibility()
  2. 7 simplemenu.module \_simplemenu_page_visibility()

Determine if simplemenu should be displayed based on visibility settings.

Return value

boolean

1 call to _simplemenu_page_visibility()
simplemenu_enabled in ./simplemenu.module
Is simplemenu enabled for this page request?

File

./simplemenu.module, line 411
Creates a simplemenu.

Code

function _simplemenu_page_visibility() {
  $operator = variable_get('simplemenu_visibility_operator', 0);
  $pages = variable_get('simplemenu_visibility_pages', '');
  if ($pages) {
    $path = drupal_get_path_alias($_GET['q']);

    // Compare with the internal and path alias (if any).
    $page_match = drupal_match_path($path, $pages);
    if ($path != $_GET['q']) {
      $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
    }

    // When $operator has a value of 0, the menu is displayed on
    // all pages except those listed in $pages. When set to 1, it
    // is displayed only on those pages listed in $pages.
    $page_match = !($operator xor $page_match);
  }
  else {
    $page_match = TRUE;
  }
  return $page_match;
}