You are here

function highlight_keywords in Highlight 6

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

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

File

./highlight.module, line 218

Code

function highlight_keywords() {
  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;
    }
  */

  // parse the referring url to make sure it's local
  if (variable_get('clean_url', 0)) {
    $search_url = $base_url . '/search/';
  }
  else {
    $search_url = $base_url . '/?q=search/';
  }
  if (strpos($_SERVER['HTTP_REFERER'], $search_url) === 0) {
    $referer_is_local = true;
    $keywords = end(explode("/", urldecode($_SERVER['HTTP_REFERER'])));
    return explode(" ", $keywords);
  }
  else {
    return null;
  }
}