summaryrefslogtreecommitdiff
path: root/program/include/clisetup.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-08-12 11:47:45 +0200
committerAleksander Machniak <alec@alec.pl>2012-08-12 11:47:45 +0200
commit413df054ad3235c59c24e897b616c569adc4f67b (patch)
treeb556cc29c8e9d4adf608c349bba53d3d21c51908 /program/include/clisetup.php
parenta7b32b61e685d32f8f101a854b6a3ba38d329677 (diff)
CS fixes (mostly tab -> spaces)
Diffstat (limited to 'program/include/clisetup.php')
-rw-r--r--program/include/clisetup.php49
1 files changed, 26 insertions, 23 deletions
diff --git a/program/include/clisetup.php b/program/include/clisetup.php
index 039020bdc..a9af90a6f 100644
--- a/program/include/clisetup.php
+++ b/program/include/clisetup.php
@@ -33,33 +33,36 @@ require_once INSTALL_PATH . 'program/include/iniset.php';
*/
function get_opt($aliases = array())
{
- $args = array();
- for ($i=1; $i < count($_SERVER['argv']); $i++) {
- $arg = $_SERVER['argv'][$i];
- $value = true;
- $key = null;
+ $args = array();
- if ($arg[0] == '-') {
- $key = preg_replace('/^-+/', '', $arg);
- $sp = strpos($arg, '=');
- if ($sp > 0) {
- $key = substr($key, 0, $sp - 2);
- $value = substr($arg, $sp+1);
- }
- else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
- $value = $_SERVER['argv'][++$i];
- }
+ for ($i=1; $i < count($_SERVER['argv']); $i++) {
+ $arg = $_SERVER['argv'][$i];
+ $value = true;
+ $key = null;
- $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value;
- }
- else
- $args[] = $arg;
+ if ($arg[0] == '-') {
+ $key = preg_replace('/^-+/', '', $arg);
+ $sp = strpos($arg, '=');
+ if ($sp > 0) {
+ $key = substr($key, 0, $sp - 2);
+ $value = substr($arg, $sp+1);
+ }
+ else if (strlen($_SERVER['argv'][$i+1]) && $_SERVER['argv'][$i+1][0] != '-') {
+ $value = $_SERVER['argv'][++$i];
+ }
- if ($alias = $aliases[$key])
- $args[$alias] = $args[$key];
- }
+ $args[$key] = is_string($value) ? preg_replace(array('/^["\']/', '/["\']$/'), '', $value) : $value;
+ }
+ else {
+ $args[] = $arg;
+ }
- return $args;
+ if ($alias = $aliases[$key]) {
+ $args[$alias] = $args[$key];
+ }
+ }
+
+ return $args;
}