Source of file Feed.php
Size: 6,338 Bytes - Last Modified: 2014-03-12T23:21:18+01:00
/home/theseer/Downloads/ZendFramework-2.3.0/library/Zend/Feed/Reader/Extension/Podcast/Feed.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 | <?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace Zend\Feed\Reader\Extension\Podcast; use DOMText; use Zend\Feed\Reader\Extension; /** */ class Feed extends Extension\AbstractFeed { /** * Get the entry author * * @return string */ public function getCastAuthor() { if (isset($this->data['author'])) { return $this->data['author']; } $author = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:author)'); if (!$author) { $author = null; } $this->data['author'] = $author; return $this->data['author']; } /** * Get the entry block * * @return string */ public function getBlock() { if (isset($this->data['block'])) { return $this->data['block']; } $block = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:block)'); if (!$block) { $block = null; } $this->data['block'] = $block; return $this->data['block']; } /** * Get the entry category * * @return string */ public function getItunesCategories() { if (isset($this->data['categories'])) { return $this->data['categories']; } $categoryList = $this->xpath->query($this->getXpathPrefix() . '/itunes:category'); $categories = array(); if ($categoryList->length > 0) { foreach ($categoryList as $node) { $children = null; if ($node->childNodes->length > 0) { $children = array(); foreach ($node->childNodes as $childNode) { if (!($childNode instanceof DOMText)) { $children[$childNode->getAttribute('text')] = null; } } } $categories[$node->getAttribute('text')] = $children; } } if (!$categories) { $categories = null; } $this->data['categories'] = $categories; return $this->data['categories']; } /** * Get the entry explicit * * @return string */ public function getExplicit() { if (isset($this->data['explicit'])) { return $this->data['explicit']; } $explicit = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:explicit)'); if (!$explicit) { $explicit = null; } $this->data['explicit'] = $explicit; return $this->data['explicit']; } /** * Get the entry image * * @return string */ public function getItunesImage() { if (isset($this->data['image'])) { return $this->data['image']; } $image = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:image/@href)'); if (!$image) { $image = null; } $this->data['image'] = $image; return $this->data['image']; } /** * Get the entry keywords * * @return string */ public function getKeywords() { if (isset($this->data['keywords'])) { return $this->data['keywords']; } $keywords = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:keywords)'); if (!$keywords) { $keywords = null; } $this->data['keywords'] = $keywords; return $this->data['keywords']; } /** * Get the entry's new feed url * * @return string */ public function getNewFeedUrl() { if (isset($this->data['new-feed-url'])) { return $this->data['new-feed-url']; } $newFeedUrl = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:new-feed-url)'); if (!$newFeedUrl) { $newFeedUrl = null; } $this->data['new-feed-url'] = $newFeedUrl; return $this->data['new-feed-url']; } /** * Get the entry owner * * @return string */ public function getOwner() { if (isset($this->data['owner'])) { return $this->data['owner']; } $owner = null; $email = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:email)'); $name = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:owner/itunes:name)'); if (!empty($email)) { $owner = $email . (empty($name) ? '' : ' (' . $name . ')'); } elseif (!empty($name)) { $owner = $name; } if (!$owner) { $owner = null; } $this->data['owner'] = $owner; return $this->data['owner']; } /** * Get the entry subtitle * * @return string */ public function getSubtitle() { if (isset($this->data['subtitle'])) { return $this->data['subtitle']; } $subtitle = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:subtitle)'); if (!$subtitle) { $subtitle = null; } $this->data['subtitle'] = $subtitle; return $this->data['subtitle']; } /** * Get the entry summary * * @return string */ public function getSummary() { if (isset($this->data['summary'])) { return $this->data['summary']; } $summary = $this->xpath->evaluate('string(' . $this->getXpathPrefix() . '/itunes:summary)'); if (!$summary) { $summary = null; } $this->data['summary'] = $summary; return $this->data['summary']; } /** * Register iTunes namespace * */ protected function registerNamespaces() { $this->xpath->registerNamespace('itunes', 'http://www.itunes.com/dtds/podcast-1.0.dtd'); } } |