/** * @param \DomDocument $document * @param FeedOutInterface $content */ public function setMetas(\DOMDocument $document, FeedOutInterface $content) { $elements = array(); $elements[] = $document->createElement('title', htmlspecialchars($content->getTitle())); $elements[] = $document->createElement('description', htmlspecialchars($content->getDescription())); $elements[] = $document->createElement('link', $content->getLink()); $elements[] = $document->createElement('lastBuildDate', $content->getLastModified()->format(\DateTime::RSS)); $elements[] = $document->createElement('pubDate', $content->getLastModified()->format(\DateTime::RSS)); foreach ($elements as $element) { $document->documentElement->firstChild->appendChild($element); } }
/** * @param \DomDocument $document * @param FeedOutInterface $content */ public function setMetas(\DOMDocument $document, FeedOutInterface $content) { $elements = array(); $elements[] = $document->createElement('title', htmlspecialchars($content->getTitle())); $elements[] = $document->createElement('subtitle', $content->getDescription()); $elements[] = $document->createElement('id', $content->getLink()); $link = $document->createElement('link'); $link->setAttribute('href', $content->getLink()); $link->setAttribute('rel', 'self'); $elements[] = $link; $elements[] = $document->createElement('updated', $content->getLastModified()->format(\DateTime::ATOM)); foreach ($elements as $element) { $document->documentElement->appendChild($element); } }