]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8597 - Fixed: weblib.php::print_speller_code was adding CDATA and <script> tags...
authornicolasconnault <nicolasconnault>
Fri, 2 Mar 2007 05:06:51 +0000 (05:06 +0000)
committernicolasconnault <nicolasconnault>
Fri, 2 Mar 2007 05:06:51 +0000 (05:06 +0000)
Check lib/editor/htmlarea/htmlarea.class.php for a seemingly duplicated print_speller_code method.

lib/editor/htmlarea/htmlarea.class.php
lib/weblib.php

index 7d4af69b8eda1441ba08aae6f2a79aab56cb1832..1bf41b22f2ec21d5e934c5b6707c9648a98afcb2 100644 (file)
@@ -337,9 +337,10 @@ class htmlarea extends editorObject {
     /**
     * Prints out needed code for spellchecking.
     * @param bool $usehtmleditor
+    * @todo Deprecated? see lib/weblib.php::print_speller_code()
+    * @see lib/weblib.php::print_speller_code()
     */
     function print_speller_code ($usehtmleditor=false) {
-
         echo "\n".'<script type="text/javascript">'."\n";
         echo '//<![CDATA['."\n";
         if (!$usehtmleditor) {
@@ -362,6 +363,7 @@ class htmlarea extends editorObject {
         }
         echo '//]]>'."\n";
         echo '</script>'."\n";
+        
     }
 
 }
index 8af5024f3d6205d6c4576dd8ff14d94a0a9912bc..0a577e52c4e20c5bcb32cae5ac479a129f243d32 100644 (file)
@@ -3864,7 +3864,7 @@ function print_editor_config($editorhidebuttons='', $return=false) {
     }
 
     if (!empty($CFG->editorspelling) && !empty($CFG->aspellpath)) {
-        $str .= print_speller_code($usehtmleditor=true, true);
+        $str .= print_speller_code($CFG->htmleditor, true);
     }
 
     if ($return) {
@@ -5378,17 +5378,17 @@ function print_side_block_end($attributes = array()) {
 /**
  * Prints out code needed for spellchecking.
  * Original idea by Ludo (Marc Alier).
- *
+ *  
+ * Opening CDATA and <script> are output by weblib::use_html_editor()
  * @uses $CFG
- * @param boolean $usehtmleditor ?
- * @todo Finish documenting this function
+ * @param boolean $usehtmleditor Normally set by $CFG->htmleditor, can be overriden here
+ * @param boolean $return If false, echos the code instead of returning it
+ * @todo Find out if lib/editor/htmlarea/htmlarea.class.php::print_speller_code() is still used, and delete if not
  */
 function print_speller_code ($usehtmleditor=false, $return=false) {
     global $CFG;
     $str = '';
 
-    $str .= "\n".'<script type="text/javascript">'."\n";
-    $str .= '//<![CDATA['."\n";
     if(!$usehtmleditor) {
         $str .= 'function openSpellChecker() {'."\n";
         $str .= "\tvar speller = new spellChecker();\n";
@@ -5407,8 +5407,7 @@ function print_speller_code ($usehtmleditor=false, $return=false) {
         $str .= "\tspeller.openChecker();\n";
         $str .= '}'."\n";
     }
-    $str .= '//]]>'."\n";
-    $str .= '</script>'."\n";
+    
     if ($return) {
         return $str;
     }