/** * @return object a singleton of the class */ static function getInstance() { if (is_null(self::$instance)) { $class = __CLASS__; self::$instance = new $class(); } return self::$instance; }
* @param string $errstr Error-Message * @param string $errfile Filename where the error was raised * @param interger $errline Line-Number in the File * @param mixed $errctx ... */ function __shell_default_error_handler($errno, $errstr, $errfile, $errline, $errctx) { ## ... what is this errno again ? if ($errno == 2048) { return; } throw new Exception(sprintf("%s:%d\r\n%s", $errfile, $errline, $errstr)); } set_error_handler("__shell_default_error_handler"); $__shell = new PHP_Shell(); $__shell_exts = PHP_Shell_Extensions::getInstance(); $__shell_exts->registerExtensions(array("options" => PHP_Shell_Options::getInstance(), "autoload" => new PHP_Shell_Extensions_Autoload(), "autoload_debug" => new PHP_Shell_Extensions_AutoloadDebug(), "colour" => new PHP_Shell_Extensions_Colour(), "exectime" => new PHP_Shell_Extensions_ExecutionTime(), "inlinehelp" => new PHP_Shell_Extensions_InlineHelp(), "verboseprint" => new PHP_Shell_Extensions_VerbosePrint(), "loadscript" => new PHP_Shell_Extensions_LoadScript())); $f = <<<EOF PHP-Shell - Version %s%s (c) 2006, Jan Kneschke <*****@*****.**> >> use '?' to open the inline help EOF; printf($f, $__shell->getVersion(), $__shell->hasReadline() ? ', with readline() support' : ''); unset($f); print $__shell_exts->colour->getColour("default"); while ($__shell->input()) { if ($__shell_exts->autoload->isAutoloadEnabled() && !function_exists('__autoload')) { /** * default autoloader