mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Filter will now not link within the head tags
This commit is contained in:
parent
7369657c9b
commit
8af04b002d
@ -155,6 +155,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
//Avoid searching within the document head
|
||||
$head = array();
|
||||
preg_match_all('/<head>(.+?)<\/head>/is',$text,$list_of_heads);
|
||||
foreach (array_unique($list_of_heads[0]) as $key=>$value) {
|
||||
$head['<~'.$key.'~>'] = $value;
|
||||
}
|
||||
if (!empty($head)) {
|
||||
$text = str_replace($head,array_keys($head),$text);
|
||||
}
|
||||
|
||||
|
||||
//Now avoid searching inside the <nolink>tag
|
||||
$excludes = array();
|
||||
preg_match_all('/<nolink>(.+?)<\/nolink>/is',$text,$list_of_excludes);
|
||||
@ -217,6 +228,9 @@
|
||||
if (!empty( $excludes)) {
|
||||
$text = str_replace(array_keys($excludes),$excludes,$text);
|
||||
}
|
||||
if (!empty( $head)) {
|
||||
$text = str_replace(array_keys($head),$head,$text);
|
||||
}
|
||||
if ($fullmatch and !empty($words)) {
|
||||
$text = str_replace(array_keys($words),$words,$text);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user