public function highlightArrayOfWordsInContent($wordArray, $content)
    {
        if (is_array($wordArray) && count($wordArray)) {
            $highlightedWord = (!empty($this->conf['highlightedWord_stdWrap'])) ?
                $this->cObj->stdWrap('\0', $this->conf['highlightedWord_stdWrap']) :
                '<span class="hit">\0</span>';

            foreach ($wordArray as $word) {
                $word = preg_quote($word, '/');
                $word = htmlspecialchars($word);
                // Todo: Highlight hits within words when using ke_seaarch_premium
                // Todo: option "in word search" by removing the \b parameter
                //$content = preg_replace('/(' . $word . ')/iu', $highlightedWord, $content);
                $content = preg_replace('/\b(' . $word . ')/iu', $highlightedWord, $content);
            }
        }
        return $content;
    }
public function highlightArrayOfWordsInContent($wordArray, $content)
    {
        if (is_array($wordArray) && count($wordArray)) {
            $highlightedWord = (!empty($this->conf['highlightedWord_stdWrap'])) ?
                $this->cObj->stdWrap('\0', $this->conf['highlightedWord_stdWrap']) :
                '<span class="hit">\0</span>';

            foreach ($wordArray as $word) {
                $word = preg_quote($word, '/');
                $word = htmlspecialchars($word);
                // Todo: Highlight hits within words when using ke_seaarch_premium
                // Todo: option "in word search" by removing the \b parameter
                //$content = preg_replace('/(' . $word . ')/iu', $highlightedWord, $content);
                $content = preg_replace('/\b(' . $word . ')/iu', $highlightedWord, $content);
            }
        }
        return $content;
    }
public function highlightArrayOfWordsInContent ( $ wordArray , $ content ) { if ( is_array ( $ wordArray ) && count ( $ wordArray ) ) { $ highlightedWord = ( ! empty ( $ this -> conf [ 'highlightedWord_stdWrap' ] ) ) ? $ this -> cObj -> stdWrap ( '\0' , $ this -> conf [ 'highlightedWord_stdWrap' ] ) : '<span class="hit">\0</span>' ; foreach ( $ wordArray as $ word ) { $ word = preg_quote ( $ word , '/' ) ; $ word = htmlspecialchars ( $ word ) ; // Todo: Highlight hits within words when using ke_seaarch_premium // Todo: option "in word search" by removing the \b parameter //$content = preg_replace('/(' . $word . ')/iu', $highlightedWord, $content); $ content = preg_replace ( '/\b(' . $ word . ')/iu' , $ highlightedWord , $ content ) ; } } return $ content ; }
Find and highlight the searchwords

@param array $wordArray
@param string $content
@return string The content with highlighted searchwords
Find and highlight the searchwords