You are here

function fckeditor_install in FCKeditor - WYSIWYG HTML editor 6.2

Same name and namespace in other branches
  1. 5.2 fckeditor.install \fckeditor_install()
  2. 6 fckeditor.install \fckeditor_install()

File

./fckeditor.install, line 42

Code

function fckeditor_install() {
  drupal_install_schema('fckeditor');

  //create two default roles based on previous settings
  db_query("INSERT INTO {fckeditor_role} (name, rid) VALUES ('%s', %d)", "Default", defined('DRUPAL_ANONYMOUS_RID') ? DRUPAL_ANONYMOUS_RID : 1);
  db_query("INSERT INTO {fckeditor_role} (name, rid) VALUES ('%s', %d)", "Advanced", defined('DRUPAL_AUTHENTICATED_RID') ? DRUPAL_AUTHENTICATED_RID : 2);

  //insert settings for default role
  $arr = array();
  $arr['allow_user_conf'] = "f";
  $arr['min_rows'] = variable_get('fckeditor_minimum_rows', 1);
  $arr['excl_mode'] = variable_get('fckeditor_exclude_toggle', 0);
  $arr['filebrowser'] = 'none';
  $arr['quickupload'] = 'f';

  //security
  $arr['ss'] = "2";
  $arr['filters']['filter/0'] = 1;

  //appearance
  $arr['default'] = "t";
  $arr['show_toggle'] = "t";
  $arr['popup'] = variable_get('fckeditor_popup', 0) ? "t" : "f";
  $arr['skin'] = "default";
  $arr['toolbar'] = variable_get('fckeditor_default_toolbar', 'DrupalBasic');
  $arr['expand'] = variable_get('fckeditor_toolbar_start_expanded', 1) ? "t" : "f";
  $arr['width'] = variable_get("fckeditor_width", "100%");
  $arr['lang'] = "en";
  $arr['auto_lang'] = "t";

  //output
  $arr['enter_mode'] = "p";
  $arr['shift_enter_mode'] = "br";
  $arr['font_format'] = 'p;div;pre;address;h1;h2;h3;h4;h5;h6';
  $arr['format_source'] = "t";
  $arr['format_output'] = "t";

  //css
  $arr['css_mode'] = "theme";
  $arr['css_path'] = variable_get("fckeditor_stylesheet", "");

  //upload

  //get permissions here like in _update_role_permissions
  $arr['filebrowser'] = "none";
  $arr['quickupload'] = "f";
  $arr['user_choose'] = "f";
  $arr['show_fieldnamehint'] = "t";
  $arr['autofixplaintext'] = 'f';
  db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Default", serialize($arr));

  //insert settings for advanced role
  $arr['toolbar'] = variable_get('fckeditor_advanced_toolbar', 'DrupalFiltered');
  db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", "Advanced", serialize($arr));
  $arr = array();

  //exclude by default some known textareas where HTML is not expected

  //edit-recipients //contact module

  //edit-reply //contact module

  //edit-description //taxonomy module

  //edit-synonyms //taxonomy module

  //edit-img-assist-textareas //img assist module
  $arr['excl_mode'] = 0;
  $arr['excl'] = variable_get("fckeditor_exclude", "admin/user/settings.edit-user-mail-*\n" . "*.edit-pages\n" . "*.edit-pathauto-ignore-words\n" . "*.edit-recipients\n" . "*.edit-reply\n" . "*.edit-description\n" . "*.edit-synonyms\n" . "*.edit-img-assist-textareas\n" . "*.edit-img-assist-paths\n" . "*.edit-nodewords-description\n" . "*.edit-nodewords-description-value\n" . "admin/content/nodewords/global*\n" . "*.edit-relatedlinks-fieldset-relatedlinks\n" . "*.edit-allowed-values-php\n" . "*.edit-allowed-values\n" . "*.edit-update-notify-emails\n" . "*.edit-googleanalytics-*\n" . "*.edit-piwik-*\n" . "*.edit-feedburner-useragents\n" . "*@*.edit-webform-*\n" . "webform@*.edit-extra-items\n" . "admin/*/logintoboggan\n" . "admin/settings/actions/configure/*\n" . "*.edit-target\n");

  //force by default simple toolbar on selected textareas
  $arr['simple_incl_mode'] = 1;
  $arr['simple_incl'] = "*.edit-signature\n" . "admin/settings/site-information.*\n" . "admin/settings/site-maintenance.*\n" . "*.edit-page-help\n" . "*.edit-user-registration-help\n" . "*.edit-user-picture-guidelines\n";
  db_query("INSERT INTO {fckeditor_settings} (name, settings) VALUES ('%s', '%s')", "FCKeditor Global Profile", serialize($arr));
  module_load_include('inc', 'fckeditor', 'fckeditor.admin');
  fckeditor_rebuild_selectors();
}