private function canDisableTheme($panelName) { $iterator = new Gpf_Io_DirectoryIterator(Gpf_Paths::getInstance()->getTopTemplatePath() . $panelName, '', false, true); $enabledCount = 0; foreach ($iterator as $fullName => $themeId) { if ($themeId == rtrim(Gpf_Paths::DEFAULT_THEME, '/')) { continue; } try { $theme = new Gpf_Desktop_Theme($themeId, $panelName); if ($theme->isEnabled()) { $enabledCount++; if ($enabledCount == 2) { return true; } } } catch (Gpf_Exception $e) { Gpf_Log::error($e->getMessage()); } } return false; }
public function isThemeValid($theme) { if (strpos($theme, '_') === 0) { return false; } $themePath = Gpf_Paths::getInstance()->getTopTemplatePath() . $this->getPanelName() . '/' . $theme . '/'; if (!Gpf_Io_File::isFileExists($themePath) || !Gpf_Io_File::isFileExists($themePath . Gpf_Desktop_Theme::CONFIG_FILE_NAME)) { return false; } $themeObj = new Gpf_Desktop_Theme($theme, $this->getPanelName()); return $themeObj->isEnabled(); }