[geeklog-cvs] geeklog: Need to simulate stripos on PHP 4
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Apr 20 12:48:18 EDT 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/0f4255abb760
changeset: 6982:0f4255abb760
user: Dirk Haun <dirk at haun-online.de>
date: Mon Apr 20 16:07:41 2009 +0200
description:
Need to simulate stripos on PHP 4
diffstat:
1 file changed, 18 insertions(+), 1 deletion(-)
system/classes/search.class.php | 19 ++++++++++++++++++-
diffs (36 lines):
diff -r d0bb412e546c -r 0f4255abb760 system/classes/search.class.php
--- a/system/classes/search.class.php Mon Apr 20 12:30:10 2009 +0200
+++ b/system/classes/search.class.php Mon Apr 20 16:07:41 2009 +0200
@@ -765,7 +765,7 @@
}
$rt = '';
- $pos = stripos($text, $keyword);
+ $pos = $this->_stripos($text, $keyword);
if ($pos !== false)
{
$pos_space = strpos($text, ' ', $pos);
@@ -868,6 +868,23 @@
}
return $sql;
}
+
+ /**
+ * Helper function: Simulate stripos on PHP 4
+ *
+ * @param string $haystack string to search in
+ * @param string $needle string to search for
+ * @return mixed first pos of $needle in $haystack, or false
+ *
+ */
+ function _stripos($haystack, $needle)
+ {
+ if (function_exists('stripos')) {
+ return stripos($haystack, $needle);
+ } else {
+ return strpos(strtolower($haystack), strtolower($needle));
+ }
+ }
}
?>
More information about the geeklog-cvs
mailing list