/** * @param XMLFilenameProcessor $xmlModuleName * @param Object $customArgs * @return void * @desc Add custom setup elements */ public function Setup($xmlModuleName, $customArgs) { $this->_start = microtime(true); $this->_xmlModuleName = $xmlModuleName; $this->_context = Context::getInstance(); $this->_cacheFile = new CacheFilenameProcessor($this->_xmlModuleName->ToString()); $this->_action = $this->_context->get("action"); if ($this->_action == "") { $this->_action = $this->_context->get("acao"); } $this->CustomSetup($customArgs); $this->defaultXmlnukeDocument = new XmlnukeDocument(); $this->_url = new XmlnukeManageUrl(URLTYPE::MODULE, $this->_xmlModuleName->ToString()); $this->_moduleName = $this->_xmlModuleName->ToString(); }
/** *@desc Get a XMLDocument from a XMLFile *@param XMLFilenameProcessor $xmlFile XML File *@return DOMDocument */ public function getXmlDocument($xmlFile) { $this->_context->setXml($xmlFile->ToString()); // Load XMLDocument and add ALL and INDEX nodes $xmlDoc = new DOMDocument(); try { if (!($xmlFile->getFilenameLocation() == ForceFilenameLocation::PathFromRoot)) { $xmlDoc = $this->_context->getXMLDataBase()->getDocument($xmlFile->FullQualifiedName(), null); } else { $xmlDoc = XmlUtil::CreateXmlDocumentFromFile($xmlFile->FullQualifiedNameAndPath()); } } catch (Exception $ex) { $xmlFileNotFound = new XMLFilenameProcessor("notfound"); if ($this->_context->getXMLDataBase()->existsDocument($xmlFileNotFound->FullQualifiedName())) { $xmlDoc = $this->_context->getXMLDataBase()->getDocument($xmlFileNotFound->FullQualifiedName(), null); } else { throw $ex; } } $xmlRootNode = $xmlDoc->getElementsByTagName("page")->item(0); if ($xmlRootNode != null) { $this->addXMLDefault($xmlRootNode); } return $xmlDoc; }