3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
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
10 namespace Zend\Feed\Reader\Extension\Podcast;
13 use Zend\Feed\Reader\Extension;
17 class Feed extends Extension\AbstractFeed
20 * Get the entry author
24 public function getCastAuthor()
26 if (isset($this->data['author'])) {
27 return $this->data['author'];
30 $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)');
36 $this->data['author'] = $author;
38 return $this->data['author'];
46 public function getBlock()
48 if (isset($this->data['block'])) {
49 return $this->data['block'];
52 $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)');
58 $this->data['block'] = $block;
60 return $this->data['block'];
64 * Get the entry category
68 public function getItunesCategories()
70 if (isset($this->data['categories'])) {
71 return $this->data['categories'];
74 $categoryList = $this->xpath->query($this->getXpathPrefix() . '/itunes:category');
78 if ($categoryList->length > 0) {
79 foreach ($categoryList as $node) {
82 if ($node->childNodes->length > 0) {
85 foreach ($node->childNodes as $childNode) {
86 if (! ($childNode instanceof DOMText)) {
87 $children[$childNode->getAttribute('text')] = null;
92 $categories[$node->getAttribute('text')] = $children;
100 $this->data['categories'] = $categories;
102 return $this->data['categories'];
106 * Get the entry explicit
110 public function getExplicit()
112 if (isset($this->data['explicit'])) {
113 return $this->data['explicit'];
116 $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)');
122 $this->data['explicit'] = $explicit;
124 return $this->data['explicit'];
128 * Get the entry image
132 public function getItunesImage()
134 if (isset($this->data['image'])) {
135 return $this->data['image'];
138 $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)');
144 $this->data['image'] = $image;
146 return $this->data['image'];
150 * Get the entry keywords
154 public function getKeywords()
156 if (isset($this->data['keywords'])) {
157 return $this->data['keywords'];
160 $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)');
166 $this->data['keywords'] = $keywords;
168 return $this->data['keywords'];
172 * Get the entry's new feed url
176 public function getNewFeedUrl()
178 if (isset($this->data['new-feed-url'])) {
179 return $this->data['new-feed-url'];
182 $newFeedUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)');
188 $this->data['new-feed-url'] = $newFeedUrl;
190 return $this->data['new-feed-url'];
194 * Get the entry owner
198 public function getOwner()
200 if (isset($this->data['owner'])) {
201 return $this->data['owner'];
206 $email = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)');
207 $name = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)');
209 if (! empty($email)) {
210 $owner = $email . (empty($name) ? '' : ' (' . $name . ')');
211 } elseif (! empty($name)) {
219 $this->data['owner'] = $owner;
221 return $this->data['owner'];
225 * Get the entry subtitle
229 public function getSubtitle()
231 if (isset($this->data['subtitle'])) {
232 return $this->data['subtitle'];
235 $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)');
241 $this->data['subtitle'] = $subtitle;
243 return $this->data['subtitle'];
247 * Get the entry summary
251 public function getSummary()
253 if (isset($this->data['summary'])) {
254 return $this->data['summary'];
257 $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)');
263 $this->data['summary'] = $summary;
265 return $this->data['summary'];
269 * Register iTunes namespace
272 protected function registerNamespaces()
274 $this->xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd');