/** * init base url map */ public function init() { // request $this->_baseUrl = Yii::app()->request->baseUrl; $baseUrl = $this->_baseUrl . '/'; $this->_baseUrlMap[$baseUrl] = dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR; // themes if (Yii::app()->theme) { $baseUrl = Yii::app()->theme->baseUrl . '/'; $this->_baseUrlMap[$baseUrl] = Yii::app()->theme->basePath . DIRECTORY_SEPARATOR; } parent::init(); }
/** * Initialize the minScript application component. * @throws CException if the minScript controller is not defined in CWebApplication::$controllerMap. */ public function init() { parent::init(); // Initialize the cache application component instance for minScript if (($minScriptCache = Yii::app()->getComponent($this->minScriptCacheId)) !== null) { $this->_minScriptCache = $minScriptCache; } else { Yii::app()->setComponents(array('minScriptCache' => array('class' => 'system.caching.CFileCache', 'cachePath' => Yii::app()->runtimePath . '/minScript/cache/', 'cacheFileSuffix' => '')), false); $this->_minScriptCache = Yii::app()->getComponent('minScriptCache'); } // Check for existence of the minScript controller inside CWebApplication::$controllerMap if (!isset(Yii::app()->controllerMap[$this->minScriptControllerId])) { throw new CException('The minScript controller with ID "' . $this->minScriptControllerId . '" needs to be defined in CWebApplication::$controllerMap.'); } }
/** * init */ public function init() { if (Util::isIE()) { $this->combineCssFiles = false; } // request $this->_baseUrl = Yii::app()->request->baseUrl; $baseUrl = $this->_baseUrl . '/'; $basePath = dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR; $this->_baseUrlMap[$baseUrl] = $basePath; // themes if (Yii::app()->theme) { $basePath = Yii::app()->theme->basePath . DIRECTORY_SEPARATOR; $baseUrl = Yii::app()->theme->baseUrl . '/'; $this->_baseUrlMap[$baseUrl] = $basePath; } parent::init(); }
public function init() { parent::init(); if (!is_executable($this->javaPath)) { throw new Exception('Java not found or not accessable'); } if (!is_readable($this->yuicPath)) { $this->yuicPath = dirname(__FILE__) . DS . 'yuicompressor-2.4.2.jar'; } if (!is_readable($this->closurePath)) { $this->closurePath = dirname(__FILE__) . DS . 'compiler.jar'; } if (!file_exists($this->yuicPath)) { throw new Exception('YUI compressor not found'); } if (!file_exists($this->closurePath)) { throw new Exception('Google closure compiler not found'); } $this->_baseUrl = Yii::app()->baseUrl; $this->_basePath = YiiBase::getPathOfAlias('webroot'); $this->_assetsPath = $this->_basePath . str_replace($this->_baseUrl, '', $this->getCoreScriptUrl()); }
public function init() { parent::init(); //we need jquery $this->registerCoreScript('jquery'); //getting url of the document root if (!$this->serverBaseUrl) { $this->serverBaseUrl = strtolower(preg_replace('#/.*$#', '', $_SERVER['SERVER_PROTOCOL'])) . '://' . $_SERVER['HTTP_HOST']; if ($_SERVER['SERVER_PORT'] != 80) { $this->serverBaseUrl .= ':' . $_SERVER['SERVER_PORT']; } } }
public function init() { parent::init(); //we need jquery $this->registerCoreScript('jquery'); //getting url of the document root - using framework method if (!$this->serverBaseUrl) { $this->serverBaseUrl = Yii::app()->getRequest()->getHostInfo(); } }
public function init() { parent::init(); if (is_numeric($this->nlsScriptPosition)) { //-> we need jquery $this->registerCoreScript('jquery'); } //set root working dir $this->workingDirPath = rtrim(\Yii::app()->assetManager->basePath, '/') . '/nls'; $this->workingDirUrl = rtrim(\Yii::app()->assetManager->baseUrl, '/') . '/nls'; if (!file_exists($this->workingDirPath)) { mkdir($this->workingDirPath); } //setup downloader $serverBase = \Yii::app()->getRequest()->getHostInfo(); $this->downloader = new NLSDownloader(array('serverBaseUrl' => $serverBase, 'appBaseUrl' => $serverBase . \Yii::app()->getRequest()->getBaseUrl(), 'curlConnectionTimeOut' => $this->curlConnectionTimeOut, 'curlTimeOut' => $this->curlTimeOut)); //setup css merger $this->cssMerger = new NLSCssMerge(array('downloadResources' => $this->downloadCssResources, 'downloadResourceRootPath' => $this->workingDirPath . '/resources', 'downloadResourceRootUrl' => $this->workingDirUrl . '/resources', 'minify' => $this->compressMergedCss, 'closeCurl' => false), $this->downloader); }
/** * init base url map */ public function init() { // Если мы работаем внутри консольного приложения (Yiiq), добавляем недостающие методы приложению // и выставляем соответствующий режим работы. if (Yii::app() instanceof CConsoleApplication) { $this->mode = self::MODE_SAVE; Yii::app()->attachBehavior('YiissetConsoleBehavior', ['class' => 'yiisset.util.YiissetConsoleBehavior']); } // request $this->_baseUrl = Yii::app()->assetManager->baseUrl; $baseUrl = $this->_baseUrl . '/'; $this->_baseUrlMap[$baseUrl] = Yii::app()->assetManager->basePath . DIRECTORY_SEPARATOR; // themes if (Yii::app()->hasComponent('theme')) { $baseUrl = Yii::app()->theme->baseUrl . '/'; $this->_baseUrlMap[$baseUrl] = Yii::app()->theme->basePath . DIRECTORY_SEPARATOR; } $behaviors = $this->behaviors; $this->behaviors = array(); parent::init(); $this->behaviors = $behaviors; $this->onInit(); }
public function init() { parent::init(); //we need jquery $this->registerCoreScript('jquery'); //getting url of the document root /* x2modstart */ // commented out since it breaks unit tests // if (!$this->serverBaseUrl) { // $this->serverBaseUrl = strtolower(preg_replace('#/.*$#','',$_SERVER['SERVER_PROTOCOL'])) . '://' . $_SERVER['HTTP_HOST']; // if ($_SERVER['SERVER_PORT'] != 80) // $this->serverBaseUrl .= ':' . $_SERVER['SERVER_PORT']; // } /* x2modend */ }
/** * Prepare the clientScript */ public function init() { $this->_minifyPath = Yii::app()->getRuntimePath() . '/' . 'MinifyClientScript'; $this->_minifyJsPositions = array(self::POS_BEGIN, self::POS_END, self::POS_HEAD, self::POS_LOAD, self::POS_READY); parent::init(); }