function thickbox_menu in Thickbox 5
Same name and namespace in other branches
- 6 thickbox.module \thickbox_menu()
Implementation of hook_menu().
File
- ./
thickbox.module, line 83 - Author: Fredrik Jonsson fredrik at combonet dot se The thickbox module is a simple wrapper for the jquery plugin ThickBox http://jquery.com/demo/thickbox/.
Code
function thickbox_menu($may_cache) {
global $user;
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/thickbox',
'title' => t('Thickbox'),
'description' => t('Configure Thickbox behavior.'),
'callback' => 'drupal_get_form',
'callback arguments' => 'thickbox_admin_settings',
'access' => user_access('administer site configuration'),
'type' => MENU_NORMAL_ITEM,
);
$items[] = array(
'path' => 'thickbox_login',
'title' => t('Login'),
'callback' => 'thickbox_login',
'access' => !$user->uid,
'type' => MENU_CALLBACK,
);
}
else {
// Code from the block_list funtion in block.module.
// 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('thickbox_pages', ''), '/')) . ')$/';
// 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 (!$page_match) {
_thickbox_doheader();
}
}
return $items;
}