summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class8
1 files changed, 3 insertions, 5 deletions
diff --git a/it.class b/it.class
index 3055cb0..dd3a118 100644
--- a/it.class
+++ b/it.class
@@ -394,18 +394,16 @@ static function match($pattern, $string, $p = null)
*/
static function replace($replacements, $string, $p = array())
{
- $patterns = array();
-
- foreach (array_keys($replacements) as $pattern)
+ foreach ($replacements as $pattern => $dummy)
$patterns[] = !preg_match('/\\\\[wb]|[!\x80-\xff]|\[\[:/i', $pattern) && !$p ? "!$pattern!i" : it::convertregex($complex = $pattern, $p);
if (!$complex)
- $result = preg_replace($patterns, array_values($replacements), $string);
+ $result = preg_replace($patterns, $replacements, $string);
else
{
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'de_CH');
- $result = preg_replace($patterns, array_values($replacements), $string, isset($p['limit']) ? $p['limit'] : -1);
+ $result = preg_replace($patterns, $replacements, $string, isset($p['limit']) ? $p['limit'] : -1);
setlocale(LC_CTYPE, $oldlocale);
}