summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}