/** * Returns an XML file with current profile's settings (configuration + filter options) * * @return string The XML export data */ function &export() { static $_xml; // Static variable holding export data if (!$_xml) { // Load JoomlaPack registry class and get a copy of the DBO jpimport('models.registry', true); $registry = new JoomlapackModelRegistry(array('id' => $this->_id)); $db =& JFactory::getDBO(); // Create XML header and dump configuration if (!defined('JPCR')) { define('JPCR', "\n"); } $_xml = '<?xml version="1.0" encoding="utf-8"?>' . JPCR; $_xml .= '<jpexport version="1.3">' . JPCR; $_xml .= "\t" . '<config>' . JPCR; $reg =& $registry->getRawRegistryArray(); foreach ($reg as $key => $value) { $_xml .= "\t\t<{$key}><![CDATA[" . serialize($value) . "]]></{$key}>\n"; } $_xml .= "\t" . '</config>' . JPCR; // Dump inclusion filters $_xml .= "\t" . '<inclusion>' . JPCR; $sql = 'SELECT * FROM #__jp_inclusion WHERE ' . $db->nameQuote('profile') . ' = ' . $db->Quote($this->_id); $db->setQuery($sql); $data = $db->loadAssocList(); foreach ($data as $entry) { $_xml .= "\t\t<entry><![CDATA[" . serialize($entry) . "]]></entry>\n"; } $_xml .= "\t" . '</inclusion>' . JPCR; // Dump exclusion filters $_xml .= "\t" . '<exclusion>' . JPCR; $sql = 'SELECT * FROM #__jp_exclusion WHERE ' . $db->nameQuote('profile') . ' = ' . $db->Quote($this->_id); $db->setQuery($sql); $data = $db->loadAssocList(); foreach ($data as $entry) { $_xml .= "\t\t<entry><![CDATA[" . serialize($entry) . "]]></entry>\n"; } $_xml .= "\t" . '</exclusion>' . JPCR; // Finish up the document $_xml .= '</jpexport>' . JPCR; } return $_xml; }