From b96596e310f107f4ae9b94fffef4859594c10640 Mon Sep 17 00:00:00 2001 From: CaMer0n <cameron@e107coders.org> Date: Tue, 22 Jan 2008 02:06:35 +0000 Subject: [PATCH] Removed blank lines and added ?> --- e107_handlers/cli_class.php | 183 ++++++++++++++++++------------------ 1 file changed, 92 insertions(+), 91 deletions(-) diff --git a/e107_handlers/cli_class.php b/e107_handlers/cli_class.php index d44cabeb4..b773ea7dd 100644 --- a/e107_handlers/cli_class.php +++ b/e107_handlers/cli_class.php @@ -1,91 +1,92 @@ -<?php -/* -+ ----------------------------------------------------------------------------+ -| e107 website system -| -| �Steve Dunstan 2001-2002 -| http://e107.org -| jalist@e107.org -| -| Released under the terms and conditions of the -| GNU General Public License (http://gnu.org). -| -| $Source: /cvs_backup/e107_0.8/e107_handlers/cli_class.php,v $ -| $Revision: 1.1 $ -| $Date: 2008-01-21 13:25:42 $ -| $Author: mcfly_e107 $ -+----------------------------------------------------------------------------+ -*/ - -class eCLI -{ - /** - * Provided a list of command line arguments, parse them in a unix manner. - * If no args are provided, will default to $_SERVER['argv'] - * - * @return array arg values - */ - - function parse_args($argv='') - { - if($argv == '') - { - if(isset($_SERVER['argv'])) - { - $argv = $_SERVER['argv']; - } - else - { - return array(); - } - } - if(!is_array($argv)) - { - return array(); - } - $_ARG = array(); - foreach ($argv as $arg) - { - if (preg_match('#^-{1,2}([a-zA-Z0-9]*)=?(.*)$#', $arg, $matches)) - { - $key = $matches[1]; - switch ($matches[2]) - { - case '': - case 'true': - $arg = true; - break; - case 'false': - $arg = false; - break; - default: - $arg = $matches[2]; - } - - /* make unix like -afd == -a -f -d */ - if(preg_match("/^-([a-zA-Z0-9]+)/", $matches[0], $match)) - { - $string = $match[1]; - for($i=0; strlen($string) > $i; $i++) - { - $_ARG[$string[$i]] = true; - } - } - else - { - /* --arg=val will assign $_ARG['arg'] to 'val' */ - /* --arg (or --arg=true) will assign $_ARG['arg'] to true */ - /* --arg=false will assign $_ARG['arg'] to false */ - $_ARG[$key] = $arg; - } - } - else - { - /* assume command input parm, add each to input array */ - $_ARG['input'][] = $arg; - } - } - return $_ARG; - } - -} +<?php +/* ++ ----------------------------------------------------------------------------+ +| e107 website system +| +| �Steve Dunstan 2001-2002 +| http://e107.org +| jalist@e107.org +| +| Released under the terms and conditions of the +| GNU General Public License (http://gnu.org). +| +| $Source: /cvs_backup/e107_0.8/e107_handlers/cli_class.php,v $ +| $Revision: 1.2 $ +| $Date: 2008-01-22 02:06:35 $ +| $Author: e107coders $ ++----------------------------------------------------------------------------+ +*/ + +class eCLI +{ + /** + * Provided a list of command line arguments, parse them in a unix manner. + * If no args are provided, will default to $_SERVER['argv'] + * + * @return array arg values + */ + + function parse_args($argv='') + { + if($argv == '') + { + if(isset($_SERVER['argv'])) + { + $argv = $_SERVER['argv']; + } + else + { + return array(); + } + } + if(!is_array($argv)) + { + return array(); + } + $_ARG = array(); + foreach ($argv as $arg) + { + if (preg_match('#^-{1,2}([a-zA-Z0-9]*)=?(.*)$#', $arg, $matches)) + { + $key = $matches[1]; + switch ($matches[2]) + { + case '': + case 'true': + $arg = true; + break; + case 'false': + $arg = false; + break; + default: + $arg = $matches[2]; + } + + /* make unix like -afd == -a -f -d */ + if(preg_match("/^-([a-zA-Z0-9]+)/", $matches[0], $match)) + { + $string = $match[1]; + for($i=0; strlen($string) > $i; $i++) + { + $_ARG[$string[$i]] = true; + } + } + else + { + /* --arg=val will assign $_ARG['arg'] to 'val' */ + /* --arg (or --arg=true) will assign $_ARG['arg'] to true */ + /* --arg=false will assign $_ARG['arg'] to false */ + $_ARG[$key] = $arg; + } + } + else + { + /* assume command input parm, add each to input array */ + $_ARG['input'][] = $arg; + } + } + return $_ARG; + } + +} +?> \ No newline at end of file