scripts/shells/*.php:

- use strtolower()/strtoupper() instead of low()/up() shortnames.
  This makes the code slightly longer, but easier to understand because
  strtolower()/strtoupper() are well-known function names



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1213 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 13 years ago
parent 1a4bd35e08
commit 7bcd041d45

@ -41,8 +41,8 @@ class PostfixAdminAlias extends Shell {
foreach ($commands as $cmd) {
$this->out("{$cmd}\n\n");
}
} elseif (isset($commands[low($this->args[1])])) {
$this->out($commands[low($this->args[1])] . "\n\n");
} elseif (isset($commands[strtolower($this->args[1])])) {
$this->out($commands[strtolower($this->args[1])] . "\n\n");
} else {
$this->out("Command '" . $this->args[1] . "' not found");
}

@ -53,8 +53,8 @@ class PostfixAdminDomain extends Shell {
foreach ($commands as $cmd) {
$this->out("{$cmd}\n\n");
}
} elseif (isset($commands[low($this->args[1])])) {
$this->out($commands[low($this->args[1])] . "\n\n");
} elseif (isset($commands[strtolower($this->args[1])])) {
$this->out($commands[strtolower($this->args[1])] . "\n\n");
} else {
$this->out("Command '" . $this->args[1] . "' not found");
}

@ -41,8 +41,8 @@ class PostfixAdminMailbox extends Shell {
foreach ($commands as $cmd) {
$this->out("{$cmd}\n\n");
}
} elseif (isset($commands[low($this->args[1])])) {
$this->out($commands[low($this->args[1])] . "\n\n");
} elseif (isset($commands[strtolower($this->args[1])])) {
$this->out($commands[strtolower($this->args[1])] . "\n\n");
} else {
$this->out("Command '" . $this->args[1] . "' not found");
}

@ -138,10 +138,10 @@ class Shell {
$shellKey = Inflector::underscore($this->className);
if (!PHP5 && isset($this->args[0])) {
if(strpos($this->className, low(Inflector::camelize($this->args[0]))) !== false) {
if(strpos($this->className, strtolower(Inflector::camelize($this->args[0]))) !== false) {
$dispatch->shiftArgs();
}
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
$dispatch->shiftArgs();
}
}
@ -259,7 +259,7 @@ if ( empty($this->params['q'] ) ) {
}
}
if (is_array($options)) {
while ($in == '' || ($in && (!in_array(low($in), $options) && !in_array(up($in), $options)) && !in_array($in, $options))) {
while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
$in = $this->Dispatch->getInput($prompt, $options, $default);
}
}

Loading…
Cancel
Save