You are here

function shadowbox_active in Shadowbox 6

Same name and namespace in other branches
  1. 5.2 shadowbox.module \shadowbox_active()
  2. 5 shadowbox.module \shadowbox_active()
  3. 6.4 shadowbox.module \shadowbox_active()
  4. 6.2 shadowbox.module \shadowbox_active()
  5. 6.3 shadowbox.module \shadowbox_active()

Verify that Shadowbox should be active for the current URL.

Code from Thickbox, previously from block.module.

Return value

TRUE if Shadowbox should be active for the current page.

1 call to shadowbox_active()
shadowbox_init in ./shadowbox.module
Implementation of hook_init().

File

./shadowbox.module, line 588
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialog.

Code

function shadowbox_active() {

  // If the path doesn't match any of the exeptions, load header files.
  $path = drupal_get_path_alias($_GET['q']);
  $regexp = '/^(' . preg_replace(array(
    '/(\\r\\n?|\\n)/',
    '/\\\\\\*/',
    '/(^|\\|)\\\\<front\\\\>($|\\|)/',
  ), array(
    '|',
    '.*',
    '\\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\\2',
  ), preg_quote(variable_get('shadowbox_excluded_pages', "admin*\nimg_assist*\nnode/add/*\nnode/*/edit"), '/')) . ')$/';

  // 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;
}