]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE
authorskodak <skodak>
Fri, 25 Jul 2008 22:44:17 +0000 (22:44 +0000)
committerskodak <skodak>
Fri, 25 Jul 2008 22:44:17 +0000 (22:44 +0000)
lib/weblib.php

index 9daa71ca2dd0cf9aec936cbf1c6125a4d3d7108f..ed31605fa456cb72f103a0921d40d03260fd36d3 100644 (file)
@@ -1609,9 +1609,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[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
+    } else {
+        // Otherwise strip just links if that is required (default)
+        if ($striplinks) {  //strip links in string
+            $string = preg_replace('/(<a\s[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
+        }
+        $string = clean_text($string);
     }
 
     //Store to cache