/** * Get DOM node */ public function getNode($document) { $entry = $document->createElement('entry'); $entry->appendChild(AtomFeed::getTextNode($document, 'title', $this->title)); $entry->appendChild(AtomFeed::getTextNode($document, 'id', $this->id)); $entry->appendChild(AtomFeed::getDateNode($document, 'updated', $this->updated)); if ($this->summary !== null) { $entry->appendChild(AtomFeed::getCDATANode($document, 'summary', $this->summary)); } if ($this->link !== null) { $entry->appendChild($this->link->getNode($document)); } if ($this->published !== null) { $entry->appendChild(AtomFeed::getDateNode($document, 'published', $this->published)); } if ($this->contributor !== null) { $entry->appendChild($this->contributor->getNode($document)); } // add authors foreach ($this->authors as $author) { $entry->appendChild($author->getNode($document)); } if ($this->content !== null) { $entry->appendChild(AtomFeed::getCDATANode($document, 'content', $this->content)); } return $entry; }
/** * Get DOM node */ public function getNode($document) { $node_name = $this->node_name; if ($this->name_space !== null) { $name = $this->name_space . ':' . $node_name; } $author = $document->createElement($node_name); $author->appendChild(AtomFeed::getTextNode($document, 'name', $this->name, $this->name_space)); if ($this->email !== null) { $author->appendChild(AtomFeed::getTextNode($document, 'email', $this->email, $this->name_space)); } if ($this->uri !== null) { $author->appendChild(AtomFeed::getTextNode($document, 'uri', $this->uri, $this->name_space)); } return $author; }