You are here

function highlight_check_display in Highlight 5

controls the conditions for displaying highlights returns true if highlight should be active, false otherwise

1 call to highlight_check_display()
highlight_filter in ./highlight.module
Implementation of hook_filter

File

./highlight.module, line 209

Code

function highlight_check_display() {
  global $base_url;
  static $allow_external_highlight;
  $allow_external_highlight = variable_get('hl_allow_external', false);

  // we don't need to check the url if we allow external highlights
  if ($allow_external_highlight) {
    $referer_is_local = true;
  }
  else {

    // parse the referring url to make sure it's local
    if (strpos($_SERVER['HTTP_REFERER'], $base_url) == 0) {
      $referer_is_local = true;
    }
  }
  if ($allow_external_highlight || $referer_is_local) {
    if ($_GET['highlight']) {
      return true;
    }
    if (strstr($_SERVER['HTTP_REFERER'], "search/node")) {
      return true;
    }
  }
  else {
    return false;
  }
}