3 * @see https://github.com/zendframework/zend-feed for the canonical source repository
4 * @copyright Copyright (c) 2018 Zend Technologies USA Inc. (https://www.zend.com)
5 * @license https://github.com/zendframework/zend-feed/blob/master/LICENSE.md New BSD License
8 namespace Zend\Feed\Reader\Extension\GooglePlayPodcast
;
11 use Zend\Feed\Reader\Extension
;
13 class Feed
extends Extension\AbstractFeed
16 * Get the entry author
20 public function getPlayPodcastAuthor()
22 if (isset($this->data
['author'])) {
23 return $this->data
['author'];
26 $author = $this->xpath
->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:author)');
32 $this->data
['author'] = $author;
34 return $this->data
['author'];
42 public function getPlayPodcastBlock()
44 if (isset($this->data
['block'])) {
45 return $this->data
['block'];
48 $block = $this->xpath
->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:block)');
54 $this->data
['block'] = $block;
56 return $this->data
['block'];
60 * Get the entry category
64 public function getPlayPodcastCategories()
66 if (isset($this->data
['categories'])) {
67 return $this->data
['categories'];
70 $categoryList = $this->xpath
->query($this->getXpathPrefix() . '/googleplay:category');
74 if ($categoryList->length
> 0) {
75 foreach ($categoryList as $node) {
78 if ($node->childNodes
->length
> 0) {
81 foreach ($node->childNodes
as $childNode) {
82 if (! ($childNode instanceof DOMText
)) {
83 $children[$childNode->getAttribute('text')] = null;
88 $categories[$node->getAttribute('text')] = $children;
96 $this->data
['categories'] = $categories;
98 return $this->data
['categories'];
102 * Get the entry explicit
106 public function getPlayPodcastExplicit()
108 if (isset($this->data
['explicit'])) {
109 return $this->data
['explicit'];
112 $explicit = $this->xpath
->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:explicit)');
118 $this->data
['explicit'] = $explicit;
120 return $this->data
['explicit'];
124 * Get the feed/podcast image
128 public function getPlayPodcastImage()
130 if (isset($this->data
['image'])) {
131 return $this->data
['image'];
134 $image = $this->xpath
->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:image/@href)');
140 $this->data
['image'] = $image;
142 return $this->data
['image'];
146 * Get the entry description
150 public function getPlayPodcastDescription()
152 if (isset($this->data
['description'])) {
153 return $this->data
['description'];
156 $description = $this->xpath
->evaluate('string(' . $this->getXpathPrefix() . '/googleplay:description)');
158 if (! $description) {
162 $this->data
['description'] = $description;
164 return $this->data
['description'];
168 * Register googleplay namespace
171 protected function registerNamespaces()
173 $this->xpath
->registerNamespace('googleplay', 'http://www.google.com/schemas/play-podcasts/1.0');