You are here

function fckeditor_rule_to_regex in FCKeditor - WYSIWYG HTML editor 6.2

1 call to fckeditor_rule_to_regex()
fckeditor_rebuild_selectors in ./fckeditor.admin.inc
Rebuilds the regular expression that is used to match the inclusion/exclusion rules and the simplified toolbar rules

File

./fckeditor.admin.inc, line 1417
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben

Code

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