1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-08 16:45:19 +02:00

- Replaced the old 2.0.x highlight code with much nicer code :-)

git-svn-id: file:///svn/phpbb/trunk@5381 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M 2005-12-27 13:59:15 +00:00
parent eb45360c02
commit 5bf738d345
2 changed files with 2 additions and 6 deletions

View File

@ -528,9 +528,7 @@ if ($keywords || $author || $search_id || $search_session_id)
if ($hilit) if ($hilit)
{ {
// This was shamelessly 'borrowed' from volker at multiartstudio dot de $row['post_text'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">\1</span>', $row['post_text']);
// via php.net's annotated manual
$row['post_text'] = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . str_replace('\\', '\\\\', $hilit) . ")\b#i', '<span class=\"posthilit\">\\\\1</span>', '\\0')", '>' . $row['post_text'] . '<'), 1, -1));
} }
$row['post_text'] = smiley_text($row['post_text']); $row['post_text'] = smiley_text($row['post_text']);

View File

@ -1171,9 +1171,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
// Highlight active words (primarily for search) // Highlight active words (primarily for search)
if ($highlight_match) if ($highlight_match)
{ {
// This was shamelessly 'borrowed' from volker at multiartstudio dot de $message = preg_replace('#(?!<.*)(?<!\w)(' . $highlight_match . ')(?!\w|[^<>]*>)#i', '<span class="posthilit">\1</span>', $message);
// via php.net's annotated manual
$message = str_replace('\"', '"', substr(preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "preg_replace('#\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\b#i', '<span class=\"posthilit\">\\\\1</span>', '\\0')", '>' . $message . '<'), 1, -1));
} }
if ($row['enable_html'] && $auth->acl_get('f_html', $forum_id)) if ($row['enable_html'] && $auth->acl_get('f_html', $forum_id))