/** * * @return array */ public function getRequestInvokeParams() { $request = EhrlichAndreas_Mvc_FrontController::getInstance()->getRequest(); if (is_null($request)) { $invokeParams = $this->getRequest()->getParams(); } else { $invokeParams = $request->getParams(); } unset($invokeParams['bootstrap']); unset($invokeParams['_optionsDb']); unset($invokeParams['__NAMESPACE__']); unset($invokeParams['__CONTROLLER__']); unset($invokeParams['__ACTION__']); if (get_magic_quotes_gpc()) { $invokeParams = json_decode(stripslashes(json_encode($invokeParams)), true); } return $invokeParams; }
<?php if (isset($_SERVER['REQUEST_TIME_FLOAT'])) { $microtime = $_SERVER['REQUEST_TIME_FLOAT']; } else { $microtime = microtime(true); } include_once dirname(__FILE__) . '/bootstrap.php'; $mvc = EhrlichAndreas_Mvc_FrontController::getInstance(); echo $mvc->dispatch(); echo microtime(true) - $microtime;
public function redirectToRoute($route = null, $params = array(), $options = array(), $reuseMatchedParams = false, $exit = true) { if (3 == func_num_args() && (is_bool($options) || is_scalar($options))) { $reuseMatchedParams = $options; $options = array(); } $router = EhrlichAndreas_Mvc_FrontController::getInstance()->getRouter(); if ($route === null) { $route = $router->getCurrentRoute(); } if ($reuseMatchedParams) { $routeMatchParams = $this->getRequest()->getParams(); $params = array_merge($routeMatchParams, $params); } $url = $router->assemble($params, $route); if (!preg_match('#^(https?|ftp)://#', $url)) { $request = EhrlichAndreas_Mvc_FrontController::getInstance()->getRequest(); $scheme = $request->getScheme(); $httpHost = $request->getHttpHost(); $url = $scheme . '://' . $httpHost . '/' . ltrim($url, '/'); } return $this->redirectToUrl($url, $exit); }
/** * Singleton instance * * @return EhrlichAndreas_Mvc_FrontController */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * * @param array $param * @return string */ public function widget($param) { return EhrlichAndreas_Mvc_FrontController::getInstance()->runByParameter($param); }
/** * Retrieve Front Controller * * @return EhrlichAndreas_Mvc_FrontController */ public function getFrontController() { // Used cache version if found if (null !== $this->_frontController) { return $this->_frontController; } $this->_frontController = EhrlichAndreas_Mvc_FrontController::getInstance(); return $this->_frontController; }