? 917930.patch
Index: API.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/API.txt,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 API.txt
--- API.txt	28 Sep 2010 12:17:47 -0000	1.1.2.9
+++ API.txt	30 Sep 2010 13:49:38 -0000
@@ -1,366 +1,366 @@
-/* $Id: API.txt,v 1.1.2.9 2010/09/28 12:17:47 swentel Exp $ */
-
-Table of contents
-------------------
-
-1. Hook for cTools.
-2. Hooks for registering selectors, properties and types.
-3. Plugins hook.
-4. Plugin class example.
-5. sweaver_get_plugin().
-6. Images handler.
-7. Session handling
-8. Sweaver popups.
-9. General methods.
-10. General JS functions.
-11. General CSS styles.
-12. Skins
-13. Theme extensions.
-
-------------------------------------------------------
-1. Hook for cTools
-------------------------------------------------------
-
-/**
- * Implementation of hook_ctools_plugin_api().
- */
-function hook_ctools_plugin_api($owner, $api) {
-  if ($owner == 'sweaver' && $api == 'sweaver') {
-    return array('version' => 1);
-  }
-}
-
----------------------------------------------------------
-2. Hooks for registering selectors, properties and types
----------------------------------------------------------
-
-/**
- * Implementation of hook_default_sweaver_selector().
- */
-function hook_default_sweaver_selector() {
-
-  $selectors = array();
-
-  $selector = new stdClass;
-  $selector->api_version = 1;
-  $selector->disabled = FALSE; // Set this to true if you want to disable this by default.
-  $selector->name = 'machine_name';
-  $selector->description = 'Description';
-  $selector->selector_selector = '.selector'; // css selector.
-  $selector->selector_highlight = FALSE; // Whether to highlight the selector in the active path. 
-  $selectors['machine_name'] = $selector;
-  
-  return $selectors;
-}
-
-/**
- * Implementation of hook_default_sweaver_property().
- */
-function hook_default_sweaver_property() {
-
-  $propertys = array();
-
-  // Font.
-  $property = new stdClass;
-  $property->api_version = 1;
-  $property->disabled = FALSE; // Set this to true if you want to disable this by default.
-  $property->name = 'machine_name';
-  $property->description = 'Description';
-  $property->property = '';  // The actual css property. Seperate multiple values by spaces.
-  $property->property_parent = ''; // Wether this property has a parent.
-  $property->property_type = 'select'; // Can be select, slider, image, color or parent.
-  // Prefix or suffix: eg: padding has suffix 'px', url has prefix 'url(' and suffix ');'
-  $property->property_prefix = '';
-  $property->property_suffix = '';
-  // Slider min & max - only applicable for slider.
-  $property->property_slider_min = ''; // Minimum for slider  , usually 1.
-  $property->property_slider_max = ''; // Maximum for slider
-  // Options are only applicable for select.
-  $property->property_options = array(
-        'option_1' => 'Readable option 1',
-        'option_2' => 'Readable option 2',
-        'option_2' => 'Readable option 3',
-      );
-  $propertys['font-machine_name'] = $property;
-
-  // Yes you need to return propertys, that's the way Ctools works :)
-  return $propertys;
-}
-
-/**
- * Implementation of hook_sweaver_type().
- */
-function sweaver_default_sweaver_type() {
-
-  $types = array();
-
-  $type = new stdClass;
-  $type->api_version = 1;
-  $type->disabled = FALSE;
-  $type->name = 'machine_name';
-  $type->description = 'Description';
-  $type->type_options = array(
-    'property_1' => 'property_1',
-    'property_2' => 'property_2',
-    'property_3' => 'property_2',
-  );
-  $types['machine_name'] = $type;
-  
-  return $types;
-}
-
-
----------------------------------------------------------
-3. Plugins hook.
----------------------------------------------------------
-
-/**
- * Implementation of hook_sweaver_plugins().
- */
-function hook_sweaver_plugins() {
-  $plugins = array();
-  
-  $plugins['yourpluginname'] = array(
-    'handler' => array(
-      'tab' => t('Tab name'), // If you want todo something in the frontend of course.
-      'tab_description' => t('Description of your plugin in frontend'),
-      'path' => drupal_get_path('module', 'yourmodulename') .'/plugins/yourpluginname',
-      'file' => 'yourpluginname.inc',
-      'class' => 'yourclassnameusuallythesameasyourpluginname',
-      'parent' => 'sweaver_plugin', // This is required.
-    ),
-  );
-  
-  return $plugins;
-}
-
----------------------------------------------------------
-4. Plugin class example.
----------------------------------------------------------
-
-/**
- * Your plugin
- *
- * All methods are optional.
- */
-class pluginname extends sweaver_plugin {
-
-  /**
-   * Return module dependencies.
-   */
-  function sweaver_dependencies() {
-    return array('module');
-  }
-
-  /**
-   * Menu registry.
-   */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
-    // $page_arguments = array('plugin' => 'name_of_your_plugin'); 
-    //  $base = array(
-    //    'access arguments' => array('configure sweaver'),
-    //    'page callback' => 'sweaver_menu_callback',
-    //  );
-    // You can use these to add to your menu items.
-    // Other stuff you can return in page arguments:
-    // callback_method: defaults to sweaver_menu_callback - optional.
-    // return_method : default to drupal_get_form - optional
-    // Return menu items for Drupal.
-  }
-
-  /**
-   * Theme registry.
-   */
-  function sweaver_theme() {
-    // Return theming functions for Drupal.
-  }
-
-  /**
-   * Init function.
-   */
-  function sweaver_init() {
-    // Do stuff during hook_init() of Drupal.
-  }
-
-  /**
-   * Sweaver objects alter.
-   */
-  function sweaver_objects_alter(&$objects) {}
-
-  /**
-   * Sweaver form.
-   */
-  function sweaver_form() {
-    return array();
-  }
-
-  /**
-   * Sweaver form render.
-   */
-  function sweaver_form_render(&$vars, &$form, $plugin) {
-    // Do some extra rendering on the form.
-  }
-
-  /**
-   * Frontend css and js.
-   */
-  function sweaver_form_css_js(&$inline_settings) {
-    // Add css, js and manipulate the inline settings of sweaver.
-  }
-
-  /**
-   * Frontend form submit.
-   */
-  function sweaver_form_submit($form, &$form_state) {
-    // Do something with the submitted values.
-  }
-  
-  /**
-   * Default menu callback.
-   */
-  function sweaver_menu_callback() {
-    // Return a form or simply some other output.
-    // Must return a form array() by default. This
-    // is the default method you need to implement.
-    // This makes is possible to have menu callbacks in your
-    // class without having to create a new file.
-    // All plugins - except for editor.admin.inc' use this
-    // technique. See sweaver_menu_callback() for options.
-  }
-
-  /**
-   * Default sweaver menu callback validate.
-   */
-  function sweaver_menu_callback_validate($form, &$form_state) {
-    // Validate the submission.
-  }
-
-  /**
-   * Default sweaver menu callback submit
-   */
-  function sweaver_menu_callback_submit($form, &$form_state) {
-    // Do something with the submitted values.
-  }
-}
-
-------------------------------------------------------
-5. sweaver_get_plugin().
-------------------------------------------------------
-
-.You can use sweaver_get_plugin to get an object. This function will
-load the plugin and return the class if found.
-
-$object = sweaver_get_plugin('plugin_name');
-$object->do_some_method();
-
-------------------------------------------------------
-6. Images handler.
-------------------------------------------------------
-
-The editor searches for a class which implements a method called sweaver_images_handler.
-By default, the images plugin which comes in the sweaver module provides extra images.
-You can change this by setting the variable 'sweaver_plugin_handle_images' to the name
-of the plugin you want. The plugin itself must implement following method:
-
-myclass extends sweaver_plugin {
-  function sweaver_images_handler(&$images) {
-    $images['file_path_1'] = 'Real name 1'; 
-    $images['file_path_2'] = 'Real name 2'; 
-  }
-}
-
-------------------------------------------------------
-7. Session handling
-------------------------------------------------------
-
-sweaver_session($value = NULL, $session_key = 'sweaver_editor_messages', $remove = FALSE, $return = 'string')
-
-Set or return session variables which you can easily use througout the plugin system.
-Much easier than using $_SESSION variables. This function does it all for you.
-Use it as much as you can.
-
-------------------------------------------------------
-8. Sweaver popups.
-------------------------------------------------------
-
-You can put forms in a sweaver popup, which we do for example in the themesettings plugin.
-Following things in the sweaver_form method will make sure this happens:
-
-    $form['#popups'] = array(); // Initialize the popups array.
-    $form['#popups'][] = $key; // Put a FAPI key in the popups array.
-    // Link class: popup-link This will trigger the popup.
-    // The link needs an id with at least 'link' in the name. The form
-    // it has to show needs the same id, but with 'link' replaced as 'data'.
-    
-For inspiration, take a look at plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc.
-
-------------------------------------------------------
-9. General methods.
-------------------------------------------------------
-
-- sweaver_get_current_style($theme, $reset = FALSE) {}
-  Returns the css for the theme.
-- sweaver_get_theme_info($theme) {}
-  Returns the theme info for the theme.
-
-------------------------------------------------------
-10. General JS functions.
-------------------------------------------------------
-
-There are a couple of JS functions you can use in your plugins.
-
-- HOOK_updateCss() {} 
-  Must a return CSS definitions to write for the editor.
-  Implemented in editor and custom css plugin. You must add the plugin
-  in the sweaver_form_css_js method in the inline_settings variable in 
-  key 'invokes'. See plugins/sweaver_custom_css/sweaver_custom_css.inc.
-- Drupal.Sweaver.switchTab(remove_tab, show_tab) {}
-  Switch to a tab in the editor
-- Drupal.Sweaver.setMessage(messages) {}
-  Sets a message above the editor. Times out after 5 seconds.
-- Drupal.Sweaver.showPopup(message) {}
-  Shows a popup screen with any content you like. 
-  Gets a close button.
-- Drupal.Sweaver.hidePopup() {}
-  Closes the popup screen.
-
-------------------------------------------------------
-11. General CSS styles.
-------------------------------------------------------
-
-There are several css classes which you can use which will do all kinds of stuff
-
-- display-none: hides an element
-- popup-link: put this on a link and this will trigger a sweaver popup
-- sweaver-switch-to-style: adds a brush icon
-- container: lets a div float
-- container-1 to container-4: determines the width (from 25% to 100%)
-- float-left: floats to left
-- form-floater: makes form items and submits float
-
-------------------------------------------------------
-12. Skins.
-------------------------------------------------------
-You can create new skins for the editor if you like. Simply
-create a new directory with your name and copy the files which
-are found in default, rename them to the name of your new skin
-and adjust them to your likings. On the general configuration screen, 
-you can select the skin you like.
-
-The variable in the database is 'sweaver_skin'.
-
-------------------------------------------------------
-13. Theme info selectors.
-------------------------------------------------------
-You can define selectors per theme in the info file, eg:
-
-sweaver[body] = Body
-sweaver[h1] = Heading 1
-...
-
-The order is how you define it in the info file.
-In the backend you can select if these selectors
-are to be used instead of those in the database.
-
-Note: if you add new selectors but they don't show up,
-then you need to clear the theme registry.
+/* $Id: API.txt,v 1.1.2.9 2010/09/28 12:17:47 swentel Exp $ */
+
+Table of contents
+------------------
+
+1. Hook for cTools.
+2. Hooks for registering selectors, properties and types.
+3. Plugins hook.
+4. Plugin class example.
+5. sweaver_get_plugin().
+6. Images handler.
+7. Session handling
+8. Sweaver popups.
+9. General methods.
+10. General JS functions.
+11. General CSS styles.
+12. Skins
+13. Theme extensions.
+
+------------------------------------------------------
+1. Hook for cTools
+------------------------------------------------------
+
+/**
+ * Implementation of hook_ctools_plugin_api().
+ */
+function hook_ctools_plugin_api($owner, $api) {
+  if ($owner == 'sweaver' && $api == 'sweaver') {
+    return array('version' => 1);
+  }
+}
+
+---------------------------------------------------------
+2. Hooks for registering selectors, properties and types
+---------------------------------------------------------
+
+/**
+ * Implementation of hook_default_sweaver_selector().
+ */
+function hook_default_sweaver_selector() {
+
+  $selectors = array();
+
+  $selector = new stdClass;
+  $selector->api_version = 1;
+  $selector->disabled = FALSE; // Set this to true if you want to disable this by default.
+  $selector->name = 'machine_name';
+  $selector->description = 'Description';
+  $selector->selector_selector = '.selector'; // css selector.
+  $selector->selector_highlight = FALSE; // Whether to highlight the selector in the active path. 
+  $selectors['machine_name'] = $selector;
+  
+  return $selectors;
+}
+
+/**
+ * Implementation of hook_default_sweaver_property().
+ */
+function hook_default_sweaver_property() {
+
+  $propertys = array();
+
+  // Font.
+  $property = new stdClass;
+  $property->api_version = 1;
+  $property->disabled = FALSE; // Set this to true if you want to disable this by default.
+  $property->name = 'machine_name';
+  $property->description = 'Description';
+  $property->property = '';  // The actual css property. Seperate multiple values by spaces.
+  $property->property_parent = ''; // Wether this property has a parent.
+  $property->property_type = 'select'; // Can be select, slider, image, color or parent.
+  // Prefix or suffix: eg: padding has suffix 'px', url has prefix 'url(' and suffix ');'
+  $property->property_prefix = '';
+  $property->property_suffix = '';
+  // Slider min & max - only applicable for slider.
+  $property->property_slider_min = ''; // Minimum for slider  , usually 1.
+  $property->property_slider_max = ''; // Maximum for slider
+  // Options are only applicable for select.
+  $property->property_options = array(
+        'option_1' => 'Readable option 1',
+        'option_2' => 'Readable option 2',
+        'option_2' => 'Readable option 3',
+      );
+  $propertys['font-machine_name'] = $property;
+
+  // Yes you need to return propertys, that's the way Ctools works :)
+  return $propertys;
+}
+
+/**
+ * Implementation of hook_sweaver_type().
+ */
+function sweaver_default_sweaver_type() {
+
+  $types = array();
+
+  $type = new stdClass;
+  $type->api_version = 1;
+  $type->disabled = FALSE;
+  $type->name = 'machine_name';
+  $type->description = 'Description';
+  $type->type_options = array(
+    'property_1' => 'property_1',
+    'property_2' => 'property_2',
+    'property_3' => 'property_2',
+  );
+  $types['machine_name'] = $type;
+  
+  return $types;
+}
+
+
+---------------------------------------------------------
+3. Plugins hook.
+---------------------------------------------------------
+
+/**
+ * Implementation of hook_sweaver_plugins().
+ */
+function hook_sweaver_plugins() {
+  $plugins = array();
+  
+  $plugins['yourpluginname'] = array(
+    'handler' => array(
+      'tab' => t('Tab name'), // If you want todo something in the frontend of course.
+      'tab_description' => t('Description of your plugin in frontend'),
+      'path' => drupal_get_path('module', 'yourmodulename') .'/plugins/yourpluginname',
+      'file' => 'yourpluginname.inc',
+      'class' => 'yourclassnameusuallythesameasyourpluginname',
+      'parent' => 'sweaver_plugin', // This is required.
+    ),
+  );
+  
+  return $plugins;
+}
+
+---------------------------------------------------------
+4. Plugin class example.
+---------------------------------------------------------
+
+/**
+ * Your plugin
+ *
+ * All methods are optional.
+ */
+class pluginname extends sweaver_plugin {
+
+  /**
+   * Return module dependencies.
+   */
+  function sweaver_dependencies() {
+    return array('module');
+  }
+
+  /**
+   * Menu registry.
+   */
+  function sweaver_menu(&$weight, $page_arguments, $base) {
+    // $page_arguments = array('plugin' => 'name_of_your_plugin'); 
+    //  $base = array(
+    //    'access arguments' => array('configure sweaver'),
+    //    'page callback' => 'sweaver_menu_callback',
+    //  );
+    // You can use these to add to your menu items.
+    // Other stuff you can return in page arguments:
+    // callback_method: defaults to sweaver_menu_callback - optional.
+    // return_method : default to drupal_get_form - optional
+    // Return menu items for Drupal.
+  }
+
+  /**
+   * Theme registry.
+   */
+  function sweaver_theme() {
+    // Return theming functions for Drupal.
+  }
+
+  /**
+   * Init function.
+   */
+  function sweaver_init() {
+    // Do stuff during hook_init() of Drupal.
+  }
+
+  /**
+   * Sweaver objects alter.
+   */
+  function sweaver_objects_alter(&$objects) {}
+
+  /**
+   * Sweaver form.
+   */
+  function sweaver_form() {
+    return array();
+  }
+
+  /**
+   * Sweaver form render.
+   */
+  function sweaver_form_render(&$vars, &$form, $plugin) {
+    // Do some extra rendering on the form.
+  }
+
+  /**
+   * Frontend css and js.
+   */
+  function sweaver_form_css_js(&$inline_settings) {
+    // Add css, js and manipulate the inline settings of sweaver.
+  }
+
+  /**
+   * Frontend form submit.
+   */
+  function sweaver_form_submit($form, &$form_state) {
+    // Do something with the submitted values.
+  }
+  
+  /**
+   * Default menu callback.
+   */
+  function sweaver_menu_callback() {
+    // Return a form or simply some other output.
+    // Must return a form array() by default. This
+    // is the default method you need to implement.
+    // This makes is possible to have menu callbacks in your
+    // class without having to create a new file.
+    // All plugins - except for editor.admin.inc' use this
+    // technique. See sweaver_menu_callback() for options.
+  }
+
+  /**
+   * Default sweaver menu callback validate.
+   */
+  function sweaver_menu_callback_validate($form, &$form_state) {
+    // Validate the submission.
+  }
+
+  /**
+   * Default sweaver menu callback submit
+   */
+  function sweaver_menu_callback_submit($form, &$form_state) {
+    // Do something with the submitted values.
+  }
+}
+
+------------------------------------------------------
+5. sweaver_get_plugin().
+------------------------------------------------------
+
+.You can use sweaver_get_plugin to get an object. This function will
+load the plugin and return the class if found.
+
+$object = sweaver_get_plugin('plugin_name');
+$object->do_some_method();
+
+------------------------------------------------------
+6. Images handler.
+------------------------------------------------------
+
+The editor searches for a class which implements a method called sweaver_images_handler.
+By default, the images plugin which comes in the sweaver module provides extra images.
+You can change this by setting the variable 'sweaver_plugin_handle_images' to the name
+of the plugin you want. The plugin itself must implement following method:
+
+myclass extends sweaver_plugin {
+  function sweaver_images_handler(&$images) {
+    $images['file_path_1'] = 'Real name 1'; 
+    $images['file_path_2'] = 'Real name 2'; 
+  }
+}
+
+------------------------------------------------------
+7. Session handling
+------------------------------------------------------
+
+sweaver_session($value = NULL, $session_key = 'sweaver_editor_messages', $remove = FALSE, $return = 'string')
+
+Set or return session variables which you can easily use througout the plugin system.
+Much easier than using $_SESSION variables. This function does it all for you.
+Use it as much as you can.
+
+------------------------------------------------------
+8. Sweaver popups.
+------------------------------------------------------
+
+You can put forms in a sweaver popup, which we do for example in the themesettings plugin.
+Following things in the sweaver_form method will make sure this happens:
+
+    $form['#popups'] = array(); // Initialize the popups array.
+    $form['#popups'][] = $key; // Put a FAPI key in the popups array.
+    // Link class: popup-link This will trigger the popup.
+    // The link needs an id with at least 'link' in the name. The form
+    // it has to show needs the same id, but with 'link' replaced as 'data'.
+    
+For inspiration, take a look at plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc.
+
+------------------------------------------------------
+9. General methods.
+------------------------------------------------------
+
+- sweaver_get_current_style($reset = FALSE) {}
+  Returns the css for the theme.
+- sweaver_get_theme_info($theme) {}
+  Returns the theme info for the theme.
+
+------------------------------------------------------
+10. General JS functions.
+------------------------------------------------------
+
+There are a couple of JS functions you can use in your plugins.
+
+- HOOK_updateCss() {} 
+  Must a return CSS definitions to write for the editor.
+  Implemented in editor and custom css plugin. You must add the plugin
+  in the sweaver_form_css_js method in the inline_settings variable in 
+  key 'invokes'. See plugins/sweaver_custom_css/sweaver_custom_css.inc.
+- Drupal.Sweaver.switchTab(remove_tab, show_tab) {}
+  Switch to a tab in the editor
+- Drupal.Sweaver.setMessage(messages) {}
+  Sets a message above the editor. Times out after 5 seconds.
+- Drupal.Sweaver.showPopup(message) {}
+  Shows a popup screen with any content you like. 
+  Gets a close button.
+- Drupal.Sweaver.hidePopup() {}
+  Closes the popup screen.
+
+------------------------------------------------------
+11. General CSS styles.
+------------------------------------------------------
+
+There are several css classes which you can use which will do all kinds of stuff
+
+- display-none: hides an element
+- popup-link: put this on a link and this will trigger a sweaver popup
+- sweaver-switch-to-style: adds a brush icon
+- container: lets a div float
+- container-1 to container-4: determines the width (from 25% to 100%)
+- float-left: floats to left
+- form-floater: makes form items and submits float
+
+------------------------------------------------------
+12. Skins.
+------------------------------------------------------
+You can create new skins for the editor if you like. Simply
+create a new directory with your name and copy the files which
+are found in default, rename them to the name of your new skin
+and adjust them to your likings. On the general configuration screen, 
+you can select the skin you like.
+
+The variable in the database is 'sweaver_skin'.
+
+------------------------------------------------------
+13. Theme info selectors.
+------------------------------------------------------
+You can define selectors per theme in the info file, eg:
+
+sweaver[body] = Body
+sweaver[h1] = Heading 1
+...
+
+The order is how you define it in the info file.
+In the backend you can select if these selectors
+are to be used instead of those in the database.
+
+Note: if you add new selectors but they don't show up,
+then you need to clear the theme registry.
Index: sweaver.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/sweaver.install,v
retrieving revision 1.1.2.23
diff -u -p -r1.1.2.23 sweaver.install
--- sweaver.install	24 Sep 2010 14:37:36 -0000	1.1.2.23
+++ sweaver.install	30 Sep 2010 13:49:39 -0000
@@ -162,6 +162,16 @@ function sweaver_uninstall() {
 }
 
 /**
+ * Implementation of hook_update_N().
+ *
+ * We simply return an array here. We want the people to
+ * run update.php because a lot of code has been refactored.
+ */
+function sweaver_update_6001() {
+  return array();
+}
+
+/**
  * Implementation of hook_schema().
  */
 function sweaver_schema() {
Index: sweaver.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/sweaver.module,v
retrieving revision 1.1.2.26
diff -u -p -r1.1.2.26 sweaver.module
--- sweaver.module	22 Sep 2010 14:20:15 -0000	1.1.2.26
+++ sweaver.module	30 Sep 2010 13:49:39 -0000
@@ -231,10 +231,10 @@ function sweaver_object_load($name = NUL
       }
 
       // Let sweaver plugins alter objects.
-      foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-        $plugin_name = $plugin['name'];
-        $object = sweaver_get_plugin($plugin_name);
-        $object->sweaver_objects_alter($objects);
+      $sweaver = Sweaver::get_instance();
+      foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+        $sweaver_plugin = $sweaver->get_plugin($plugin_name);
+        $sweaver_plugin->sweaver_objects_alter($objects);
       }
 
       cache_set('sweaver', $objects);
@@ -252,57 +252,22 @@ function sweaver_object_load($name = NUL
 
 /**
  * Get all plugins or a plugin handler.
+ * Depreacated. Only here for backward compatibility.
  *
  * @param $plugin_name
  *   The name of the plugin.
  * @param $enabled
- *   Whether the plugin has to be enabled or not.
+ *   Whether the plugin is enabled or not.
  * @return
  *   Either a list of (enabled) plugins or a(n) (enabled) loaded plugin class.
  */
-function sweaver_get_plugin($plugin_name = NULL, $enabled = NULL) {
-  static $run = FALSE;
-  static $cache, $cached_plugins, $cached_plugins_enabled = array();
-
-  if (!$run) {
-    ctools_include('plugins');
-    if ($plugins_cache = cache_get('sweaver_plugins')) {
-      $cached_plugins = $plugins_cache->data['sweaver_plugins'];
-      $cached_plugins_enabled = $plugins_cache->data['sweaver_plugins_enabled'];
-    }
-    else {
-      $plugins = ctools_get_plugins('sweaver', 'plugins');
-      $cached_plugins = $plugins;
-
-      // Build enabled plugins.
-      foreach ($cached_plugins as $key => $plugin) {
-        if (variable_get('sweaver_plugin_status_'. $key, FALSE)) {
-          $cached_plugins_enabled[$key] = $plugin;
-        }
-      }
-
-      // Cache the plugins ourselves too.
-      $sweaver_plugins['sweaver_plugins'] = $cached_plugins;
-      $sweaver_plugins['sweaver_plugins_enabled'] = $cached_plugins_enabled;
-      cache_set('sweaver_plugins', $sweaver_plugins);
-    }
-    $run = TRUE;
-  }
-
+function sweaver_get_plugin($plugin_name = NULL, $enabled = FALSE) {
+  $sweaver = Sweaver::get_instance();
   if ($plugin_name == NULL) {
-    return ($enabled) ? $cached_plugins_enabled : $cached_plugins;
+    return $sweaver->get_plugins_registry($enabled);
   }
   else {
-    if (!isset($cache[$plugin_name])) {
-      $check = ($enabled) ? isset($cached_plugins_enabled[$plugin_name]) : TRUE;
-      if ($check && $class = ctools_plugin_get_class($cached_plugins[$plugin_name], 'handler')) {
-        $cache[$plugin_name] = new $class($cached_plugins[$plugin_name]);
-      }
-      else {
-        $cache[$plugin_name] = FALSE;
-      }
-    }
-    return isset($cache[$plugin_name]) ? $cache[$plugin_name] : FALSE;
+  	return $sweaver->get_plugin($plugin_name, $enabled);
   }
 }
 
@@ -310,21 +275,30 @@ function sweaver_get_plugin($plugin_name
  * Implementation of hook_init().
  */
 function sweaver_init() {
+
+  module_load_include('inc', 'sweaver', 'sweaver');
+
   // We use the ctools_static here instead of a session, because
   // pressflow doesn't allow us to start a session without breaking
   // the page cache.
   $load_style = &ctools_static('load_style', TRUE);
   if (sweaver_show_editor()) {
+
+    $sweaver = Sweaver::get_instance();
+
     $load_style = FALSE;
     $inline_js_settings = array('sweaver' => array('invokes' => array()));
+    $skin = variable_get('sweaver_skin', SWEAVER_SKIN);
 
-    foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-      $plugin_name = $plugin['name'];
-      $object = sweaver_get_plugin($plugin_name);
+    drupal_add_js(drupal_get_path('module', 'sweaver') .'/sweaver_plugin.js', 'module');
+    drupal_add_css(drupal_get_path('module', 'sweaver') .'/skins/'. $skin .'/'. $skin .'.css', 'module');
+
+    foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+    	$sweaver_plugin = $sweaver->get_plugin($plugin_name);
       // Fire init.
-      $object->sweaver_init();
+      $sweaver_plugin->sweaver_init();
       // CSS and JS.
-      $object->sweaver_form_css_js($inline_js_settings);
+      $sweaver_plugin->sweaver_form_css_js($inline_js_settings);
     }
 
     // JS inline settings.
@@ -338,12 +312,12 @@ function sweaver_init() {
 function sweaver_preprocess_page(&$vars) {
   // Load css for this theme if available.
   if (variable_get('sweaver_load_style_when_editor_inactive', TRUE) || sweaver_show_editor()) {
-    global $theme_key;
-    $sweaver = sweaver_get_plugin('sweaver_plugin');
-    $sweaver_style = $sweaver->sweaver_get_current_style($theme_key);
+
+  	$sweaver = Sweaver::get_instance();
+    $sweaver_style = $sweaver->get_current_style();
     if (isset($sweaver_style->css) && ctools_static('load_style')) {
       $css = $vars['css'];
-      $css_path = file_directory_path() .'/sweaver/sweaver_'. $theme_key . '_'. $sweaver_style->style_id .'_'. $sweaver_style->type .'.css';
+      $css_path = file_directory_path() .'/sweaver/sweaver_'. $sweaver->get_theme_key() . '_'. $sweaver_style->style_id .'_'. $sweaver_style->type .'.css';
       drupal_add_css($css_path, 'theme');
       $vars['css']['all']['theme'][$css_path] = TRUE;
       $vars['styles'] = drupal_get_css();
@@ -362,6 +336,98 @@ function sweaver_footer($main = 0) {
 }
 
 /**
+ * Sweaver editor containers.
+ * TODO make this a function instead of letting every plugin have this.
+ * OR prove it can be changed by others, removing the final.
+ */
+function sweaver_containers() {
+  return array(
+    'one' => t('Font'),
+    'two' => t('Background'),
+    'three' => t('Spacing'),
+    'four' => t('Empty'),
+  );
+}
+
+/**
+ * Return all enabled themes.
+ */
+function sweaver_get_all_themes() {
+  $themes = &ctools_static('all_themes', array());
+  if (empty($themes)) {
+    $themes = array();
+    $result = db_query("SELECT filename, name, status, info FROM {system} WHERE type = 'theme' AND status = '1' ORDER BY name ASC");
+    while ($theme = db_fetch_object($result)) {
+      if ($theme->status) {
+        $theme->info = unserialize($theme->info);
+        $theme->prefix = isset($theme->info['engine']) ? $theme->info['engine'] : NULL;
+        $themes[$theme->name] = $theme;
+      }
+    }
+  }
+  return $themes;
+}
+
+/**
+ * Get theme info.
+ *
+ * @param $theme
+ *   The machine name for the theme.
+ * @return $theme_info
+ *   The info about a theme.
+ */
+function sweaver_get_theme_info($theme) {
+  $themes = sweaver_get_all_themes();
+  return $themes[$theme]->info;
+}
+
+/**
+ * Session handler for sweaver.
+ *
+ * @param $value
+ *   The value hold by the session key.
+ * @param $session_key
+ *   Name of the session key.
+ * @param $action
+ *   Action to perform. TRUE will remove the session key.
+ * @param $return_string
+ *   Whether to return the value of the session key as string
+ *   or simply return the value.
+ * @return
+ *   Either FALSE, a value from the key or nothing.
+ */
+function sweaver_session($value = NULL, $session_key = 'sweaver_editor_messages', $remove = FALSE, $return_string = TRUE) {
+  // Add value to session key.
+  if (isset($session_key) && isset($value) && !$remove) {
+    if (!isset($_SESSION[$session_key])) $_SESSION[$session_key] = array();
+    $_SESSION[$session_key][] = $value;
+  }
+  // Remove complete session key.
+  elseif (isset($_SESSION[$session_key]) && !isset($value) && $remove) {
+    if (isset($_SESSION[$session_key])) unset($_SESSION[$session_key]);
+  }
+  // Return values from session key.
+  elseif (isset($_SESSION[$session_key])) {
+    if ($return_string) {
+      $return = FALSE;
+      $values = $_SESSION[$session_key];
+      if (count($values) > 1) {
+        foreach ($values as $key => $value) {
+          $return .= $value ."\n";
+        }
+      }
+      elseif (isset($values[0])) {
+        $return = $values[0];
+      }
+      return $return;
+    }
+    else {
+      return $_SESSION[$session_key];
+    }
+  }
+}
+
+/**
  * Function to check if we are going to show the editor.
  */
 function sweaver_show_editor() {
@@ -396,15 +462,14 @@ function sweaver_show_editor() {
 function sweaver_frontend(&$form_state) {
   $form = array();
   $weight = 1;
-  global $theme_key;
   $form['#plugins'] = array();
   $form['#theme'] = 'sweaver_plugin';
   $form['#attributes'] = array('enctype' => 'multipart/form-data');
   $plugins_order = variable_get('sweaver_plugins_weight', array());
 
-  foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-    $plugin_name = $plugin['name'];
-    $object = sweaver_get_plugin($plugin_name);
+  $sweaver = Sweaver::get_instance();
+  foreach ($sweaver->get_plugins_registry(TRUE) as $plugin_name => $plugin) {
+    $sweaver_plugin = $sweaver->get_plugin($plugin_name);
 
     // Calculate weight.
     $default_weight = isset($plugins_order[$plugin_name]) ? $plugins_order[$plugin_name] : $weight++;
@@ -413,7 +478,7 @@ function sweaver_frontend(&$form_state) 
     $form['#plugins_full'][$plugin_name] = $plugin;
 
     // Form.
-    $plugin_form = $object->sweaver_form();
+    $plugin_form = $sweaver_plugin->sweaver_form();
     if (!empty($plugin_form)) {
       $form[$plugin['name']]['form'] = $plugin_form;
       if (isset($plugin['handler']['tab'])) {
@@ -424,14 +489,14 @@ function sweaver_frontend(&$form_state) 
   }
 
   // Editor messages.
-  $messages = $object->sweaver_session();
-  $object->sweaver_session(NULL, 'sweaver_editor_messages', TRUE);
+  $messages = sweaver_session();
+  sweaver_session(NULL, 'sweaver_editor_messages', TRUE);
   $form['sweaver-editor-messages'] = array(
     '#type' => 'hidden',
     '#value' => trim($messages),
   );
 
-  $form['#current_theme'] = $theme_key;
+  $form['#current_theme'] = $sweaver->get_theme_key();
   $form['destination'] = array(
     '#type' => 'hidden',
     '#value' => $_GET['q'],
@@ -441,16 +506,24 @@ function sweaver_frontend(&$form_state) 
 }
 
 /**
+ * Clear cache and page requisites.
+ */
+function sweaver_clear_cache() {
+  cache_clear_all();
+  drupal_clear_css_cache();
+}
+
+/**
  * Sweaver frontend submit.
  */
 function sweaver_frontend_submit($form, &$form_state) {
 
-  foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-    $plugin_name = $plugin['name'];
-    $object = sweaver_get_plugin($plugin_name);
+  $sweaver = Sweaver::get_instance();
+  foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+    $sweaver_plugin = $sweaver->get_plugin($plugin_name);
     // In the first version, we'll let everyone who has submit methods
     // simply do their stuff with the submitted values.
-    $object->sweaver_form_submit($form, $form_state);
+    $sweaver_plugin->sweaver_form_submit($form, $form_state);
   }
 
   // Redirect to same path. We issue this function so things like
@@ -472,8 +545,8 @@ function sweaver_menu_callback($settings
   $return_method = (isset($settings['return_method'])) ? $settings['return_method'] : 'drupal_get_form';
   $js = (isset($settings['js'])) ? TRUE : FALSE;
 
-  if ($object = sweaver_get_plugin($plugin_name, TRUE)) {
-    $output = $object->$callback_method();
+  if ($sweaver_plugin = Sweaver::get_instance()->get_plugin($plugin_name, TRUE)) {
+    $output = $sweaver_plugin->$callback_method();
     if (!empty($output)) {
       if ($return_method == 'drupal_get_form') {
         return drupal_get_form('sweaver_menu_callback_form', $output, $plugin_name, $callback_method);
@@ -513,10 +586,10 @@ function sweaver_menu_callback_form($for
  * Sweaver menu callback validate.
  */
 function sweaver_menu_callback_form_validate($form, &$form_state) {
-  $object = sweaver_get_plugin($form['#plugin_name']);
+  $sweaver_plugin = Sweaver::get_instance()->get_plugin($form['#plugin_name']);
   $callback_validate_function = $form['#callback_method'] .'_validate';
-  if (method_exists($object, $callback_validate_function)) {
-    $object->$callback_validate_function($form, $form_state);
+  if (method_exists($sweaver_plugin, $callback_validate_function)) {
+    $sweaver_plugin->$callback_validate_function($form, $form_state);
   }
 }
 
@@ -524,9 +597,9 @@ function sweaver_menu_callback_form_vali
  * Sweaver menu callback form submit.
  */
 function sweaver_menu_callback_form_submit($form, &$form_state) {
-  $object = sweaver_get_plugin($form['#plugin_name']);
+  $sweaver_plugin = Sweaver::get_instance()->get_plugin($form['#plugin_name']);
   $callback_submit_function = $form['#callback_method'] .'_submit';
-  if (method_exists($object, $callback_submit_function)) {
-    $object->$callback_submit_function($form, $form_state);
+  if (method_exists($sweaver_plugin, $callback_submit_function)) {
+    $sweaver_plugin->$callback_submit_function($form, $form_state);
   }
 }
Index: sweaver.registry.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/sweaver.registry.inc,v
retrieving revision 1.1.2.26
diff -u -p -r1.1.2.26 sweaver.registry.inc
--- sweaver.registry.inc	24 Sep 2010 14:56:54 -0000	1.1.2.26
+++ sweaver.registry.inc	30 Sep 2010 13:49:39 -0000
@@ -13,18 +13,31 @@ function _sweaver_menu() {
   $weight = 0;
   $items = array();
 
+  // The sweaver plugins administration.
+  $items['admin/settings/sweaver/plugins'] = array(
+    'title' => 'Plugins',
+    'type' => MENU_LOCAL_TASK,
+    'weight' => 2,
+    'access arguments' => array('configure sweaver'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('sweaver_plugin_config_plugins'),
+    'file' => 'sweaver.admin.inc'
+  );
+
   $base = array(
     'access arguments' => array('configure sweaver'),
     'page callback' => 'sweaver_menu_callback',
   );
 
-  foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-    $plugin_name = $plugin['name'];
-    $object = sweaver_get_plugin($plugin_name);
+  $sweaver = Sweaver::get_instance();
+  foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+    $sweaver_plugin = $sweaver->get_plugin($plugin_name);
     $page_arguments = array(
       'plugin' => $plugin_name,
     );
-    $items += $object->sweaver_menu($weight, $page_arguments, $base);
+    $item = $sweaver_plugin->sweaver_menu($weight, $page_arguments, $base);
+
+    $items += $item;
   }
 
   return $items;
@@ -34,13 +47,30 @@ function _sweaver_menu() {
  * Theming functions.
  */
 function _sweaver_theme() {
-  $theme_functions = array();
 
-  foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-    $plugin_name = $plugin['name'];
-    $object = sweaver_get_plugin($plugin_name);
-    $theme_functions += $object->sweaver_theme();
+  $skin = variable_get('sweaver_skin', SWEAVER_SKIN);
+  $theme_functions = array(
+    'sweaver_plugin' => array(
+      'template' => $skin,
+      'file' => $skin .'.theme.inc',
+      'path' => drupal_get_path('module', 'sweaver') .'/skins/'. $skin,
+      'arguments' => array('form' => NULL),
+    ),
+    'sweaver_plugin_config_plugins' => array(
+      'template' => 'sweaver-plugin-config-plugins',
+      'file' => 'sweaver_plugin.theme.inc',
+      'path' => drupal_get_path('module', 'sweaver'),
+      'arguments' => array('form' => NULL),
+    ),
+  );
+
+  $sweaver = Sweaver::get_instance();
+  foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+    $sweaver_plugin = $sweaver->get_plugin($plugin_name);
+    $theme_function = $sweaver_plugin->sweaver_theme();
+    $theme_functions += $theme_function;
   }
+
   return $theme_functions;
 }
 
@@ -50,13 +80,6 @@ function _sweaver_theme() {
 function _sweaver_sweaver_plugins() {
   $plugins = array();
 
-  $plugins['sweaver_plugin'] = array(
-    'handler' => array(
-      'path' => drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin',
-      'file' => 'sweaver_plugin.inc',
-      'class' => 'sweaver_plugin',
-    ),
-  );
   $plugins['sweaver_plugin_editor'] = array(
     'handler' => array(
       'tab' => t('Style'),
Index: drush/sweaver.drush.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/drush/Attic/sweaver.drush.inc,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 sweaver.drush.inc
--- drush/sweaver.drush.inc	22 Sep 2010 15:11:29 -0000	1.1.2.13
+++ drush/sweaver.drush.inc	30 Sep 2010 13:49:39 -0000
@@ -112,8 +112,9 @@ function sweaver_drush_edit_style($style
   );
 
   // Get some plugins.
-  $sweaver_cs = sweaver_get_plugin('sweaver_plugin_customcss', TRUE);
-  $sweaver_ts = sweaver_get_plugin('sweaver_plugin_themesettings', TRUE);
+  $sweaver = Sweaver::get_instance();
+  $sweaver_cs = $sweaver ->get_plugin('sweaver_plugin_customcss');
+  $sweaver_ts = $sweaver ->get_plugin('sweaver_plugin_themesettings');
 
   // Create steps array.
   $steps = array(
@@ -185,9 +186,8 @@ function sweaver_drush_edit_style($style
 
   // Let's save!
   else {
-    // Get sweaver plugin.
-    $sweaver = sweaver_get_plugin('sweaver_plugin');
-    $sweaver_styles = sweaver_get_plugin('sweaver_plugin_styles');
+    // Get sweaver plugin styles.
+    $sweaver_styles = $sweaver->get_plugin('sweaver_plugin_styles');
 
     // Save into database.
     $update = array('style_id');
@@ -219,7 +219,7 @@ function sweaver_drush_edit_style($style
     }
 
     // Flush cache.
-    $sweaver->sweaver_clear_cache();
+    sweaver_clear_cache();
   }
 }
 
Index: plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.inc,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 sweaver_plugin_customcss.inc
--- plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.inc	23 Sep 2010 15:24:19 -0000	1.1.2.8
+++ plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.inc	30 Sep 2010 13:49:39 -0000
@@ -1,61 +1,61 @@
-<?php
-// $Id: sweaver_plugin_customcss.inc,v 1.1.2.8 2010/09/23 15:24:19 swentel Exp $
-
-/**
- * @file
- * Custom CSS plugin.
- */
-class sweaver_plugin_customcss extends sweaver_plugin {
-
-  /**
-   * Frontend form.
-   */
-  function sweaver_form() {
-    $form = array();
-    global $theme_key;
-    $current_style = $this->sweaver_get_current_style($theme_key);
-
-    $attributes = array();
-    $form['sweaver_plugin_custom_css'] = array(
-      '#type' => 'textarea',
-      '#rows' => 10,
-      '#cols' => 80,
-      '#resizable' => FALSE,
-      '#wysiwyg' => FALSE,
-      '#attributes' => array(
-        'class' => 'sweaver-400',
-      ),
-      '#default_value' => (isset($current_style->customcss)) ? $current_style->customcss : '',
-      '#prefix' => '<div class="form-floater">',
-    );
-    $form['sweaver_plugin_custom_css_button'] = array(
-      '#type' => 'button',
-      '#value' => t('Apply'),
-      '#suffix' => '</div>',
-    );
-
-    return $form;
-  }
-
-  /**
-   * Frontend form submit handler.
-   */
-  function sweaver_form_submit($form, &$form_state) {
-    $clicked_button = $form_state['clicked_button']['#value'];
-
-    if (($clicked_button == t('Save and continue') || $clicked_button == t('Save and publish') || $clicked_button == t('Publish style')) && isset($form_state['style_id'])) {
-      db_query("UPDATE {sweaver_style_draft} set customcss = '%s' WHERE style_id = %d", $form_state['values']['sweaver_plugin_custom_css'], $form_state['style_id']);
-      if ($form_state['publish']) {
-        db_query("UPDATE {sweaver_style} set customcss = '%s' WHERE style_id = %d", $form_state['values']['sweaver_plugin_custom_css'], $form_state['style_id']);
-      }
-    }
-  }
-
-  /**
-   * Frontend css and js.
-   */
-  function sweaver_form_css_js(&$inline_settings) {
-    drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.js', 'module');
-    $inline_settings['sweaver']['invokes'][] = 'sweaver_plugin_customcss';
-  }
+<?php
+// $Id: sweaver_plugin_customcss.inc,v 1.1.2.7 2010/09/22 14:47:24 swentel Exp $
+
+/**
+ * @file
+ * Custom CSS plugin.
+ */
+class sweaver_plugin_customcss extends sweaver_plugin {
+
+  /**
+   * Frontend form.
+   */
+  public function sweaver_form() {
+
+    $current_style = Sweaver::get_instance()->get_current_style();
+
+    $form = array();
+    $attributes = array();
+    $form['sweaver_plugin_custom_css'] = array(
+      '#type' => 'textarea',
+      '#rows' => 10,
+      '#cols' => 80,
+      '#resizable' => FALSE,
+      '#wysiwyg' => FALSE,
+      '#attributes' => array(
+        'class' => 'sweaver-400',
+      ),
+      '#default_value' => (isset($current_style->customcss)) ? $current_style->customcss : '',
+      '#prefix' => '<div class="form-floater">',
+    );
+    $form['sweaver_plugin_custom_css_button'] = array(
+      '#type' => 'button',
+      '#value' => t('Apply'),
+      '#suffix' => '</div>',
+    );
+
+    return $form;
+  }
+
+  /**
+   * Frontend form submit handler.
+   */
+  function sweaver_form_submit($form, &$form_state) {
+    $clicked_button = $form_state['clicked_button']['#value'];
+
+    if (($clicked_button == t('Save and continue') || $clicked_button == t('Save and publish') || $clicked_button == t('Publish style')) && isset($form_state['style_id'])) {
+      db_query("UPDATE {sweaver_style_draft} set customcss = '%s' WHERE style_id = %d", $form_state['values']['sweaver_plugin_custom_css'], $form_state['style_id']);
+      if ($form_state['publish']) {
+        db_query("UPDATE {sweaver_style} set customcss = '%s' WHERE style_id = %d", $form_state['values']['sweaver_plugin_custom_css'], $form_state['style_id']);
+      }
+    }
+  }
+
+  /**
+   * Frontend css and js.
+   */
+  public function sweaver_form_css_js(&$inline_settings) {
+    drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_customcss/sweaver_plugin_customcss.js', 'module');
+    $inline_settings['sweaver']['invokes'][] = 'sweaver_plugin_customcss';
+  }
 }
\ No newline at end of file
Index: plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc,v
retrieving revision 1.1.2.24
diff -u -p -r1.1.2.24 sweaver_plugin_editor.admin.inc
--- plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc	28 Sep 2010 12:17:47 -0000	1.1.2.24
+++ plugins/sweaver_plugin_editor/sweaver_plugin_editor.admin.inc	30 Sep 2010 13:49:39 -0000
@@ -776,8 +776,7 @@ function sweaver_plugin_editor_config_ed
   $form['#tree'] = TRUE;
   $form['#properties_tree'] = array();
   $form['#properties_region'] = array();
-  $sweaver = sweaver_get_plugin('sweaver_plugin');
-  $form['#containers'] = $sweaver->sweaver_containers();
+  $form['#containers'] = sweaver_containers();
   $sweaver_editor_form_configuration = variable_get('sweaver_editor_form_configuration', array());
 
   $order = array();
@@ -826,7 +825,7 @@ function sweaver_plugin_editor_config_ed
     );
     $form[$key]['container'] = array(
       '#type' => 'select',
-      '#options' => $sweaver->sweaver_containers(),
+      '#options' => sweaver_containers(),
       '#attributes' => array(
         'class' => 'property-container-select property-container-'. $container
       ),
Index: plugins/sweaver_plugin_editor/sweaver_plugin_editor.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_editor/sweaver_plugin_editor.inc,v
retrieving revision 1.1.2.21
diff -u -p -r1.1.2.21 sweaver_plugin_editor.inc
--- plugins/sweaver_plugin_editor/sweaver_plugin_editor.inc	28 Sep 2010 12:17:47 -0000	1.1.2.21
+++ plugins/sweaver_plugin_editor/sweaver_plugin_editor.inc	30 Sep 2010 13:49:40 -0000
@@ -10,7 +10,7 @@ class sweaver_plugin_editor extends swea
   /**
    * Menu registry.
    */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
     $items = array();
 
     $base = array(
@@ -135,7 +135,7 @@ class sweaver_plugin_editor extends swea
   /**
    * Theme registry.
    */
-  function sweaver_theme() {
+  public function sweaver_theme() {
     $theme_functions = array();
 
     $editor_plugin_path = drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_editor';
@@ -163,12 +163,11 @@ class sweaver_plugin_editor extends swea
   /**
    * Frontend form.
    */
-  function sweaver_form() {
+  public function sweaver_form() {
     $form = array();
     $form['#editor_containers'] = array();
-    global $theme_key;
 
-    $current_style = $this->sweaver_get_current_style($theme_key);
+    $current_style = Sweaver::get_instance()->get_current_style();
     $form['css'] = array(
       '#type' => 'hidden',
       '#default_value' => isset($current_style->css) ? $current_style->css : '',
@@ -192,7 +191,7 @@ class sweaver_plugin_editor extends swea
     $images = array('' => t('Theme default'), 'none' => t('No image'));
     $image_handler_plugin = variable_get('sweaver_plugin_handle_images', '');
     if (!empty($image_handler_plugin)) {
-      $image_handler = sweaver_get_plugin($image_handler_plugin);
+      $image_handler = Sweaver::get_instance()->get_plugin($image_handler_plugin);
       if (is_object($image_handler) && method_exists($image_handler, 'sweaver_images_handler')) {
         $image_handler->sweaver_images_handler($images);
       }
@@ -237,7 +236,7 @@ class sweaver_plugin_editor extends swea
   /**
    * Frontend form render.
    */
-  function sweaver_form_render(&$vars, &$form, $plugin) {
+  public function sweaver_form_render(&$vars, &$form, $plugin) {
 
     $name = $plugin['name'];
     $vars['tabs'][$name]['#tab_name'] = $form[$name]['#tab_name'];
@@ -311,7 +310,7 @@ class sweaver_plugin_editor extends swea
   /**
    * Frontend css and js.
    */
-  function sweaver_form_css_js(&$inline_settings) {
+  public function sweaver_form_css_js(&$inline_settings) {
 
     drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_editor/sweaver_plugin_editor.js', 'module');
 
@@ -331,13 +330,10 @@ class sweaver_plugin_editor extends swea
     // the selectors into the inline javascript.
     $selectors = array();
     $default_source = TRUE;
-    $theme_key = variable_get('theme_default', 'garland');
-    // Check with themeswitch.
-    if ($theme_switch = $this->sweaver_session(NULL, 'sweaver_plugin_switch_theme')) {
-      $theme_key = $theme_switch;
-    }
+    $theme_key = Sweaver::get_instance()->get_theme_key();
+
     if (variable_get('sweaver_selectors_source', FALSE)) {
-      $theme_info = $this->sweaver_get_theme_info($theme_key);
+      $theme_info = sweaver_get_theme_info($theme_key);
       if (isset($theme_info['sweaver'])) {
         foreach ($theme_info['sweaver'] as $selector_name => $selector_description) {
           $selector = new stdClass;
@@ -444,7 +440,7 @@ class sweaver_plugin_editor extends swea
    * @param $images
    *   A collection of images to use for the image type.
    */
-  protected function sweaver_property_element($property, $images) {
+  private function sweaver_property_element($property, $images) {
     switch ($property->property_type) {
 
       case 'slider':
Index: plugins/sweaver_plugin_editor/sweaver_plugin_editor.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_editor/sweaver_plugin_editor.js,v
retrieving revision 1.1.2.48
diff -u -p -r1.1.2.48 sweaver_plugin_editor.js
--- plugins/sweaver_plugin_editor/sweaver_plugin_editor.js	30 Sep 2010 08:30:02 -0000	1.1.2.48
+++ plugins/sweaver_plugin_editor/sweaver_plugin_editor.js	30 Sep 2010 13:49:40 -0000
@@ -1,4 +1,4 @@
-// $Id: sweaver_plugin_editor.js,v 1.1.2.48 2010/09/30 08:30:02 swentel Exp $
+// $Id: sweaver_plugin_editor.js,v 1.1.2.49 2010/09/30 09:15:33 jyve Exp $
 
 /**
  * Add the sweaver bar at the bottom of the theme
@@ -418,6 +418,12 @@ Drupal.Sweaver.bindClicks = function() {
           event.preventDefault();
         }
 
+        // Initial check for the changesbox.
+        if (Drupal.Sweaver.changesboxcheck == false) {
+          Drupal.Sweaver.ChangesBox(true);
+          Drupal.Sweaver.changesboxcheck = true;
+        }
+        
         // Reset some values.
         Drupal.Sweaver.path.length = 0;
         Drupal.Sweaver.pathIndexes.length = 0;
@@ -428,12 +434,6 @@ Drupal.Sweaver.bindClicks = function() {
         Drupal.Sweaver.buildPath(tempObject);
         Drupal.Sweaver.updateScreen();
         Drupal.Sweaver.updateForm();
-
-        // Initial check for the changesbox.
-        if (Drupal.Sweaver.changesboxcheck == false) {
-          Drupal.Sweaver.ChangesBox(true);
-          Drupal.Sweaver.changesboxcheck = true;
-        }
       }
     }
   });
@@ -915,11 +915,11 @@ Drupal.Sweaver.ChangesBox = function(coo
   if (show_box == true) {
     Drupal.Sweaver.writeChanges();
     box.css({'right' : '10px'});
-    toggler.toggleClass('open').html(Drupal.t('Hide changes'));
+    toggler.addClass('open').html(Drupal.t('Hide changes'));
     Drupal.Sweaver.cookie('sweaver_changes_box', true);
   } else {
     box.css({'right' : '-10000px'});
-    toggler.toggleClass('open').html(Drupal.t('Show changes'));
+    toggler.removeClass('open').html(Drupal.t('Show changes'));
     Drupal.Sweaver.cookie('sweaver_changes_box', false);
   }
 }
Index: plugins/sweaver_plugin_fontface/sweaver_plugin_fontface.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_fontface/Attic/sweaver_plugin_fontface.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 sweaver_plugin_fontface.inc
--- plugins/sweaver_plugin_fontface/sweaver_plugin_fontface.inc	12 Sep 2010 20:43:17 -0000	1.1.2.4
+++ plugins/sweaver_plugin_fontface/sweaver_plugin_fontface.inc	30 Sep 2010 13:49:40 -0000
@@ -10,14 +10,14 @@ class sweaver_plugin_fontface extends sw
   /**
    * Sweaver dependencies.
    */
-  function sweaver_dependencies() {
+  public function sweaver_dependencies() {
     return array('fontyourface');
   }
 
   /**
    * Sweaver objects alter.
    */
-  function sweaver_objects_alter(&$objects) {
+  public function sweaver_objects_alter(&$objects) {
     $extra_fonts = array();
     $used_fonts = fontyourface_get_fonts();
 
Index: plugins/sweaver_plugin_images/sweaver_plugin_images.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_images/sweaver_plugin_images.inc,v
retrieving revision 1.1.2.13
diff -u -p -r1.1.2.13 sweaver_plugin_images.inc
--- plugins/sweaver_plugin_images/sweaver_plugin_images.inc	24 Sep 2010 09:59:27 -0000	1.1.2.13
+++ plugins/sweaver_plugin_images/sweaver_plugin_images.inc	30 Sep 2010 13:49:40 -0000
@@ -10,7 +10,7 @@ class sweaver_plugin_images extends swea
   /**
    * Menu registry.
    */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
 
     $items = array();
 
@@ -45,7 +45,7 @@ class sweaver_plugin_images extends swea
   /**
    * Frontend form: add image form.
    */
-  function sweaver_form() {
+  public function sweaver_form() {
     $form = array();
 
     if (variable_get('sweaver_plugin_images_tab', TRUE)) {
@@ -72,7 +72,7 @@ class sweaver_plugin_images extends swea
   /**
    * Frontend form submit handler.
    */
-  function sweaver_form_submit($form, &$form_state) {
+  public function sweaver_form_submit($form, &$form_state) {
 
     if ($form_state['clicked_button']['#value'] == t('Save image')) {
 
@@ -94,10 +94,10 @@ class sweaver_plugin_images extends swea
         db_query("UPDATE {files} set filepath = '%s' WHERE fid = %d", $new_image_name, $image->fid);
         file_set_status($image, FILE_STATUS_PERMANENT);
         drupal_write_record('sweaver_image', $image);
-        $this->sweaver_session(t('Image @image has been uploaded.', array('@image' => t($image->description))));
+        sweaver_session(t('Image @image has been uploaded.', array('@image' => t($image->description))));
       }
       else {
-
+      
         // Reset error messages.
         $errors = form_get_errors();
         if (!empty($errors)) {
@@ -107,13 +107,13 @@ class sweaver_plugin_images extends swea
 
         // Messages for Sweaver.
         if (empty($form_state['values']['image_description'])) {
-          $this->sweaver_session(t('You need to enter a description for the image.'));
+          sweaver_session(t('You need to enter a description for the image.'));
         }
         if (!empty($errors)) {
-          $this->sweaver_session(t('The image is invalid. Only JPG, PNG and GIF images are allowed.'));
+          sweaver_session(t('The image is invalid. Only JPG, PNG and GIF images are allowed.'));
         }
         elseif (!$image) {
-          $this->sweaver_session(t('The image is empty.'));
+          sweaver_session(t('The image is empty.'));
         }
       }
     }
@@ -122,7 +122,7 @@ class sweaver_plugin_images extends swea
   /**
    * Images handler.
    */
-  function sweaver_images_handler(&$images) {
+  public function sweaver_images_handler(&$images) {
     $imagecache_presets = array();
     if (variable_get('sweaver_plugin_images_imagecache', FALSE) && function_exists('imagecache_presets')) {
       $imagecache_presets = imagecache_presets();
@@ -144,7 +144,7 @@ class sweaver_plugin_images extends swea
   /**
    * Menu callback.
    */
-  function sweaver_menu_callback() {
+  public function sweaver_menu_callback() {
     $form = array();
 
     $form['sweaver_plugin_images_tab'] = array(
@@ -223,7 +223,7 @@ class sweaver_plugin_images extends swea
   /**
    * Menu callback submit.
    */
-  function sweaver_menu_callback_submit($form, &$form_state) {
+  public function sweaver_menu_callback_submit($form, &$form_state) {
     variable_set('sweaver_plugin_images_imagecache', $form_state['values']['sweaver_plugin_images_imagecache']);
     variable_set('sweaver_plugin_images_tab', $form_state['values']['sweaver_plugin_images_tab']);
     variable_set('sweaver_plugin_handle_images', 'sweaver_plugin_images');
@@ -233,7 +233,7 @@ class sweaver_plugin_images extends swea
   /**
    * Images form.
    */
-  function sweaver_images_backend_form() {
+  public function sweaver_images_backend_form() {
     $form = array();
 
     $description = '';
@@ -277,7 +277,7 @@ class sweaver_plugin_images extends swea
   /**
    * Images validate.
    */
-  function sweaver_images_backend_form_validate($form, &$form_state) {
+  public function sweaver_images_backend_form_validate($form, &$form_state) {
     $validators = array(
       'file_validate_is_image' => array(),
     );
@@ -296,7 +296,7 @@ class sweaver_plugin_images extends swea
   /**
    * Images add submit.
    */
-  function sweaver_images_backend_form_submit(&$form, &$form_state) {
+  public function sweaver_images_backend_form_submit(&$form, &$form_state) {
     $image = new stdClass;
 
     if (isset($form_state['image'])) {
@@ -322,7 +322,7 @@ class sweaver_plugin_images extends swea
   /**
    * Image delete form.
    */
-  function sweaver_images_confirm_form_delete() {
+  public function sweaver_images_confirm_form_delete() {
     $image = $this->sweaver_get_image(arg(5));
     if ($image) {
       $form['#image'] = $image;
@@ -337,7 +337,7 @@ class sweaver_plugin_images extends swea
   /**
    * Image delete submit callback.
    */
-  function sweaver_images_confirm_form_delete_submit(&$form, &$form_state) {
+  public function sweaver_images_confirm_form_delete_submit(&$form, &$form_state) {
     $image = $form['#image'];
     file_delete($image->filepath);
     db_query("DELETE FROM {files} where fid = %d", $image->fid);
@@ -354,7 +354,7 @@ class sweaver_plugin_images extends swea
    * @return
    *   False or image object.
    */
-  function sweaver_get_image($fid) {
+  public function sweaver_get_image($fid) {
     if (!empty($fid)) {
       $query = 'SELECT ti.fid, ti.description, f.filepath FROM {sweaver_image} ti
                 INNER JOIN {files} f on f.fid = ti.fid WHERE f.fid = %d';
Index: plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_kb/Attic/sweaver_plugin_kb.inc,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 sweaver_plugin_kb.inc
--- plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc	21 Sep 2010 09:19:49 -0000	1.1.2.9
+++ plugins/sweaver_plugin_kb/sweaver_plugin_kb.inc	30 Sep 2010 13:49:41 -0000
@@ -10,7 +10,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * Sweaver dependencies.
    */
-  function sweaver_dependencies() {
+  public function sweaver_dependencies() {
     if (!variable_get('sweaver_plugin_status_sweaver_plugin_styles', FALSE)) {
       return array('Manage styles');
     }
@@ -20,7 +20,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * Menu registry.
    */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
     $items = array();
 
     $items['admin/settings/sweaver/kb'] = $base + array(
@@ -36,7 +36,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * Frontend css and js.
    */
-  function sweaver_form_css_js(&$inline_settings) {
+  public function sweaver_form_css_js(&$inline_settings) {
     drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_kb/jquery.hotkeys.js', 'module');
     drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_kb/sweaver_plugin_kb.js', 'module');
     $first_key = (variable_get('sweaver_plugin_kb_firstkey', '') != '') ? variable_get('sweaver_plugin_kb_firstkey', '') .'+': '';
@@ -63,7 +63,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * Keyboard bindings settings form.
    */
-  function sweaver_menu_callback() {
+  public function sweaver_menu_callback() {
     $form = array();
     $bindings = $this->sweaver_kb_bindings();
     $binding_options_firstkey = drupal_map_assoc($this->sweaver_kb_binding_firstkeys());
@@ -97,7 +97,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * Possible keyboard bindings.
    */
-  function sweaver_kb_bindings() {
+  public function sweaver_kb_bindings() {
     $bindings = array(
       'save' => array(
         'title' => t('Save style popup'),
@@ -137,7 +137,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * First key options
    */
-  function sweaver_kb_binding_firstkeys() {
+  public function sweaver_kb_binding_firstkeys() {
     return array(
       '',
       'shift',
@@ -149,7 +149,7 @@ class sweaver_plugin_kb extends sweaver_
   /**
    * All possible keyboard bindings.
    */
-  function sweaver_kb_binding_options() {
+  public function sweaver_kb_binding_options() {
     return array(
       '',
       'esc',
Index: plugins/sweaver_plugin_styles/sweaver_plugin_styles.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_styles/sweaver_plugin_styles.inc,v
retrieving revision 1.1.2.57
diff -u -p -r1.1.2.57 sweaver_plugin_styles.inc
--- plugins/sweaver_plugin_styles/sweaver_plugin_styles.inc	30 Sep 2010 10:02:37 -0000	1.1.2.57
+++ plugins/sweaver_plugin_styles/sweaver_plugin_styles.inc	30 Sep 2010 13:49:41 -0000
@@ -15,7 +15,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Menu registry.
    */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
 
     $items = array();
     $page_arguments = array(
@@ -53,19 +53,19 @@ class sweaver_plugin_styles extends swea
   /**
    * Frontend form: add styles form.
    */
-  function sweaver_form() {
+  public function sweaver_form() {
     $form = array();
     $form['#popups'] = array();
-    global $theme_key;
 
     // Current style.
-    $current_style = $this->sweaver_get_current_style($theme_key);
+    $sweaver = Sweaver::get_instance();
+    $current_style = $sweaver->get_current_style();
 
     // Saved styles in database.
     $existing_styles = FALSE;
     $existing_styles_options = array();
     // Draft versions.
-    $drafts = db_query("SELECT style_id, style FROM {sweaver_style_draft} where theme = '%s'", $theme_key);
+    $drafts = db_query("SELECT style_id, style FROM {sweaver_style_draft} where theme = '%s'", $sweaver->get_theme_key());
     while ($data = db_fetch_array($drafts)) {
       $existing_styles_options[$data['style_id']] = $data['style'];
     }
@@ -73,7 +73,7 @@ class sweaver_plugin_styles extends swea
       $existing_styles = TRUE;
     }
     // Live versions.
-    $lives = db_query("SELECT style_id, style FROM {sweaver_style} where theme = '%s' AND active = 1", $theme_key);
+    $lives = db_query("SELECT style_id, style FROM {sweaver_style} where theme = '%s' AND active = 1", $sweaver->get_theme_key());
     while ($data = db_fetch_array($drafts)) {
       $existing_styles_options[$data['style_id']] = $data['style'];
     }
@@ -241,7 +241,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Frontend form render.
    */
-  function sweaver_form_render(&$vars, &$form, $plugin) {
+  public function sweaver_form_render(&$vars, &$form, $plugin) {
     $vars['style_actions'] = $form['sweaver_plugin_styles']['form']['#popups_links'];
     $this->sweaver_popups_render($vars, $form, $plugin['name']);
   }
@@ -249,7 +249,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Frontend css and js.
    */
-  function sweaver_form_css_js(&$inline_settings) {
+  public function sweaver_form_css_js(&$inline_settings) {
     if (variable_get('sweaver_styles_autosave', 10) > 0) {
       $inline_settings['sweaver']['autosave'] = variable_get('sweaver_styles_autosave', 10);
     }
@@ -259,7 +259,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Frontend form submit.
    */
-  function sweaver_form_submit($form, &$form_state) {
+  public function sweaver_form_submit($form, &$form_state) {
     $path = file_create_path('sweaver');
     file_check_directory($path, FILE_CREATE_DIRECTORY);
 
@@ -303,7 +303,7 @@ class sweaver_plugin_styles extends swea
       else {
         $style->style = $style_name;
         if (empty($style->style)) {
-          $this->sweaver_session(t('You need to enter a name for your style.'));
+          sweaver_session(t('You need to enter a name for your style.'));
           // Reset the clicked button
           $form_state['clicked_button']['#value'] = t('Unknown Sweaver button.');
           return;
@@ -332,9 +332,9 @@ class sweaver_plugin_styles extends swea
 
       // Draft only save.
       if ($submit_type != SWEAVER_STYLE_PUBLISH) {
-        $this->sweaver_session(TRUE, 'draft_mode');
-        $this->sweaver_session($style->style_id, 'loaded_style');
-        $this->sweaver_session('draft', 'loaded_table');
+        sweaver_session(TRUE, 'draft_mode');
+        sweaver_session($style->style_id, 'loaded_style');
+        sweaver_session('draft', 'loaded_table');
         $message = 'The style @style has been saved. You can keep working on your style.';
       }
 
@@ -343,7 +343,7 @@ class sweaver_plugin_styles extends swea
         $message = 'The style @style has been saved and published. You can keep working on your style.';
       }
 
-      $this->sweaver_session(t($message, array('@style' => $style->style)));
+      sweaver_session(t($message, array('@style' => $style->style)));
     }
 
     // Load style.
@@ -364,10 +364,10 @@ class sweaver_plugin_styles extends swea
         $style_id = str_replace('_live_table', '', $style_id);
       }
 
-      $this->sweaver_session(TRUE, 'draft_mode');
-      $this->sweaver_session($style_id, 'loaded_style');
-      $this->sweaver_session($table, 'loaded_table');
-      $this->sweaver_session(t('The style @style has been loaded. It is only visible for you.', array('@style' => $style_name)));
+      sweaver_session(TRUE, 'draft_mode');
+      sweaver_session($style_id, 'loaded_style');
+      sweaver_session($table, 'loaded_table');
+      sweaver_session(t('The style @style has been loaded. It is only visible for you.', array('@style' => $style_name)));
     }
 
     // Delete style.
@@ -388,17 +388,17 @@ class sweaver_plugin_styles extends swea
 
       // Message.
       $style_name = $styles_form['delete_style_popup']['question']['delete_style']['#options'][$style_id];
-      $this->sweaver_session(t('The style @style has been deleted.', array('@style' => $style_name)));
+      sweaver_session(t('The style @style has been deleted.', array('@style' => $style_name)));
     }
 
     // Clear page & block cache and page requisites.
-    $this->sweaver_clear_cache();
+    sweaver_clear_cache();
   }
 
   /**
    * Export css to file.
    */
-  function sweaver_export_file($css, $style, $type = 'draft') {
+  public function sweaver_export_file($css, $style, $type = 'draft') {
     $css = str_replace('<style type="text/css">', '', $css);
     $css = str_replace('</style>', '', $css);
     $filename = 'sweaver_' . $style->theme . '_'. $style->style_id .'_'. $type .'.css';
@@ -408,7 +408,7 @@ class sweaver_plugin_styles extends swea
     file_check_directory($path, FILE_CREATE_DIRECTORY);
     $file = $path .'/'. $filename;
     if (!$fp = fopen($file, 'w')) {
-      $this->sweaver_session(t('The css file could not be created.'));
+      sweaver_session(t('The css file could not be created.'));
     }
     else {
       // Clean the css before writing it.
@@ -461,7 +461,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Delete a complete style.
    */
-  function sweaver_delete_style($style) {
+  public function sweaver_delete_style($style) {
     db_query("DELETE FROM {sweaver_style} WHERE style_id = %d", $style->style_id);
     db_query("DELETE FROM {sweaver_style_draft} WHERE style_id = %d", $style->style_id);
     $draft = file_directory_path() .'/sweaver/sweaver_'. $style->theme .'_'. $style->style_id .'_draft.css';
@@ -481,11 +481,11 @@ class sweaver_plugin_styles extends swea
   /**
    * Reset style session.
    */
-  function sweaver_reset_style_session() {
-    $this->sweaver_session(NULL, 'loaded_table', TRUE);
-    $this->sweaver_session(NULL, 'draft_mode', TRUE);
-    $this->sweaver_session(NULL, 'loaded_style', TRUE);
-    $this->sweaver_session(NULL, 'sweaver_temp', TRUE);
+  public function sweaver_reset_style_session() {
+    sweaver_session(NULL, 'loaded_table', TRUE);
+    sweaver_session(NULL, 'draft_mode', TRUE);
+    sweaver_session(NULL, 'loaded_style', TRUE);
+    sweaver_session(NULL, 'sweaver_temp', TRUE);
     ctools_include('object-cache');
     ctools_object_cache_clear('sweaver-styling', 'sweaver-styling');
   }
@@ -493,7 +493,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Menu callback
    */
-  function sweaver_menu_callback() {
+  public function sweaver_menu_callback() {
     $form = array();
 
     // Settings.
@@ -568,7 +568,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Menu callback, delete style.
    */
-  function sweaver_style_confirm_form_delete() {
+  public function sweaver_style_confirm_form_delete() {
     $style_id = arg(5);
     $style = db_fetch_object(db_query('SELECT * FROM {sweaver_style_draft} WHERE style_id = %d', $style_id));
     if ($style->style_id) {
@@ -584,10 +584,10 @@ class sweaver_plugin_styles extends swea
   /**
    * Submit callback, delete style.
    */
-  function sweaver_style_confirm_form_delete_submit($form, &$form_state) {
+  public function sweaver_style_confirm_form_delete_submit($form, &$form_state) {
     $style = $form['#style'];
     $this->sweaver_delete_style($style);
-    $this->sweaver_clear_cache();
+    sweaver_clear_cache();
     drupal_set_message(t('Style %style has been removed', array('%style' => $form['#style']->style)));
     $form_state['redirect'] = 'admin/settings/sweaver/styles';
   }
@@ -595,7 +595,7 @@ class sweaver_plugin_styles extends swea
   /**
    * Autosave post.
    */
-  function sweaver_autosave() {
+  public function sweaver_autosave() {
     // Prevent caching of JS output.
     $GLOBALS['conf']['cache'] = FALSE;
     // Prevent Devel from hi-jacking our output in any case.
@@ -610,9 +610,9 @@ class sweaver_plugin_styles extends swea
     $style->themesettings = '';
 
     // Get the themesettings if applicable and overwrite style id & style name.
-    if ($this->sweaver_session(NULL, 'draft_mode')) {
-      $table = ($this->sweaver_session(NULL, 'loaded_table') == 'live') ? 'sweaver_style' : 'sweaver_style_draft';
-      $original = db_fetch_object(db_query("SELECT style_id, style, theme, themesettings FROM {". $table ."} where style_id = %d", $this->sweaver_session(NULL, 'loaded_style')));
+    if (sweaver_session(NULL, 'draft_mode')) {
+      $table = (sweaver_session(NULL, 'loaded_table') == 'live') ? 'sweaver_style' : 'sweaver_style_draft';
+      $original = db_fetch_object(db_query("SELECT style_id, style, theme, themesettings FROM {". $table ."} where style_id = %d", sweaver_session(NULL, 'loaded_style')));
       if (isset($original->style_id)) {
         $style->style_id = $original->style_id;
         $style->style = $original->style;
@@ -626,7 +626,7 @@ class sweaver_plugin_styles extends swea
     ctools_object_cache_set('sweaver-styling', 'sweaver-styling', $style);
 
     // Set session variable.
-    $this->sweaver_session(TRUE, 'sweaver_temp');
+    sweaver_session(TRUE, 'sweaver_temp');
 
     // Exit.
     exit(drupal_json(array('error' => 0)));
Index: plugins/sweaver_plugin_themeclasses/sweaver_plugin_themeclasses.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_themeclasses/Attic/sweaver_plugin_themeclasses.inc,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 sweaver_plugin_themeclasses.inc
--- plugins/sweaver_plugin_themeclasses/sweaver_plugin_themeclasses.inc	27 Sep 2010 08:16:51 -0000	1.1.2.9
+++ plugins/sweaver_plugin_themeclasses/sweaver_plugin_themeclasses.inc	30 Sep 2010 13:49:41 -0000
@@ -1,134 +1,134 @@
-<?php
-// $Id: sweaver_plugin_themeclasses.inc,v 1.1.2.9 2010/09/27 08:16:51 swentel Exp $
-
-/**
- * @file
- * Theme classes plugin.
- */
-define('SWEAVER_PLUGIN_THEMECLASSES_DEFAULT', 'skinr');
-
-class sweaver_plugin_themeclasses extends sweaver_plugin {
-
-  /**
-   * Menu registry.
-   */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
-
-    $items = array();
-
-    // Theme classes groups administration.
-    $items['admin/settings/sweaver/themeclasses'] = $base + array(
-      'title' => 'Theme classes',
-      'page arguments' => array($page_arguments),
-      'type' => MENU_LOCAL_TASK,
-      'weight' => $weight++,
-    );
-
-    return $items;
-  }
-
-  /**
-   * Frontend form.
-   */
-  function sweaver_form() {
-    $form = array();
-
-    $class_groups = trim(variable_get('sweaver_themeclasses_groups', SWEAVER_PLUGIN_THEMECLASSES_DEFAULT));
-    if (empty($class_groups)) {
-      return $form;
-    }
-
-    global $theme_key;
-    $theme_info = $this->sweaver_get_theme_info($theme_key);
-    if (empty($theme_info)) {
-      return $form;
-    }
-
-
-    $cache = variable_get('sweaver_plugin_themeclasses_'. $theme_key, array());
-    if (!empty($cache)) {
-      $styles = $cache['styles'];
-    }
-    else {
-      $styles = array();
-      $groups = explode("\n", $class_groups);
-      foreach ($groups as $group) {
-        $group = trim($group);
-        if (isset($theme_info[$group])) {
-          $this->sweaver_get_styles($theme_info[$group], $styles);
-        }
-      }
-
-      // Cache the stuff.
-      variable_set('sweaver_plugin_themeclasses_'. $theme_key, array('checked' => TRUE, 'styles' => $styles));
-    }
-
-    if (!empty($styles)) {
-      $content = t('<h2>Styles</h2>!styles', array('!styles' => implode(' ', $styles)));
-    }
-    else {
-      $content = t('<p>No styles found.</p>');
-    }
-
-    $form['sweaver_plugin_themeclasses'] = array(
-      '#type' => 'markup',
-      '#value' => $content,
-    );
-
-    return $form;
-  }
-
-
-  /**
-   * Frontend css and js.
-   */
-  function sweaver_form_css_js(&$inline_settings) {
-    drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_themeclasses/sweaver_plugin_themeclasses.js', 'module');
-  }
-
-  /**
-   * Menu callback.
-   */
-  function sweaver_menu_callback() {
-    $form = array();
-
-    $form['sweaver_themeclasses_groups'] = array(
-      '#type' => 'textarea',
-      '#title' => t('Theme groups'),
-      '#description' => t('Enter a group which is available in your theme(s) info file. This plugin will try to fetch all classes from it and make them available in a separate tab. Enter one group per line. This is inspired by the skinr way of theming, so we need to find a key called \'class\' to get a list of styles. If you have added new classes and the editor does not pick them up yet, click on submit button to reset the cache.'),
-      '#default_value' => variable_get('sweaver_themeclasses_groups', SWEAVER_PLUGIN_THEMECLASSES_DEFAULT),
-      '#wysiwyg' => FALSE,
-    );
-
-    $form['sweaver_themeclasses_submit'] = array(
-      '#type' => 'submit',
-      '#value' => t('Save configuration'),
-    );
-
-    return $form;
-  }
-
-  /**
-   * Menu callback submit.
-   */
-  function sweaver_menu_callback_submit($form, &$form_state) {
-    db_query("DELETE FROM {variable} where name LIKE '%s%%'", 'sweaver_plugin_themeclasses_');
-    variable_set('sweaver_themeclasses_groups', $form_state['values']['sweaver_themeclasses_groups']);
-    drupal_set_message(t('The configuration options have been saved.'));
-  }
-
-  /**
-   * Get styles from the group. We look for a key called 'class'.
-   */
-  function sweaver_get_styles($theme_info, &$styles) {
-    foreach ($theme_info as $key => $value) {
-      if (is_array($value) && isset($value['class'])) {
-        $label = isset($value['label']) ? $value['label'] : $value['class'];
-        $styles[] = '<div class="sweaver-switch-to-style " id="spt-'. $value['class'] .'"><a href="javascript:Drupal.Sweaver.ThemeClasses(\'spt-'. $value['class'] .'\', \'spt-'. strip_tags($value['label']) .'\')">'. strip_tags($value['label']) .'</a></div>';
-      }
-      if (is_array($value)) {
-        $this->sweaver_get_styles($theme_info[$key], $styles);
-      }
-    }
-  }
-}
+<?php
+// $Id: sweaver_plugin_themeclasses.inc,v 1.1.2.9 2010/09/27 08:16:51 swentel Exp $
+
+/**
+ * @file
+ * Theme classes plugin.
+ */
+define('SWEAVER_PLUGIN_THEMECLASSES_DEFAULT', 'skinr');
+
+class sweaver_plugin_themeclasses extends sweaver_plugin {
+
+  /**
+   * Menu registry.
+   */
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
+
+    $items = array();
+
+    // Theme classes groups administration.
+    $items['admin/settings/sweaver/themeclasses'] = $base + array(
+      'title' => 'Theme classes',
+      'page arguments' => array($page_arguments),
+      'type' => MENU_LOCAL_TASK,
+      'weight' => $weight++,
+    );
+
+    return $items;
+  }
+
+  /**
+   * Frontend form.
+   */
+  public function sweaver_form() {
+    $form = array();
+
+    $class_groups = trim(variable_get('sweaver_themeclasses_groups', SWEAVER_PLUGIN_THEMECLASSES_DEFAULT));
+    if (empty($class_groups)) {
+      return $form;
+    }
+
+    $theme_key = Sweaver::get_instance()->get_theme_key();
+    $theme_info = sweaver_get_theme_info($theme_key);
+    if (empty($theme_info)) {
+      return $form;
+    }
+
+
+    $cache = variable_get('sweaver_plugin_themeclasses_'. $theme_key, array());
+    if (!empty($cache)) {
+      $styles = $cache['styles'];
+    }
+    else {
+      $styles = array();
+      $groups = explode("\n", $class_groups);
+      foreach ($groups as $group) {
+        $group = trim($group);
+        if (isset($theme_info[$group])) {
+          $this->sweaver_get_styles($theme_info[$group], $styles);
+        }
+      }
+
+      // Cache the stuff.
+      variable_set('sweaver_plugin_themeclasses_'. $theme_key, array('checked' => TRUE, 'styles' => $styles));
+    }
+
+    if (!empty($styles)) {
+      $content = t('<h2>Styles</h2>!styles', array('!styles' => implode(' ', $styles)));
+    }
+    else {
+      $content = t('<p>No styles found.</p>');
+    }
+
+    $form['sweaver_plugin_themeclasses'] = array(
+      '#type' => 'markup',
+      '#value' => $content,
+    );
+
+    return $form;
+  }
+
+
+  /**
+   * Frontend css and js.
+   */
+  public function sweaver_form_css_js(&$inline_settings) {
+    drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_themeclasses/sweaver_plugin_themeclasses.js', 'module');
+  }
+
+  /**
+   * Menu callback.
+   */
+  public function sweaver_menu_callback() {
+    $form = array();
+
+    $form['sweaver_themeclasses_groups'] = array(
+      '#type' => 'textarea',
+      '#title' => t('Theme groups'),
+      '#description' => t('Enter a group which is available in your theme(s) info file. This plugin will try to fetch all classes from it and make them available in a separate tab. Enter one group per line. This is inspired by the skinr way of theming, so we need to find a key called \'class\' to get a list of styles. If you have added new classes and the editor does not pick them up yet, click on submit button to reset the cache.'),
+      '#default_value' => variable_get('sweaver_themeclasses_groups', SWEAVER_PLUGIN_THEMECLASSES_DEFAULT),
+      '#wysiwyg' => FALSE,
+    );
+
+    $form['sweaver_themeclasses_submit'] = array(
+      '#type' => 'submit',
+      '#value' => t('Save configuration'),
+    );
+
+    return $form;
+  }
+
+  /**
+   * Menu callback submit.
+   */
+  public function sweaver_menu_callback_submit($form, &$form_state) {
+    db_query("DELETE FROM {variable} where name LIKE '%s%%'", 'sweaver_plugin_themeclasses_');
+    variable_set('sweaver_themeclasses_groups', $form_state['values']['sweaver_themeclasses_groups']);
+    drupal_set_message(t('The configuration options have been saved.'));
+  }
+
+  /**
+   * Get styles from the group. We look for a key called 'class'.
+   */
+  public function sweaver_get_styles($theme_info, &$styles) {
+    foreach ($theme_info as $key => $value) {
+      if (is_array($value) && isset($value['class'])) {
+        $label = isset($value['label']) ? $value['label'] : $value['class'];
+        $styles[] = '<div class="sweaver-switch-to-style " id="spt-'. $value['class'] .'"><a href="javascript:Drupal.Sweaver.ThemeClasses(\'spt-'. $value['class'] .'\', \'spt-'. strip_tags($value['label']) .'\')">'. strip_tags($value['label']) .'</a></div>';
+      }
+      if (is_array($value)) {
+        $this->sweaver_get_styles($theme_info[$key], $styles);
+      }
+    }
+  }
+}
Index: plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc,v
retrieving revision 1.1.2.26
diff -u -p -r1.1.2.26 sweaver_plugin_themesettings.inc
--- plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc	23 Sep 2010 15:24:19 -0000	1.1.2.26
+++ plugins/sweaver_plugin_themesettings/sweaver_plugin_themesettings.inc	30 Sep 2010 13:49:41 -0000
@@ -10,19 +10,15 @@ class sweaver_plugin_themesettings exten
   /**
    * Init function.
    */
-  function sweaver_init() {
+  public function sweaver_init() {
     // Override theme settings in $conf variable when in Draft.
-    if ($this->sweaver_session(NULL, 'draft_mode')) {
-      $theme_key = variable_get('theme_default', 'garland');
-      // Check with themeswitch.
-      if ($theme_switch = $this->sweaver_session(NULL, 'sweaver_plugin_switch_theme')) {
-        $theme_key = $theme_switch;
-      }
-      $css = $this->sweaver_get_current_style($theme_key);
-      if (isset($css->themesettings) && !empty($css->themesettings)) {
+    if (sweaver_session(NULL, 'draft_mode')) {
+      $sweaver = Sweaver::get_instance();
+      $sweaver_style = $sweaver->get_current_style();
+      if (isset($sweaver_style->themesettings) && !empty($sweaver_style->themesettings)) {
         global $conf;
-        $theme_settings_name = str_replace('/', '_', 'theme_'. $theme_key .'_settings');
-        $conf[$theme_settings_name] = unserialize($css->themesettings);
+        $theme_settings_name = str_replace('/', '_', 'theme_'. $sweaver->get_theme_key() .'_settings');
+        $conf[$theme_settings_name] = unserialize($sweaver_style->themesettings);
       }
     }
   }
@@ -30,18 +26,18 @@ class sweaver_plugin_themesettings exten
   /**
    * Frontend form.
    */
-  function sweaver_form() {
+  public function sweaver_form() {
     $form = array();
     $form['#popups'] = array();
-    global $theme_key;
 
     // Get theme settings form.
     $themesettings = array();
-    $css = $this->sweaver_get_current_style($theme_key);
-    if (isset($css->themesettings) && !empty($css->themesettings)) {
-      $themesettings = unserialize($css->themesettings);
+    $sweaver = Sweaver::get_instance();
+    $sweaver_style = $sweaver->get_current_style();
+    if (isset($sweaver_style->themesettings) && !empty($sweaver_style->themesettings)) {
+      $themesettings = unserialize($sweaver_style->themesettings);
     }
-    $form = $this->sweaver_get_theme_settings_form($theme_key, $themesettings);
+    $form = $this->sweaver_get_theme_settings_form($sweaver->get_theme_key(), $themesettings);
 
     // Add extra property for theme settings which need to be saved also.
     // Form alters on the theme settings form must be put those keys in this array.
@@ -106,7 +102,7 @@ class sweaver_plugin_themesettings exten
   /**
    * Frontend form submit.
    */
-  function sweaver_form_submit($form, &$form_state) {
+  public function sweaver_form_submit($form, &$form_state) {
 
     $values = $form_state['values'];
     $theme_key = $values['var'];
@@ -213,14 +209,14 @@ class sweaver_plugin_themesettings exten
   /**
    * Frontend css and js.
    */
-  function sweaver_form_css_js(&$inline_settings) {
+  public function sweaver_form_css_js(&$inline_settings) {
     drupal_add_js('misc/collapse.js');
   }
 
   /**
    * Get theme specific keys.
    */
-  function sweaver_get_theme_specific_keys($theme_specific_form, &$theme_specific_keys, $fapi_types) {
+  public function sweaver_get_theme_specific_keys($theme_specific_form, &$theme_specific_keys, $fapi_types) {
     $children = element_children($theme_specific_form);
     foreach ($children as $element) {
       if (in_array($theme_specific_form[$element]['#type'], $fapi_types)) {
@@ -246,14 +242,14 @@ class sweaver_plugin_themesettings exten
    * @param $revision_theme_settings
    *   Revisions theme settings.
    */
-  function sweaver_get_theme_settings_form($key, $revision_theme_settings) {
+  public function sweaver_get_theme_settings_form($key, $revision_theme_settings) {
     $has_theme = FALSE;
 
     // Default settings are defined in theme_get_settings() in includes/theme.inc
     if ($key) {
       $settings = theme_get_settings($key);
       $var = str_replace('/', '_', 'theme_'. $key .'_settings');
-      $themes = $this->sweaver_get_all_themes();
+      $themes = sweaver_get_all_themes();
       if (isset($themes[$key]->info['features'])) {
         $has_theme = TRUE;
         $features = $themes[$key]->info['features'];
Index: plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.inc,v
retrieving revision 1.1.2.11
diff -u -p -r1.1.2.11 sweaver_plugin_themeswitch.inc
--- plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.inc	18 Sep 2010 18:23:10 -0000	1.1.2.11
+++ plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.inc	30 Sep 2010 13:49:41 -0000
@@ -10,7 +10,7 @@ class sweaver_plugin_themeswitch extends
   /**
    * Menu registry.
    */
-  function sweaver_menu(&$weight, $page_arguments, $base) {
+  public function sweaver_menu(&$weight, $page_arguments, $base) {
 
     $items = array();
 
@@ -29,25 +29,22 @@ class sweaver_plugin_themeswitch extends
   /**
    * Init
    */
-  function sweaver_init() {
-    global $custom_theme, $theme_key;
-    if ($theme_switch = $this->sweaver_session(NULL, 'sweaver_plugin_switch_theme')) {
-      $custom_theme = $theme_switch;
-      $theme_key = $theme_switch;
-    }
+  public function sweaver_init() {
+    global $custom_theme;
+    $custom_theme = Sweaver::get_instance()->get_theme_key();
   }
 
   /**
    * Frontend form.
    */
-  function sweaver_form() {
+  public function sweaver_form() {
     $form = array();
     $content = '';
-    global $theme_key;
     $no_image = drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_themeswitch/no_screenshot.png';
 
+    $theme_key = Sweaver::get_instance()->get_theme_key();
     $number_of_themes = 0;
-    $themes = $this->sweaver_get_all_themes();
+    $themes = sweaver_get_all_themes();
     foreach ($themes as $theme) {
 
       if (isset($theme->info['screenshot']) && file_exists($theme->info['screenshot'])) {
@@ -86,7 +83,7 @@ class sweaver_plugin_themeswitch extends
   /**
    * Frontend form submit handler.
    */
-  function sweaver_form_submit($form, &$form_state) {
+  public function sweaver_form_submit($form, &$form_state) {
     if ($form_state['clicked_button']['#value'] == t('Publish style') && isset($form_state['style_id'])) {
       $theme_key = $form['#current_theme'];
       variable_set('theme_default', $theme_key);
@@ -96,7 +93,7 @@ class sweaver_plugin_themeswitch extends
   /**
    * Frontend css and js.
    */
-  function sweaver_form_css_js(&$inline_settings) {
+  public function sweaver_form_css_js(&$inline_settings) {
     drupal_add_js(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.js', 'module');
     drupal_add_css(drupal_get_path('module', 'sweaver') .'/plugins/sweaver_plugin_themeswitch/sweaver_plugin_themeswitch.css', 'module');
   }
@@ -104,23 +101,23 @@ class sweaver_plugin_themeswitch extends
   /**
    * Frontend themeswitch.
    */
-  function sweaver_menu_callback() {
+  public function sweaver_menu_callback() {
     $theme = arg(1);
     $theme_default = variable_get('theme_default', 'garland');
 
-    $all_themes = $this->sweaver_get_all_themes();
+    $all_themes = sweaver_get_all_themes();
     if (!empty($theme) && isset($all_themes[$theme]) && $all_themes[$theme]->status == 1) {
 
       if ($theme != $theme_default) {
-        $this->sweaver_session(NULL, 'sweaver_plugin_switch_theme', TRUE);
-        $this->sweaver_session($theme, 'sweaver_plugin_switch_theme');
+        sweaver_session(NULL, 'sweaver_theme', TRUE);
+        sweaver_session($theme, 'sweaver_theme');
       }
       else {
         // Reset session variable because it's the default.
-        $this->sweaver_session(NULL, 'sweaver_plugin_switch_theme', TRUE);
+        sweaver_session(NULL, 'sweaver_theme', TRUE);
       }
 
-      $this->sweaver_session(t('You have switched to @switched_theme.', array('@switched_theme' => $all_themes[$theme]->info['name'])));
+      sweaver_session(t('You have switched to @switched_theme.', array('@switched_theme' => $all_themes[$theme]->info['name'])));
     }
 
     // Go back to previous page.
Index: skins/default/default.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/skins/default/Attic/default.css,v
retrieving revision 1.1.2.19
diff -u -p -r1.1.2.19 default.css
--- skins/default/default.css	30 Sep 2010 08:37:03 -0000	1.1.2.19
+++ skins/default/default.css	30 Sep 2010 13:49:41 -0000
@@ -1,4 +1,4 @@
-/* $Id: default.css,v 1.1.2.19 2010/09/30 08:37:03 jyve Exp $ */
+/* $Id: default.css,v 1.1.2.20 2010/09/30 09:15:33 jyve Exp $ */
 
 /**
  * @file
@@ -809,7 +809,7 @@ body.sweaver {
   -moz-border-radius: 7px 7px 0 0 !important;
   -webkit-border-top-right-radius: 7px !important;
   -webkit-border-top-left-radius: 7px !important;
-  background: #333333 url(images/close2.png) no-repeat 95% 50%;
+  background: #333333 url(images/open2.png) no-repeat 95% 50%;
   position: absolute;
   bottom: 0;
   right: 10px;
@@ -820,7 +820,7 @@ body.sweaver {
 }
 
 #sweaver_plugin_editor #changes-toggler.open {
-  background-image: url(images/open2.png);
+  background-image: url(images/close2.png);
 }
 
 #sweaver_plugin_editor #editor-changes p {
Index: skins/default/default.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/skins/default/Attic/default.theme.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 default.theme.inc
--- skins/default/default.theme.inc	8 Sep 2010 17:14:57 -0000	1.1.2.2
+++ skins/default/default.theme.inc	30 Sep 2010 13:49:41 -0000
@@ -25,7 +25,7 @@ function template_preprocess_sweaver_plu
       $active_tab = $plugin_name;
       $i++;
     }
-    $object = sweaver_get_plugin($plugin_name);
+    $object = Sweaver::get_instance()->get_plugin($plugin_name);
     $object->sweaver_form_render($vars, $form, $form['#plugins_full'][$plugin_name]);
   }
 
Index: skins/grey/grey.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/skins/grey/Attic/grey.css,v
retrieving revision 1.1.2.19
diff -u -p -r1.1.2.19 grey.css
--- skins/grey/grey.css	30 Sep 2010 08:37:03 -0000	1.1.2.19
+++ skins/grey/grey.css	30 Sep 2010 13:49:41 -0000
@@ -1,4 +1,4 @@
-/* $Id: grey.css,v 1.1.2.19 2010/09/30 08:37:03 jyve Exp $ */
+/* $Id: grey.css,v 1.1.2.20 2010/09/30 09:15:33 jyve Exp $ */
 
 /**
  * @file
@@ -820,7 +820,7 @@ body.sweaver {
   border-radius: 7px 7px 0 0 !important;
   -moz-border-radius: 7px 7px 0 0 !important;
   -webkit-border-radius: 7px 7px 0 0 !important;
-  background: #000 url(images/close2.png) no-repeat 95% 50%;
+  background: #000 url(images/open2.png) no-repeat 95% 50%;
   position: absolute;
   bottom: 0;
   right: 10px;
@@ -831,7 +831,7 @@ body.sweaver {
 }
 
 #sweaver_plugin_editor #changes-toggler.open {
-  background-image: url(images/open2.png);
+  background-image: url(images/close2.png);
 }
 
 #sweaver_plugin_editor #editor-changes p {
Index: skins/grey/grey.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/skins/grey/Attic/grey.theme.inc,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 grey.theme.inc
--- skins/grey/grey.theme.inc	8 Sep 2010 17:14:57 -0000	1.1.2.2
+++ skins/grey/grey.theme.inc	30 Sep 2010 13:49:41 -0000
@@ -25,7 +25,7 @@ function template_preprocess_sweaver_plu
       $active_tab = $plugin_name;
       $i++;
     }
-    $object = sweaver_get_plugin($plugin_name);
+    $object = Sweaver::get_instance()->get_plugin($plugin_name);
     $object->sweaver_form_render($vars, $form, $form['#plugins_full'][$plugin_name]);
   }
 
Index: tests/sweaver.editor.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/tests/Attic/sweaver.editor.test,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 sweaver.editor.test
--- tests/sweaver.editor.test	23 Sep 2010 15:38:42 -0000	1.1.2.17
+++ tests/sweaver.editor.test	30 Sep 2010 13:49:41 -0000
@@ -47,7 +47,6 @@ class sweaverEditor extends DrupalWebTes
     $admin_user = $this->drupalCreateUser(array('use editor', 'configure sweaver'));
     $this->drupalLogin($admin_user);
     $editor_tests = t('Editor testing');
-    $sweaver = sweaver_get_plugin('sweaver_plugin');
 
     // Enable minelli.
     db_query("UPDATE {system} set status = 1 where type = 'theme' AND name = 'minnelli'");
Index: tests/sweaver.themesettings.test
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/sweaver/tests/Attic/sweaver.themesettings.test,v
retrieving revision 1.1.2.17
diff -u -p -r1.1.2.17 sweaver.themesettings.test
--- tests/sweaver.themesettings.test	23 Sep 2010 15:24:19 -0000	1.1.2.17
+++ tests/sweaver.themesettings.test	30 Sep 2010 13:49:42 -0000
@@ -88,8 +88,8 @@ class sweaverThemeSettings extends Drupa
     $form = array();
     $values = array();
     $this->enableSweaverData();
-    $sweaver_style = sweaver_get_plugin('sweaver_plugin_styles');
-    $sweaver_ts = sweaver_get_plugin('sweaver_plugin_themesettings');
+    $sweaver_style = Sweaver::get_instance()->get_plugin('sweaver_plugin_styles');
+    $sweaver_ts = Sweaver::get_instance()->get_plugin('sweaver_plugin_themesettings');
 
     $form['#current_theme'] = 'garland';
     $form['sweaver_plugin_themesettings']['form'] = $sweaver_ts->sweaver_get_theme_settings_form('garland', array());
@@ -174,16 +174,16 @@ class sweaverThemeSettings extends Drupa
    *   The form array.
    */
   function performStyleAction($op, $form_state, $form = array()) {
-    $sweaver = sweaver_get_plugin('sweaver_plugin');
+    $sweaver = Sweaver::get_instance();
+    $sweaver_plugin = $sweaver->get_plugin('sweaver_plugin');
 
     // Additional form_state properties
     $form_state['clicked_button']['#value'] = t($op);
 
     // Call submit methods.
-    foreach (sweaver_get_plugin(NULL, TRUE) as $plugin) {
-      $plugin_name = $plugin['name'];
-      $object = sweaver_get_plugin($plugin_name);
-      $object->sweaver_form_submit($form, $form_state);
+    foreach (array_keys($sweaver->get_plugins_registry(TRUE)) as $plugin_name) {
+      $sweaver_plugin = $sweaver->get_plugin($plugin_name);
+      $sweaver_plugin->sweaver_form_submit($form, $form_state);
     }
   }
 
