function _tinymce_page_match in TinyMCE 5
Same name and namespace in other branches
- 5.2 tinymce.module \_tinymce_page_match()
- 6.2 tinymce.module \_tinymce_page_match()
- 6 tinymce.module \_tinymce_page_match()
Determine if TinyMCE has permission to be used on the current page.
Return value
TRUE if can render, FALSE if not allowed.
1 call to _tinymce_page_match()
- tinymce_process_textarea in ./
tinymce.module - Attach tinymce to a textarea
File
- ./
tinymce.module, line 1111 - Integrate the TinyMCE editor (http://tinymce.moxiecode.com/) into Drupal.
Code
function _tinymce_page_match($edit) {
$page_match = FALSE;
// Kill TinyMCE if we're editing a textarea with PHP in it!
// PHP input formats are #2 in the filters table.
if (is_numeric(arg(1)) && arg(2) == 'edit') {
$node = node_load(arg(1));
if ($node->format == 2) {
return FALSE;
}
}
if ($edit->settings['access_pages']) {
// If the PHP option wasn't selected
if ($edit->settings['access'] < 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($edit->settings['access_pages'], '/')) . ')$/';
$page_match = !($edit->settings['access'] xor preg_match($regexp, $path));
}
else {
$page_match = drupal_eval($edit->settings['access_pages']);
}
}
else {
$page_match = TRUE;
}
return $page_match;
}