function fckeditor_rebuild_selectors in FCKeditor - WYSIWYG HTML editor 6.2
Rebuilds the regular expression that is used to match the inclusion/exclusion rules and the simplified toolbar rules
Parameters
string $name Name of the profile to process. If omitted, all profiles are rebuilt:
5 calls to fckeditor_rebuild_selectors()
- fckeditor_admin_global_profile_form_submit in ./
fckeditor.admin.inc - fckeditor_admin_profile_clone_form_submit in ./
fckeditor.admin.inc - fckeditor_admin_profile_form_submit in ./
fckeditor.admin.inc - fckeditor_install in ./
fckeditor.install - fckeditor_update_6200 in ./
fckeditor.install - Update from 6.x-1.x to 6.x-2.x
File
- ./
fckeditor.admin.inc, line 1333 - FCKeditor - The text editor for Internet - http://www.fckeditor.net Copyright (C) 2003-2008 Frederico Caldeira Knabben
Code
function fckeditor_rebuild_selectors($name = NULL) {
if ($name == NULL) {
$result = db_query("SELECT * FROM {fckeditor_settings}");
}
else {
$result = db_query("SELECT * FROM {fckeditor_settings} WHERE name = '%s'", $name);
}
while ($data = db_fetch_object($result)) {
if ($data->settings) {
$settings = unserialize($data->settings);
foreach (array(
'excl',
'simple_incl',
) as $var) {
$settings[$var . '_regex'] = '';
if (!empty($settings[$var])) {
$rules = preg_split('/[\\s,]+/', $settings[$var]);
$regex = array();
if (!empty($rules)) {
foreach ($rules as $rule) {
if (!empty($rule)) {
$rule = fckeditor_parse_rule($rule);
$regex[] = '(?:' . fckeditor_rule_to_regex($rule) . ')';
}
}
if (!empty($regex)) {
$settings[$var . '_regex'] = '#' . implode('|', $regex) . '#';
}
}
}
}
db_query("UPDATE {fckeditor_settings} SET settings='%s' WHERE name='%s'", serialize($settings), $data->name);
}
}
}