diff options
author | Christian Schneider | 2009-08-17 17:37:31 +0000 |
---|---|---|
committer | Christian Schneider | 2009-08-17 17:37:31 +0000 |
commit | 685d9970cc58adc93500058215ae6c9337790a59 (patch) | |
tree | 25422d0da7047bded4342482f8de0cffdc2b9897 /it.class | |
parent | 7fc4e9df668c8c7b663c68f05ef6e96d09a3c16d (diff) | |
download | itools-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.class | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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(); |