Exemplo n.º 1
0
 public function __construct()
 {
     if (!auto::isCliMode()) {
         throw new exception_base('cannot run daemon with http request!', -1);
     }
     $this->_init();
 }
Exemplo n.º 2
0
 public static function topDeal404($e)
 {
     if (!auto::isDebugMode() && !auto::isCliMode()) {
         echo '404, page not found!';
     } else {
         //debugmode or in sapi mode
         var_dump($e->getMessage(), $e->getCode());
     }
 }
Exemplo n.º 3
0
 public static function topDeal($e)
 {
     if (!auto::isDebugMode() && !auto::isCliMode()) {
         //response::top404();
         echo 'error occured!';
     } else {
         //debugmode or in sapi mode
         var_dump($e->getMessage(), $e->getCode());
     }
 }
Exemplo n.º 4
0
    public static function shutdownCall()
    {
        if (self::$shutdownFunction) {
            call_user_func(self::$shutdownFunction);
            return;
        }
        if (!auto::isDebugMode()) {
            return;
        }
        //do not output debug info when ajax request
        if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
            return;
        }
        $rn = "\n";
        $hasNotRunPlugins = plugin::getHasNotRunPlugin(plugin::type_before_run);
        if ($hasNotRunPlugins) {
            $msg = array('title' => '<font color=red><b>Warning: some plugins NOT RUN(maybe "exit()" used! in your program?)</b></font>', 'msg' => var_export($hasNotRunPlugins, true));
            array_unshift(self::$_debugQueue, $msg);
        }
        $hasNotRunPlugins2 = plugin::getHasNotRunPlugin(plugin::type_after_run);
        if ($hasNotRunPlugins2) {
            $msg = array('title' => '<font color=red><b>Warning: some plugins NOT RUN(maybe "exit()" used in your program?)</b></font>', 'msg' => var_export($hasNotRunPlugins2, true));
            array_unshift(self::$_debugQueue, $msg);
        }
        //total cost
        auto::$runtimeEnd = microtime(true);
        $msg = array('title' => 'total runtime cost', 'msg' => auto::$runtimeEnd - auto::$runtimeStart);
        array_unshift(self::$_debugQueue, $msg);
        if (auto::isCliMode()) {
            $output = '
#################### debug info : ####################
(you can turn this off by "auto::setDebugMode(false)")
                ';
            foreach (self::$_debugQueue as $item) {
                $tstr = '
>>>>>>' . $item['title'] . '>>>>>> ' . $item['msg'];
                $output .= $tstr;
            }
            $output .= '
                ';
        } else {
            $output = '<style>.autophp_debug_span{width:100%;display:block;border-bottom: dashed 1px gray;margin: 3px 0 3px 0;padding:3px 0 3px 0;font-size: 14px;font-family: Arial}</style>
                <fieldset>
                <span  class="autophp_debug_span"><b>debug info : </b> (you can turn this off by "auto::setDebugMode(false)")</span>';
            foreach (self::$_debugQueue as $item) {
                $tstr = '<span class="autophp_debug_span"><font color=blue>' . $item['title'] . ': </font>' . $item['msg'] . '</span>';
                $output .= $tstr;
            }
            $output .= '</fieldset>';
        }
        echo $output;
    }