|
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 license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Feed_Reader |
|
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: Entry.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
20 */ |
|
21 |
|
22 /** |
|
23 * @see Zend_Feed_Reader |
|
24 */ |
|
25 require_once 'Zend/Feed/Reader.php'; |
|
26 |
|
27 /** |
|
28 * @see Zend_Feed_Reader_Extension_EntryAbstract |
|
29 */ |
|
30 require_once 'Zend/Feed/Reader/Extension/EntryAbstract.php'; |
|
31 |
|
32 /** |
|
33 * @category Zend |
|
34 * @package Zend_Feed_Reader |
|
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
36 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
37 */ |
|
38 class Zend_Feed_Reader_Extension_Podcast_Entry extends Zend_Feed_Reader_Extension_EntryAbstract |
|
39 { |
|
40 /** |
|
41 * Get the entry author |
|
42 * |
|
43 * @return string |
|
44 */ |
|
45 public function getCastAuthor() |
|
46 { |
|
47 if (isset($this->_data['author'])) { |
|
48 return $this->_data['author']; |
|
49 } |
|
50 |
|
51 $author = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); |
|
52 |
|
53 if (!$author) { |
|
54 $author = null; |
|
55 } |
|
56 |
|
57 $this->_data['author'] = $author; |
|
58 |
|
59 return $this->_data['author']; |
|
60 } |
|
61 |
|
62 /** |
|
63 * Get the entry block |
|
64 * |
|
65 * @return string |
|
66 */ |
|
67 public function getBlock() |
|
68 { |
|
69 if (isset($this->_data['block'])) { |
|
70 return $this->_data['block']; |
|
71 } |
|
72 |
|
73 $block = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); |
|
74 |
|
75 if (!$block) { |
|
76 $block = null; |
|
77 } |
|
78 |
|
79 $this->_data['block'] = $block; |
|
80 |
|
81 return $this->_data['block']; |
|
82 } |
|
83 |
|
84 /** |
|
85 * Get the entry duration |
|
86 * |
|
87 * @return string |
|
88 */ |
|
89 public function getDuration() |
|
90 { |
|
91 if (isset($this->_data['duration'])) { |
|
92 return $this->_data['duration']; |
|
93 } |
|
94 |
|
95 $duration = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); |
|
96 |
|
97 if (!$duration) { |
|
98 $duration = null; |
|
99 } |
|
100 |
|
101 $this->_data['duration'] = $duration; |
|
102 |
|
103 return $this->_data['duration']; |
|
104 } |
|
105 |
|
106 /** |
|
107 * Get the entry explicit |
|
108 * |
|
109 * @return string |
|
110 */ |
|
111 public function getExplicit() |
|
112 { |
|
113 if (isset($this->_data['explicit'])) { |
|
114 return $this->_data['explicit']; |
|
115 } |
|
116 |
|
117 $explicit = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); |
|
118 |
|
119 if (!$explicit) { |
|
120 $explicit = null; |
|
121 } |
|
122 |
|
123 $this->_data['explicit'] = $explicit; |
|
124 |
|
125 return $this->_data['explicit']; |
|
126 } |
|
127 |
|
128 /** |
|
129 * Get the entry keywords |
|
130 * |
|
131 * @return string |
|
132 */ |
|
133 public function getKeywords() |
|
134 { |
|
135 if (isset($this->_data['keywords'])) { |
|
136 return $this->_data['keywords']; |
|
137 } |
|
138 |
|
139 $keywords = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); |
|
140 |
|
141 if (!$keywords) { |
|
142 $keywords = null; |
|
143 } |
|
144 |
|
145 $this->_data['keywords'] = $keywords; |
|
146 |
|
147 return $this->_data['keywords']; |
|
148 } |
|
149 |
|
150 /** |
|
151 * Get the entry subtitle |
|
152 * |
|
153 * @return string |
|
154 */ |
|
155 public function getSubtitle() |
|
156 { |
|
157 if (isset($this->_data['subtitle'])) { |
|
158 return $this->_data['subtitle']; |
|
159 } |
|
160 |
|
161 $subtitle = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); |
|
162 |
|
163 if (!$subtitle) { |
|
164 $subtitle = null; |
|
165 } |
|
166 |
|
167 $this->_data['subtitle'] = $subtitle; |
|
168 |
|
169 return $this->_data['subtitle']; |
|
170 } |
|
171 |
|
172 /** |
|
173 * Get the entry summary |
|
174 * |
|
175 * @return string |
|
176 */ |
|
177 public function getSummary() |
|
178 { |
|
179 if (isset($this->_data['summary'])) { |
|
180 return $this->_data['summary']; |
|
181 } |
|
182 |
|
183 $summary = $this->_xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); |
|
184 |
|
185 if (!$summary) { |
|
186 $summary = null; |
|
187 } |
|
188 |
|
189 $this->_data['summary'] = $summary; |
|
190 |
|
191 return $this->_data['summary']; |
|
192 } |
|
193 |
|
194 /** |
|
195 * Register iTunes namespace |
|
196 * |
|
197 */ |
|
198 protected function _registerNamespaces() |
|
199 { |
|
200 $this->_xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); |
|
201 } |
|
202 } |