Permalink
Browse files

MDL-15823 format_string() improvements

  • Loading branch information...
skodak
skodak committed Jul 25, 2008
1 parent c43b787 commit 25db6e1545e4acd190841a58d7099f58d6f32142
Showing with 6 additions and 3 deletions.
  1. +6 −3 lib/weblib.php
View
@@ -1697,9 +1697,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

0 comments on commit 25db6e1

Please sign in to comment.