You are here

function external_active in External New Tab 7

Same name and namespace in other branches
  1. 8 external.module \external_active()
  2. 6 external.module \external_active()

Determine if the module is active for the page being viewed.

1 call to external_active()
external_init in ./external.module
Implement hook_init().

File

./external.module, line 86

Code

function external_active() {
  $path = drupal_get_path_alias($_GET['q']);
  $patterns = variable_get('external_disabled_patterns', "admin*\nimg_assist*\nnode/add/*\nnode/*/edit");
  $front_page = variable_get('site_frontpage', 'node');
  $regexp = '/^(' . preg_replace(array(
    '/(\\r\\n?|\\n)/',
    '/\\\\\\*/',
    '/(^|\\|)\\\\<front\\\\>($|\\|)/',
  ), array(
    '|',
    '.*',
    '\\1' . preg_quote($front_page, '/') . '\\2',
  ), preg_quote($patterns, '/')) . ')$/';

  // Compare with the internal and path alias (if any).
  $page_match = preg_match($regexp, $path);
  if ($path != $_GET['q']) {
    $page_match = $page_match || preg_match($regexp, $_GET['q']);
  }
  return !$page_match;
}