private function build_debug() { global $debug, $debug_log; $tqueries = 0; // First, we output the top $debugout = ' <section id="debug"> <h1>Debug output</h1> <table> <thead> <tr> <th style="width:80px;">Type</th> <th>Description</th> </tr> </thead> <tbody> '; // Output each of the log stuff foreach ($debug_log as $log) { switch ($log['type']) { case 'query': $tqueries++; $debugout .= '<tr><td>Query #' . $tqueries . '</td><td>' . $log['text'] . '</td>'; break; default: $debugout .= '<tr><td>Unknown</td><td>' . $log['text'] . '</td>'; break; } } // How long'd it take to generate this page? global $starttime; $mtime = explode(' ', microtime()); $totaltime = sprintf('%.5f', $mtime[0] + $mtime[1] - $starttime); // And now output the bottom, along with the generation time $debugout .= ' </tbody> </table> <p> This page was generated by <del>unicorn powers</del> spray ' . sp_get_version() . ' in ' . $totaltime . ' seconds </p> </section> '; return "\n" . $debugout . "\n"; }
<dl> <dt> <label for="pwd">Password</label> </dt> <dd> <input type="password" id="pwd" name="pwd" tabindex="2" /> </dd> </dl> <div id="remember-wrap"> <input type="checkbox" name="remember" id="remember" tabindex="3" /> <label for="remember">Remember me</label> </div> <input type="submit" id="submit" name="submit" value="Login" tabindex="4" /> <div style="clear: both;"></div> </form> <footer> <div id="powered">powered by <a href="http://github.com/a2h/bugspray">spray</a> <?php echo sp_get_version(); ?> </div> <div id="by">a project by <a href="http://a2h.uni.cc/">a2h</a></div> </footer> </div> </body> </html> <?php }
/** * @version 0.3 * @since 0.3 */ function sp_die($message, $title = 'Error!') { // Disable templating if it's already loaded global $page; if (isset($page)) { $page->theme_disable(true); } // And now for the content... ob_start(); ?> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title><?php echo $title; ?> </title> <link rel="stylesheet" type="text/css" href="sp-includes/_spray.css" /> </head> <div id="container"> <h1 id="heading"><?php echo $title; ?> </h1> <div id="main"> <?php echo $message; ?> </div> <footer> <div id="powered">powered by <a href="http://github.com/a2h/bugspray">spray</a> <?php echo sp_get_version(); ?> </div> <div id="by">a project by <a href="http://a2h.uni.cc/">a2h</a></div> </footer> </div> <?php // Strip out all the tabs and all $out = ob_get_clean(); $out = str_replace("\t", '', $out); // And now to output it! die($out); }