File indexing completed on 2025-01-19 05:21:06

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to padraic dot brady at yahoo dot com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Feed_Writer
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version    $Id$
0020  */
0021 
0022 /**
0023  * @see Zend_Feed_Writer_Extension_RendererInterface
0024  */
0025 // require_once 'Zend/Feed/Writer/Extension/RendererInterface.php';
0026 
0027  /**
0028  * @category   Zend
0029  * @package    Zend_Feed_Writer
0030  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0031  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0032  */
0033 abstract class Zend_Feed_Writer_Extension_RendererAbstract
0034     implements Zend_Feed_Writer_Extension_RendererInterface
0035 {
0036     /**
0037      * @var DOMDocument
0038      */
0039     protected $_dom = null;
0040 
0041     /**
0042      * @var mixed
0043      */
0044     protected $_entry = null;
0045 
0046     /**
0047      * @var DOMElement
0048      */
0049     protected $_base = null;
0050 
0051     /**
0052      * @var mixed
0053      */
0054     protected $_container = null;
0055 
0056     /**
0057      * @var string
0058      */
0059     protected $_type = null;
0060 
0061     /**
0062      * @var DOMElement
0063      */
0064     protected $_rootElement = null;
0065 
0066     /**
0067      * Encoding of all text values
0068      *
0069      * @var string
0070      */
0071     protected $_encoding = 'UTF-8';
0072 
0073     /**
0074      * Constructor
0075      *
0076      * @param  mixed $container
0077      * @return void
0078      */
0079     public function __construct($container)
0080     {
0081         $this->_container = $container;
0082     }
0083 
0084     /**
0085      * Set feed encoding
0086      *
0087      * @param  string $enc
0088      * @return Zend_Feed_Writer_Extension_RendererAbstract
0089      */
0090     public function setEncoding($enc)
0091     {
0092         $this->_encoding = $enc;
0093         return $this;
0094     }
0095 
0096     /**
0097      * Get feed encoding
0098      *
0099      * @return void
0100      */
0101     public function getEncoding()
0102     {
0103         return $this->_encoding;
0104     }
0105 
0106     /**
0107      * Set DOMDocument and DOMElement on which to operate
0108      *
0109      * @param  DOMDocument $dom
0110      * @param  DOMElement $base
0111      * @return Zend_Feed_Writer_Extension_RendererAbstract
0112      */
0113     public function setDomDocument(DOMDocument $dom, DOMElement $base)
0114     {
0115         $this->_dom  = $dom;
0116         $this->_base = $base;
0117         return $this;
0118     }
0119 
0120     /**
0121      * Get data container being rendered
0122      *
0123      * @return mixed
0124      */
0125     public function getDataContainer()
0126     {
0127         return $this->_container;
0128     }
0129 
0130     /**
0131      * Set feed type
0132      *
0133      * @param  string $type
0134      * @return Zend_Feed_Writer_Extension_RendererAbstract
0135      */
0136     public function setType($type)
0137     {
0138         $this->_type = $type;
0139         return $this;
0140     }
0141 
0142     /**
0143      * Get feedtype
0144      *
0145      * @return string
0146      */
0147     public function getType()
0148     {
0149         return $this->_type;
0150     }
0151 
0152     /**
0153      * Set root element of document
0154      *
0155      * @param  DOMElement $root
0156      * @return Zend_Feed_Writer_Extension_RendererAbstract
0157      */
0158     public function setRootElement(DOMElement $root)
0159     {
0160         $this->_rootElement = $root;
0161         return $this;
0162     }
0163 
0164     /**
0165      * Get root element
0166      *
0167      * @return DOMElement
0168      */
0169     public function getRootElement()
0170     {
0171         return $this->_rootElement;
0172     }
0173 
0174     /**
0175      * Append namespaces to feed
0176      *
0177      * @return void
0178      */
0179     abstract protected function _appendNamespaces();
0180 }