\n"; $content .= htmlspecialchars(print_r($data, true)); $content .= "\n\n"; return $content; } public static function handle(&$result) { self::json($result); self::callback($result); self::func($result); Debug::out($result); if (self::$format == 'json') { print_r($result); } else { self::html($result); } } public static function page($method = 'current') { return Paginator::getInstance($method)->toArray(); } private static function json(&$result) { if (self::$format == 'json' || Route::input('json') == 1) { if (!$result) { $result = (object) $result; } $result = Dever::json_encode($result); self::$format = 'json'; } else { self::$format = 'str'; } } private static function callback(&$result) { if ($callback = Route::input('callback')) { $result = $callback . '(' . $result . ')'; } } private static function func(&$result) { if ($function = Route::input('function')) { $result = ''; } } public static function html($msg) { $html = '' . $msg['msg']; $host = Route::url(''); $name = '404'; if ($msg['code'] > 1) { $name = $msg['code']; } if ($name == 404) { header("HTTP/1.1 404 Not Found"); header("Status: 404 Not Found"); } $file = DEVER_APP_PATH . 'config/html/' . $name . '.html'; if (is_file($file)) { include $file; } else { $file = DEVER_PROJECT_PATH . 'config/html/' . $name . '.html'; if (is_file($file)) { include $file; } else { include DEVER_PATH . 'config/html/default.html'; } } } }