/** * Generate XML Archive for skin set * * @access public * @param int Skin set ID * @param boolean Modifications in this set only * @param array [Array of apps to export from. Default is all] * @return string XML */ public function generateSetXMLArchive($setID = 0, $setOnly = FALSE, $appslimit = null) { //----------------------------------------- // INIT //----------------------------------------- $templates = array(); $csss = array(); $replacements = ""; $css = ""; $setData = $this->fetchSkinData($setID); //----------------------------------------- // Reset handlers //----------------------------------------- $this->_resetErrorHandle(); $this->_resetMessageHandle(); //----------------------------------------- // First up... fetch templates //----------------------------------------- foreach (ipsRegistry::$applications as $appDir => $data) { if (is_array($appslimit) and !in_array($appDir, $appslimit)) { continue; } if (!empty($data['app_enabled'])) { $templates[$appDir] = $this->generateTemplateXML($appDir, $setID, $setOnly); $csss[$appDir] = $this->generateCSSXML($appDir, $setID, $setOnly); } } //----------------------------------------- // Replacements //----------------------------------------- $replacements = $this->generateReplacementsXML($setID, $setOnly); //----------------------------------------- // Information //----------------------------------------- $info = $this->generateInfoXML($setID); //----------------------------------------- // De-bug //----------------------------------------- foreach ($templates as $app_dir => $templateXML) { IPSDebug::addLogMessage("Template Export: {$app_dir}\n" . $templateXML, 'admin-setExport', false, true, true); } foreach ($csss as $app_dir => $cssXML) { IPSDebug::addLogMessage("CSS Export: {$app_dir}\n" . $cssXML, 'admin-setExport', false, true); } IPSDebug::addLogMessage("Replacements Export:\n" . $replacements, 'admin-setExport', false, true); IPSDebug::addLogMessage("Info Export:\n" . $info, 'admin-setExport', false, true); //----------------------------------------- // Create new XML archive... //----------------------------------------- require_once IPS_KERNEL_PATH . 'classXMLArchive.php'; /*noLibHook*/ $xmlArchive = new classXMLArchive(); /* Add in version numbers */ $version = IPSLib::fetchVersionNumber(); $xmlArchive->addRootTagValues(array('ipbLongVersion' => $version['long'], 'ipbHumanVersion' => $version['human'])); # Templates foreach ($templates as $app_dir => $templateXML) { $xmlArchive->add($templateXML, "templates/" . $app_dir . ".xml"); } # CSS foreach ($csss as $app_dir => $cssXML) { $xmlArchive->add($cssXML, "css/" . $app_dir . ".xml"); } # Replacements $xmlArchive->add($replacements, "replacements.xml"); # Information $xmlArchive->add($info, 'info.xml'); return $xmlArchive->getArchiveContents(); }