|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to padraic dot brady at yahoo dot com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Feed_Writer_Entry_Rss |
|
17 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
18 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
19 * @version $Id: RendererAbstract.php 20785 2010-01-31 09:43:03Z mikaelkael $ |
|
20 */ |
|
21 |
|
22 /** |
|
23 * @see Zend_Feed_Writer_Extension_RendererInterface |
|
24 */ |
|
25 require_once 'Zend/Feed/Writer/Extension/RendererInterface.php'; |
|
26 |
|
27 /** |
|
28 * @category Zend |
|
29 * @package Zend_Feed_Writer_Entry_Rss |
|
30 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
31 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
32 */ |
|
33 abstract class Zend_Feed_Writer_Extension_RendererAbstract |
|
34 implements Zend_Feed_Writer_Extension_RendererInterface |
|
35 { |
|
36 /** |
|
37 * @var DOMDocument |
|
38 */ |
|
39 protected $_dom = null; |
|
40 |
|
41 /** |
|
42 * @var mixed |
|
43 */ |
|
44 protected $_entry = null; |
|
45 |
|
46 /** |
|
47 * @var DOMElement |
|
48 */ |
|
49 protected $_base = null; |
|
50 |
|
51 /** |
|
52 * @var mixed |
|
53 */ |
|
54 protected $_container = null; |
|
55 |
|
56 /** |
|
57 * @var string |
|
58 */ |
|
59 protected $_type = null; |
|
60 |
|
61 /** |
|
62 * @var DOMElement |
|
63 */ |
|
64 protected $_rootElement = null; |
|
65 |
|
66 /** |
|
67 * Encoding of all text values |
|
68 * |
|
69 * @var string |
|
70 */ |
|
71 protected $_encoding = 'UTF-8'; |
|
72 |
|
73 /** |
|
74 * Constructor |
|
75 * |
|
76 * @param mixed $container |
|
77 * @return void |
|
78 */ |
|
79 public function __construct($container) |
|
80 { |
|
81 $this->_container = $container; |
|
82 } |
|
83 |
|
84 /** |
|
85 * Set feed encoding |
|
86 * |
|
87 * @param string $enc |
|
88 * @return Zend_Feed_Writer_Extension_RendererAbstract |
|
89 */ |
|
90 public function setEncoding($enc) |
|
91 { |
|
92 $this->_encoding = $enc; |
|
93 return $this; |
|
94 } |
|
95 |
|
96 /** |
|
97 * Get feed encoding |
|
98 * |
|
99 * @return void |
|
100 */ |
|
101 public function getEncoding() |
|
102 { |
|
103 return $this->_encoding; |
|
104 } |
|
105 |
|
106 /** |
|
107 * Set DOMDocument and DOMElement on which to operate |
|
108 * |
|
109 * @param DOMDocument $dom |
|
110 * @param DOMElement $base |
|
111 * @return Zend_Feed_Writer_Extension_RendererAbstract |
|
112 */ |
|
113 public function setDomDocument(DOMDocument $dom, DOMElement $base) |
|
114 { |
|
115 $this->_dom = $dom; |
|
116 $this->_base = $base; |
|
117 return $this; |
|
118 } |
|
119 |
|
120 /** |
|
121 * Get data container being rendered |
|
122 * |
|
123 * @return mixed |
|
124 */ |
|
125 public function getDataContainer() |
|
126 { |
|
127 return $this->_container; |
|
128 } |
|
129 |
|
130 /** |
|
131 * Set feed type |
|
132 * |
|
133 * @param string $type |
|
134 * @return Zend_Feed_Writer_Extension_RendererAbstract |
|
135 */ |
|
136 public function setType($type) |
|
137 { |
|
138 $this->_type = $type; |
|
139 return $this; |
|
140 } |
|
141 |
|
142 /** |
|
143 * Get feedtype |
|
144 * |
|
145 * @return string |
|
146 */ |
|
147 public function getType() |
|
148 { |
|
149 return $this->_type; |
|
150 } |
|
151 |
|
152 /** |
|
153 * Set root element of document |
|
154 * |
|
155 * @param DOMElement $root |
|
156 * @return Zend_Feed_Writer_Extension_RendererAbstract |
|
157 */ |
|
158 public function setRootElement(DOMElement $root) |
|
159 { |
|
160 $this->_rootElement = $root; |
|
161 return $this; |
|
162 } |
|
163 |
|
164 /** |
|
165 * Get root element |
|
166 * |
|
167 * @return DOMElement |
|
168 */ |
|
169 public function getRootElement() |
|
170 { |
|
171 return $this->_rootElement; |
|
172 } |
|
173 |
|
174 /** |
|
175 * Append namespaces to feed |
|
176 * |
|
177 * @return void |
|
178 */ |
|
179 abstract protected function _appendNamespaces(); |
|
180 } |