/** * Load manifesto file, and set infomations from the file to member * property. * * @return bool */ function loadManifesto($file) { if (file_exists($file)) { $iniHandler = new XCube_IniHandler($file, true); $this->_mManifesto = $iniHandler->getAllConfig(); $this->mName = isset($this->_mManifesto['Manifesto']['Name']) ? $this->_mManifesto['Manifesto']['Name'] : ""; $this->mDepends = isset($this->_mManifesto['Manifesto']['Depends']) ? $this->_mManifesto['Manifesto']['Depends'] : ""; $this->mVersion = isset($this->_mManifesto['Manifesto']['Version']) ? $this->_mManifesto['Manifesto']['Version'] : ""; $this->mUrl = isset($this->_mManifesto['Manifesto']['Url']) ? $this->_mManifesto['Manifesto']['Url'] : ""; $this->mRenderSystemName = isset($this->_mManifesto['Theme']['RenderSystem']) ? $this->_mManifesto['Theme']['RenderSystem'] : ""; $this->mAuthor = isset($this->_mManifesto['Theme']['Author']) ? $this->_mManifesto['Theme']['Author'] : ""; if (isset($this->_mManifesto['Theme']['ScreenShot'])) { $this->mScreenShot = $this->_mManifesto['Theme']['ScreenShot']; } if (isset($this->_mManifesto['Theme']['Description'])) { $this->mDescription = $this->_mManifesto['Theme']['Description']; } $this->mFormat = isset($this->_mManifesto['Theme']['Format']) ? $this->_mManifesto['Theme']['Format'] : ""; if (isset($this->_mManifesto['Theme']['License'])) { $this->mLicense = $this->_mManifesto['Theme']['License']; $this->mLicence = $this->_mManifesto['Theme']['License']; } elseif (isset($this->_mManifesto['Theme']['Licence'])) { // For typo $this->mLicense = $this->_mManifesto['Theme']['Licence']; $this->mLicence = $this->_mManifesto['Theme']['Licence']; } return true; } else { return false; } }
/** * Search themes that Legacy_RenderSystem can render in file system, then register by handler. */ function searchThemes() { $themeList = array(); if ($handler = opendir(XOOPS_THEME_PATH)) { while (($dir = readdir($handler)) !== false) { if ($dir == "." || $dir == "..") { continue; } $themeDir = XOOPS_THEME_PATH . "/" . $dir; if (is_dir($themeDir)) { $manifesto = array(); if (file_exists($mnfFile = $themeDir . "/manifesto.ini.php")) { $iniHandler = new XCube_IniHandler($mnfFile, true); $manifesto = $iniHandler->getAllConfig(); } if (count($manifesto) > 0) { // // If this system can use this theme, add this to list. // if (isset($manifesto['Manifesto']) && isset($manifesto['Manifesto']['Depends']) && preg_match('/Legacy_RenderSystem(\\s|,|$)/', $manifesto['Manifesto']['Depends'])) { $themeList[] = $dir; } } else { $file = $themeDir . "/theme.html"; if (file_exists($file)) { $themeList[] = $dir; } } } } closedir($handler); } return $themeList; }