function ckeditor_parse_rule in CKEditor - WYSIWYG HTML editor 6
1 call to ckeditor_parse_rule()
- ckeditor_rebuild_selectors in includes/
ckeditor.admin.inc - Rebuilds the regular expression that is used to match the inclusion/exclusion rules and the simplified toolbar rules
File
- includes/
ckeditor.admin.inc, line 2090 - CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.
Code
function ckeditor_parse_rule($rule) {
$ruleobj = new stdClass();
$colonpos = strpos($rule, ':');
if ($colonpos !== FALSE) {
$ruleobj->theme = substr($rule, 0, $colonpos);
$rule = substr($rule, $colonpos + 1);
}
else {
$ruleobj->theme = '*';
}
$atpos = strpos($rule, '@');
if ($atpos !== FALSE) {
$ruleobj->nodetype = substr($rule, 0, $atpos);
$rule = substr($rule, $atpos + 1);
}
else {
$ruleobj->nodetype = '*';
}
$dotpos = strpos($rule, '.');
if ($dotpos === FALSE) {
if (strpos($rule, '/') === FALSE && strpos($rule, '-') !== FALSE) {
// assume it's a field
$ruleobj->path = '*';
$ruleobj->field = $rule;
}
elseif (strpos($rule, '/') !== FALSE) {
// assume it's a path
$ruleobj->path = $rule;
$ruleobj->field = '*';
}
else {
return NULL;
}
}
else {
$ruleobj->path = substr($rule, 0, $dotpos);
$ruleobj->field = str_replace('\\.', '.', substr($rule, $dotpos + 1));
}
return $ruleobj;
}