/** * @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); } } }); } }
public function init() { parent::init(); if (empty($this->defaultPath)) { $this->defaultPath[] = realpath(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'defaultViews'); } }
public function init() { parent::init(); if (wanhunet::$app->getSession()->hasFlash('errors')) { $this->params['errors'] = wanhunet::$app->getSession()->getFlash('errors'); } }
public function init() { parent::init(); if (is_string($this->viewElementsGathener)) { $this->viewElementsGathener = Yii::$app->get('viewElementsGathener'); } }
public function init() { parent::init(); $this->modularityService = LuLu::getService('modularity'); $this->rbacService = LuLu::getService('rbac'); $this->taxonomyService = LuLu::getService('taxonomy'); }
/** * @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]); } } }); } }
/** * @inheritdoc */ public function init() { parent::init(); $this->setDefaultSmartLoadConfig(); if ($this->smartLoadConfig['disableNativeScriptFilter']) { $this->disableNativeScriptFilter(); } $this->getRSmartLoad()->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'); } }
public function init() { parent::init(); if ($this->channels == null) { $this->channels = CommonUtility::getCachedChannel(); } if ($this->rootChannels == null) { $this->rootChannels = CommonUtility::getRootChannels(); } }
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.')); } }
/** * @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); } } }); } }
public function init() { parent::init(); $this->on(self::EVENT_END_BODY, $this->getOgMetaTagsLoader()); $this->on(self::EVENT_END_BODY, $this->getTwitterMetaTagsLoader()); }
/** * Ensures storage component is set. */ public function init() { parent::init(); $this->storage = Instance::ensure($this->storage, '\\ArrayAccess'); }
public function init() { parent::init(); $this->publishPath = \Yii::getAlias($this->publishPath); $this->publishUrl = \Yii::getAlias($this->publishUrl); }
public function init() { parent::init(); $this->on(self::EVENT_BEGIN_PAGE, [$this, 'eventSetMeta']); }
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); }
public function init() { parent::init(); $this->initService(); }
public function init() { parent::init(); $this->wpTheme = $this->theme; }
/** * Set default page title. */ public function init() { parent::init(); $this->setTitle(\Yii::$app->name); }
public function init() { parent::init(); }