Mercurial > hg > cmmr2012-drupal-site
comparison vendor/zendframework/zend-feed/src/Reader/Extension/Podcast/Entry.php @ 2:5311817fb629
Theme updates
author | Chris Cannam |
---|---|
date | Tue, 10 Jul 2018 13:19:18 +0000 |
parents | c75dbcec494b |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
1:0b0e5f3b1e83 | 2:5311817fb629 |
---|---|
1 <?php | 1 <?php |
2 /** | 2 /** |
3 * Zend Framework (http://framework.zend.com/) | 3 * @see https://github.com/zendframework/zend-feed for the canonical source repository |
4 * | 4 * @copyright Copyright (c) 2005-2018 Zend Technologies USA Inc. (https://www.zend.com) |
5 * @link http://github.com/zendframework/zf2 for the canonical source repository | 5 * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License |
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) | |
7 * @license http://framework.zend.com/license/new-bsd New BSD License | |
8 */ | 6 */ |
9 | 7 |
10 namespace Zend\Feed\Reader\Extension\Podcast; | 8 namespace Zend\Feed\Reader\Extension\Podcast; |
11 | 9 |
12 use Zend\Feed\Reader\Extension; | 10 use Zend\Feed\Reader\Extension; |
13 | 11 |
14 /** | |
15 */ | |
16 class Entry extends Extension\AbstractEntry | 12 class Entry extends Extension\AbstractEntry |
17 { | 13 { |
18 /** | 14 /** |
19 * Get the entry author | 15 * Get the entry author |
20 * | 16 * |
26 return $this->data['author']; | 22 return $this->data['author']; |
27 } | 23 } |
28 | 24 |
29 $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); | 25 $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); |
30 | 26 |
31 if (!$author) { | 27 if (! $author) { |
32 $author = null; | 28 $author = null; |
33 } | 29 } |
34 | 30 |
35 $this->data['author'] = $author; | 31 $this->data['author'] = $author; |
36 | 32 |
48 return $this->data['block']; | 44 return $this->data['block']; |
49 } | 45 } |
50 | 46 |
51 $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); | 47 $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); |
52 | 48 |
53 if (!$block) { | 49 if (! $block) { |
54 $block = null; | 50 $block = null; |
55 } | 51 } |
56 | 52 |
57 $this->data['block'] = $block; | 53 $this->data['block'] = $block; |
58 | 54 |
70 return $this->data['duration']; | 66 return $this->data['duration']; |
71 } | 67 } |
72 | 68 |
73 $duration = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); | 69 $duration = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:duration)'); |
74 | 70 |
75 if (!$duration) { | 71 if (! $duration) { |
76 $duration = null; | 72 $duration = null; |
77 } | 73 } |
78 | 74 |
79 $this->data['duration'] = $duration; | 75 $this->data['duration'] = $duration; |
80 | 76 |
92 return $this->data['explicit']; | 88 return $this->data['explicit']; |
93 } | 89 } |
94 | 90 |
95 $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); | 91 $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); |
96 | 92 |
97 if (!$explicit) { | 93 if (! $explicit) { |
98 $explicit = null; | 94 $explicit = null; |
99 } | 95 } |
100 | 96 |
101 $this->data['explicit'] = $explicit; | 97 $this->data['explicit'] = $explicit; |
102 | 98 |
104 } | 100 } |
105 | 101 |
106 /** | 102 /** |
107 * Get the entry keywords | 103 * Get the entry keywords |
108 * | 104 * |
105 * @deprecated since 2.10.0; itunes:keywords is no longer part of the | |
106 * iTunes podcast RSS specification. | |
109 * @return string | 107 * @return string |
110 */ | 108 */ |
111 public function getKeywords() | 109 public function getKeywords() |
112 { | 110 { |
111 trigger_error( | |
112 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' | |
113 . ' and should not be relied on.', | |
114 \E_USER_DEPRECATED | |
115 ); | |
116 | |
113 if (isset($this->data['keywords'])) { | 117 if (isset($this->data['keywords'])) { |
114 return $this->data['keywords']; | 118 return $this->data['keywords']; |
115 } | 119 } |
116 | 120 |
117 $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); | 121 $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); |
118 | 122 |
119 if (!$keywords) { | 123 if (! $keywords) { |
120 $keywords = null; | 124 $keywords = null; |
121 } | 125 } |
122 | 126 |
123 $this->data['keywords'] = $keywords; | 127 $this->data['keywords'] = $keywords; |
124 | 128 |
136 return $this->data['subtitle']; | 140 return $this->data['subtitle']; |
137 } | 141 } |
138 | 142 |
139 $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); | 143 $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); |
140 | 144 |
141 if (!$subtitle) { | 145 if (! $subtitle) { |
142 $subtitle = null; | 146 $subtitle = null; |
143 } | 147 } |
144 | 148 |
145 $this->data['subtitle'] = $subtitle; | 149 $this->data['subtitle'] = $subtitle; |
146 | 150 |
158 return $this->data['summary']; | 162 return $this->data['summary']; |
159 } | 163 } |
160 | 164 |
161 $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); | 165 $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); |
162 | 166 |
163 if (!$summary) { | 167 if (! $summary) { |
164 $summary = null; | 168 $summary = null; |
165 } | 169 } |
166 | 170 |
167 $this->data['summary'] = $summary; | 171 $this->data['summary'] = $summary; |
168 | 172 |
169 return $this->data['summary']; | 173 return $this->data['summary']; |
170 } | 174 } |
171 | 175 |
172 /** | 176 /** |
177 * Get the entry image | |
178 * | |
179 * @return string | |
180 */ | |
181 public function getItunesImage() | |
182 { | |
183 if (isset($this->data['image'])) { | |
184 return $this->data['image']; | |
185 } | |
186 | |
187 $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); | |
188 | |
189 if (! $image) { | |
190 $image = null; | |
191 } | |
192 | |
193 $this->data['image'] = $image; | |
194 | |
195 return $this->data['image']; | |
196 } | |
197 | |
198 /** | |
199 * Get the episode number | |
200 * | |
201 * @return null|int | |
202 */ | |
203 public function getEpisode() | |
204 { | |
205 if (isset($this->data['episode'])) { | |
206 return $this->data['episode']; | |
207 } | |
208 | |
209 $episode = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episode)'); | |
210 | |
211 if (! $episode) { | |
212 $episode = null; | |
213 } | |
214 | |
215 $this->data['episode'] = null === $episode ? $episode : (int) $episode; | |
216 | |
217 return $this->data['episode']; | |
218 } | |
219 | |
220 /** | |
221 * Get the episode number | |
222 * | |
223 * @return string One of "full", "trailer", or "bonus"; defaults to "full". | |
224 */ | |
225 public function getEpisodeType() | |
226 { | |
227 if (isset($this->data['episodeType'])) { | |
228 return $this->data['episodeType']; | |
229 } | |
230 | |
231 $type = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:episodeType)'); | |
232 | |
233 if (! $type) { | |
234 $type = 'full'; | |
235 } | |
236 | |
237 $this->data['episodeType'] = (string) $type; | |
238 | |
239 return $this->data['episodeType']; | |
240 } | |
241 | |
242 /** | |
243 * Is the episode closed captioned? | |
244 * | |
245 * Returns true only if itunes:isClosedCaptioned has the value 'Yes'. | |
246 * | |
247 * @return bool | |
248 */ | |
249 public function isClosedCaptioned() | |
250 { | |
251 if (isset($this->data['isClosedCaptioned'])) { | |
252 return $this->data['isClosedCaptioned']; | |
253 } | |
254 | |
255 $status = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:isClosedCaptioned)'); | |
256 | |
257 $this->data['isClosedCaptioned'] = $status === 'Yes'; | |
258 | |
259 return $this->data['isClosedCaptioned']; | |
260 } | |
261 | |
262 /** | |
263 * Get the season number | |
264 * | |
265 * @return null|int | |
266 */ | |
267 public function getSeason() | |
268 { | |
269 if (isset($this->data['season'])) { | |
270 return $this->data['season']; | |
271 } | |
272 | |
273 $season = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:season)'); | |
274 | |
275 if (! $season) { | |
276 $season = null; | |
277 } | |
278 | |
279 $this->data['season'] = null === $season ? $season : (int) $season; | |
280 | |
281 return $this->data['season']; | |
282 } | |
283 | |
284 /** | |
173 * Register iTunes namespace | 285 * Register iTunes namespace |
174 * | 286 * |
175 */ | 287 */ |
176 protected function registerNamespaces() | 288 protected function registerNamespaces() |
177 { | 289 { |