diff options
author | Urban Müller | 2010-03-22 19:37:03 +0000 |
---|---|---|
committer | Urban Müller | 2010-03-22 19:37:03 +0000 |
commit | 28218071669bf2b757c747e32b54f855068a4109 (patch) | |
tree | 53047fc9a9d939ec34b96c82108596e62a752164 /it.class | |
parent | 617517b1426c57b9505b65ea532e5fea9fc5a708 (diff) | |
download | itools-28218071669bf2b757c747e32b54f855068a4109.tar.gz itools-28218071669bf2b757c747e32b54f855068a4109.tar.bz2 itools-28218071669bf2b757c747e32b54f855068a4109.zip |
cleanup, bugfix
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 20 |
1 files changed, 11 insertions, 9 deletions
@@ -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; } |