You are here

function ckeditor_rule_to_regex in CKEditor - WYSIWYG HTML editor 6

1 call to ckeditor_rule_to_regex()
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 2135
CKEditor - The text editor for the Internet - http://ckeditor.com Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.

Code

function ckeditor_rule_to_regex($rule) {
  static $replace = array(
    '\\*' => '.*',
    '\\?' => '.',
  );
  $field = str_replace('.', '\\.', $rule->field);
  $regex = '^' . preg_quote($rule->theme, '#') . ':' . preg_quote($rule->nodetype, '#') . '@' . preg_quote($rule->path, '#') . '\\.' . preg_quote($field, '#') . '$';
  $regex = strtr($regex, $replace);
  return $regex;
}