Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Feed / Writer / Extension / Content / Renderer / Entry.php
blob8785fb7320ba86c94ee3b80fd440c707535263e9
1 <?php
2 /**
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
8 */
10 namespace Zend\Feed\Writer\Extension\Content\Renderer;
12 use DOMDocument;
13 use DOMElement;
14 use Zend\Feed\Writer\Extension;
16 /**
18 class Entry extends Extension\AbstractRenderer
21 /**
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.
26 * @var bool
28 protected $called = false;
30 /**
31 * Render entry
33 * @return void
35 public function render()
37 if (strtolower($this->getType()) == 'atom') {
38 return;
40 $this->_setContent($this->dom, $this->base);
41 if ($this->called) {
42 $this->_appendNamespaces();
46 /**
47 * Append namespaces to root element
49 * @return void
51 protected function _appendNamespaces()
53 $this->getRootElement()->setAttribute('xmlns:content',
54 'http://purl.org/rss/1.0/modules/content/');
57 /**
58 * Set entry content
60 * @param DOMDocument $dom
61 * @param DOMElement $root
62 * @return void
64 protected function _setContent(DOMDocument $dom, DOMElement $root)
66 $content = $this->getDataContainer()->getContent();
67 if (!$content) {
68 return;
70 $element = $dom->createElement('content:encoded');
71 $root->appendChild($element);
72 $cdata = $dom->createCDATASection($content);
73 $element->appendChild($cdata);
74 $this->called = true;