You are here

function fckeditor_parse_rule in FCKeditor - WYSIWYG HTML editor 6.2

1 call to fckeditor_parse_rule()
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 1381
FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben

Code

function fckeditor_parse_rule($rule) {
  $ruleobj = new stdClass();
  $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;
}