/** * Build OPML feed * * @access public * @param string $filename * @return string */ public function build($filename = '') { $this->document = new DomDocument('1.0', 'UTF-8'); $this->document->formatOutput = true; $opmlElement = $this->document->createElement('opml'); $opmlElement->setAttribute('version', '1.0'); $headElement = $this->document->createElement('head'); if ($this->subscriptionList->getTitle() !== '') { $titleElement = $this->document->createElement('title'); $titleElement->appendChild($this->document->createTextNode($this->subscriptionList->getTitle())); $headElement->appendChild($titleElement); } $opmlElement->appendChild($headElement); $opmlElement->appendChild($this->buildBody()); $this->document->appendChild($opmlElement); if ($filename !== '') { $this->document->save($filename); return ''; } return $this->document->saveXML(); }
/** * Parse title * * @access protected * @param SimpleXMLElement $xml */ protected function parseTitle(SimpleXMLElement $xml) { $this->subscriptionList->setTitle((string) $xml->title); }