Output = $OUTPUT; $this->Request = $REQUEST; $this->Config = $CONFIG; $this->Arguments = $this->Request->getArguments(); } public function run(){ // Analyser les entrées standard if(count($this->Arguments) > 0){ // Le premier argument est le nom du script unset($this->Arguments[0]); if(count($this->Arguments) > 0){ // Identifier la Commande $this->Command = ucfirst($this->Arguments[1] . "Command"); unset($this->Arguments[1]); // Vérifier le chemin dans /Command/ et /lib/plugins/ $this->Path = $this->Config->root() . "/Command/" . $this->Command . ".php"; if(!is_file($this->Path)){ $this->Path = $this->Config->root() . "/lib/plugins/" . strtolower(str_replace('Command','',$this->Command)) . "/Command.php"; } if(is_file($this->Path)){ require_once $this->Path; if(class_exists($this->Command)){ $this->Class = new $this->Command(); if(count($this->Arguments) > 0){ $this->Action = $this->Arguments[2] . "Action"; unset($this->Arguments[2]); if(method_exists($this->Class, $this->Action)){ $this->Class->{$this->Action}(); } else { $this->Output->help("L’action " . strtolower(str_replace('Action','',$this->Action)) . " n’est pas disponible"); } } else { $this->Output->help(); } } else { $this->Output->help("Impossible d’initialiser la commande " . strtolower(str_replace('Command','',$this->Command))); } } else { $this->Output->help("La commande " . strtolower(str_replace('Command','',$this->Command)) . " n’est pas disponible"); } } else { $this->Output->help(); } } else { $this->Output->help("Erreur Interne"); } } }