[geeklog-cvs] geeklog: Removed stripos() workaround for PHP 4 (feature request...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sat Nov 6 08:37:23 EDT 2010
changeset 8010:c90efd17bba8
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/c90efd17bba8
user: Dirk Haun <dirk at haun-online.de>
date: Sat Nov 06 12:58:07 2010 +0100
description:
Removed stripos() workaround for PHP 4 (feature request #0001217)
diffstat:
system/classes/search.class.php | 27 ++++-----------------------
1 files changed, 4 insertions(+), 23 deletions(-)
diffs (63 lines):
diff -r bd69d81cb233 -r c90efd17bba8 system/classes/search.class.php
--- a/system/classes/search.class.php Sat Nov 06 12:56:20 2010 +0100
+++ b/system/classes/search.class.php Sat Nov 06 12:58:07 2010 +0100
@@ -2,7 +2,7 @@
/* Reminder: always indent with 4 spaces (no tabs). */
// +---------------------------------------------------------------------------+
-// | Geeklog 1.7 |
+// | Geeklog 1.8 |
// +---------------------------------------------------------------------------+
// | search.class.php |
// | |
@@ -759,7 +759,7 @@
}
$rt = '';
- $pos = $this->_stripos($text, $keyword);
+ $pos = stripos($text, $keyword);
if ($pos !== false)
{
$pos_space = strpos($text, ' ', $pos);
@@ -836,13 +836,13 @@
$num_keywords = count($keywords);
foreach ($haystack as $key => $value) {
- if ($this->_stripos($value, $keywords[0]) !== false) {
+ if (stripos($value, $keywords[0]) !== false) {
if ($num_keywords == 1) {
return $key;
} else {
$matched_all = true;
for ($i = 1; $i < $num_keywords; $i++) {
- if ($this->_stripos($haystack[$key + $i], $keywords[$i]) === false) {
+ if (stripos($haystack[$key + $i], $keywords[$i]) === false) {
$matched_all = false;
break;
}
@@ -916,25 +916,6 @@
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);
- } elseif (empty($needle)) {
- return false;
- } else {
- return strpos(strtolower($haystack), strtolower($needle));
- }
- }
}
?>
More information about the geeklog-cvs
mailing list