$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");
+ }
}
?>
}
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"';
}
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;
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};)/", "&", $string);
-
+
if (!empty($CFG->filterall)) {
$string = filter_text($string, $courseid);
}