當前位置: 首頁>>代碼示例>>PHP>>正文


PHP View::init方法代碼示例

本文整理匯總了PHP中yii\web\View::init方法的典型用法代碼示例。如果您正苦於以下問題:PHP View::init方法的具體用法?PHP View::init怎麽用?PHP View::init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在yii\web\View的用法示例。


在下文中一共展示了View::init方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 public function init()
 {
     parent::init();
     if (empty($this->defaultPath)) {
         $this->defaultPath[] = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'defaultViews');
     }
 }
開發者ID:netis-pl,項目名稱:yii2-crud,代碼行數:7,代碼來源:View.php

示例2: init

 /**
  * @throws \rmrevin\yii\minify\Exception
  */
 public function init()
 {
     parent::init();
     $minify_path = $this->minify_path = (string) \Yii::getAlias($this->minify_path);
     if (!file_exists($minify_path)) {
         helpers\FileHelper::createDirectory($minify_path);
     }
     if (!is_readable($minify_path)) {
         throw new Exception('Directory for compressed assets is not readable.');
     }
     if (!is_writable($minify_path)) {
         throw new Exception('Directory for compressed assets is not writable.');
     }
     if (true === $this->compress_output) {
         \Yii::$app->response->on(\yii\web\Response::EVENT_BEFORE_SEND, function (\yii\base\Event $Event) {
             /** @var \yii\web\Response $Response */
             $Response = $Event->sender;
             if ($Response->format === \yii\web\Response::FORMAT_HTML) {
                 if (!empty($Response->data)) {
                     $Response->data = HtmlCompressor::compress($Response->data, $this->compress_options);
                 }
                 if (!empty($Response->content)) {
                     $Response->content = HtmlCompressor::compress($Response->content, $this->compress_options);
                 }
             }
         });
     }
 }
開發者ID:audriusdob,項目名稱:yii2-minify-view,代碼行數:31,代碼來源:View.php

示例3: init

 public function init()
 {
     parent::init();
     if (wanhunet::$app->getSession()->hasFlash('errors')) {
         $this->params['errors'] = wanhunet::$app->getSession()->getFlash('errors');
     }
 }
開發者ID:suyuanen,項目名稱:p2p,代碼行數:7,代碼來源:View.php

示例4: init

 public function init()
 {
     parent::init();
     if (is_string($this->viewElementsGathener)) {
         $this->viewElementsGathener = Yii::$app->get('viewElementsGathener');
     }
 }
開發者ID:tqsq2005,項目名稱:dotplant2,代碼行數:7,代碼來源:WebView.php

示例5: init

 public function init()
 {
     parent::init();
     $this->modularityService = LuLu::getService('modularity');
     $this->rbacService = LuLu::getService('rbac');
     $this->taxonomyService = LuLu::getService('taxonomy');
 }
開發者ID:hucongyang,項目名稱:lulucms2,代碼行數:7,代碼來源:BaseView.php

示例6: init

 /**
  * @throws \rmrevin\yii\minify\Exception
  */
 public function init()
 {
     parent::init();
     if (php_sapi_name() !== 'cli') {
         $urlDetails = \Yii::$app->urlManager->parseRequest(\Yii::$app->request);
         if (in_array($urlDetails[0], $this->exclude_routes)) {
             $this->enableMinify = false;
         }
     }
     $minify_path = $this->minify_path = (string) \Yii::getAlias($this->minify_path);
     if (!file_exists($minify_path)) {
         helpers\FileHelper::createDirectory($minify_path);
     }
     if (!is_readable($minify_path)) {
         throw new Exception('Directory for compressed assets is not readable.');
     }
     if (!is_writable($minify_path)) {
         throw new Exception('Directory for compressed assets is not writable.');
     }
     if (true === $this->compress_output) {
         \Yii::$app->response->on(\yii\web\Response::EVENT_BEFORE_SEND, function (\yii\base\Event $Event) {
             /** @var \yii\web\Response $Response */
             $Response = $Event->sender;
             if ($Response->format === \yii\web\Response::FORMAT_HTML) {
                 if (!empty($Response->data)) {
                     $Response->data = HtmlCompressor::compress($Response->data, ['extra' => true]);
                 }
                 if (!empty($Response->content)) {
                     $Response->content = HtmlCompressor::compress($Response->content, ['extra' => true]);
                 }
             }
         });
     }
 }
開發者ID:synackSA,項目名稱:yii2-minify-view,代碼行數:37,代碼來源:View.php

示例7: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->setDefaultSmartLoadConfig();
     if ($this->smartLoadConfig['disableNativeScriptFilter']) {
         $this->disableNativeScriptFilter();
     }
     $this->getRSmartLoad()->init();
 }
開發者ID:istranger,項目名稱:yii2-resource-smart-load,代碼行數:12,代碼來源:View.php

示例8: init

 public function init()
 {
     // call parent initializer
     parent::init();
     // auto register csrf tags if enabled
     if ($this->autoRegisterCsrf && Yii::$app->request->enableCsrfValidation) {
         $this->registerMetaTag(['name' => 'csrf-param', 'content' => Yii::$app->request->csrfParam], 'csrfParam');
         $this->registerMetaTag(['name' => 'csrf-token', 'content' => Yii::$app->request->getCsrfToken()], 'csrfToken');
     }
 }
開發者ID:rocksolid-tn,項目名稱:luya,代碼行數:10,代碼來源:View.php

示例9: init

 public function init()
 {
     parent::init();
     if ($this->channels == null) {
         $this->channels = CommonUtility::getCachedChannel();
     }
     if ($this->rootChannels == null) {
         $this->rootChannels = CommonUtility::getRootChannels();
     }
 }
開發者ID:liangdabiao,項目名稱:lulucms,代碼行數:10,代碼來源:BaseView.php

示例10: init

 public function init()
 {
     parent::init();
     $minify_path = $this->minify_path = \Yii::getAlias($this->minify_path);
     if (!file_exists($minify_path)) {
         FileHelper::createDirectory($minify_path);
     }
     if (!is_readable($minify_path)) {
         throw new \RuntimeException(\Yii::t('app', 'Directory for compressed assets is not readable.'));
     }
     if (!is_writable($minify_path)) {
         throw new \RuntimeException(\Yii::t('app', 'Directory for compressed assets is not writable.'));
     }
 }
開發者ID:pernatiy02,項目名稱:yii2-minify-view,代碼行數:14,代碼來源:View.php

示例11: init

 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if ($this->compress === true) {
         \Yii::$app->response->on(\yii\web\Response::EVENT_BEFORE_SEND, function (\yii\base\Event $Event) {
             $Response = $Event->sender;
             if ($Response->format === \yii\web\Response::FORMAT_HTML) {
                 if (!empty($Response->data)) {
                     $Response->data = self::compress($Response->data);
                 }
                 if (!empty($Response->content)) {
                     $Response->content = self::compress($Response->content);
                 }
             }
         });
     }
 }
開發者ID:rlockerl,項目名稱:yii2-htmlcompress,代碼行數:20,代碼來源:View.php

示例12: init

 public function init()
 {
     parent::init();
     $this->on(self::EVENT_END_BODY, $this->getOgMetaTagsLoader());
     $this->on(self::EVENT_END_BODY, $this->getTwitterMetaTagsLoader());
 }
開發者ID:jlorente,項目名稱:yii2-app-advanced-template,代碼行數:6,代碼來源:View.php

示例13: init

 /**
  * Ensures storage component is set.
  */
 public function init()
 {
     parent::init();
     $this->storage = Instance::ensure($this->storage, '\\ArrayAccess');
 }
開發者ID:HumanDevice,項目名稱:yii2-tools,代碼行數:8,代碼來源:View.php

示例14: init

 public function init()
 {
     parent::init();
     $this->publishPath = \Yii::getAlias($this->publishPath);
     $this->publishUrl = \Yii::getAlias($this->publishUrl);
 }
開發者ID:slinstj,項目名稱:yii2-assets-optimizer,代碼行數:6,代碼來源:View.php

示例15: init

 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']);
 }
開發者ID:heartshare,項目名稱:yii2-seo-1,代碼行數:5,代碼來源:CustomView.php


注:本文中的yii\web\View::init方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。