From: <var...@us...> - 2014-09-19 12:42:08
|
Revision: 9097 http://sourceforge.net/p/phpwiki/code/9097 Author: vargenau Date: 2014-09-19 12:42:04 +0000 (Fri, 19 Sep 2014) Log Message: ----------- str_ireplace exists in PHP 5 Modified Paths: -------------- trunk/lib/config.php Modified: trunk/lib/config.php =================================================================== --- trunk/lib/config.php 2014-09-19 10:09:57 UTC (rev 9096) +++ trunk/lib/config.php 2014-09-19 12:42:04 UTC (rev 9097) @@ -315,38 +315,6 @@ return preg_match("%^${requri}[^/]*$%", $GLOBALS['HTTP_SERVER_VARS']['SCRIPT_NAME']); } -// needed < php5 -// by bradhuizenga at softhome dot net from the php docs -if (!function_exists('str_ireplace')) { - function str_ireplace($find, $replace, $string) - { - if (!is_array($find)) $find = array($find); - if (!is_array($replace)) { - if (!is_array($find)) - $replace = array($replace); - else { - // this will duplicate the string into an array the size of $find - $c = count($find); - $rString = $replace; - unset($replace); - for ($i = 0; $i < $c; $i++) { - $replace[$i] = $rString; - } - } - } - foreach ($find as $fKey => $fItem) { - $between = explode(strtolower($fItem), strtolower($string)); - $pos = 0; - foreach ($between as $bKey => $bItem) { - $between[$bKey] = substr($string, $pos, strlen($bItem)); - $pos += strlen($bItem) + strlen($fItem); - } - $string = implode($replace[$fKey], $between); - } - return ($string); - } -} - // htmlspecialchars_decode exists for PHP >= 5.1 if (!function_exists('htmlspecialchars_decode')) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |