$replaceword) { $text = str_replace($replaceword, ''.$replaceword.'', $text); } return "$prepend$text"; } function bat_highlight($message, $words, $color = '#ff0000') { if(!empty($words)) { $highlightarray = explode(' ', $words); $sppos = strrpos($message, chr(0).chr(0).chr(0)); if($sppos !== FALSE) { $specialextra = substr($message, $sppos + 3); $message = substr($message, 0, $sppos); } bat_highlight_callback_highlight_21($highlightarray, 1); $message = preg_replace_callback("/(^|>)([^<]+)(?=<|$)/sU", 'bat_highlight_callback_highlight_21', $message); $message = preg_replace("/(.*)<\/highlight>/siU", "\\1", $message); if($sppos !== FALSE) { $message = $message.chr(0).chr(0).chr(0).$specialextra; } } return $message; } function bat_highlight_callback_highlight_21($matches, $action = 0) { static $highlightarray = array(); if($action == 1) { $highlightarray = $matches; } else { return highlight($matches[2], $highlightarray, $matches[1]); } } ?>