[Jaws-commits] r13279 - branches/0.8/html/include/Jaws/Widgets

afz at jaws-project.com afz at jaws-project.com
Sun Aug 5 14:46:18 UTC 2012


Author: afz
Date: 2012-08-05 14:46:18 +0000 (Sun, 05 Aug 2012)
New Revision: 13279

Modified:
   branches/0.8/html/include/Jaws/Widgets/CKEditor.php
Log:
[CKEditor] Added auto load extra plugins added by user, and also auto add toolbars by using registry key

Modified: branches/0.8/html/include/Jaws/Widgets/CKEditor.php
===================================================================
--- branches/0.8/html/include/Jaws/Widgets/CKEditor.php	2012-08-05 11:33:59 UTC (rev 13278)
+++ branches/0.8/html/include/Jaws/Widgets/CKEditor.php	2012-08-05 14:46:18 UTC (rev 13279)
@@ -148,12 +148,6 @@
      * @access  private
      * @var     string
      */
-    var $_ExtraPlugins;
-
-    /**
-     * @access  private
-     * @var     string
-     */
     var $_RemovePlugins;
 
     /**
@@ -236,7 +230,7 @@
      */
     function buildXHTML()
     {
-        $ckeditorPlugins = array();
+        $extraPlugins = array();
         static $alreadyLoaded;
         $alreadyLoaded = isset($alreadyLoaded) ? true : false;
 
@@ -259,12 +253,22 @@
             foreach ($dirs as $dir) {
                 if ($dir{0} != '.' && is_dir($pluginDir . $dir)) {
                     if (!in_array($dir, $this->_DefaultPlugins)) {
-                        $ckeditorPlugins[] = $dir;
+                        $extraPlugins[] = $dir;
                     }
                 }
             }
         }
 
+        $extraToolbars = $GLOBALS['app']->Registry->Get('/config/editor_ckeditor_toolbar');
+        $extraToolbars = array_filter(explode('|', $extraToolbars));
+        foreach ($extraToolbars as $key => $items) {
+            $items = array_filter(array_map('trim', explode(',', $items)));
+            if (!empty($items)) {
+                $this->_BaseToolbar[] = array('name'  => "extra$key",
+                                              'items' => $items);
+            }
+        }
+
         // CKEditor configuration
         $this->_Config = array();
         $this->_Config['contentsLangDirection'] = $this->_Direction;
@@ -278,8 +282,8 @@
         $this->_Config['resize_enabled'] = $this->_IsResizable;
         $this->_Config['toolbar'] = $this->_BaseToolbar;
 
-        if(!empty($this->_ExtraPlugins)) {
-            $this->_Config['extraPlugins'] = $this->_ExtraPlugins;
+        if(!empty($extraPlugins)) {
+            $this->_Config['extraPlugins'] = implode(',', $extraPlugins);
         }
 
         if(!empty($this->_RemovePlugins)) {
@@ -459,14 +463,6 @@
     /**
      * @param string $Plugins
      */
-    function addPlugins($Plugins)
-    {
-        $this->_ExtraPlugins .= "," . $Plugins;
-    }
-
-    /**
-     * @param string $Plugins
-     */
     function removePlugins($Plugins)
     {
         $this->_RemovePlugins .= "," . $Plugins;



More information about the Jaws-commits mailing list