]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-8691 - Finally found the source of the error and fixed it. Add to apply s(format_...
authornicolasconnault <nicolasconnault>
Tue, 6 Mar 2007 02:59:25 +0000 (02:59 +0000)
committernicolasconnault <nicolasconnault>
Tue, 6 Mar 2007 02:59:25 +0000 (02:59 +0000)
lib/simpletest/testweblib.php
lib/weblib.php

index 9506311406ad1a2ee4e8ff015f3c7d902f98a6a9..214d23111b27053e79a9589a8faa81bed3e8e172 100644 (file)
@@ -28,6 +28,11 @@ class web_test extends UnitTestCase {
         $this->assertEqual(format_string("ANother & &&&&& Category"), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
         $this->assertEqual(format_string("ANother & &&&&& Category", true), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
         $this->assertEqual(format_string("Nick's Test Site & Other things", true), "Nick's Test Site &amp; Other things");
+        
     }    
+    
+    function test_s() {
+          $this->assertEqual(s("This Breaks \" Strict"), "This Breaks &quot; Strict"); 
+    }
 }
 ?>
index 589737da008fb6327e580ac75a5d86e3ec929d35..db42b43bcf68074f9779c429c058abac681f5c00 100644 (file)
@@ -739,9 +739,10 @@ function choose_from_menu_nested($options,$name,$selected='',$nothing='choose',$
     }
     if (!empty($options)) {
         foreach ($options as $section => $values) {
-            $output .= '   <optgroup label="'.$section.'">'."\n";
+            
+            $output .= '   <optgroup label="'. s(format_string($section)) .'">'."\n";
             foreach ($values as $value => $label) {
-                $output .= '   <option value="'. $value .'"';
+                $output .= '   <option value="'. format_string($value) .'"';
                 if ((string)$value == (string)$selected) {
                     $output .= ' selected="selected"';
                 }
@@ -976,7 +977,7 @@ function popup_form($common, $options, $formid, $selected='', $nothing='choose',
             unset($optgr);
             $optgr = array();
 
-            $optgr[]  = '   <optgroup label="'. substr($label,2) .'">';   // Plain labels
+            $optgr[]  = '   <optgroup label="'. s(format_string(substr($label,2))) .'">';   // Plain labels
 
             $inoptgroup = true; /// everything following will be in an optgroup
             continue;
@@ -1430,9 +1431,9 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) {
         return $strcache[$md5];
     }
 
-    // First replace all ampersands not followed html entity code
+    // First replace all ampersands not followed by html entity code
     $string = preg_replace("/\&(?![a-z0-9]{1,8};)/", "&amp;", $string);
-
+    
     if (!empty($CFG->filterall)) {
         $string = filter_text($string, $courseid);
     }