From 4340602f5f3fbcd6874b7cba101ed0fea1feb55a Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Thu, 3 Mar 2011 18:56:42 +0000 Subject: allow multiple or no (=stdin) fn --- it_pipe.class | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'it_pipe.class') diff --git a/it_pipe.class b/it_pipe.class index 838fa39..3bfcfff 100644 --- a/it_pipe.class +++ b/it_pipe.class @@ -13,8 +13,11 @@ function __construct($p = array()) { if ($p['data']) $this->lines = $p['data']; + else if ($p['cmd']) + $this->lines = explode("\n", rtrim(it::exec($p['cmd'], $p['args']))); else - $this->lines = isset($p['fn']) ? file($p['fn'], FILE_IGNORE_NEW_LINES) : explode("\n", rtrim(it::exec($p['cmd'], $p['args']))); + foreach ((array)($p['fn'] ? $p['fn'] : "php://stdin") as $fn) + $this->lines = array_merge((array)$this->lines, file($fn, FILE_IGNORE_NEW_LINES)); } /** -- cgit v1.2.3