From 9fbed9c9bcaa42983a5f28e3be28423b10e090d2 Mon Sep 17 00:00:00 2001 From: moodler Date: Fri, 16 Mar 2007 05:36:24 +0000 Subject: [PATCH] Merged format_string fixes from stable MDL-8713 --- lib/weblib.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 930c9233e3..fa6e656a13 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -1402,7 +1402,12 @@ function format_string ($string, $striplinks=true, $courseid=NULL ) { $string = filter_string($string, $courseid); } - if ($striplinks) { //strip links in string + // If the site requires it, strip ALL tags from this string + if (!empty($CFG->formatstringstriptags)) { + $string = strip_tags($string); + + // Otherwise strip just links if that is required (default) + } else if ($striplinks) { //strip links in string $string = preg_replace('/(]+?>)(.+?)(<\/a>)/is','$2',$string); } @@ -1529,12 +1534,16 @@ function filter_string($string, $courseid=NULL) { $stringfilters = explode(',', $CFG->stringfilters); // ..use the list we have } else { // Otherwise try to derive a list from textfilters - if (strpos($CFG->textfilters, 'filter/multilang')) { // Multilang is here + if (strpos($CFG->textfilters, 'filter/multilang') !== false) { // Multilang is here $stringfilters = array('filter/multilang'); // Let's use just that $CFG->stringfilters = 'filter/multilang'; // Save it for next time through + } else { + $CFG->stringfilters = ''; // Save the result and return + return $string; } } + foreach ($stringfilters as $stringfilter) { if (is_readable($CFG->dirroot .'/'. $stringfilter .'/filter.php')) { include_once($CFG->dirroot .'/'. $stringfilter .'/filter.php'); -- 2.39.5