Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE

  • Loading branch information...
commit 3e4fae4d8d5ac82b4dc75536b3604301da5e511b 1 parent 84ca389
skodak authored

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. +10 2 lib/weblib.php
12 lib/weblib.php
@@ -1466,8 +1466,16 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) {
1466 1466 $string = filter_text($string, $courseid);
1467 1467 }
1468 1468
1469   - if ($striplinks) { //strip links in string
1470   - $string = preg_replace('/(<a[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
  1469 + // If the site requires it, strip ALL tags from this string
  1470 + if (!empty($CFG->formatstringstriptags)) {
  1471 + $string = strip_tags($string);
  1472 +
  1473 + } else {
  1474 + // Otherwise strip just links if that is required (default)
  1475 + if ($striplinks) { //strip links in string
  1476 + $string = preg_replace('/(<a\s[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
  1477 + }
  1478 + $string = clean_text($string);
1471 1479 }
1472 1480
1473 1481 //Store to cache

0 comments on commit 3e4fae4

Please sign in to comment.
Something went wrong with that request. Please try again.