PHP Classes
elePHPant
Icontem

File: commands/help.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andoitz Jordan Marmolejo  >  PHP Query Terminal  >  commands/help.php  >  Download  
File: commands/help.php
Role: Example script
Content type: text/plain
Description: Class example for command
Class: PHP Query Terminal
Run command classes from an interactive console
Author: By
Last change:
Date: 1 year ago
Size: 1,205 bytes
 

Contents

Class file image Download
<?php
class help extends Command{
    public function
__construct(){
       
parent::__construct();
    }
    public function
init($params){
       
$result = "\n[[;#F00;<BACKGROUND>]Estas órdenes del shell están definidas internamente. Teclee 'help nombre' para saber más sobre la función 'nombre']\n";
        if(isset(
$params[1])){
           
//AYUDA EXTENDIDA DE UN COMANDO
           
$pError = $this->syntaxError($params,1);
            if(!
$pError) $result .= $this->moreHelp($params[1]);
            else
$result = $pError;
        }
        else{
           
$dir = opendir("commands");
           
           
$result .= "\n [[ib;#FFF;<BACKGROUND>]help ->] ".$this::$info;
            while(
$file = readdir($dir)){
                if(!
is_dir($file) && $file != 'help.php'){
                    include(
$file);
                   
$file = rtrim($file,'.php');
                   
$result .= "\n [[ib;#FFF;<BACKGROUND>]".$file." ->] ".$file::$info;
                }
            }
        }
       
$this->data = $result."\n";
    }
    public function
moreHelp($command){
       
$result = "";
        if(
file_exists($this->folder.$command.".php")){
            include(
$this->folder.$command.".php");
           
$result .= "\n [[ib;#FFF;<BACKGROUND>]".$command." ->] ".command::help();
        }
        else{
           
$result .= "\n [[ib;#FFF;<BACKGROUND>]".$command." ->] El comando introducido no existe";
        }
        return
$result;
    }
}
?>