public function readXMLConfig($custom_conf = null)
{
if (!is_null($this->_xmlConfigTree) && !$custom_conf) {
return $this->_xmlConfigTree;
}
$path = $GLOBALS['registry']->get('fileroot', $this->_app) . '/config';
if ($custom_conf) {
$this->_currentConfig = $custom_conf;
} else {
/* Fetch the current conf.php contents. */
@eval($this->getPHPConfig());
if (isset($conf)) {
$this->_currentConfig = $conf;
}
}
/* Load the DOM object. */
$dom = new DOMDocument();
$dom->loadXML(file_get_contents($path . '/conf.xml'));
/* Check if there is a CVS/Git version tag and store it. */
$node = $dom->firstChild;
while (!empty($node)) {
if ($node->nodeType == XML_COMMENT_NODE && ($vers_tag = $this->getVersion($node->nodeValue))) {
$this->_versionTag = $vers_tag . "\n";
break;
}
$node = $node->nextSibling;
}
/* Parse the config file. */
$this->_xmlConfigTree = array();
$root = $dom->documentElement;
if ($root->hasChildNodes()) {
$this->_parseLevel($this->_xmlConfigTree, $root->childNodes, '');
}
/* Parse additional config files. */
foreach (glob($path . '/conf.d/*.xml') as $additional) {
$dom = new DOMDocument();
$dom->load($additional);
$root = $dom->documentElement;
if ($root->hasChildNodes()) {
$tree = array();
$this->_parseLevel($tree, $root->childNodes, '');
$this->_xmlConfigTree = array_replace_recursive($this->_xmlConfigTree, $tree);
}
}
return $this->_xmlConfigTree;
}