static function includeFileFromDir($path, $fileExclude = array()) { $file = ThemeFile::scanDir($path); if ($file === false) { return false; } foreach ($file as $value) { if (in_array($value, $fileExclude)) { continue; } self::includeFile($path . $value); } return true; }
/** * Before delete event */ public function beforeDelete() { // Delete all theme files first ThemeFile::model()->deleteAll('theme_id=:id', array(':id' => $this->id)); // Delete theme folder with all files $path = Yii::getPathOfAlias('application.www.themes'); $themeDir = $path . '/' . $this->dirname; if (is_dir($themeDir)) { recursiveDirRemove($themeDir); } return parent::beforeDelete(); }
function getIcon() { $file = ThemeFile::scanDir(THEME_PATH_MEDIA . 'image/public/icon_menu/'); return $file; }
function createMultisitePath() { $data = array(THEME_PATH_MULTISITE_SITE, THEME_PATH_MULTISITE_SITE_STYLE); foreach ($data as $path) { if (!ThemeFile::dirExist($path)) { @mkdir($path); } if (!ThemeFile::dirExist($path)) { return false; } } return true; }
public function delete() { $request = $this->getRequest(); $tfh = ThemeFile::getNewInstance($request->get('theme')); $tfh->removeFile($request->get('file')); }
/** * set file content */ public function actionAjaxSetThemeFileContent() { // Init $fileId = getPostParam('fileId'); $content = getPostParam('content'); // Access check if (!checkAccess('op_theme_file_edit')) { echoJson(array('error' => at('Sorry, You are not allowed to edit theme files.'))); } // Check to make sure the theme file exists $themeFile = ThemeFile::model()->with(array('theme'))->findByPk($fileId); if (!$themeFile) { echoJson(array('error' => at('Sorry, We could not located that file.'))); } // Update theme content $themeFile->content = $content; $themeFile->update(); // Log alog(at("Updated Theme '{name}', File {file}", array('{name}' => $themeFile->theme->name, '{file}' => $themeFile->file_location))); // Sync theme to save changes $themeFile->theme->syncTheme(); echoJson(array('html' => at('Theme File Saved!'))); }