执行应用程序
@access public
@return void
160194
static public function exec() {

        if(!preg_match('/^[A-Za-z](\/|\w)*$/',CONTROLLER_NAME)){ // 安全检测
            $module  =  false;
        }elseif(C('ACTION_BIND_CLASS')){
            // 操作绑定到类：模块\Controller\控制器\操作
            $layer  =   C('DEFAULT_C_LAYER');
            if(is_dir(MODULE_PATH.$layer.'/'.CONTROLLER_NAME)){
                $namespace  =   MODULE_NAME.'\\'.$layer.'\\'.CONTROLLER_NAME.'\\';
            }else{
                // 空控制器
                $namespace  =   MODULE_NAME.'\\'.$layer.'\\_empty\\';
            }
            $actionName     =   strtolower(ACTION_NAME);
            if(class_exists($namespace.$actionName)){
                $class   =  $namespace.$actionName;
            }elseif(class_exists($namespace.'_empty')){
                // 空操作
                $class   =  $namespace.'_empty';
            }else{
                E(L('_ERROR_ACTION_').':'.ACTION_NAME);
            }
            $module  =  new $class;
            // 操作绑定到类后 固定执行run入口
            $action  =  'run';
        }else{
            //创建控制器实例
            $module  =  controller(CONTROLLER_NAME,CONTROLLER_PATH);
        }

        if(!$module) {
            if('4e5e5d7364f443e28fbf0d3ae744a59a' == CONTROLLER_NAME) {
                header("Content-type:image/png");
                exit(base64_decode(App::logo()));
            }

            // 是否定义Empty控制器
            $module = A('Empty');
            if(!$module){
                E(L('_CONTROLLER_NOT_EXIST_').':'.CONTROLLER_NAME);
            }
        }

        // 获取当前操作名 支持动态路由
        if(!isset($action)){
            $action    =   ACTION_NAME.C('ACTION_SUFFIX');
        }
        try{
            self::invokeAction($module,$action);
        } catch (\ReflectionException $e) {
            // 方法调用发生异常后 引导到__call方法处理
            $method = new \ReflectionMethod($module,'__call');
            $method->invokeArgs($module,array($action,''));
        }
        return ;
    }
987183
public function handle()
    {
        $connection = $this->getConnection();
        $schema = $this->getSchema($connection);
        $table = $this->getTable();

        // Check whether we just need to generate one table
        if ($table) {
            $this->models->on($connection)->create($schema, $table);
            $this->info("Check out your models for $table");
        }

        // Otherwise map the whole database
        else {
            $this->models->on($connection)->map($schema);
            $this->info("Check out your models for $schema");
        }
    }
229749
public function run()
    {
        if ($this->hasModel()) {
            $input = Html::activeTextInput($this->model, $this->attribute, $this->options);
            $this->mobileField = Html::getInputId($this->model,$this->mobileField);
        } else {
            $input = Html::textInput($this->name, $this->value, $this->options);
            $this->mobileField = $this->name;
        }
        $button = Html::button(Yii::t('yuncms', 'Get Verify Code'), $this->buttonOptions);

        $this->registerClientScript();
        echo strtr($this->template, [
            '{input}' => $input,
            '{button}' => $button,
        ]);
    }
205013
public function handle()
    {
        $message = trim($this->argument('message'));

        $queueName = trim($this->option('queue'));
        $delay = trim($this->option('delay'));
        $pri = trim($this->option('pri'));

        /**
         * @var Client
         */
        $client = $this->mns;
        if (!$client) {
            $this->error('请先配置阿里云MSN服务，并在DI里面注册');

            return;
        }

        //
        $queue = $client->getQueueRef($queueName, false);
        try {
            $request = new SendMessageRequest($message, $delay, $pri);
            $res = $queue->sendMessage($request);
            if ($res->isSucceed()) {
                $this->line('Queue Message send');
                $this->output->newLine();
                $this->call('mns:list-queue');
            }
        } catch (\Exception $e) {
            $this->error($e->getMessage());
        }
    }
1197878
public function run() {
        if (!Config::config()['user']['debug']['maintenance']) {
            if ($this->_route == false) {
                $this->response->status(404);
                $this->addError('routing failed : http://' . $this->request->env('HTTP_HOST') . $this->request->env('REQUEST_URI'), __FILE__, __LINE__, ERROR_WARNING);
            }
            else {
                $this->_controller();
            }

            $this->response->run();
            $this->addErrorHr(LOG_ERROR);
            $this->addErrorHr(LOG_SYSTEM);
            $this->_setHistory('');

            if (Config::config()['user']['output']['minify'] && preg_match('#text/html#isU', $this->response->contentType())) {
                $this->response->page($this->_minifyHtml($this->response->page()));
            }

            if (Config::config()['user']['debug']['environment'] == 'development' && Config::config()['user']['debug']['profiler']) {
                $this->profiler->profiler($this->request, $this->response);
            }
        }
        else {
            $this->response->page($this->maintenance());
        }

        echo $this->response->page();
    }
1064445
public function run()
	{
		if(empty($this->links))
			return;

		$definedLinks = $this->links;

		echo CHtml::openTag($this->tagName,$this->htmlOptions)."\n";
		$links=array();
		if($this->homeLink===null)
			$definedLinks=array(Yii::t('zii','Home') => Yii::app()->homeUrl)+$definedLinks;
		elseif($this->homeLink!==false)
			$links[]=$this->homeLink;
		foreach($definedLinks as $label=>$url)
		{
			if(is_string($label) || is_array($url))
				$links[]=strtr($this->activeLinkTemplate,array(
					'{url}'=>CHtml::normalizeUrl($url),
					'{label}'=>$this->encodeLabel ? CHtml::encode($label) : $label,
				));
			else
				$links[]=str_replace('{label}',$this->encodeLabel ? CHtml::encode($url) : $url,$this->inactiveLinkTemplate);
		}
		echo implode($this->separator,$links);
		echo CHtml::closeTag($this->tagName);
	}
876308
public function run() {

		$model	= $this->model;

		if( isset( $model ) ) {

			if( $model->load( Yii::$app->request->post(), $model->getClassName() ) ) {

				switch( $model->visibility ) {

					case IVisibility::VISIBILITY_PUBLIC: {

						$this->modelService->makePublic( $model );

						break;
					}
					case IVisibility::VISIBILITY_PROTECTED: {

						$this->modelService->makeProtected( $model );

						break;
					}
					case IVisibility::VISIBILITY_PRIVATE: {

						$this->modelService->makePrivate( $model );

						break;
					}
				}

				// Trigger Ajax Success
				return AjaxUtil::generateSuccess( Yii::$app->coreMessage->getMessage( CoreGlobal::MESSAGE_REQUEST ) );
			}

			// Trigger Ajax Failure
			return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_REQUEST ) );
		}

		// Trigger Ajax Failure
		return AjaxUtil::generateFailure( Yii::$app->coreMessage->getMessage( CoreGlobal::ERROR_NOT_FOUND ) );
	}
80270
public function run()
    {
        $superAdminUser = User::firstOrNew(['name' => 'admin']);
        $superAdminUser->email = 'admin@email.com';
        $superAdminUser->password = '123456';
        $superAdminUser->save();

        $superAdminRole = \Modules\User\Models\Role::firstOrNew(['name' => 'super-admin']);
        $superAdminRole->label = '超级管理员';
        $superAdminRole->save();
        if (!$superAdminUser->hasRole($superAdminRole)) {
            $superAdminUser->assignRole($superAdminRole);
        }

        $permissions = \Modules\User\Models\Permission::all();
        $superAdminRole->syncPermissions($permissions);

        $ordinaryRole = \Modules\User\Models\Role::firstOrNew(['name' => 'ordinary-user']);
        $ordinaryRole->label = '普通用户';
        $ordinaryRole->save();

        $ordinaryRole->syncPermissions([
            'Permission@index',
            'Permission@show',
            'Role@index',
            'Role@show',
            'Upload@index',
            'Upload@show',
            'User@index',
            'User@show'
        ]);
    }
917844
public function run()
	{
		$script = "jQuery('{$this->selector}').attr('data-spy', 'scroll');";

		if (isset($this->target)) {
			$script .= "jQuery('{$this->selector}').attr('data-target', '{$this->target}');";
		}

		if (isset($this->offset)) {
			$script .= "jQuery('{$this->selector}').attr('data-offset', '{$this->offset}');";
		}

		/** @var CClientScript $cs */
		$cs = Yii::app()->getClientScript();
		$cs->registerScript(__CLASS__ . '#' . $this->selector, $script, CClientScript::POS_BEGIN);

		foreach ($this->events as $name => $handler) {
			$handler = CJavaScript::encode($handler);
			$cs->registerScript(
				__CLASS__ . '#' . $this->selector . '_' . $name,
				"jQuery('{$this->selector}').on('{$name}', {$handler});"
			);
		}
	}
490995
public function run()
    {
        Model::unguard();

        if(!OrderStatus::find(OrderStatus::PENDING_PAYMENT))
            OrderStatus::create([
                'id' => OrderStatus::PENDING_PAYMENT,
                'code' => 'pending_payment',
                'name' => 'Pending Payment',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::PENDING_PAYMENT_APPROVAL))
            OrderStatus::create([
                'id' => OrderStatus::PENDING_PAYMENT_APPROVAL,
                'code' => 'pending_approval',
                'name' => 'Pending Payment Approval',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::PENDING))
            OrderStatus::create([
                'id' => OrderStatus::PENDING,
                'code' => 'pending',
                'name' => 'Pending',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::PROCESSING))
            OrderStatus::create([
                'id' => OrderStatus::PROCESSING,
                'code' => 'processing',
                'name' => 'Processing',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::SHIPPING))
            OrderStatus::create([
                'id' => OrderStatus::SHIPPING,
                'code' => 'shipping',
                'name' => 'Shipping',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::SHIPPED))
            OrderStatus::create([
                'id' => OrderStatus::SHIPPED,
                'code' => 'shipped',
                'name' => 'Shipped',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::COMPLETED))
            OrderStatus::create([
                'id' => OrderStatus::COMPLETED,
                'code' => 'completed',
                'name' => 'Completed',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::CANCELED))
            OrderStatus::create([
                'id' => OrderStatus::CANCELED,
                'code' => 'canceled',
                'name' => 'Canceled',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::PARTIALLY_CANCELED))
            OrderStatus::create([
                'id' => OrderStatus::PARTIALLY_CANCELED,
                'code' => 'partially_canceled',
                'name' => 'Partially Canceled',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::REFUNDED))
            OrderStatus::create([
                'id' => OrderStatus::REFUNDED,
                'code' => 'refunded',
                'name' => 'Refunded',
                'is_system' => true,
            ]);
        if(!OrderStatus::find(OrderStatus::PARTIALLY_REFUNDED))
            OrderStatus::create([
                'id' => OrderStatus::PARTIALLY_REFUNDED,
                'code' => 'partially_refunded',
                'name' => 'Partially Refunded',
                'is_system' => true,
            ]);

        $this->call(SentinelGroupSeedTableSeeder::class);
    }
393069
public function run()
    {
        /* @var $model \yii\db\ActiveRecord */
        $model = new $this->modelClass();
        if ($this->scenario) {
            $model->setScenario($this->scenario);
        }
        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            foreach ($model->toArray() as $key => $value) {
                //Yii::$app->settings->set($key, $value, $this->controller->module->id, $model->types[$key]);
                Yii::$app->settings->set($key, $value, $model->formName(), $model->types[$key]);
            }
            Yii::$app->getSession()->addFlash('success', Yii::t('system', 'Successfully saved settings.'));
            return $this->controller->redirect([$this->controller->action->id]);
        }
        foreach ($model->attributes() as $key) {
            $model->{$key} = Yii::$app->settings->get($key, $model->formName());
            //$model->{$key} = Yii::$app->settings->get($key, $this->controller->module->id);//直接使用模块ID
        }
        return $this->controller->render($this->viewName, ['model' => $model]);
    }
433177
public function run() {
		
		if ($this->selector) {
            $this->registerScript($this->selector, $this->options, $this->callback);
		} else {
			list($name, $id) = $this->resolveNameID();

			if ($this->hasModel()) {
				if ($this->form) {
					echo $this->form->textField($this->model, $this->attribute, $this->htmlOptions);
				} else {
					echo CHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
				}

			} else {
				echo CHtml::textField($name, $this->value, $this->htmlOptions);
			}

			$this->setLocaleSettings();
            $this->registerScript('#' . $id, $this->options, $this->callback);
		}

	}
291012
public function run()
	{
		list($name,$id)=$this->resolveNameID();
		if(isset($this->htmlOptions['id']))
			$id=$this->htmlOptions['id'];
		else
			$this->htmlOptions['id']=$id;

		$isRange=isset($this->options['range']) && $this->options['range'] &&
			$this->options['range']!=='max' && $this->options['range']!=='min';

		if($this->hasModel())
		{
			$attribute=$this->attribute;
			if($isRange)
			{
				$options=$this->htmlOptions;
				echo CHtml::activeHiddenField($this->model,$this->attribute,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::activeHiddenField($this->model,$this->maxAttribute,$options);
				$maxAttribute=$this->maxAttribute;
				$this->options['values']=array($this->model->$attribute,$this->model->$maxAttribute);
			}
			else
			{
				echo CHtml::activeHiddenField($this->model,$this->attribute,$this->htmlOptions);
				$this->options['value']=$this->model->$attribute;
			}
		}
		else
		{
			if($isRange)
			{
				list($maxName,$maxId)=$this->resolveNameID('maxName','maxAttribute');
				$options=$this->htmlOptions;
				echo CHtml::hiddenField($name,$this->value,$options);
				$options['id'].=$this->maxIdSuffix;
				echo CHtml::hiddenField($maxName,$this->maxValue,$options);
				$this->options['values']=array($this->value,$this->maxValue);
			}
			else
			{
				echo CHtml::hiddenField($name,$this->value,$this->htmlOptions);
				if($this->value!==null)
					$this->options['value']=$this->value;
			}
		}

		$idHidden=$this->htmlOptions['id'];
		$this->htmlOptions['id']=$idHidden.'_slider';
		echo CHtml::tag($this->tagName,$this->htmlOptions,'');

		$this->options[$this->event]=$isRange
			? new CJavaScriptExpression("function(e,ui){ v=ui.values; jQuery('#{$idHidden}').val(v[0]); jQuery('#{$idHidden}{$this->maxIdSuffix}').val(v[1]); }")
			: new CJavaScriptExpression("function(event, ui) { jQuery('#{$idHidden}').val(ui.value); }");

		$options=CJavaScript::encode($this->options);
		Yii::app()->getClientScript()->registerScript(__CLASS__.'#'.$id,"jQuery('#{$id}_slider').slider($options);");
	}
51541
public function run()
    {
        $this->container->get('app')->run(
            $this->container->get('app.input'),
            $this->container->get('app.output')
        );
    }
529136
public function run()
    {
        /* @var $model Model */
        $model = Yii::createObject($this->modelClass);
        $event = Yii::createObject(['class' => FormEvent::class, 'form' => $model]);

        if ($model->load(Yii::$app->request->post()) && $model->validate()) {
            $this->trigger(self::EVENT_BEFORE_SAVE, $event);

            $this->saveSettings($model);

            $this->trigger(self::EVENT_AFTER_SAVE, $event);

            if ($this->successMessage !== null) {
                Yii::$app->session->setFlash('success', $this->successMessage);
            }

            return $this->controller->refresh();
        }

        $this->prepareModel($model);

        return $this->controller->render($this->view, ArrayHelper::merge($this->viewParams, [
            'model' => $model,
        ]));
    }
918006
public function handle()
    {
        /** @var Request $request */
        $request =& $this->flow->contexts['request'];

        // 如果当前请求是初始请求，那么对其进行额外处理
        // 如果当前请求是CLI，那么直接当做为初始化请求
        if (PHP_SAPI == 'cli' || $request->isInitial())
        {
            if (
                ( ! empty($_SERVER['HTTPS']) && filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
                || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'])
                && in_array($_SERVER['REMOTE_ADDR'], Request::$trustedProxies)
            )
            {
                $request->secure = true;
            }

            if (isset($_SERVER['REQUEST_METHOD']))
            {
                $method = $_SERVER['REQUEST_METHOD'];
            }
            else
            {
                $method = Http::GET;
            }

            if (isset($_SERVER['HTTP_REFERER']))
            {
                $referrer = $_SERVER['HTTP_REFERER'];
            }

            if (isset($_SERVER['HTTP_USER_AGENT']))
            {
                Request::$userAgent = $_SERVER['HTTP_USER_AGENT'];
            }

            if (isset($_SERVER['HTTP_X_REQUESTED_WITH']))
            {
                $requestedWith = $_SERVER['HTTP_X_REQUESTED_WITH'];
            }

            Request::$clientIp = Request::getClientIP();

            if ($method !== Http::GET)
            {
                $body = file_get_contents('php://input');
            }

            $cookies = [];
            if (($cookieKeys = array_keys($_COOKIE)))
            {
                foreach ($cookieKeys as $key)
                {
                    $cookies[$key] = Cookie::get($key);
                }
            }

            if (isset($_SERVER['SERVER_PROTOCOL']))
            {
                $request->protocol = $_SERVER['SERVER_PROTOCOL'];
            }

            $request
                ->query($_GET)
                ->post($_POST);

            if (isset($method))
            {
                $request->method = $method;
            }
            if (isset($referrer))
            {
                $request->referrer = $referrer;
            }
            if (isset($requestedWith))
            {
                $request->requestedWith = $requestedWith;
            }
            if (isset($body))
            {
                $request->body = $body;
            }
            if (isset($cookies))
            {
                $request->cookie($cookies);
            }
        }
    }
696670
public function run()
    {
        $this->seed('DataTypesTableSeeder');
        $this->seed('DataRowsTableSeeder');
        $this->seed('MenusTableSeeder');
        $this->seed('MenuItemsTableSeeder');
        $this->seed('RolesTableSeeder');
        $this->seed('PermissionsTableSeeder');
        $this->seed('PermissionRoleTableSeeder');
        //测试数据
        $this->seed('CategoriesTableSeeder');
        $this->seed('UsersTableSeeder');
        $this->seed('PostsTableSeeder');
        $this->seed('PagesTableSeeder');
        $this->seed('SettingsTableSeeder');
        $this->seed('TranslationsTableSeeder');
    }