Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE

  • Loading branch information...
commit 1899c6567a36e13e5ae3f94a90523e3efea0af4a 1 parent 6ec6c2d
skodak authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/weblib.php
View
12 lib/weblib.php
@@ -1401,8 +1401,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.