I have had several users complain that the FeedBurner module settings gets messed up when FCKeditor is enabled. Could you please add the field id 'edit-feedburner-useragents' to the default exclusion list?

Maybe it would be useful to have the following functions in FCKeditor for module developers to help exclude their own fields or paths?

function fckeditor_exclude_field($field) {
  $result = unserialize(db_result(db_query("SELECT settings FROM {fckeditor_settings} WHERE name = 'FCKeditor Global Profile'")));
  $settings = array_merge(array('excl_mode' => 0, 'excl_fields' => ''), $settings);

  if (!$settings['excl_mode']) {
    $field_regex = '/^'. preg_quote($field) .'$/im';
    if (!preg_match($field_regex, $settings['excl_fields'])) {
      $settings['excl_fields'] .= $field ."\n";
      db_query("UPDATE {fckeditor_settings} SET settings = '%s' WHERE name = 'FCKeditor Global Profile'", serialize($settings));
    }
  }
}

function fckeditor_exclude_path($path) {
  $settings = unserialize(db_result(db_query("SELECT settings FROM {fckeditor_settings} WHERE name = 'FCKeditor Global Profile'")));
  $settings = array_merge(array('excl_mode' => 0, 'excl_paths' => ''), $settings);

  if (!$settings['excl_mode']) {
    $path = drupal_get_normal_path($path);
    $path_regex = '/^'. preg_quote($path, '/') .'$/im';
    if (!preg_matchc($path_regex, $settings['excl_paths'])) {
      $settings['excl_paths'] .= $path ."\n";
      db_query("UPDATE {fckeditor_settings} SET settings = '%s' WHERE name = 'FCKeditor Global Profile'", serialize($settings));
    }
  }
}

Comments

Dave Reid’s picture

Really all I need is to have 'edit-feedburner-useragents' added to the default exclusion list. The code is just a suggestion. Anyone?

wwalc’s picture

Status: Active » Fixed

Added to default exclusion list.

However when people are upgrading FCKeditor module, they do not get the new ID's automatically... so I have additionally added checking for #fckeditor property in textarea element:

  if (key_exists('#fckeditor', $element) && !$element['#fckeditor']) {
    return $element;
  } 

...so to disable FCKeditor on specific field just set #fckeditor to FALSE.

This problem will hopefully be solved in Drupal 7, in the meantime that should do the trick.

Dave Reid’s picture

Could you maybe just check for #wysiwyg = FALSE so that it can be compatible with the current method in the WYSIWYG project?

wwalc’s picture

Yeah, that was pretty bad idea. Renamed to #wysiwyg.

Some more explanation: FCKeditor now respects #wysiwyg attribute in textarea element. If #wysiwyg is set to FALSE, FCKeditor will not appear on that field regardless of user settings. On the other side, setting #wysiwyg to TRUE doesn't change anything (it does not force FCKeditor on that field if user decided to not enable FCKeditor on that textarea).

Dave Reid’s picture

Thanks wwalc! :)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.