From 3aed1f6e19d0504710f73362440e4b3817d699e8 Mon Sep 17 00:00:00 2001 From: vargenau Date: Fri, 26 Apr 2013 14:16:50 +0000 Subject: [PATCH] Remove stri_replace git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@8777 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/plugin/WikiAdminSearchReplace.php | 35 +-------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/lib/plugin/WikiAdminSearchReplace.php b/lib/plugin/WikiAdminSearchReplace.php index a06aeff66..b7addae9f 100644 --- a/lib/plugin/WikiAdminSearchReplace.php +++ b/lib/plugin/WikiAdminSearchReplace.php @@ -66,12 +66,7 @@ class WikiPlugin_WikiAdminSearchReplace 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 @@ class WikiPlugin_WikiAdminSearchReplace } } -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 -- 2.42.0