function shadowbox_active in Shadowbox 5
Same name and namespace in other branches
- 5.2 shadowbox.module \shadowbox_active()
 - 6.4 shadowbox.module \shadowbox_active()
 - 6 shadowbox.module \shadowbox_active()
 - 6.2 shadowbox.module \shadowbox_active()
 - 6.3 shadowbox.module \shadowbox_active()
 
Verify that Shadowbox should be active for the current URL.
Return value
TRUE if Shadowbox should be active for the current page.
1 call to shadowbox_active()
- shadowbox_construct_header in ./
shadowbox.module  - Build the Shadowbox header by adding the necessary CSS and JS files.
 
File
- ./
shadowbox.module, line 747  - Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.
 
Code
function shadowbox_active() {
  $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;
}