You are here

function tweetbutton_allowed_path in Tweet Button 6

2 calls to tweetbutton_allowed_path()
tweetbutton_link in ./tweetbutton.module
Implementation of hook_link
tweetbutton_nodeapi in ./tweetbutton.module
Implementation of hook_nodeapi()

File

./tweetbutton.module, line 120

Code

function tweetbutton_allowed_path() {
  static $page_match;
  if (isset($page_match)) {
    return $page_match;
  }
  $pages = variable_get('tweetbutton_page_pages', '');
  $visibility = variable_get('tweetbutton_page_visibility', '');

  // Match path if necessary
  if ($pages) {
    if ($visibility < 2) {
      $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);
      }
      $page_match = !($visibility xor $page_match);
    }
    else {
      $page_match = drupal_eval($pages);
    }
  }
  else {
    $page_match = TRUE;
  }
  return $page_match;
}