summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2008-03-10 22:49:39 +0100
committerAndreas Gohr <andi@splitbrain.org>2008-03-10 22:49:39 +0100
commit546d3a9994d9f365f75e55f2f22601dc4941f5d5 (patch)
treea01027133c05b3e2fb39b081c814613a35909397 /inc/html.php
parent68c26e6d2ab4feaf957863bcf5ba379036c014d3 (diff)
downloadrpg-546d3a9994d9f365f75e55f2f22601dc4941f5d5.tar.gz
rpg-546d3a9994d9f365f75e55f2f22601dc4941f5d5.tar.bz2
another change in highlight handling
Now higlighting phrases are passed as an array which then is quoted correctly when used in a regexp. This should make phrase highlighting work completely correct. Please everyone test it. darcs-hash:20080310214939-7ad00-1abefb02dde40edeead50b4fa5c866c46b95ca3a.gz
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/inc/html.php b/inc/html.php
index a0ae0110d..5811fd141 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -262,10 +262,8 @@ function html_draft(){
* @author Andreas Gohr <andi@splitbrain.org>
* @author Harry Fuecks <hfuecks@gmail.com>
*/
-function html_hilight($html,$regex){
- // strip everything that's special except pipes:
- $regex = preg_replace('![\[\]()/\\\\?\.+*]+!','',$regex);
- $regex = join('|',array_filter(array_map('trim',explode('|',$regex))));
+function html_hilight($html,$phrases){
+ $regex = join('|',array_map('preg_quote_cb',array_filter((array) $phrases)));
if ($regex === '') return $html;
$html = preg_replace_callback("/((<[^>]*)|$regex)/ui",'html_hilight_callback',$html);