| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- /**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category Zend
- * @package Zend_Feed_Writer
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- * @version $Id$
- */
- /**
- * @see Zend_Feed_Writer_Extension_RendererAbstract
- */
- require_once 'Zend/Feed/Writer/Extension/RendererAbstract.php';
- /**
- * @category Zend
- * @package Zend_Feed_Writer
- * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- * @license http://framework.zend.com/license/new-bsd New BSD License
- */
- class Zend_Feed_Writer_Extension_Content_Renderer_Entry
- extends Zend_Feed_Writer_Extension_RendererAbstract
- {
- /**
- * Set to TRUE if a rendering method actually renders something. This
- * is used to prevent premature appending of a XML namespace declaration
- * until an element which requires it is actually appended.
- *
- * @var bool
- */
- protected $_called = false;
- /**
- * Render entry
- *
- * @return void
- */
- public function render()
- {
- if (strtolower($this->getType()) == 'atom') {
- return;
- }
- $this->_setContent($this->_dom, $this->_base);
- if ($this->_called) {
- $this->_appendNamespaces();
- }
- }
- /**
- * Append namespaces to root element
- *
- * @return void
- */
- protected function _appendNamespaces()
- {
- $this->getRootElement()->setAttribute('xmlns:content',
- 'http://purl.org/rss/1.0/modules/content/');
- }
- /**
- * Set entry content
- *
- * @param DOMDocument $dom
- * @param DOMElement $root
- * @return void
- */
- protected function _setContent(DOMDocument $dom, DOMElement $root)
- {
- $content = $this->getDataContainer()->getContent();
- if (!$content) {
- return;
- }
- $element = $dom->createElement('content:encoded');
- $root->appendChild($element);
- $cdata = $dom->createCDATASection($content);
- $element->appendChild($cdata);
- $this->_called = true;
- }
- }
|