diff options
author | Oliver Schramm <oliver.schramm97@gmail.com> | 2014-04-14 19:22:14 +0200 |
---|---|---|
committer | Oliver Schramm <oliver.schramm97@gmail.com> | 2014-04-15 20:43:16 +0200 |
commit | f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d (patch) | |
tree | 5fb67fff2c76bcf58ad1c8abb0c679507c88d034 | |
parent | 601ecd3da132c376be2119ef7bc7126f219859f3 (diff) | |
download | forums-f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d.tar forums-f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d.tar.gz forums-f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d.tar.bz2 forums-f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d.tar.xz forums-f3cd7f73e1ed3acbf1a319331e2f99ea27d5fe2d.zip |
[ticket/10423] Replace foreach with function in viewtopic.php
PHPBB3-10423
-rw-r--r-- | phpBB/viewtopic.php | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 31bc1d2701..f52e04e1a8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -471,18 +471,11 @@ else $highlight_match = $highlight = ''; if ($hilit_words) { - foreach (explode(' ', trim($hilit_words)) as $word) - { - if (trim($word)) - { - $word = phpbb_clean_search_string($word); - $word = str_replace('\*', '\w+?', preg_quote($word, '#')); - $word = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $word); - $highlight_match .= (($highlight_match != '' && $word != '') ? '|' : '') . $word; - } - } - - $highlight = urlencode($hilit_words); + $highlight_match = phpbb_clean_search_string($hilit_words); + $highlight = urlencode($highlight_match); + $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); + $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); + $highlight_match = str_replace(' ', '|', $highlight_match); } // Make sure $start is set to the last page if it exceeds the amount |