From: <var...@us...> - 2013-04-26 14:16:53
|
Revision: 8777 http://sourceforge.net/p/phpwiki/code/8777 Author: vargenau Date: 2013-04-26 14:16:50 +0000 (Fri, 26 Apr 2013) Log Message: ----------- Remove stri_replace Modified Paths: -------------- trunk/lib/plugin/WikiAdminSearchReplace.php Modified: trunk/lib/plugin/WikiAdminSearchReplace.php =================================================================== --- trunk/lib/plugin/WikiAdminSearchReplace.php 2013-04-26 14:10:54 UTC (rev 8776) +++ trunk/lib/plugin/WikiAdminSearchReplace.php 2013-04-26 14:16:50 UTC (rev 8777) @@ -66,12 +66,7 @@ if ($case_exact) { $newtext = str_replace($from, $to, $text); } else { - //not all PHP have this enabled. use a workaround - if (function_exists('str_ireplace')) - $newtext = str_ireplace($from, $to, $text); - else { // see eof - $newtext = stri_replace($from, $to, $text); - } + $newtext = str_ireplace($from, $to, $text); } } if ($text != $newtext) { @@ -254,34 +249,6 @@ } } -function stri_replace($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; -} - // Local Variables: // mode: php // tab-width: 8 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |