/** * Initialise the router and start grabbing routes * * @return void */ function init() { include_once $this->getRoutingFile(); $uri = str_replace(PPI_Helper::getConfig()->system->base_url, '/', PPI_Helper::getFullUrl()); $route = $uri; // Loop through the route array looking for wild-cards foreach ($routes as $key => $val) { // Convert wild-cards to RegEx $key = str_replace(array(':any', ':num'), array('.+', '[0-9]+'), $key); // Does the RegEx match? if (preg_match('#^' . $key . '$#', $uri)) { // Do we have a back-reference? if (strpos($val, '$') !== false && strpos($key, '(') !== false) { $val = preg_replace('#^' . $key . '$#', $val, $uri); } $route = $val; break; } } $this->setMatchedRoute($route); }
/** * Get the full URL * * @return string */ protected function getFullUrl() { return PPI_Helper::getFullUrl(); }
/** * Obtain the list of default view variables * * @todo review making var names not HNC prefixed. * @param array $options * @return array */ function getDefaultRenderValues(array $options, $p_oConfig) { $authData = PPI_Helper::getSession()->getAuthData(); $oDispatch = PPI_Helper::getDispatcher(); $request = array('controller' => $oDispatch->getControllerName(), 'method' => $oDispatch->getMethodName()); return array('isLoggedIn' => !empty($authData), 'config' => $p_oConfig, 'request' => $request, 'input' => PPI_Helper::getInput(), 'authData' => $authData, 'baseUrl' => $p_oConfig->system->base_url, 'fullUrl' => PPI_Helper::getFullUrl(), 'currUrl' => PPI_Helper::getCurrUrl(), 'viewDir' => $options['viewDir'], 'actionFile' => $options['actionFile'], 'responseCode' => PPI_Helper::getRegistry()->get('PPI_View::httpResponseCode', 200), 'stylesheetFiles' => PPI_View_Helper::getStylesheets(), 'javascriptFiles' => PPI_View_Helper::getJavascripts(), 'authInfo' => $authData, 'aAuthInfo' => $authData, 'bIsLoggedIn' => !empty($authData), 'oConfig' => $p_oConfig); }