From 8af04b002d79611edbb10c0248e32b635861fda8 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 1 Mar 2005 08:42:07 +0000 Subject: [PATCH] Filter will now not link within the head tags --- mod/glossary/filter.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mod/glossary/filter.php b/mod/glossary/filter.php index 68897947a43..06edbcb0997 100644 --- a/mod/glossary/filter.php +++ b/mod/glossary/filter.php @@ -155,6 +155,17 @@ } } + //Avoid searching within the document head + $head = array(); + preg_match_all('/(.+?)<\/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 tag $excludes = array(); preg_match_all('/(.+?)<\/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); }