Exemplo n.º 1
1
 /**
  * @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);
                 }
             }
         });
     }
 }
Exemplo n.º 2
0
 public function init()
 {
     parent::init();
     if (empty($this->defaultPath)) {
         $this->defaultPath[] = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'defaultViews');
     }
 }
Exemplo n.º 3
0
 public function init()
 {
     parent::init();
     if (wanhunet::$app->getSession()->hasFlash('errors')) {
         $this->params['errors'] = wanhunet::$app->getSession()->getFlash('errors');
     }
 }
Exemplo n.º 4
0
 public function init()
 {
     parent::init();
     if (is_string($this->viewElementsGathener)) {
         $this->viewElementsGathener = Yii::$app->get('viewElementsGathener');
     }
 }
Exemplo n.º 5
0
 public function init()
 {
     parent::init();
     $this->modularityService = LuLu::getService('modularity');
     $this->rbacService = LuLu::getService('rbac');
     $this->taxonomyService = LuLu::getService('taxonomy');
 }
Exemplo n.º 6
0
 /**
  * @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]);
                 }
             }
         });
     }
 }
Exemplo n.º 7
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $this->setDefaultSmartLoadConfig();
     if ($this->smartLoadConfig['disableNativeScriptFilter']) {
         $this->disableNativeScriptFilter();
     }
     $this->getRSmartLoad()->init();
 }
Exemplo n.º 8
0
 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');
     }
 }
Exemplo n.º 9
0
 public function init()
 {
     parent::init();
     if ($this->channels == null) {
         $this->channels = CommonUtility::getCachedChannel();
     }
     if ($this->rootChannels == null) {
         $this->rootChannels = CommonUtility::getRootChannels();
     }
 }
Exemplo n.º 10
0
 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.'));
     }
 }
Exemplo n.º 11
0
 /**
  * @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);
                 }
             }
         });
     }
 }
Exemplo n.º 12
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_END_BODY, $this->getOgMetaTagsLoader());
     $this->on(self::EVENT_END_BODY, $this->getTwitterMetaTagsLoader());
 }
Exemplo n.º 13
0
 /**
  * Ensures storage component is set.
  */
 public function init()
 {
     parent::init();
     $this->storage = Instance::ensure($this->storage, '\\ArrayAccess');
 }
Exemplo n.º 14
0
 public function init()
 {
     parent::init();
     $this->publishPath = \Yii::getAlias($this->publishPath);
     $this->publishUrl = \Yii::getAlias($this->publishUrl);
 }
Exemplo n.º 15
0
 public function init()
 {
     parent::init();
     $this->on(self::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']);
 }
Exemplo n.º 16
0
 public function init()
 {
     parent::init();
     $this->registerJs('window.appName = ' . Json::encode(Yii::$app->name) . ';', View::POS_END);
     $this->registerJs('window[' . Json::encode(Yii::$app->name) . '] = {};', View::POS_END);
 }
Exemplo n.º 17
0
 public function init()
 {
     parent::init();
     $this->initService();
 }
Exemplo n.º 18
0
 public function init()
 {
     parent::init();
     $this->wpTheme = $this->theme;
 }
Exemplo n.º 19
0
 /**
  * Set default page title.
  */
 public function init()
 {
     parent::init();
     $this->setTitle(\Yii::$app->name);
 }
Exemplo n.º 20
0
 public function init()
 {
     parent::init();
 }