function _asset_page_match in Asset 6
Same name and namespace in other branches
- 5 asset.module \_asset_page_match()
Should we show the insert access link, determined by admin setting Borrowed from tinymce.module
Return value
TRUE if can render, FALSE if not allowed.
1 call to _asset_page_match()
- asset_textarea in ./
asset.module - The #process callback function for the textareas
File
- ./
asset.module, line 363
Code
function _asset_page_match() {
$page_match = FALSE;
if (!user_access('create assets') && !user_access('administer assets')) {
return $page_match;
}
$access_option = variable_get('asset_access_option', 1);
$access_pages = variable_get('asset_access_pages', "node/add/*\nnode/*/edit");
if ($access_pages) {
// If the PHP option wasn't selected
if ($access_option < 2) {
$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($access_pages, '/')) . ')$/';
$page_match = !($access_option xor preg_match($regexp, $path));
}
else {
$page_match = drupal_eval($access_pages);
}
}
else {
// No pages were specified to block so show on all
$page_match = TRUE;
}
return $page_match;
}