From 311955b47c4bb35b1f15adf6669c58d9967e5dff Mon Sep 17 00:00:00 2001 From: dj3c1t Date: Fri, 9 May 2014 17:06:24 +0200 Subject: [PATCH] parse_cli_arguments avec fonction param dans env --- mw/app/data/modules/share/mw_data_images.php | 4 +--- mw/env/modules/mw_env_cli.php | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/mw/app/data/modules/share/mw_data_images.php b/mw/app/data/modules/share/mw_data_images.php index c540972..48ceeee 100644 --- a/mw/app/data/modules/share/mw_data_images.php +++ b/mw/app/data/modules/share/mw_data_images.php @@ -3,7 +3,7 @@ class mw_data_images extends mw_data{ function img_size($file, $max_width, $max_height){ - $img_infos = getimagesize($file); + $img_infos = @getimagesize($file); $img_size = array(); if($img_infos){ if($img_infos[0] > $max_width || $img_infos[1] > $max_height){ @@ -23,5 +23,3 @@ } } - -?> \ No newline at end of file diff --git a/mw/env/modules/mw_env_cli.php b/mw/env/modules/mw_env_cli.php index 33dd0fb..7ff6ca2 100644 --- a/mw/env/modules/mw_env_cli.php +++ b/mw/env/modules/mw_env_cli.php @@ -61,11 +61,24 @@ } } if(strlen($cmd_arg)){ + $param_name = ""; + $param_value = ""; if(($k = strpos($cmd_arg, "=")) === false){ - $this->params[$cmd_arg] = ""; + foreach($this->get_PARAMS() as $_key => $_value) if(strcmp($cmd_arg, $_value) == 0){ + $param_name = $_key; + break; + } } elseif($k != 0){ - $this->params[substr($cmd_arg, 0, $k)] = substr($cmd_arg, $k + 1); + $_cmd_arg = substr($cmd_arg, 0, $k); + foreach($this->get_PARAMS() as $_key => $_value) if(strcmp($_cmd_arg, $_value) == 0){ + $param_name = $_key; + $param_value = substr($cmd_arg, $k + 1); + break; + } + } + if($param_name){ + $this->params[$param_name] = $param_value; } } } -- 2.1.4