You are here

function _syntaxhighlighter_page_match in Syntax Highlighter 7

Same name and namespace in other branches
  1. 8 syntaxhighlighter.module \_syntaxhighlighter_page_match()
  2. 6.2 syntaxhighlighter.module \_syntaxhighlighter_page_match()
  3. 6 syntaxhighlighter.module \_syntaxhighlighter_page_match()
  4. 7.2 syntaxhighlighter.module \_syntaxhighlighter_page_match()
1 call to _syntaxhighlighter_page_match()
syntaxhighlighter_init in ./syntaxhighlighter.module

File

./syntaxhighlighter.module, line 126
Syntax highlight code using the Syntaxhighlighter javascript library. See http://alexgorbatchev.com/wiki/SyntaxHighlighter

Code

function _syntaxhighlighter_page_match() {
  $inject = variable_get('syntaxhighlighter_inject', SYNTAXHIGHLIGHTER_INJECT_EXCEPT_LISTED);
  $pages = variable_get('syntaxhighlighter_pages', "admin\nadmin/*\nuser\nuser/*\nimce\nimce/*\n");
  if ($inject != SYNTAXHIGHLIGHTER_INJECT_PHP) {
    $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);
    }
    return !($inject xor $page_match);
  }
  else {

    // if the PHP module is not enabled, we just return FALSE
    // which just ends up disabling the syntaxhighlighter
    return function_exists('php_eval') && php_eval($pages);
  }
}