You are here

function _disclaimer_visibility in Disclaimer 6.2

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

Calculate visibility of disclaimer if set function copy from block.module, thanks for the original code.

Return value

bolean

1 call to _disclaimer_visibility()
disclaimer_init in ./disclaimer.module
Implementation of hook_init().

File

./disclaimer.module, line 153
Create and show disclaimer for your site. Visotors need js enabled and accept cookie

Code

function _disclaimer_visibility() {
  $visibility = variable_get('disclaimer_visibility', 0);
  $pages = variable_get('disclaimer_pages', "admin/*\nuser");
  if ($pages) {
    if ($visibility < 2) {
      $path = drupal_get_path_alias($_GET['q']);
      $page_match = drupal_match_path($path, $pages);
      if ($path != $_GET['q']) {
        $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
      }
      $page_match = !($visibility xor $page_match);
    }
    else {
      $page_match = drupal_eval($pages);
    }
  }
  else {
    $page_match = TRUE;
  }
  return $page_match;
}