function shadowbox_active in Shadowbox 6.2
Same name and namespace in other branches
- 5.2 shadowbox.module \shadowbox_active()
- 5 shadowbox.module \shadowbox_active()
- 6.4 shadowbox.module \shadowbox_active()
- 6 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 923 - Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.
Code
function shadowbox_active() {
if (variable_get('shadowbox_active_type', 'disable') == 'php') {
return drupal_eval(variable_get('shadowbox_pages', ''));
}
$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_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']);
}
if (variable_get('shadowbox_active_type', 'disable') == 'disable') {
return !$page_match;
}
else {
return $page_match;
}
}