]> granicus.if.org Git - php/commitdiff
- mnoGoSearch extension example updated to support words hilighting (gluke)
authorSergey Kartashoff <gluke@php.net>
Sun, 4 Nov 2001 08:46:55 +0000 (08:46 +0000)
committerSergey Kartashoff <gluke@php.net>
Sun, 4 Nov 2001 08:46:55 +0000 (08:46 +0000)
ext/mnogosearch/index.php

index 7d4abf6b1cae872d474e700fdfa74a16df827393..4f98ac911ea032442242e6a740681265a51765aa 100644 (file)
@@ -194,10 +194,16 @@ function ParseDocText($text){
     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;