4 PHP-Shell - Version %s%s
5 (c) 2006, Jan Kneschke <jan@kneschke.de>
7 >> use '?' to open the inline help
12 $__shell->getVersion(),
13 $__shell->hasReadline() ? ', with readline() support' : '');
16 print $__shell_exts->colour->getColour("default");
17 while($__shell->input()) {
18 if ($__shell_exts->autoload->isAutoloadEnabled() && !function_exists('__autoload')) {
22 * If a class doesn't exist try to load it by guessing the filename
23 * class PHP_Shell should be located in PHP/Shell.php.
25 * you can set your own autoloader by defining __autoload() before including
28 * @param string $classname name of the class
31 function __autoload($classname) {
34 if ($__shell_exts->autoload_debug->isAutoloadDebug()) {
35 print str_repeat(".", $__shell_exts->autoload_debug->incAutoloadDepth())." -> autoloading $classname".PHP_EOL;
37 include_once str_replace('_', '/', $classname).'.php';
38 if ($__shell_exts->autoload_debug->isAutoloadDebug()) {
39 print str_repeat(".", $__shell_exts->autoload_debug->decAutoloadDepth())." <- autoloading $classname".PHP_EOL;
45 $__shell_exts->exectime->startParseTime();
46 if ($__shell->parse() == 0) {
47 ## we have a full command, execute it
49 $__shell_exts->exectime->startExecTime();
51 $__shell_retval = eval($__shell->getCode());
52 if (isset($__shell_retval)) {
53 print $__shell_exts->colour->getColour("value");
55 if (function_exists("__shell_print_var")) {
56 __shell_print_var($__shell,$__shell_retval, $__shell_exts->verboseprint->isVerbose());
58 var_export($__shell_retval);
61 ## cleanup the variable namespace
62 unset($__shell_retval);
63 $__shell->resetCode();
65 } catch(Exception $__shell_exception) {
66 print $__shell_exts->colour->getColour("exception");
67 printf('%s (code: %d) got thrown'.PHP_EOL, get_class($__shell_exception), $__shell_exception->getCode());
68 print $__shell_exception;
70 $__shell->resetCode();
72 ## cleanup the variable namespace
73 unset($__shell_exception);
75 print $__shell_exts->colour->getColour("default");
76 $__shell_exts->exectime->stopTime();
77 if ($__shell_exts->exectime->isShow()) {
78 printf(" (parse: %.4fs, exec: %.4fs)",
79 $__shell_exts->exectime->getParseTime(),
80 $__shell_exts->exectime->getExecTime()
85 print $__shell_exts->colour->getColour("reset");