summaryrefslogtreecommitdiff
path: root/ext/mnogosearch/index.php
diff options
context:
space:
mode:
authorSergey Kartashoff <gluke@php.net>2001-11-04 08:46:55 +0000
committerSergey Kartashoff <gluke@php.net>2001-11-04 08:46:55 +0000
commite475621f2c1b6e213fcf6ee554ab1a8156254808 (patch)
treec904a9f9fc05cbf3fcd3c704532aa051cfad563c /ext/mnogosearch/index.php
parent488b76b95d14f6ef5aa72c04ef886986a83d275f (diff)
downloadphp-git-e475621f2c1b6e213fcf6ee554ab1a8156254808.tar.gz
- mnoGoSearch extension example updated to support words hilighting (gluke)
Diffstat (limited to 'ext/mnogosearch/index.php')
-rw-r--r--ext/mnogosearch/index.php14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/mnogosearch/index.php b/ext/mnogosearch/index.php
index 7d4abf6b1c..4f98ac911e 100644
--- a/ext/mnogosearch/index.php
+++ b/ext/mnogosearch/index.php
@@ -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;