Permalink
Browse files

MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE

  • Loading branch information...
1 parent 84ca389 commit 3e4fae4d8d5ac82b4dc75536b3604301da5e511b skodak committed Jul 25, 2008
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/weblib.php
View
@@ -1466,8 +1466,16 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) {
$string = filter_text($string, $courseid);
}
- if ($striplinks) { //strip links in string
- $string = preg_replace('/(<a[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
+ // If the site requires it, strip ALL tags from this string
+ if (!empty($CFG->formatstringstriptags)) {
+ $string = strip_tags($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 3e4fae4

Please sign in to comment.