Chris@0: data['author'])) { Chris@0: return $this->data['author']; Chris@0: } Chris@0: Chris@0: $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); Chris@0: Chris@12: if (! $author) { Chris@0: $author = null; Chris@0: } Chris@0: Chris@0: $this->data['author'] = $author; Chris@0: Chris@0: return $this->data['author']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry block Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getBlock() Chris@0: { Chris@0: if (isset($this->data['block'])) { Chris@0: return $this->data['block']; Chris@0: } Chris@0: Chris@0: $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); Chris@0: Chris@12: if (! $block) { Chris@0: $block = null; Chris@0: } Chris@0: Chris@0: $this->data['block'] = $block; Chris@0: Chris@0: return $this->data['block']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry category Chris@0: * Chris@0: * @return array|null Chris@0: */ Chris@0: public function getItunesCategories() Chris@0: { Chris@0: if (isset($this->data['categories'])) { Chris@0: return $this->data['categories']; Chris@0: } Chris@0: Chris@0: $categoryList = $this->xpath->query($this->getXpathPrefix() . '/itunes:category'); Chris@0: Chris@0: $categories = []; Chris@0: Chris@0: if ($categoryList->length > 0) { Chris@0: foreach ($categoryList as $node) { Chris@0: $children = null; Chris@0: Chris@0: if ($node->childNodes->length > 0) { Chris@0: $children = []; Chris@0: Chris@0: foreach ($node->childNodes as $childNode) { Chris@12: if (! ($childNode instanceof DOMText)) { Chris@0: $children[$childNode->getAttribute('text')] = null; Chris@0: } Chris@0: } Chris@0: } Chris@0: Chris@0: $categories[$node->getAttribute('text')] = $children; Chris@0: } Chris@0: } Chris@0: Chris@12: if (! $categories) { Chris@0: $categories = null; Chris@0: } Chris@0: Chris@0: $this->data['categories'] = $categories; Chris@0: Chris@0: return $this->data['categories']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry explicit Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getExplicit() Chris@0: { Chris@0: if (isset($this->data['explicit'])) { Chris@0: return $this->data['explicit']; Chris@0: } Chris@0: Chris@0: $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); Chris@0: Chris@12: if (! $explicit) { Chris@0: $explicit = null; Chris@0: } Chris@0: Chris@0: $this->data['explicit'] = $explicit; Chris@0: Chris@0: return $this->data['explicit']; Chris@0: } Chris@0: Chris@0: /** Chris@16: * Get the feed/podcast image Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getItunesImage() Chris@0: { Chris@0: if (isset($this->data['image'])) { Chris@0: return $this->data['image']; Chris@0: } Chris@0: Chris@0: $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); Chris@0: Chris@12: if (! $image) { Chris@0: $image = null; Chris@0: } Chris@0: Chris@0: $this->data['image'] = $image; Chris@0: Chris@0: return $this->data['image']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry keywords Chris@0: * Chris@16: * @deprecated since 2.10.0; itunes:keywords is no longer part of the Chris@16: * iTunes podcast RSS specification. Chris@0: * @return string Chris@0: */ Chris@0: public function getKeywords() Chris@0: { Chris@16: trigger_error( Chris@16: 'itunes:keywords has been deprecated in the iTunes podcast RSS specification,' Chris@16: . ' and should not be relied on.', Chris@16: \E_USER_DEPRECATED Chris@16: ); Chris@16: Chris@0: if (isset($this->data['keywords'])) { Chris@0: return $this->data['keywords']; Chris@0: } Chris@0: Chris@0: $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); Chris@0: Chris@12: if (! $keywords) { Chris@0: $keywords = null; Chris@0: } Chris@0: Chris@0: $this->data['keywords'] = $keywords; Chris@0: Chris@0: return $this->data['keywords']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry's new feed url Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getNewFeedUrl() Chris@0: { Chris@0: if (isset($this->data['new-feed-url'])) { Chris@0: return $this->data['new-feed-url']; Chris@0: } Chris@0: Chris@0: $newFeedUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); Chris@0: Chris@12: if (! $newFeedUrl) { Chris@0: $newFeedUrl = null; Chris@0: } Chris@0: Chris@0: $this->data['new-feed-url'] = $newFeedUrl; Chris@0: Chris@0: return $this->data['new-feed-url']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry owner Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getOwner() Chris@0: { Chris@0: if (isset($this->data['owner'])) { Chris@0: return $this->data['owner']; Chris@0: } Chris@0: Chris@0: $owner = null; Chris@0: Chris@0: $email = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); Chris@0: $name = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); Chris@0: Chris@12: if (! empty($email)) { Chris@0: $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); Chris@12: } elseif (! empty($name)) { Chris@0: $owner = $name; Chris@0: } Chris@0: Chris@12: if (! $owner) { Chris@0: $owner = null; Chris@0: } Chris@0: Chris@0: $this->data['owner'] = $owner; Chris@0: Chris@0: return $this->data['owner']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry subtitle Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getSubtitle() Chris@0: { Chris@0: if (isset($this->data['subtitle'])) { Chris@0: return $this->data['subtitle']; Chris@0: } Chris@0: Chris@0: $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); Chris@0: Chris@12: if (! $subtitle) { Chris@0: $subtitle = null; Chris@0: } Chris@0: Chris@0: $this->data['subtitle'] = $subtitle; Chris@0: Chris@0: return $this->data['subtitle']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry summary Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getSummary() Chris@0: { Chris@0: if (isset($this->data['summary'])) { Chris@0: return $this->data['summary']; Chris@0: } Chris@0: Chris@0: $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); Chris@0: Chris@12: if (! $summary) { Chris@0: $summary = null; Chris@0: } Chris@0: Chris@0: $this->data['summary'] = $summary; Chris@0: Chris@0: return $this->data['summary']; Chris@0: } Chris@0: Chris@0: /** Chris@16: * Get the type of podcast Chris@16: * Chris@16: * @return string One of "episodic" or "serial". Defaults to "episodic" Chris@16: * if no itunes:type tag is encountered. Chris@16: */ Chris@16: public function getPodcastType() Chris@16: { Chris@16: if (isset($this->data['podcastType'])) { Chris@16: return $this->data['podcastType']; Chris@16: } Chris@16: Chris@16: $type = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:type)'); Chris@16: Chris@16: if (! $type) { Chris@16: $type = 'episodic'; Chris@16: } Chris@16: Chris@16: $this->data['podcastType'] = (string) $type; Chris@16: Chris@16: return $this->data['podcastType']; Chris@16: } Chris@16: Chris@16: /** Chris@16: * Is the podcast complete (no more episodes will post)? Chris@16: * Chris@16: * @return bool Chris@16: */ Chris@16: public function isComplete() Chris@16: { Chris@16: if (isset($this->data['complete'])) { Chris@16: return $this->data['complete']; Chris@16: } Chris@16: Chris@16: $complete = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:complete)'); Chris@16: Chris@16: if (! $complete) { Chris@16: $complete = false; Chris@16: } Chris@16: Chris@16: $this->data['complete'] = $complete === 'Yes'; Chris@16: Chris@16: return $this->data['complete']; Chris@16: } Chris@16: Chris@16: /** Chris@0: * Register iTunes namespace Chris@0: * Chris@0: */ Chris@0: protected function registerNamespaces() Chris@0: { Chris@0: $this->xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); Chris@0: } Chris@0: }