? plugins/export_ui
Index: wysiwyg.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg.admin.inc,v
retrieving revision 1.15.2.9
diff -u -p -r1.15.2.9 wysiwyg.admin.inc
--- wysiwyg.admin.inc	13 Feb 2010 23:58:41 -0000	1.15.2.9
+++ wysiwyg.admin.inc	8 Jul 2010 18:16:03 -0000
@@ -415,7 +415,8 @@ function wysiwyg_profile_overview() {
   }
 
   $formats = filter_formats();
-  $profiles = wysiwyg_profile_load_all();
+  // Reset Wysiwyg cache
+  $profiles = wysiwyg_profile_load_all(TRUE);
   $form['formats'] = array(
     '#type' => 'item',
     '#description' => t('To assign a different editor to a text format, click "delete" to remove the existing first.'),
Index: wysiwyg.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg.install,v
retrieving revision 1.4.2.2
diff -u -p -r1.4.2.2 wysiwyg.install
--- wysiwyg.install	13 Feb 2010 23:58:41 -0000	1.4.2.2
+++ wysiwyg.install	8 Jul 2010 18:16:04 -0000
@@ -7,10 +7,32 @@
 function wysiwyg_schema() {
   $schema['wysiwyg'] = array(
     'description' => t('Stores Wysiwyg profiles.'),
+    'join' => array(
+      'exportables' => array(
+        'table' => 'exportables',
+        'left_key' => 'format',
+        'right_key' => 'id',
+        'extra' => "AND t__1.type = 'input_formats' AND t__0.editor != ''",
+        'load' => array(
+          'machine',
+        ),
+      ),
+    ),
+    'export' =>  array(
+      'key' => 'machine',
+      'key in table' => 'exportables',
+      'identifier' => 'wysiwyg',
+      'export module' => 'wysiwyg',
+      'api' => array(
+        'owner' => 'wysiwyg',
+        'minimum_version' => 2,
+        'current_version' => 2,
+      ),
+    ),
     'fields' => array(
-      'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0),
+      'format' => array('type' => 'int', 'not null' => TRUE, 'default' => 0, 'no export' => TRUE),
       'editor' => array('type' => 'varchar', 'length' => 128, 'not null' => TRUE, 'default' => ''),
-      'settings' => array('type' => 'text', 'size' => 'normal'),
+      'settings' => array('type' => 'text', 'size' => 'normal', 'serialize' => TRUE),
     ),
     'primary key' => array('format'),
   );
Index: wysiwyg.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/wysiwyg/wysiwyg.module,v
retrieving revision 1.33.2.11
diff -u -p -r1.33.2.11 wysiwyg.module
--- wysiwyg.module	14 Feb 2010 01:59:47 -0000	1.33.2.11
+++ wysiwyg.module	8 Jul 2010 18:16:06 -0000
@@ -87,6 +87,13 @@ function wysiwyg_help($path, $arg) {
 }
 
 /**
+ * Clear wysiwyg cache on admin/build/modules form.
+ */
+function wysiwyg_form_system_modules_alter(&$form, $form_state) {
+  wysiwyg_profile_load_all(TRUE);
+}
+
+/**
  * Implementation of hook_form_alter().
  *
  * Before Drupal 7, there is no way to easily identify form fields that are
@@ -586,11 +593,7 @@ function wysiwyg_profile_load($format) {
   static $profiles;
 
   if (!isset($profiles) || !array_key_exists($format, $profiles)) {
-    $result = db_query('SELECT format, editor, settings FROM {wysiwyg} WHERE format = %d', $format);
-    while ($profile = db_fetch_object($result)) {
-      $profile->settings = unserialize($profile->settings);
-      $profiles[$profile->format] = $profile;
-    }
+    $profiles = wysiwyg_profile_load_all();
   }
 
   return (isset($profiles[$format]) ? $profiles[$format] : FALSE);
@@ -599,16 +602,42 @@ function wysiwyg_profile_load($format) {
 /**
  * Load all profiles.
  */
-function wysiwyg_profile_load_all() {
+function wysiwyg_profile_load_all($reset = FALSE) {
   static $profiles;
 
-  if (!isset($profiles)) {
+  if ($reset || !isset($profiles)) {
     $profiles = array();
+    if (!$reset && ($cache = cache_get('wysiwyg:profiles', 'cache')) && is_array($cache->data)) {
+      $profiles = $cache->data;
+      return $profiles;
+    }
+
+    // First load Wysiwyg profiles from code, calling to hook_default_wysiwyg
+    // Ensure that Exportables modules exists to convert machine names
+    // into numeric ids. And ctools to load all the profiles from code.
+    if (module_exists('exportables') && module_exists('ctools')) {
+      if (exportables_api() >= 2) {
+        $input_formats = exportables_load_all('input_formats');
+        ctools_include('export');
+        $schema = ctools_export_get_schema('wysiwyg');
+        $default_profiles = _ctools_export_get_defaults('wysiwyg', $schema['export']);
+        foreach ($default_profiles as $machine_name => $default_profile) {
+          $default_profile->format = $input_formats[$machine_name];
+          $default_profile->default = TRUE;
+          $profiles[$default_profile->format] = $default_profile;
+        }
+      }
+    }
+
+    // Now, load settings from the database.
+    // They will override settings from code, if any
     $result = db_query('SELECT format, editor, settings FROM {wysiwyg}');
     while ($profile = db_fetch_object($result)) {
       $profile->settings = unserialize($profile->settings);
       $profiles[$profile->format] = $profile;
     }
+    drupal_alter('wysiwyg_load_profiles', $profiles);
+    cache_set('wysiwyg:profiles', $profiles);
   }
 
   return $profiles;
@@ -971,3 +1000,30 @@ function _wysiwyg_process_include($modul
  * @} End of "defgroup wysiwyg_api".
  */
 
+/**
+ * Implementation of hook_features_export_options().
+ * 
+ * Provide better descriptions for wysiwyg profiles.
+ */
+function wysiwyg_features_export_options() {
+  ctools_include('export');
+  $wysiwyg_profiles = ctools_export_load_object('wysiwyg', 'all');
+  $filter_formats = filter_formats();
+  if (is_array($wysiwyg_profiles)) {
+    foreach ($wysiwyg_profiles as $id => $wysiwyg_profile) {
+      $labels[$id] = t('@format (@editor)', array('@editor' => $wysiwyg_profile->editor, '@format' => $filter_formats[$wysiwyg_profile->format]->name));
+    }
+  }
+  return $labels;
+}
+
+/**
+ * Implementation of hook_features_export().
+ */
+function wysiwyg_features_export($data, &$export, $module_name = '') {
+
+  $return = ctools_component_features_export('wysiwyg', $data, $export, $module_name);
+  $export['dependencies']['exportables'] = 'exportables';
+
+  return $return;
+}
