Google Hi-Lite fix

Peggy emailed me about a problem I was having on this site with the Google Hi-Lite plugin that’s included with 1.2. She did all the searching to find the fix the problem (which was posted on huddledmasses.org here ) (So all credit for finding this goes to her) Certain searches (I think ones that contain a backslash - you know how WP eats these for breakfast) ;-) will cause errors on the page.

Here’s what you need to do to fix it. Look for these lines (should be Orig lines 104, 105, 106, 107)

if (!preg_match(’/<.+>/’,$text)) {
$text = preg_replace(’/(b’.$term.’b)/i’,'<span
class=”hilite”>$1</span>’,$text);
} else {
$text = preg_replace(’/(?<=>)([^<]+)?(b’.$term.’b)/i’,'$1<span
class=”hilite”>$2</span>’,$text);

Change those lines to this:

if (!preg_match(’«<.+>«’,$text)) {
$text = preg_replace(’«(b’.$term.’b)«i’,'<span
class=”hilite”>$1</span>’,$text);
} else {
$text = preg_replace(’«(?<=>)([^<]+)?(b’.$term.’b)«i’,'$1<span
class=”hilite”>$2</span>’,$text);

Comments are closed.