global $hlbeg, $hlend;
$str=$text;
- for ($i=0; $i<count($all_words); $i++) {
- $word=$all_words[$i];
- $str = preg_replace("/([\s\t\r\n\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\\\|\{\}\[\]\;\:\'\"\<\>\?\/\,\.]+)($word)/i","\\1$hlbeg\\2$hlend",$str);
- $str = preg_replace("/^($word)/i","$hlbeg\\1$hlend",$str);
+
+ if (Udm_Api_Version() < 30200) {
+ for ($i=0; $i<count($all_words); $i++) {
+ $word=$all_words[$i];
+ $str = preg_replace("/([\s\t\r\n\~\!\@\#\$\%\^\&\*\(\)\-\_\=\+\\\|\{\}\[\]\;\:\'\"\<\>\?\/\,\.]+)($word)/i","\\1$hlbeg\\2$hlend",$str);
+ $str = preg_replace("/^($word)/i","$hlbeg\\1$hlend",$str);
+ }
+ } else {
+ $str = str_replace("\2",$hlbeg,$str);
+ $str = str_replace("\3",$hlend,$str);
}
return $str;