/** * Initialize the editMe widget. */ public function init() { $this->_ckeExtensionPath = dirname(dirname(__FILE__)) . '/vendor/CKEditor'; // Start the publishing process if it has not been executed on the current page already if (empty(self::$_ckeAssetUrl)) { $excludeFiles = Yii::app()->assetManager->excludeFiles; array_push(Yii::app()->assetManager->excludeFiles, 'CHANGES.md', 'README.md', 'samples'); self::$_ckeAssetUrl = Yii::app()->assetManager->publish($this->_ckeExtensionPath); Yii::app()->assetManager->excludeFiles = $excludeFiles; $ckeAssetPath = str_replace(Yii::app()->assetManager->baseUrl, Yii::app()->assetManager->basePath, self::$_ckeAssetUrl); if (@is_file($ckeAssetPath . '/editMe.' . md5(self::$_ckeAssetUrl) . '.min.js') === false) { $scriptContents[] = 'var CKEDITOR_BASEPATH=' . CJavaScript::encode(self::$_ckeAssetUrl . '/') . ';'; $scriptContents[] = @file_get_contents($ckeAssetPath . '/ckeditor.js'); $scriptContents[] = @file_get_contents($ckeAssetPath . '/adapters/jquery.js'); @file_put_contents($ckeAssetPath . '/editMe.' . md5(self::$_ckeAssetUrl) . '.min.js', implode("\n", $scriptContents), LOCK_EX); } } }
/** * Initialize the editMe widget. */ public function init() { $this->_ckeExtensionPath = dirname(dirname(__FILE__)) . '/vendors/CKEditor'; // Start the publishing process if it has not been executed on the current page already if (empty(self::$_ckeAssetUrl)) { $excludeFiles = Yii::app()->assetManager->excludeFiles; array_push(Yii::app()->assetManager->excludeFiles, '_source.7z', 'INSTALL.html', 'CHANGES.html', 'ckeditor_basic_source.js', 'ckeditor_basic.js', 'ckeditor_php4.php', 'ckeditor_php5.php', 'ckeditor_source.js', 'ckeditor.asp', 'ckeditor.pack', 'ckeditor.php', '_samples', '_source'); self::$_ckeAssetUrl = Yii::app()->assetManager->publish($this->_ckeExtensionPath); Yii::app()->assetManager->excludeFiles = $excludeFiles; $ckeAssetPath = str_replace(Yii::app()->assetManager->baseUrl, Yii::app()->assetManager->basePath, self::$_ckeAssetUrl); if (@is_file($ckeAssetPath . '/' . md5(self::$_ckeAssetUrl) . '.js') === false) { @file_put_contents($ckeAssetPath . '/' . md5(self::$_ckeAssetUrl) . '.js', 'var CKEDITOR_BASEPATH="' . self::$_ckeAssetUrl . '/";', LOCK_EX); } } }