mvc/Router.php
/**
     * Parse URL information and run related action
     * also run related bootstrap if exists.
     * @param origin\mvc\Controller $controller
     * @param string $allow_types
     * @param callable $callback_404
     */
Parse URL information and run related action
also run related bootstrap if exists.
Parse URL information and run related action also run related bootstrap if exists .
public function routeToAction(Controller $controller, $allow_types = FALSE, $callback_404 = FALSE, $action_finder = FALSE) {
        $asi = $this->getActionScriptInfo($allow_types, $action_finder);
        if (empty($asi) || $asi->bootstrap_class_name == $asi->action_class_name) {
            if (is_callable($callback_404)) {
                call_user_func($callback_404);
            } else {
                header("HTTP/1.1 404 Not Found");
                header("Status: 404 Not Found");
            }
            exit();
        }
        $this->_routing_info = $asi;
        $controller->getView()->setViewPath($asi->action_url);
        if (is_file($asi->bootstrap_script_path)) {
            $bootstrap = new $asi->bootstrap_class_name();
            $bootstrap->run();
        }
        $action = new $asi->action_class_name();
        $action->setController($controller);
        $asi->action_instance = $action;
        if (method_exists($action, 'onActionCreated')) {
            $action->onActionCreated($asi);
        }
        if (method_exists($action, 'index')) {
            $action->index($asi->action_args);
        }
        if (method_exists($action, 'onActionComplete')) {
            $action->onActionComplete();
        }
        if ($this->_is_render_view) {
            $this->renderView($action, $asi->action_class_name);
        }
    }
public function routeToAction ( Controller $ controller , $ allow_types = FALSE , $ callback_404 = FALSE , $ action_finder = FALSE ) { $ asi = $ this -> getActionScriptInfo ( $ allow_types , $ action_finder ) ; if ( empty ( $ asi ) || $ asi -> bootstrap_class_name == $ asi -> action_class_name ) { if ( is_callable ( $ callback_404 ) ) { call_user_func ( $ callback_404 ) ; } else { header ( " HTTP/1.1 404 Not Found " ) ; header ( " Status: 404 Not Found " ) ; } exit ( ) ; } $ this -> _routing_info = $ asi ; $ controller -> getView ( ) -> setViewPath ( $ asi -> action_url ) ; if ( is_file ( $ asi -> bootstrap_script_path ) ) { $ bootstrap = new $ asi -> bootstrap_class_name ( ) ; $ bootstrap -> run ( ) ; } $ action = new $ asi -> action_class_name ( ) ; $ action -> setController ( $ controller ) ; $ asi -> action_instance = $ action ; if ( method_exists ( $ action , 'onActionCreated' ) ) { $ action -> onActionCreated ( $ asi ) ; } if ( method_exists ( $ action , 'index' ) ) { $ action -> index ( $ asi -> action_args ) ; } if ( method_exists ( $ action , 'onActionComplete' ) ) { $ action -> onActionComplete ( ) ; } if ( $ this -> _is_render_view ) { $ this -> renderView ( $ action , $ asi -> action_class_name ) ; } }
Parse URL information and run related action
 also run related bootstrap if exists.
Parse URL information and run related action also run related bootstrap if exists .