Skip to content

Commit

Permalink
MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Jul 25, 2008
1 parent 84ca389 commit 3e4fae4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/weblib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3e4fae4

Please sign in to comment.