/** * Read xml file and create elements * * @param ClipboardXmlElement $objFile * @param string $strPastePos * @param integer $intElemId */ public function readXml($objFile, $strPastePos, $intElemId) { $this->Session->set('clipboardExt', array('readXML' => TRUE)); try { $objXml = new XMLReader(); $objXml->open($objFile->getFilePath('full')); while ($objXml->read()) { switch ($objXml->nodeType) { case XMLReader::ELEMENT: switch ($objXml->localName) { case 'encryptionKey': $objXml->read(); $this->_strEncryptionKey = $objXml->value; break; case 'page': $this->createPage($objXml, $objXml->getAttribute("table"), $strPastePos, $intElemId, FALSE, $objXml->getAttribute("grouped") ? TRUE : FALSE); break; case 'article': $this->createArticle($objXml, $objXml->getAttribute("table"), $strPastePos, $intElemId, FALSE, $objXml->getAttribute("grouped") ? TRUE : FALSE); break; case 'content': $this->createContent($objXml, $objXml->getAttribute("table"), $strPastePos, $intElemId, FALSE, $objXml->getAttribute("grouped") ? TRUE : FALSE); break; case 'module': $this->createModule($objXml, $objXml->getAttribute("table"), $strPastePos, $intElemId, TRUE, $objXml->getAttribute("grouped") ? TRUE : FALSE); break; default: break; } break; default: break; } } $objXml->close(); } catch (Exception $exc) { $this->Session->set('clipboardExt', array('readXML' => FALSE)); } $this->Session->set('clipboardExt', array('readXML' => FALSE)); }
/** * Fill the clipboard from files */ protected function _createClipboardFromFiles() { $arrFiles = scan(TL_ROOT . '/' . $this->getPath()); if (is_array($arrFiles) && count($arrFiles) > 0) { foreach ($arrFiles as $strFileName) { $arrFile = $this->_objHelper->getArrFromFileName($this->getPath() . '/' . $strFileName); if ($arrFile[0] != $this->_objHelper->getPageType()) { continue; } if ($this->_fileExists($strFileName)) { $objFile = new ClipboardXmlElement($strFileName, $this->getPath()); } $this->_arrClipboardElements[$objFile->getHash()] = $objFile; } } }