コード例 #1
0
ファイル: php_shell.php プロジェクト: phpontrax/trax
function __shell_default_error_handler($errno, $errstr, $errfile, $errline, $errctx)
{
    ## ... what is this errno again ?
    if ($errno == 2048 || $errno == 8) {
        return;
    }
    throw new Exception(sprintf("%s:%d\r\n%s", $errfile, $errline, $errstr));
}
set_error_handler("__shell_default_error_handler");
$__shell = new PHP_Shell();
$f = <<<EOF
>> use '?' to open the inline help 
EOF;
printf($f, $__shell->getVersion(), $__shell->hasReadline() ? ', with readline() support' : '');
unset($f);
print $__shell->getColour("default");
while ($__shell->input()) {
    try {
        if ($__shell->parse() == 0) {
            ## we have a full command, execute it
            if ($__shell->isAutoloadEnabled() && !function_exists('__autoload')) {
                /**
                 * default autoloader
                 *
                 * If a class doesn't exist try to load it by guessing the filename
                 * class PHP_Shell should be located in PHP/Shell.php.
                 *
                 * you can set your own autoloader by defining __autoload() before including
                 * this file
                 * 
                 * @param string $classname name of the class