mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
MDL-15823 format_string() improvements; merged from MOODLE_19_STABLE
This commit is contained in:
parent
ad434752aa
commit
408d53277f
1 changed files with 6 additions and 3 deletions
|
@ -1609,9 +1609,12 @@ function format_string ($string, $striplinks=true, $courseid=NULL ) {
|
||||||
if (!empty($CFG->formatstringstriptags)) {
|
if (!empty($CFG->formatstringstriptags)) {
|
||||||
$string = strip_tags($string);
|
$string = strip_tags($string);
|
||||||
|
|
||||||
// Otherwise strip just links if that is required (default)
|
} else {
|
||||||
} else if ($striplinks) { //strip links in string
|
// Otherwise strip just links if that is required (default)
|
||||||
$string = preg_replace('/(<a[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
|
if ($striplinks) { //strip links in string
|
||||||
|
$string = preg_replace('/(<a\s[^>]+?>)(.+?)(<\/a>)/is','$2',$string);
|
||||||
|
}
|
||||||
|
$string = clean_text($string);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Store to cache
|
//Store to cache
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue