You are here

function mathjax_active in MathJax: LaTeX for Drupal 7

Same name and namespace in other branches
  1. 6 mathjax.module \mathjax_active()

Verify that MathJax should be active for the current URL.

(taken from Block module)

Return value

bool TRUE if MathJax should be active for the current page.

1 call to mathjax_active()
mathjax_init in ./mathjax.module
Implements hook_init().

File

./mathjax.module, line 87
MathJax module.

Code

function mathjax_active() {
  $pages = variable_get('mathjax_pages', "admin*\nnode/add/*\nnode/*/edit");
  $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));

  // Compare the lowercase internal and lowercase 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);
  }
  if (variable_get('mathjax_active_type', 'disable') == 'disable') {
    return !$page_match;
  }
  else {
    return $page_match;
  }
}