Chris@0: xpathQuery = '//atom:entry[' . ($this->entryKey + 1) . ']'; Chris@0: Chris@0: $manager = Reader\Reader::getExtensionManager(); Chris@0: $extensions = ['Atom\Entry', 'Thread\Entry', 'DublinCore\Entry']; Chris@0: Chris@0: foreach ($extensions as $name) { Chris@0: $extension = $manager->get($name); Chris@0: $extension->setEntryElement($entry); Chris@0: $extension->setEntryKey($entryKey); Chris@0: $extension->setType($type); Chris@0: $this->extensions[$name] = $extension; Chris@0: } Chris@0: } Chris@0: Chris@0: /** Chris@18: * @inheritdoc Chris@0: */ Chris@0: public function getAuthor($index = 0) Chris@0: { Chris@0: $authors = $this->getAuthors(); Chris@0: Chris@0: if (isset($authors[$index])) { Chris@0: return $authors[$index]; Chris@0: } Chris@0: Chris@0: return; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get an array with feed authors Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function getAuthors() Chris@0: { Chris@0: if (array_key_exists('authors', $this->data)) { Chris@0: return $this->data['authors']; Chris@0: } Chris@0: Chris@0: $people = $this->getExtension('Atom')->getAuthors(); Chris@0: Chris@0: $this->data['authors'] = $people; Chris@0: Chris@0: return $this->data['authors']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry content Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getContent() Chris@0: { Chris@0: if (array_key_exists('content', $this->data)) { Chris@0: return $this->data['content']; Chris@0: } Chris@0: Chris@0: $content = $this->getExtension('Atom')->getContent(); Chris@0: Chris@0: $this->data['content'] = $content; Chris@0: Chris@0: return $this->data['content']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry creation date Chris@0: * Chris@0: * @return \DateTime Chris@0: */ Chris@0: public function getDateCreated() Chris@0: { Chris@0: if (array_key_exists('datecreated', $this->data)) { Chris@0: return $this->data['datecreated']; Chris@0: } Chris@0: Chris@0: $dateCreated = $this->getExtension('Atom')->getDateCreated(); Chris@0: Chris@0: $this->data['datecreated'] = $dateCreated; Chris@0: Chris@0: return $this->data['datecreated']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry modification date Chris@0: * Chris@0: * @return \DateTime Chris@0: */ Chris@0: public function getDateModified() Chris@0: { Chris@0: if (array_key_exists('datemodified', $this->data)) { Chris@0: return $this->data['datemodified']; Chris@0: } Chris@0: Chris@0: $dateModified = $this->getExtension('Atom')->getDateModified(); Chris@0: Chris@0: $this->data['datemodified'] = $dateModified; Chris@0: Chris@0: return $this->data['datemodified']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry description Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getDescription() Chris@0: { Chris@0: if (array_key_exists('description', $this->data)) { Chris@0: return $this->data['description']; Chris@0: } Chris@0: Chris@0: $description = $this->getExtension('Atom')->getDescription(); Chris@0: Chris@0: $this->data['description'] = $description; Chris@0: Chris@0: return $this->data['description']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry enclosure Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getEnclosure() Chris@0: { Chris@0: if (array_key_exists('enclosure', $this->data)) { Chris@0: return $this->data['enclosure']; Chris@0: } Chris@0: Chris@0: $enclosure = $this->getExtension('Atom')->getEnclosure(); Chris@0: Chris@0: $this->data['enclosure'] = $enclosure; Chris@0: Chris@0: return $this->data['enclosure']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry ID Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getId() Chris@0: { Chris@0: if (array_key_exists('id', $this->data)) { Chris@0: return $this->data['id']; Chris@0: } Chris@0: Chris@0: $id = $this->getExtension('Atom')->getId(); Chris@0: Chris@0: $this->data['id'] = $id; Chris@0: Chris@0: return $this->data['id']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get a specific link Chris@0: * Chris@0: * @param int $index Chris@0: * @return string Chris@0: */ Chris@0: public function getLink($index = 0) Chris@0: { Chris@12: if (! array_key_exists('links', $this->data)) { Chris@0: $this->getLinks(); Chris@0: } Chris@0: Chris@0: if (isset($this->data['links'][$index])) { Chris@0: return $this->data['links'][$index]; Chris@0: } Chris@0: Chris@0: return; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get all links Chris@0: * Chris@0: * @return array Chris@0: */ Chris@0: public function getLinks() Chris@0: { Chris@0: if (array_key_exists('links', $this->data)) { Chris@0: return $this->data['links']; Chris@0: } Chris@0: Chris@0: $links = $this->getExtension('Atom')->getLinks(); Chris@0: Chris@0: $this->data['links'] = $links; Chris@0: Chris@0: return $this->data['links']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get a permalink to the entry Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getPermalink() Chris@0: { Chris@0: return $this->getLink(0); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the entry title Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getTitle() Chris@0: { Chris@0: if (array_key_exists('title', $this->data)) { Chris@0: return $this->data['title']; Chris@0: } Chris@0: Chris@0: $title = $this->getExtension('Atom')->getTitle(); Chris@0: Chris@0: $this->data['title'] = $title; Chris@0: Chris@0: return $this->data['title']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get the number of comments/replies for current entry Chris@0: * Chris@0: * @return int Chris@0: */ Chris@0: public function getCommentCount() Chris@0: { Chris@0: if (array_key_exists('commentcount', $this->data)) { Chris@0: return $this->data['commentcount']; Chris@0: } Chris@0: Chris@0: $commentcount = $this->getExtension('Thread')->getCommentCount(); Chris@0: Chris@12: if (! $commentcount) { Chris@0: $commentcount = $this->getExtension('Atom')->getCommentCount(); Chris@0: } Chris@0: Chris@0: $this->data['commentcount'] = $commentcount; Chris@0: Chris@0: return $this->data['commentcount']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns a URI pointing to the HTML page where comments can be made on this entry Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getCommentLink() Chris@0: { Chris@0: if (array_key_exists('commentlink', $this->data)) { Chris@0: return $this->data['commentlink']; Chris@0: } Chris@0: Chris@0: $commentlink = $this->getExtension('Atom')->getCommentLink(); Chris@0: Chris@0: $this->data['commentlink'] = $commentlink; Chris@0: Chris@0: return $this->data['commentlink']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Returns a URI pointing to a feed of all comments for this entry Chris@0: * Chris@0: * @return string Chris@0: */ Chris@0: public function getCommentFeedLink() Chris@0: { Chris@0: if (array_key_exists('commentfeedlink', $this->data)) { Chris@0: return $this->data['commentfeedlink']; Chris@0: } Chris@0: Chris@0: $commentfeedlink = $this->getExtension('Atom')->getCommentFeedLink(); Chris@0: Chris@0: $this->data['commentfeedlink'] = $commentfeedlink; Chris@0: Chris@0: return $this->data['commentfeedlink']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get category data as a Reader\Reader_Collection_Category object Chris@0: * Chris@0: * @return Reader\Collection\Category Chris@0: */ Chris@0: public function getCategories() Chris@0: { Chris@0: if (array_key_exists('categories', $this->data)) { Chris@0: return $this->data['categories']; Chris@0: } Chris@0: Chris@0: $categoryCollection = $this->getExtension('Atom')->getCategories(); Chris@0: Chris@0: if (count($categoryCollection) == 0) { Chris@0: $categoryCollection = $this->getExtension('DublinCore')->getCategories(); Chris@0: } Chris@0: Chris@0: $this->data['categories'] = $categoryCollection; Chris@0: Chris@0: return $this->data['categories']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Get source feed metadata from the entry Chris@0: * Chris@0: * @return Reader\Feed\Atom\Source|null Chris@0: */ Chris@0: public function getSource() Chris@0: { Chris@0: if (array_key_exists('source', $this->data)) { Chris@0: return $this->data['source']; Chris@0: } Chris@0: Chris@0: $source = $this->getExtension('Atom')->getSource(); Chris@0: Chris@0: $this->data['source'] = $source; Chris@0: Chris@0: return $this->data['source']; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Set the XPath query (incl. on all Extensions) Chris@0: * Chris@0: * @param DOMXPath $xpath Chris@0: * @return void Chris@0: */ Chris@0: public function setXpath(DOMXPath $xpath) Chris@0: { Chris@0: parent::setXpath($xpath); Chris@0: foreach ($this->extensions as $extension) { Chris@0: $extension->setXpath($this->xpath); Chris@0: } Chris@0: } Chris@0: }