Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE

  • Loading branch information...
commit 3e4fae4d8d5ac82b4dc75536b3604301da5e511b 1 parent 84ca389
skodak authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/weblib.php
View
12 lib/weblib.php
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.