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

afz at jaws-project.com afz at jaws-project.com
Fri Aug 3 21:10:13 UTC 2012


Author: afz
Date: 2012-08-03 21:10:12 +0000 (Fri, 03 Aug 2012)
New Revision: 13246

Modified:
   branches/0.8/html/include/Jaws/Widgets/CKEditor.php
Log:
[CKEditor Widget]: code improvement

Modified: branches/0.8/html/include/Jaws/Widgets/CKEditor.php
===================================================================
--- branches/0.8/html/include/Jaws/Widgets/CKEditor.php	2012-08-03 20:39:38 UTC (rev 13245)
+++ branches/0.8/html/include/Jaws/Widgets/CKEditor.php	2012-08-03 21:10:12 UTC (rev 13246)
@@ -234,42 +234,13 @@
         if (!$alreadyLoaded) {
             $this->_XHTML .= '<script language="javascript" type="text/javascript" src="'.
                 $GLOBALS['app']->getSiteURL('/libraries/ckeditor/ckeditor.js', true). '"></script>'. "\n";
-            $this->_XHTML .= '<script language="javascript" type="text/javascript" src="'.
-                $GLOBALS['app']->getSiteURL('/include/Jaws/Widgets/TextArea.js', true). '"></script>'. "\n";
         }
 
         $this->_XHTML .= $this->_Container->Get();
-        $this->_XHTML .= $this->getJSCode();
-    }
 
-    /**
-     * Get JavaScript
-     *
-     * @access protected
-     * @return string
-     */
-    function getJSCode()
-    {
-        $JS = '<script type="text/javascript">' . "\n";
-        $JS .= "	CKEDITOR.replace( '" . $this->_Name . "',";
-        $JS .= '{' . $this->getJSConfig() . '}';
-        $JS .= "					);" . "\n";
-        $JS .= '</script>' . "\n";
-
-        return $JS;
-    }
-
-    /**
-     * Get settings from Config array as a single string.
-     *
-     * @access protected
-     * @return string
-     */
-    function getJSConfig()
-    {
+        // CKEditor configuration
         $this->_Config = array();
         $this->_Config['contentsLangDirection'] = $this->_Direction;
-
         $this->_Config['language'] = $this->_Language;
         $this->_Config['AutoDetectLanguage'] = false;
         $this->_Config['height'] = $this->_Height;
@@ -299,22 +270,27 @@
         $sParams = '';
         $bFirst = true;
         foreach ($this->_Config as $sKey => $sValue) {
-            if ($bFirst == false)
+            if (!$bFirst) {
                 $sParams .= ", \n";
-            else
+            } else {
                 $bFirst = false;
-
-            if ($sValue === true)
+            }
+            if ($sValue === true) {
                 $sParams .= $this->EncodeConfig($sKey) . ': true';
-            else if ($sValue === false)
+            } elseif ($sValue === false) {
                 $sParams .= $this->EncodeConfig($sKey) . ': false';
-            else if (is_array($sValue))
+            } elseif (is_array($sValue)) {
                 $sParams .= $this->EncodeConfig($sKey) . " : " . json_encode($sValue);
-            else
+            } else {
                 $sParams .= $this->EncodeConfig($sKey) . " : '" . $this->EncodeConfig($sValue) . "'";
+            }
         }
 
-        return $sParams;
+        $this->_XHTML .= '<script type="text/javascript">' . "\n";
+        $this->_XHTML .= "	CKEDITOR.replace( '" . $this->_Name . "',";
+        $this->_XHTML .= '{' . $sParams . '}';
+        $this->_XHTML .= "					);" . "\n";
+        $this->_XHTML .= '</script>' . "\n";
     }
 
     /**



More information about the Jaws-commits mailing list