准备视图.

@param mixed                              $view
@param string                             $module
@param \wulaphp\mvc\controller\Controller $clz
@param string                             $action
344847
public static function prepareView($view, $module, $clz, $action) {
        if ($view instanceof IModuleView) {
            $tpl = $view->getTemplate();
            if ($tpl) {
                if ($tpl{0} == '~') {
                    $tpl     = substr($tpl, 1);
                    $tpls    = explode('/', $tpl);
                    $tpls[0] = App::id2dir($tpls[0]);
                    $tpl     = implode('/', $tpls);
                    unset($tpls[0]);
                } else {
                    $tpl = $module . '/views/' . $tpl;
                }
                $view->setTemplate($tpl);
            } else {
                $view->setTemplate($module . '/views/' . $clz->ctrName . '/' . $action);
            }
        }
    }
917396
protected function initViewVars($view)
    {
        $view->set('controller', $this->getName());
        $view->set('action', $this->getAction());

        if (method_exists($view, 'setRequest')) {
            $view->setRequest($this->getRequest());
        }

        return $view;
    }
437344
public function url($module = null, $controller = null, $action = null, $params = array()):string
    {
        $module=$module?:self::$module;
        $controller=$controller?:self::$controller;
        $action=$action?:self::$action;

        // 如果参数中指定了page,换成_PAGE
        if (isset ($params ['page'])) {
            $page = $params ['page'];
            unset ($params ['page']);
            $params [self::PAGE] = $page;
        } else {
            $params [self::PAGE] = $this->page;
        }

        // 调整参数中的分页尺寸参数
        if (isset ($params ['size'])) {
            $size = $params ['size'];
            unset ($params ['size']);
            $params [self::SIZE] = $size;
        } else {
            $params [self::SIZE] = $this->size;
        }

        // 调整参数中的排序依据参数
        if (isset ($params ['sort'])) {
            $sort = $params ['sort'];
            unset ($params ['sort']);
            $params [self::SORT] = $sort;
        } else {
            $params [self::SORT] = $this->sort;
        }

        // 调整参数中的排序方向参数
        if (isset ($params ['dir'])) {
            $dir = $params ['dir'];
            unset ($params ['dir']);
            $params [self::DIR] = $dir;
        } else {
            $params [self::DIR] = $this->dir;
        }

        // 把搜索条件也加上
        if ($this->where) {
            $params = array_merge($params, $this->where);
        }

        // 构造URL
        return url($module, $controller, $action, $params);
    }
334027
public function setView(\Zend_View_Interface $view = null)
    {
        $element = parent::setView($view);
        if (null !== $view) {
            if (false === $view->getPluginLoader('helper')->getPaths('Gems_JQuery_View_Helper')) {
                $view->addHelperPath('Gems/JQuery/View/Helper', 'Gems_JQuery_View_Helper');
            }
        }
        return $element;
    }
878603
public function afterRun($action, $view, $method) {
        if ($this->afterFeatures) {
            foreach ($this->afterFeatures as $feature) {
                $view = $this->$feature($action, $view, $method);
            }
        }

        return $view;
    }
155469
static function checkNodeID( $module, $view, $nodeID )
    {
        if ( !eZSSLZone::enabled() )
            return;

        /* If the given module/view is not in the list of 'keep mode' views,
         * i.e. it cannot choose access mode itself,
         * then do nothing.
         */
        if ( !eZSSLZone::isKeepModeView( $module, $view ) )
            return;

        // Fetch path string for the given node.
        $pathStrings = eZPersistentObject::fetchObjectList(
            eZContentObjectTreeNode::definition(), // def
            array( 'path_string' ),                // field_filters
            array( 'node_id' => $nodeID ),         // conds
            null,                                  // sorts
            null,                                  // limit
            false                                  // asObject
        );

        if ( !$pathStrings )
        {
            eZDebug::writeError( "Node #$nodeID not found", __METHOD__ );
            return;
        }

        eZSSLZone::checkNodePath( $module, $view, $pathStrings[0]['path_string'] );
    }
204560
protected function getControllerActions($type, $id, $module, &$result)
    {
        $token = "Create controller with cofig=" . VarDumper::dumpAsString($type) . " and id='$id'";
        Yii::beginProfile($token, __METHOD__);
        try {
            /* @var $controller \yii\base\Controller */
            $controller = Yii::createObject($type, [$id, $module]);
            $this->getActionRoutes($controller, $result);
            $all = "/{$controller->uniqueId}/*";
            $result[$all] = $all;
        } catch (\Exception $exc) {
            Yii::error($exc->getMessage(), __METHOD__);
        }
        Yii::endProfile($token, __METHOD__);
    }
1229902
public function & SetView (\MvcCore\IView & $view) {
		parent::SetView($view);

		if (self::$appRoot === NULL) self::$appRoot = $this->request->GetAppRoot();
		if (self::$basePath === NULL) self::$basePath = $this->request->GetBasePath();
		if (self::$scriptName === NULL) self::$scriptName = ltrim($this->request->GetScriptName(), '/.');
		$app = $view->GetController()->GetApplication();
		$configClass =$app->GetConfigClass();
		self::$loggingAndExceptions = $configClass::IsDevelopment(TRUE);
		$mvcCoreCompiledMode = $app->GetCompiled();

		self::$ctrlActionKey = $this->request->GetControllerName() . '/' . $this->request->GetActionName();

		// file checking is true only for classic development mode, not for single file mode
		if (!$mvcCoreCompiledMode) self::$fileChecking = TRUE;

		// file rendering is true for classic development state, SFU app mode
		if (!$mvcCoreCompiledMode || $mvcCoreCompiledMode == 'SFU') {
			self::$fileRendering = TRUE;
		}

		if (is_null(self::$assetsUrlCompletion)) {
			// set URL addresses completion to true by default for:
			// - all package modes outside PHP_STRICT_HDD and outside development
			if ($mvcCoreCompiledMode && $mvcCoreCompiledMode != 'PHP_STRICT_HDD') {
				self::$assetsUrlCompletion = TRUE;
			} else {
				self::$assetsUrlCompletion = FALSE;
			}
		}

		self::$systemConfigHash = md5(json_encode(self::$globalOptions));

		return $this;
	}
716723
public function canAccess($controller, $action, $module = null) {
        $module = is_array($module)?null:$module;
        $rights = $this->getRightsFromMap($controller, $action, $module);
        if ('*' == $rights[0]) {
            return true;
        }
        if ('@' == $rights[0]) {
            return !\mpf\WebApp::get()->user()->isGuest();
        }
        $hasRights = false;
        foreach ($rights as $right) {
            $hasRights = $hasRights || \mpf\WebApp::get()->user()->hasRight($right);
        }
        return $hasRights;
    }
648057
final public function setView($controller, $action)
    {
        $this->view = new View($controller, $action);
        // To maintain compatibility with version 1.0
        $this->View = $this->view;
        // If Layout is enable, send new view to it
        if (isset($this->layout)) {
            $this->layout->setView($this->view);
            // To maintain compatibility with version 1.0
            $this->Layout = $this->layout;
        }
    }
609813
static function run($module_name = null, $controller_name = null, $action = null) {
        try {
            $request = self::getRequest();
            if (self::getConfig()->get('security.csrf_defender')) {
                if ($request->isPost()) {
                    $csrf_token = $request->getPost('_csrftoken');
                    if ($csrf_token != $request->getCookie('_csrftoken')) {
                        exit('CsrfToken Invalid!');
                    }
                } else {
                    if (!$request->hasCookie('_csrftoken')) {
                        setcookie('_csrftoken', \Hiano\Token\Token::generate('_csrftoken'), 0, '/');
                    }
                }
            }


            $module_name or $module_name = self::getModuleName(); // $request->getParameter('module');
            $controller_name or $controller_name = self::getControllerName(); // $request->getParameter('controller');
            $action or $action = self::getActionName(); // $request->getParameter('action');

            $app_path = realpath(HIANO_APP_PATH);
            $controller_dir = $app_path . '/Controller/';
            $view_dir = $app_path . '/View/';
            $module_main_file = $controller_dir . ucfirst($module_name) . '/main.php';
            if (file_exists($module_main_file)) {
                include $module_main_file;
            }

            $view = self::getView();

            $view->set('app', array(
                'parameter' => $request->getParameter(),
                'post' => $request->getPost(),
                'cookie' => $request->getCookie(),
                'session' => $_SESSION,
                'server' => $_SERVER,
                'csrf' => array(
                    'name' => '_csrftoken',
                    'value' => $request->getCookie('_csrftoken')
                )
            ));

            $tpl_dir = $view_dir . '/' . ucfirst($module_name) . '/' . ucfirst($controller_name);
            $view->addTemplateDir($view_dir);
            $view->addTemplateDir($tpl_dir);
            $view->setTemplate($action);


            $ctrl = self::getController($module_name, $controller_name, $request, $view);
            $filter_chain = new Filter\FilterChain(function() use ($ctrl, $view) {
                $action_ret = self::dispatchAction($ctrl, self::getActionName());
                if (is_array($action_ret)) {
                    echo json_encode($action_ret);
                } elseif (is_string($action_ret)) {
                    echo $action_ret;
                } elseif ($action_ret === TRUE or $action_ret === NULL) {
                    $view->display();
                } elseif ($action_ret === FALSE) {
                    //do nothing
                } else {
                    throw new \Exception('错误的动作返回值！');
                }
            });
            if ($filters = self::$filter) {
                $filter_count = count($filters);
                for ($i = 0; $i < $filter_count; $i++) {
                    $f = self::loadFilter($filters[$i]);
                    $filter_chain->addFilter($f);
                }
            }
            $filter_chain->execute();
        } catch (Controller\NoActionException $e) {
            self::forward404();
        } catch (Controller\NoControllerException $e) {
            self::forward404();
        } catch (Controller\NoModuleException $e) {
            self::forward404();
        } catch (\Hiano\RedirectException $e) {
            call_user_func(self::$redirect_handler, $e);
        } catch (StopException $e) {
            
        } catch (\Hiano\ErrorException $e) {
            call_user_func(self::$error_handler, $e);
        }
    }
743601
final public function url($module, $controller = null, $action = null, array $params = array(), $hash = null) {
        return $this->view->url($module, $controller, $action, $params, $hash);
    }
374715
protected function createView($action='view')
    {
        $view = (new \Stack\View)->byName($this->getModelName(), 'Model_' . ucfirst($action));
        $view['controller'] = $this->getModelName();
        $view['controllerAction'] = $action;
        return $view;
    }
1355992
public function execute(Framework $framework, CliRequest $request, Response $response)
    {
        $output = 'Activated modules:' . PHP_EOL;
        $output .= '==================' . PHP_EOL . PHP_EOL;
        $moduleManager = $framework->getModuleManager();
        foreach ($moduleManager->getModules() as $namespace => $module) {
            $properties = $moduleManager->getModuleProperties($module->getDirectory());
            $info = $properties->module;
            
            $output .= '- ' . $info->name . ' ' . $info->version . ' (' . $namespace . '):' . PHP_EOL;
            $output .= '  ' . $info->description . PHP_EOL . PHP_EOL;
        }
        
        $response->setOutputPart('modules', $output);
    }
1081746
public function render($view = null, $layout = null)
    {
        $view = $this->_getFormView($view);
        return parent::render($view, $layout);
    }
874906
public function can($action, $method_code = null, $module_id = null) : bool {
		if (empty($this->controller_id)) return false;
		// module id
		if (empty($module_id)) {
			$module_id = $this->module_id;
			if (empty($module_id)) {
				Throw new \Exception('You must specify correct module #');
			}
		}
		// run permission
		return $this->canExtended($this->controller_id, $method_code ?? $this->method_code, $action, $module_id);
	}
796801
public static function findPage( $view, $config = [] ) {

		$moduleName		= $view->context->module->id;
		$controllerName	= Yii::$app->controller->id;
		$actionName		= Yii::$app->controller->action->id;

		$page = null;

		// System/Public Pages - Landing, Login, Register, Confirm Account, Activate Account, Forgot Password, Reset Password
		if( $moduleName == 'core' && $controllerName == 'site' ) {

			// Landing Page
			if( $actionName == 'index' ) {

				$page = self::getPage( 'home' );
			}
			// System Page
			else {

				$page = self::getPage( $actionName );
			}
		}
		// Blog/CMS Pages
		else if( isset( Yii::$app->request->queryParams[ 'slug' ] ) ) {

			$type = isset( $config[ 'type' ] ) ? $config[ 'type' ] : CmsGlobal::TYPE_PAGE;

			$page = self::getPage( Yii::$app->request->queryParams[ 'slug' ], $type );
		}

		return $page;
	}