public static function app_from_uri($uri) { $uri = moojon_uri::clean_uri($uri); $route_match = moojon_routes::map($uri); $data = $route_match->get_params(); foreach ($data as $key => $value) { moojon_request::set($key, $value); } $app = $data['app']; self::require_view_functions(); require_once moojon_paths::get_app_path($app); $app_class = self::get_app_class($app); return new $app_class($uri); }
public final function set_location($uri) { $uri = moojon_uri::clean_uri($uri); $route_match = moojon_routes::map($uri); $data = $route_match->get_params(); $this->app_name = $data['app']; $this->controller_name = $data['controller']; $this->action_name = $data['action']; if (self::get_app_class($this->app_name) != get_class($this)) { $location = moojon_config::get('index_file') . $uri; $this->redirect($location); } $this->set_controller(); }