/** * Class constructor * * @param array $defaults Defaults to merge for urlFor() * @param null|Horde_Route_Utils $utils Route utilities */ public function __construct($defaults = array(), $utils = null) { $this->_defaults = $defaults; if ($utils === null) { $utils = Mad_Controller_Dispatcher::getInstance()->getRouteUtils(); } $this->_utils = $utils; }
<?php require_once dirname(dirname(__FILE__)) . '/config/environment.php'; $dispatcher = Mad_Controller_Dispatcher::getInstance(); $dispatcher->dispatch();
/** * Log the http request * * @todo - get total query times * * @param Mad_Controller_Request_Http $request * @param int $totalTime */ protected function _logRequest($request, $totalTime) { $queryTime = 0; // total time to execute queries $queryCount = 0; // total queries performed $phpTime = $totalTime - $queryTime; // embed user info in log $uri = $request->getUri(); $method = $request->getMethod(); $paramStr = 'PARAMS=' . $this->_formatLogParams($request->getParameters()); $msg = sprintf("{$method} {$uri} %.4fs (DB=%.4fs [{$queryCount}] PHP=%.4fs) {$paramStr}", $totalTime, $queryTime, $phpTime); $msg = wordwrap($msg, 80, "\n\t ", 1); Mad_Controller_Dispatcher::logger()->info($msg); }
/** * Print out all defined routes in match order, with names. */ public function routes() { $dispatcher = Mad_Controller_Dispatcher::getInstance(); $mapper = $dispatcher->getRouteMapper(); $mapper->utils->printRoutes(); }
/** * Get the controller & process the request */ protected function _recognizeRoutes() { try { $this->controller = Mad_Controller_Dispatcher::getInstance()->recognize($this->request); $this->_recognized = true; } catch (Mad_Controller_Exception $e) { $this->_recognized = false; } }