summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2012-11-29 14:18:19 +0000
committerUrban Müller2012-11-29 14:18:19 +0000
commitecea76684314768e352deffbe9ffadd679cbcba7 (patch)
treeaa900a5e87476dcd0d5792bbeb0d696d352195c7 /it.class
parent28d622fd07ed7d962f6827a3e07219e0bde7925e (diff)
downloaditools-ecea76684314768e352deffbe9ffadd679cbcba7.tar.gz
itools-ecea76684314768e352deffbe9ffadd679cbcba7.tar.bz2
itools-ecea76684314768e352deffbe9ffadd679cbcba7.zip
positional args in it::exec
Diffstat (limited to 'it.class')
-rw-r--r--it.class11
1 files changed, 6 insertions, 5 deletions
diff --git a/it.class b/it.class
index 1104894..9463d41 100644
--- a/it.class
+++ b/it.class
@@ -482,9 +482,10 @@ static function filter_keys($array, $keys, $p = array())
/**
* Construct shell command using it::shell_command, log it, execute it and return output as string.
- * Keywords {keyword} are replace a la ET(), {-opts} takes an array and
- * inserts options a la it_html attributes (value, true, false or null)
- * @param $cmd Format string with {keywords} replace a la ET()
+ * {keyword} quotes and inserts value from assoc array like ET()
+ * {0} .. {n} quotes and inserts positional arguments
+ * {-opts} takes an array and inserts options a la it_html attributes (value, true, false or null)
+ * @param $cmd Format string with {keywords} a la ET()
* @param $values (zero, one or more arrays can be passed)
* @return output of command. shell errors not detectable, see error_log in /www/server/logs
*/
@@ -517,12 +518,12 @@ static function shell_command(/* $cmd, $values1 = array(), ... */)
# Merge values into one array
foreach ($args as $arg)
- $values += (array)$arg;
+ $values = array_merge($values, (array)$arg);
#for escapeshellarg in it::_exec_quotevalue
$oldlocale = setlocale(LC_CTYPE, 0);
setlocale(LC_CTYPE, 'de_CH');
- foreach (it::match('({(-?)([a-z]\w*)})', $cmd, array('all' => true)) as $tags)
+ foreach (it::match('({(-?)([a-z0-9]\w*)})', $cmd, array('all' => true)) as $tags)
{
list($tag, $option, $key) = $tags;
$parts = array();