From: Alexander Ebert Date: Sat, 20 Aug 2016 10:44:34 +0000 (+0200) Subject: Minor improvement X-Git-Tag: 3.0.0_Beta_1~639 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3a1938d87915885f6af0121bb81f82ff76746d6e;p=GitHub%2FWoltLab%2FWCF.git Minor improvement --- diff --git a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php index 4379be102d..4a55f39bc9 100644 --- a/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php +++ b/wcfsetup/install/files/lib/system/html/output/node/HtmlOutputNodeProcessor.class.php @@ -182,13 +182,15 @@ class HtmlOutputNodeProcessor extends AbstractHtmlNodeProcessor { } foreach ($nodes as $node) { $split = preg_split('+'.$keywordPattern.'+', $node->textContent, -1, PREG_SPLIT_DELIM_CAPTURE); - if (count($split) == 1) return; + $count = count($split); + if ($count == 1) return; - for ($i = 0; $i < count($split); $i++) { + for ($i = 0; $i < $count; $i++) { if ($i % 2 == 0) { // text $node->parentNode->insertBefore($node->ownerDocument->createTextNode($split[$i]), $node); } else { // match + /** @var \DOMElement $element */ $element = $node->ownerDocument->createElement('span'); $element->setAttribute('class', 'highlight'); $element->appendChild($node->ownerDocument->createTextNode($split[$i]));