/** * Constructor * * @param $path * @param $controller_root * @param $view_root * @param $use_routes * @param $force_routes */ public function __construct($path = null, $controller_root = null, $view_root = null, $use_routes = true, $force_routes = false) { $args = parse_args(); $switches = parse_switches(); $path = $path ? $path : $args[0]; array_shift($args); $controller_root = $controller_root ? $controller_root : PATH_APP . 'shell/controller/'; $view_root = $view_root ? $view_root : PATH_APP . 'shell/view/'; parent::__construct($path, $controller_root, $view_root, $use_routes, $force_routes); $this->segments = $args; }
/** * Constructor * * @param $path * @param $controller_root * @param $view_root * @param $use_routes * @param $force_routes */ public function __construct($path=null,$controller_root=null,$view_root=null,$use_routes=true,$force_routes=false) { if ($path==null) { $path = (isset ($_SERVER['PATH_INFO'])) ? $_SERVER['PATH_INFO'] : @ getenv('PATH_INFO'); $path = rtrim(strtolower($path), '/'); } else { $query_pos = strpos($path,'?'); if ($query_pos) { $query = substr($path,$query_pos+1); $this->query = new Query($query); $path = substr($path,0,$query_pos); // remove query part for Dispatcher } } // fetch the view conf $viewconf=Config::Get('request_types'); $default_engine=$viewconf->default; // set the default extension $extension=EXT; // if request type hasn't been specified // run it through the map to see if we get a hit. $req_type=$default_engine; try { foreach($viewconf->map as $item) { switch($item->test) { case 'server': $array=&$_SERVER; break; case 'get': $array=&$_GET; break; case 'post': $array=&$_POST; break; case 'env': $array=&$_ENV; break; } if (isset($array[$item->key])) { if ($item->matches) { if (preg_match("#{$item->matches}#",$array[$item->key])) { $req_type=$item->type; break; } } else { $req_type=$item->type; break; } } } } catch (ConfigInvalidFormatException $fex) { throw $fex; } catch (ConfigException $ex) { } self::$req_type=$req_type; parent::__construct($path,$controller_root,$view_root,$use_routes,$force_routes); }
/** * Constructor * * @param $module Module to display * @param $action action to execute * @param $params Modules parameters * @return string */ function __construct($module, $action = 'index', $params = null) { parent::__construct($module, $action, $params); }