diff options
Diffstat (limited to '3rdparty/ZendFeed/Reader')
42 files changed, 0 insertions, 7834 deletions
diff --git a/3rdparty/ZendFeed/Reader/AbstractEntry.php b/3rdparty/ZendFeed/Reader/AbstractEntry.php deleted file mode 100644 index cf8a9361b..000000000 --- a/3rdparty/ZendFeed/Reader/AbstractEntry.php +++ /dev/null @@ -1,224 +0,0 @@ -<?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; - -use DOMDocument; -use DOMElement; -use DOMXPath; - -abstract class AbstractEntry -{ - /** - * Feed entry data - * - * @var array - */ - protected $data = array(); - - /** - * DOM document object - * - * @var DOMDocument - */ - protected $domDocument = null; - - /** - * Entry instance - * - * @var DOMElement - */ - protected $entry = null; - - /** - * Pointer to the current entry - * - * @var int - */ - protected $entryKey = 0; - - /** - * XPath object - * - * @var DOMXPath - */ - protected $xpath = null; - - /** - * Registered extensions - * - * @var array - */ - protected $extensions = array(); - - /** - * Constructor - * - * @param DOMElement $entry - * @param int $entryKey - * @param null|string $type - */ - public function __construct(DOMElement $entry, $entryKey, $type = null) - { - $this->entry = $entry; - $this->entryKey = $entryKey; - $this->domDocument = $entry->ownerDocument; - if ($type !== null) { - $this->data['type'] = $type; - } else { - $this->data['type'] = Reader::detectType($entry); - } - $this->_loadExtensions(); - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->domDocument; - } - - /** - * Get the entry element - * - * @return DOMElement - */ - public function getElement() - { - return $this->entry; - } - - /** - * Get the Entry's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - if (empty($assumed)) { - $assumed = 'UTF-8'; - } - return $assumed; - } - - /** - * Get entry as xml - * - * @return string - */ - public function saveXml() - { - $dom = new DOMDocument('1.0', $this->getEncoding()); - $entry = $dom->importNode($this->getElement(), true); - $dom->appendChild($entry); - return $dom->saveXml(); - } - - /** - * Get the entry type - * - * @return string - */ - public function getType() - { - return $this->data['type']; - } - - /** - * Get the XPath query object - * - * @return DOMXPath - */ - public function getXpath() - { - if (!$this->xpath) { - $this->setXpath(new DOMXPath($this->getDomDocument())); - } - return $this->xpath; - } - - /** - * Set the XPath query - * - * @param DOMXPath $xpath - * @return \Zend\Feed\Reader\AbstractEntry - */ - public function setXpath(DOMXPath $xpath) - { - $this->xpath = $xpath; - return $this; - } - - /** - * Get registered extensions - * - * @return array - */ - public function getExtensions() - { - return $this->extensions; - } - - /** - * Return an Extension object with the matching name (postfixed with _Entry) - * - * @param string $name - * @return \Zend\Feed\Reader\Extension\AbstractEntry - */ - public function getExtension($name) - { - if (array_key_exists($name . '\Entry', $this->extensions)) { - return $this->extensions[$name . '\Entry']; - } - return null; - } - - /** - * Method overloading: call given method on first extension implementing it - * - * @param string $method - * @param array $args - * @return mixed - * @throws Exception\BadMethodCallException if no extensions implements the method - */ - public function __call($method, $args) - { - foreach ($this->extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - throw new Exception\BadMethodCallException('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); - } - - /** - * Load extensions from Zend\Feed\Reader\Reader - * - * @return void - */ - protected function _loadExtensions() - { - $all = Reader::getExtensions(); - $feed = $all['entry']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $className = Reader::getPluginLoader()->getClassName($extension); - $this->extensions[$extension] = new $className( - $this->getElement(), $this->entryKey, $this->data['type'] - ); - } - } -} diff --git a/3rdparty/ZendFeed/Reader/AbstractFeed.php b/3rdparty/ZendFeed/Reader/AbstractFeed.php deleted file mode 100644 index 57ed45d3e..000000000 --- a/3rdparty/ZendFeed/Reader/AbstractFeed.php +++ /dev/null @@ -1,300 +0,0 @@ -<?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; - -use DOMDocument; -use DOMElement; -use DOMXPath; - -abstract class AbstractFeed implements Feed\FeedInterface -{ - /** - * Parsed feed data - * - * @var array - */ - protected $data = array(); - - /** - * Parsed feed data in the shape of a DOMDocument - * - * @var DOMDocument - */ - protected $domDocument = null; - - /** - * An array of parsed feed entries - * - * @var array - */ - protected $entries = array(); - - /** - * A pointer for the iterator to keep track of the entries array - * - * @var int - */ - protected $entriesKey = 0; - - /** - * The base XPath query used to retrieve feed data - * - * @var DOMXPath - */ - protected $xpath = null; - - /** - * Array of loaded extensions - * - * @var array - */ - protected $extensions = array(); - - /** - * Original Source URI (set if imported from a URI) - * - * @var string - */ - protected $originalSourceUri = null; - - /** - * Constructor - * - * @param DomDocument $domDocument The DOM object for the feed's XML - * @param string $type Feed type - */ - public function __construct(DOMDocument $domDocument, $type = null) - { - $this->domDocument = $domDocument; - $this->xpath = new DOMXPath($this->domDocument); - - if ($type !== null) { - $this->data['type'] = $type; - } else { - $this->data['type'] = Reader::detectType($this->domDocument); - } - $this->registerNamespaces(); - $this->indexEntries(); - $this->loadExtensions(); - } - - /** - * Set an original source URI for the feed being parsed. This value - * is returned from getFeedLink() method if the feed does not carry - * a self-referencing URI. - * - * @param string $uri - */ - public function setOriginalSourceUri($uri) - { - $this->originalSourceUri = $uri; - } - - /** - * Get an original source URI for the feed being parsed. Returns null if - * unset or the feed was not imported from a URI. - * - * @return string|null - */ - public function getOriginalSourceUri() - { - return $this->originalSourceUri; - } - - /** - * Get the number of feed entries. - * Required by the Iterator interface. - * - * @return int - */ - public function count() - { - return count($this->entries); - } - - /** - * Return the current entry - * - * @return \Zend\Feed\Reader\AbstractEntry - */ - public function current() - { - if (substr($this->getType(), 0, 3) == 'rss') { - $reader = new Entry\RSS($this->entries[$this->key()], $this->key(), $this->getType()); - } else { - $reader = new Entry\Atom($this->entries[$this->key()], $this->key(), $this->getType()); - } - - $reader->setXpath($this->xpath); - - return $reader; - } - - /** - * Get the DOM - * - * @return DOMDocument - */ - public function getDomDocument() - { - return $this->domDocument; - } - - /** - * Get the Feed's encoding - * - * @return string - */ - public function getEncoding() - { - $assumed = $this->getDomDocument()->encoding; - if (empty($assumed)) { - $assumed = 'UTF-8'; - } - return $assumed; - } - - /** - * Get feed as xml - * - * @return string - */ - public function saveXml() - { - return $this->getDomDocument()->saveXml(); - } - - /** - * Get the DOMElement representing the items/feed element - * - * @return DOMElement - */ - public function getElement() - { - return $this->getDomDocument()->documentElement; - } - - /** - * Get the DOMXPath object for this feed - * - * @return DOMXPath - */ - public function getXpath() - { - return $this->xpath; - } - - /** - * Get the feed type - * - * @return string - */ - public function getType() - { - return $this->data['type']; - } - - /** - * Return the current feed key - * - * @return int - */ - public function key() - { - return $this->entriesKey; - } - - /** - * Move the feed pointer forward - * - */ - public function next() - { - ++$this->entriesKey; - } - - /** - * Reset the pointer in the feed object - * - */ - public function rewind() - { - $this->entriesKey = 0; - } - - /** - * Check to see if the iterator is still valid - * - * @return bool - */ - public function valid() - { - return 0 <= $this->entriesKey && $this->entriesKey < $this->count(); - } - - public function getExtensions() - { - return $this->extensions; - } - - public function __call($method, $args) - { - foreach ($this->extensions as $extension) { - if (method_exists($extension, $method)) { - return call_user_func_array(array($extension, $method), $args); - } - } - throw new Exception\BadMethodCallException('Method: ' . $method - . 'does not exist and could not be located on a registered Extension'); - } - - /** - * Return an Extension object with the matching name (postfixed with _Feed) - * - * @param string $name - * @return \Zend\Feed\Reader\Extension\AbstractFeed - */ - public function getExtension($name) - { - if (array_key_exists($name . '\Feed', $this->extensions)) { - return $this->extensions[$name . '\Feed']; - } - return null; - } - - protected function loadExtensions() - { - $all = Reader::getExtensions(); - $manager = Reader::getExtensionManager(); - $feed = $all['feed']; - foreach ($feed as $extension) { - if (in_array($extension, $all['core'])) { - continue; - } - $plugin = $manager->get($extension); - $plugin->setDomDocument($this->getDomDocument()); - $plugin->setType($this->data['type']); - $plugin->setXpath($this->xpath); - $this->extensions[$extension] = $plugin; - } - } - - /** - * Read all entries to the internal entries array - * - */ - abstract protected function indexEntries(); - - /** - * Register the default namespaces for the current feed format - * - */ - abstract protected function registerNamespaces(); -} diff --git a/3rdparty/ZendFeed/Reader/Collection.php b/3rdparty/ZendFeed/Reader/Collection.php deleted file mode 100644 index 172eecce1..000000000 --- a/3rdparty/ZendFeed/Reader/Collection.php +++ /dev/null @@ -1,17 +0,0 @@ -<?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; - -use ArrayObject; - -class Collection extends ArrayObject -{ - -} diff --git a/3rdparty/ZendFeed/Reader/Collection/AbstractCollection.php b/3rdparty/ZendFeed/Reader/Collection/AbstractCollection.php deleted file mode 100644 index 2466a0a9a..000000000 --- a/3rdparty/ZendFeed/Reader/Collection/AbstractCollection.php +++ /dev/null @@ -1,27 +0,0 @@ -<?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\Collection; - -use ArrayObject; - -abstract class AbstractCollection extends ArrayObject -{ - - /** - * Return a simple array of the most relevant slice of - * the collection values. For example, feed categories contain - * the category name, domain/URI, and other data. This method would - * merely return the most useful data - i.e. the category names. - * - * @return array - */ - abstract public function getValues(); - -} diff --git a/3rdparty/ZendFeed/Reader/Collection/Author.php b/3rdparty/ZendFeed/Reader/Collection/Author.php deleted file mode 100644 index 1c773d021..000000000 --- a/3rdparty/ZendFeed/Reader/Collection/Author.php +++ /dev/null @@ -1,29 +0,0 @@ -<?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\Collection; - -class Author extends AbstractCollection -{ - - /** - * Return a simple array of the most relevant slice of - * the author values, i.e. all author names. - * - * @return array - */ - public function getValues() - { - $authors = array(); - foreach ($this->getIterator() as $element) { - $authors[] = $element['name']; - } - return array_unique($authors); - } -} diff --git a/3rdparty/ZendFeed/Reader/Collection/Category.php b/3rdparty/ZendFeed/Reader/Collection/Category.php deleted file mode 100644 index 15112ceae..000000000 --- a/3rdparty/ZendFeed/Reader/Collection/Category.php +++ /dev/null @@ -1,35 +0,0 @@ -<?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\Collection; - -class Category extends AbstractCollection -{ - - /** - * Return a simple array of the most relevant slice of - * the collection values. For example, feed categories contain - * the category name, domain/URI, and other data. This method would - * merely return the most useful data - i.e. the category names. - * - * @return array - */ - public function getValues() - { - $categories = array(); - foreach ($this->getIterator() as $element) { - if (isset($element['label']) && !empty($element['label'])) { - $categories[] = $element['label']; - } else { - $categories[] = $element['term']; - } - } - return array_unique($categories); - } -} diff --git a/3rdparty/ZendFeed/Reader/Collection/Collection.php b/3rdparty/ZendFeed/Reader/Collection/Collection.php deleted file mode 100644 index e3a6ae3d7..000000000 --- a/3rdparty/ZendFeed/Reader/Collection/Collection.php +++ /dev/null @@ -1,17 +0,0 @@ -<?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\Collection; - -use ArrayObject; - -class Collection extends ArrayObject -{ - -} diff --git a/3rdparty/ZendFeed/Reader/Entry/AbstractEntry.php b/3rdparty/ZendFeed/Reader/Entry/AbstractEntry.php deleted file mode 100644 index 241a8cdba..000000000 --- a/3rdparty/ZendFeed/Reader/Entry/AbstractEntry.php +++ /dev/null @@ -1,230 +0,0 @@ -<?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\Entry; - -use DOMDocument; -use DOMElement; -use DOMXPath; -use Zend\Feed\Reader; -use Zend\Feed\Reader\Exception; - -abstract class AbstractEntry -{ - /** - * Feed entry data - * - * @var array - */ - protected $data = array(); - - /** - * DOM document object - |