3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 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\Content\Renderer
;
14 use Zend\Feed\Writer\Extension
;
18 class Entry
extends Extension\AbstractRenderer
22 * Set to TRUE if a rendering method actually renders something. This
23 * is used to prevent premature appending of a XML namespace declaration
24 * until an element which requires it is actually appended.
28 protected $called = false;
35 public function render()
37 if (strtolower($this->getType()) == 'atom') {
40 $this->_setContent($this->dom
, $this->base
);
42 $this->_appendNamespaces();
47 * Append namespaces to root element
51 protected function _appendNamespaces()
53 $this->getRootElement()->setAttribute('xmlns:content',
54 'http://purl.org/rss/1.0/modules/content/');
60 * @param DOMDocument $dom
61 * @param DOMElement $root
64 protected function _setContent(DOMDocument
$dom, DOMElement
$root)
66 $content = $this->getDataContainer()->getContent();
70 $element = $dom->createElement('content:encoded');
71 $root->appendChild($element);
72 $cdata = $dom->createCDATASection($content);
73 $element->appendChild($cdata);