X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fzendframework%2Fzend-feed%2Fsrc%2FWriter%2FExtension%2FDublinCore%2FRenderer%2FFeed.php;fp=vendor%2Fzendframework%2Fzend-feed%2Fsrc%2FWriter%2FExtension%2FDublinCore%2FRenderer%2FFeed.php;h=e69f95056089639f026f3c0a0f9d582bba0a777d;hb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;hp=0000000000000000000000000000000000000000;hpb=57c063afa3f66b07c4bbddc2d6129a96d90f0aad;p=yaffs-website diff --git a/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php new file mode 100644 index 000000000..e69f95056 --- /dev/null +++ b/vendor/zendframework/zend-feed/src/Writer/Extension/DublinCore/Renderer/Feed.php @@ -0,0 +1,85 @@ +getType()) == 'atom') { + return; + } + $this->_setAuthors($this->dom, $this->base); + if ($this->called) { + $this->_appendNamespaces(); + } + } + + /** + * Append namespaces to feed element + * + * @return void + */ + // @codingStandardsIgnoreStart + protected function _appendNamespaces() + { + // @codingStandardsIgnoreEnd + $this->getRootElement()->setAttribute( + 'xmlns:dc', + 'http://purl.org/dc/elements/1.1/' + ); + } + + /** + * Set feed authors + * + * @param DOMDocument $dom + * @param DOMElement $root + * @return void + */ + // @codingStandardsIgnoreStart + protected function _setAuthors(DOMDocument $dom, DOMElement $root) + { + // @codingStandardsIgnoreEnd + $authors = $this->getDataContainer()->getAuthors(); + if (! $authors || empty($authors)) { + return; + } + foreach ($authors as $data) { + $author = $this->dom->createElement('dc:creator'); + if (array_key_exists('name', $data)) { + $text = $dom->createTextNode($data['name']); + $author->appendChild($text); + $root->appendChild($author); + } + } + $this->called = true; + } +}