From 546d3a9994d9f365f75e55f2f22601dc4941f5d5 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 10 Mar 2008 22:49:39 +0100 Subject: 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 --- inc/html.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'inc/html.php') 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 * @author Harry Fuecks */ -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); -- cgit v1.2.3