Example #1
0
 /**
  * Parses the URL.
  *
  * return void
  */
 public static function requireUri()
 {
     self::setLanguage();
     self::$requestUri = !empty($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : 'index.html';
     $actionParams = array();
     $controller = 'index';
     $action = 'index';
     $layout = 'index';
     $routingPath = strpos(self::$requestUri, 'admin') ? 'Admin' : 'Portal';
     self::$routes = (require_once 'includes/Routing/' . $routingPath . '/routing.php');
     foreach (self::$routes as $key => $value) {
         if ($value['uri'][0] == '#' && preg_match($value['uri'], self::$requestUri, $matches) > 0) {
             $controller = $value['params']['controller'];
             $action = !empty($value['params']['action']) ? $value['params']['action'] : 'index';
             $actionParams = self::getActionValidParams($matches);
             $layout = !empty($value['layout']) ? $value['layout'] : $layout;
             break;
         } elseif (strpos(self::$requestUri, $value['uri']) !== false) {
             $controller = $value['params']['controller'];
             $action = !empty($value['params']['action']) ? $value['params']['action'] : 'index';
             $layout = !empty($value['layout']) ? $value['layout'] : $layout;
             break;
         }
     }
     Site::loader($controller, $action, $actionParams, $layout);
 }