MDL-8691 - Finally found the source of the error and fixed it. Add to apply s(format_string($week_summary)) on the optgroup's label.

This commit is contained in:
nicolasconnault
2007-03-06 02:59:25 +00:00
parent 60ec23afba
commit dacb47c0ca
2 changed files with 11 additions and 5 deletions
+5
View File
@@ -28,6 +28,11 @@ class web_test extends UnitTestCase {
$this->assertEqual(format_string("ANother & &&&&& Category"), "ANother & &&&&& Category");
$this->assertEqual(format_string("ANother & &&&&& Category", true), "ANother & &&&&& Category");
$this->assertEqual(format_string("Nick's Test Site & Other things", true), "Nick's Test Site & Other things");
}
function test_s() {
$this->assertEqual(s("This Breaks \" Strict"), "This Breaks " Strict");
}
}
?>
+6 -5
View 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);
}