function bail($msg) { $html = ''; if (class_exists('Router')) { $router = Router::singleton(); $html .= ' <h1 style="margin-bottom:0;">' . $router->controller . '</h1> <h3 style="margin:4px 0;">Action: ' . $router->action . '</h3> <h3 style="margin:4px 0;">Method: ' . $router->method . '</h3> <h3 style="margin:6px 0 2px 0;"><u>Params</u></h3></dt> ' . array_dump($router->params()) . ' '; } $html .= '<h2 style="margin-bottom:2px;">FATAL ERROR</h2>' . $msg . '<br>'; $trace = debug_backtrace(); $html .= '<h2 style="margin-bottom:6px;">BACKTRACE</h2>'; foreach ($trace as $t) { $html .= ' FILE: ' . $t['file'] . '<br> LINE: ' . $t['line'] . '<br> '; isset($t['class']) ? $function = $t['class'] . '->' . $t['function'] : ($function = $t['function']); $html .= 'FUNCTION: ' . $function . '<br><br>'; } echo $html; trigger_error(strip_tags($msg)); exit; }
public static function singleton() { if (!isset(self::$singleton)) { self::$singleton = new WebSeed\Router\Router(); } return self::$singleton; }
/** Main Utilities Helper functions used throughout the system. @package utility */ function bail($msg) { if (is_array($msg)) { $msg = array_dump($msg); } $html = ''; if (class_exists('Router')) { $router = Router::singleton(); $html .= ' <h1 style="margin-bottom:0;">' . $router->controller . '</h1> <h3 style="margin:4px 0;">Action: ' . $router->action . '</h3> <h3 style="margin:4px 0;">Method: ' . $router->method . '</h3> <h3 style="margin:6px 0 2px 0;"><u>Params</u></h3></dt> ' . array_dump($router->params()) . ' '; } $html .= ' <h2 style="margin-bottom:2px;">ERROR MESSAGE</h2><pre>' . $msg . '</pre><br> <h2 style="margin-bottom:6px;">BACKTRACE</h2> ' . backtrace() . ' '; echo $html; trigger_error(strip_tags($msg)); exit; }
function __construct() { session_start(); $this->router = Router::singleton(); $this->page = $this->getPageController(); if (isset($this->router->params['ajax_target_id'])) { $this->ajax_request = true; } if (isset($this->router->params['spokes'])) { $this->ajax_request = true; } if (isset($this->router->params['ajax'])) { $this->ajax_request = true; } }
private function __construct() { $this->router = Router::singleton(); }