diff --git a/lib/weblib.php b/lib/weblib.php index 6d870b2b80b..b5422e3e1fc 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1436,9 +1436,12 @@ function format_string ($string, $striplinks=true, $courseid=NULL ) { if (!empty($CFG->formatstringstriptags)) { $string = strip_tags($string); - // Otherwise strip just links if that is required (default) - } else if ($striplinks) { //strip links in string - $string = preg_replace('/(]+?>)(.+?)(<\/a>)/is','$2',$string); + } else { + // Otherwise strip just links if that is required (default) + if ($striplinks) { //strip links in string + $string = preg_replace('/(]+?>)(.+?)(<\/a>)/is','$2',$string); + } + $string = clean_text($string); } //Store to cache