cvs: php4 /ext/mnogosearch index.php
| From: | Sergey Kartashoff | Date: | Sun, 04 Nov 2001 08:46:54 +0000 |
| Subject: | cvs: php4 /ext/mnogosearch index.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-8075@lists.php.net to get a copy of this message | ||
gluke Sun Nov 4 03:46:54 2001 EDT
Modified files:
/php4/ext/mnogosearch index.php
Log:
- mnoGoSearch extension example updated to support words hilighting (gluke)
Index: php4/ext/mnogosearch/index.php
diff -u php4/ext/mnogosearch/index.php:1.4 php4/ext/mnogosearch/index.php:1.5
--- php4/ext/mnogosearch/index.php:1.4 Sat Nov 3 17:37:49 2001
+++ php4/ext/mnogosearch/index.php Sun Nov 4 03:46:54 2001
@@ -1,6 +1,6 @@
<!--
$Source: /usr/repository/php4/ext/mnogosearch/index.php,v $
- $Id: index.php,v 1.4 2001/11/03 22:37:49 gluke Exp $
+ $Id: index.php,v 1.5 2001/11/04 08:46:54 gluke Exp $
-->
<?
@@ -194,10 +194,16 @@
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;