]> git.mjollnir.org Git - moodle.git/commitdiff
Added CDATA to Javascript
authormoodler <moodler>
Fri, 22 Dec 2006 04:52:13 +0000 (04:52 +0000)
committermoodler <moodler>
Fri, 22 Dec 2006 04:52:13 +0000 (04:52 +0000)
lib/formslib.php
lib/weblib.php
mod/hotpot/view.php

index 146248704c925aa9e57e52b33683b980948ed9fc..88c0f51b9a408597bad382b5580604ba43de1b2e 100644 (file)
@@ -1045,6 +1045,7 @@ function validate_' . $this->_attributes['id'] . '(frm) {
 
     function getLockOptionEndScript(){
         $js = '<script type="text/javascript" language="javascript">'."\n";
+        $js .= '//<![CDATA['."\n";
         $js .= "var ".$this->getAttribute('id')."items= {";
         foreach ($this->_dependencies as $dependentOn => $elements){
             $js .= "'$dependentOn'".' : {dependents :[';
@@ -1065,6 +1066,7 @@ function validate_' . $this->_attributes['id'] . '(frm) {
         $js=rtrim($js, ",\n");
         $js .= '};'."\n";
         $js .="lockoptionsallsetup('".$this->getAttribute('id')."');\n";
+        $js .='//]]>'."\n";
         $js .='</script>'."\n";
         return $js;
     }
index 8e5e26a69ab43ff639d7949b17acb259826bd1d9..fe19c4b7feb4593c325f06ff220915c4bcf1b88a 100644 (file)
@@ -3694,7 +3694,8 @@ function use_html_editor($name='', $editorhidebuttons='', $id='') {
     if ($id === '') {
         $id = 'edit-'.$name;
     }
-    echo '<script language="javascript" type="text/javascript" defer="defer">'."\n";
+    echo "\n".'<script language="javascript" type="text/javascript" defer="defer">'."\n";
+    echo '//<![CDATA['."\n";
     echo "$editor = new HTMLArea('$id');\n";
     echo "var config = $editor.config;\n";
 
@@ -3705,6 +3706,7 @@ function use_html_editor($name='', $editorhidebuttons='', $id='') {
     } else {
         echo "\n$editor.generate();\n";
     }
+    echo '//]]>'."\n";
     echo '</script>'."\n";
 }
 
index e6e6c719761ba3e27f050747b0c064daf0f0c457..905f1b755b61a2082c050c6f93f697dfe98b50e9 100644 (file)
         foreach ($feedback as $i=>$str) {
             $js .= 'FEEDBACK['.$i."] = $str;\n";
         }
-        $js = '<script type="text/javascript" language="javascript">'."<!--\n"."FEEDBACK = new Array();\n".$js."//--></script>\n";
+        $js = '<script type="text/javascript" language="javascript">'."\n//<![CDATA[\n"."FEEDBACK = new Array();\n".$js."//]]>\n</script>\n";
         $hp->html = preg_replace('|</head>|i', "$js</head>", $hp->html, 1);
     }
     // insert hot-potatoes.js
         //  so some old or modified themes may not insert $body_tags
         $body .= ""
         .   '<script type="text/javascript">'."\n"
-        .   "<!--\n"
+        .   "//<![CDATA[\n"
         .   "   var s = (typeof(window.onload)=='function') ? onload.toString() : '';\n"
         .   "   if (s.indexOf('".$matches[3]."')<0) {\n"
         .   "       if (s=='') {\n" // no previous onload
         .   "           window.onload = new Function('window.onload_hotpot();'+'".$matches[3]."');\n"
         .   "       }\n"
         .   "    }\n"
-        .   "//-->\n"
+        .   "//]]>\n"
         .   "</script>\n"
         ;
         $footer = '</body>'.$footer;