public static function GetConfigFile() { $file = dirname(dirname(__FILE__)) . '/configuration.xml'; if (file_exists($file) && XMLDoc::validate($file)) { return $file; } else { die('Configuration File not found!'); } }
/** * Takes the internal $distros array and returns an XML * document representation of it. * * @access public * @return string * */ function buildDistFile() { global $loader; $loader->inc('saf.XML.Doc'); $doc = new XMLDoc(); $root =& $doc->addRoot('modfinderDistributions'); foreach ($this->distros as $distro) { $dist =& $root->addChild('distribution'); $dist->addChild('name', $distro->name); $dist->addChild('downloadSite', $distro->downloadSite); $dist->addChild('checksumSite', $distro->checksumSite); $dist->addChild('webSite', $distro->webSite); unset($dist); } return $doc->write(); }
/** * Takes an associative array or an object and returns an XMLDoc object * created from it. $toptag is the name of the root node. * * @access public * @param mixed $obj * @param string $toptag * @return object * */ function &makeDoc($obj, $toptag) { $doc = new XMLDoc(); $root =& $doc->addRoot($toptag); if (is_object($obj)) { foreach (get_object_vars($obj) as $node => $content) { $root->addChild($node, $content); } } elseif (is_array($obj)) { foreach ($obj as $node => $content) { $root->addChild($node, $content); } } else { $this->error = '$obj is not an object or an array.'; } return $doc; }