Fix to the highlight issue

- new line at the end of the search list would break the highlighter and
  throw a warning
  - fixed
pull/195/head
iglocska 2013-06-07 12:40:40 +02:00
parent 4ce6ec9a46
commit f2a5efc9d4
1 changed files with 5 additions and 2 deletions

View File

@ -25,9 +25,12 @@ if ($isSearch == 1) {
if ($isSearch == 1) {
// build the $replacePairs variable used to highlight the keywords
$replacementArray = array();
foreach ($keywordArray as &$keywordArrayElement) {
foreach ($keywordArray as $k => &$keywordArrayElement) {
$keywordArrayElement = trim($keywordArrayElement);
if ("" == $keywordArrayElement) continue;
if ("" == $keywordArrayElement) {
unset($keywordArray[$k]);
continue;
}
$replacementArray[] = '<span style="color:red">'.$keywordArrayElement.'</span>';
}
if (!empty($replacementArray))