Пример #1
0
 /**
  * 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;
 }
Пример #2
0
<?php

require_once dirname(dirname(__FILE__)) . '/config/environment.php';
$dispatcher = Mad_Controller_Dispatcher::getInstance();
$dispatcher->dispatch();
Пример #3
0
 /**
  * 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);
 }
Пример #4
0
 /**
  * Print out all defined routes in match order, with names.
  */
 public function routes()
 {
     $dispatcher = Mad_Controller_Dispatcher::getInstance();
     $mapper = $dispatcher->getRouteMapper();
     $mapper->utils->printRoutes();
 }
Пример #5
0
 /**
  * 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;
     }
 }