summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorChristian Schneider2009-08-17 17:37:31 +0000
committerChristian Schneider2009-08-17 17:37:31 +0000
commit685d9970cc58adc93500058215ae6c9337790a59 (patch)
tree25422d0da7047bded4342482f8de0cffdc2b9897 /it.class
parent7fc4e9df668c8c7b663c68f05ef6e96d09a3c16d (diff)
downloaditools-685d9970cc58adc93500058215ae6c9337790a59.tar.gz
itools-685d9970cc58adc93500058215ae6c9337790a59.tar.bz2
itools-685d9970cc58adc93500058215ae6c9337790a59.zip
Replace all {params} in one go to avoid double replacements
Diffstat (limited to 'it.class')
-rw-r--r--it.class7
1 files changed, 5 insertions, 2 deletions
diff --git a/it.class b/it.class
index 32b6a13..9d43983 100644
--- a/it.class
+++ b/it.class
@@ -425,8 +425,9 @@ function exec(/* $cmd, $values1 = array(), ... */)
#for escapeshellarg in it::_exec_quotevalue
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'de_CH');
- while (list($tag, $option, $key) = it::match('({(-?)(\w+)})', $cmd))
+ foreach (it::match('({(-?)([a-z]\w*)})', $cmd, array('all' => true)) as $tags)
{
+ list($tag, $option, $key) = $tags;
$parts = array();
if ($option)
@@ -445,8 +446,10 @@ function exec(/* $cmd, $values1 = array(), ... */)
$parts[] = it::_exec_quotevalue($value);
}
- $cmd = str_replace($tag, join(" ", $parts), $cmd);
+ $replacements[$tag] = join(" ", $parts);
}
+
+ $cmd = strtr($cmd, (array)$replacements); # Use strtr behaviour of going through source string once
setlocale(LC_CTYPE, $oldlocale);
$s = gettimeofday();