summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
authorUrban Müller2010-03-22 19:37:03 +0000
committerUrban Müller2010-03-22 19:37:03 +0000
commit28218071669bf2b757c747e32b54f855068a4109 (patch)
tree53047fc9a9d939ec34b96c82108596e62a752164 /it.class
parent617517b1426c57b9505b65ea532e5fea9fc5a708 (diff)
downloaditools-28218071669bf2b757c747e32b54f855068a4109.tar.gz
itools-28218071669bf2b757c747e32b54f855068a4109.tar.bz2
itools-28218071669bf2b757c747e32b54f855068a4109.zip
cleanup, bugfix
Diffstat (limited to 'it.class')
-rw-r--r--it.class20
1 files changed, 11 insertions, 9 deletions
diff --git a/it.class b/it.class
index ab4d87b..b1ed522 100644
--- a/it.class
+++ b/it.class
@@ -746,19 +746,21 @@ static function mail($p)
*/
static function file_get($filename, $p = array())
{
- $data = file_get_contents($filename == "-" ? "php://stdin" : $filename);
- if ($p['keyval'] && $data !== false)
+ if (($data = file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false)
{
- foreach (explode("\n", rtrim($data, "\n")) as $line)
+ if ($p['keyval'])
{
- $arr = explode("\t", $line, 2);
- $result[$arr[0]] = $arr[1];
+ foreach (explode("\n", rtrim($data, "\n")) as $line)
+ {
+ $arr = explode("\t", $line, 2);
+ $result[$arr[0]] = $arr[1];
+ }
}
+ else if ($p['lines'])
+ $result = explode("\n", rtrim($data, "\n"));
+ else
+ $result = $data;
}
- else if ($p['lines'])
- $result = $data !== false ? explode("\n", rtrim($data, "\n")) : array();
- else
- $result = $data;
return $result;
}