3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Feed\Writer\Extension\DublinCore\Renderer;
14 use Zend\Feed\Writer\Extension;
18 class Feed extends Extension\AbstractRenderer
21 * Set to TRUE if a rendering method actually renders something. This
22 * is used to prevent premature appending of a XML namespace declaration
23 * until an element which requires it is actually appended.
27 protected $called = false;
34 public function render()
36 if (strtolower($this->getType()) == 'atom') {
39 $this->_setAuthors($this->dom, $this->base);
41 $this->_appendNamespaces();
46 * Append namespaces to feed element
50 // @codingStandardsIgnoreStart
51 protected function _appendNamespaces()
53 // @codingStandardsIgnoreEnd
54 $this->getRootElement()->setAttribute(
56 'http://purl.org/dc/elements/1.1/'
63 * @param DOMDocument $dom
64 * @param DOMElement $root
67 // @codingStandardsIgnoreStart
68 protected function _setAuthors(DOMDocument $dom, DOMElement $root)
70 // @codingStandardsIgnoreEnd
71 $authors = $this->getDataContainer()->getAuthors();
72 if (! $authors || empty($authors)) {
75 foreach ($authors as $data) {
76 $author = $this->dom->createElement('dc:creator');
77 if (array_key_exists('name', $data)) {
78 $text = $dom->createTextNode($data['name']);
79 $author->appendChild($text);
80 $root->appendChild($author);