/** * Constructor * * @param DOMElement $entry * @param string $entryKey * @param string $type * @return void */ public function __construct(DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); $this->_xpathQueryRss = '//item[' . ($this->_entryKey+1) . ']'; $this->_xpathQueryRdf = '//rss:item[' . ($this->_entryKey+1) . ']'; $pluginLoader = Reader\Reader::getPluginLoader(); $dublinCoreClass = $pluginLoader->getClassName('DublinCore\\Entry'); $this->_extensions['DublinCore\\Entry'] = new $dublinCoreClass($entry, $entryKey, $type); $contentClass = $pluginLoader->getClassName('Content\\Entry'); $this->_extensions['Content\\Entry'] = new $contentClass($entry, $entryKey, $type); $atomClass = $pluginLoader->getClassName('Atom\\Entry'); $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); $wfwClass = $pluginLoader->getClassName('WellFormedWeb\\Entry'); $this->_extensions['WellFormedWeb\\Entry'] = new $wfwClass($entry, $entryKey, $type); $slashClass = $pluginLoader->getClassName('Slash\\Entry'); $this->_extensions['Slash\\Entry'] = new $slashClass($entry, $entryKey, $type); $threadClass = $pluginLoader->getClassName('Thread\\Entry'); $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); }
/** * Constructor * * @param DOMDocument $dom * @param string $type */ public function __construct(DOMDocument $dom, $type = null) { parent::__construct($dom, $type); $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); $this->_extensions['Atom\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); $this->_extensions['DublinCore\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix('/atom:feed'); } }
/** * Constructor * * @param DOMElement $entry * @param int $entryKey * @param string $type * @return void */ public function __construct(\DOMElement $entry, $entryKey, $type = null) { parent::__construct($entry, $entryKey, $type); // Everyone by now should know XPath indices start from 1 not 0 $this->_xpathQuery = '//atom:entry[' . ($this->_entryKey + 1) . ']'; $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Entry'); $this->_extensions['Atom\\Entry'] = new $atomClass($entry, $entryKey, $type); $threadClass = Reader\Reader::getPluginLoader()->getClassName('Thread\\Entry'); $this->_extensions['Thread\\Entry'] = new $threadClass($entry, $entryKey, $type); $threadClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Entry'); $this->_extensions['DublinCore\\Entry'] = new $threadClass($entry, $entryKey, $type); }
/** * Constructor: Create a Source object which is largely just a normal * Zend\Feed\Reader\AbstractFeed object only designed to retrieve feed level * metadata from an Atom entry's source element. * * @param DOMElement $source * @param string $xpathPrefix Passed from parent Entry object * @param string $type Nearly always Atom 1.0 */ public function __construct(\DOMElement $source, $xpathPrefix, $type = Reader\Reader::TYPE_ATOM_10) { $this->_domDocument = $source->ownerDocument; $this->_xpath = new \DOMXPath($this->_domDocument); $this->_data['type'] = $type; $this->_registerNamespaces(); $this->_loadExtensions(); $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); $this->_extensions['Atom\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); $atomClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); $this->_extensions['DublinCore\\Feed'] = new $atomClass($this->_domDocument, $this->_data['type'], $this->_xpath); foreach ($this->_extensions as $extension) { $extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source'); } }
/** * Constructor * * @param DOMDocument $dom * @param string $type */ public function __construct(\DomDocument $dom, $type = null) { parent::__construct($dom, $type); $dublinCoreClass = Reader\Reader::getPluginLoader()->getClassName('DublinCore\\Feed'); $this->_extensions['DublinCore\\Feed'] = new $dublinCoreClass($dom, $this->_data['type'], $this->_xpath); $atomClass = Reader\Reader::getPluginLoader()->getClassName('Atom\\Feed'); $this->_extensions['Atom\\Feed'] = new $atomClass($dom, $this->_data['type'], $this->_xpath); if ($this->getType() !== Reader\Reader::TYPE_RSS_10 && $this->getType() !== Reader\Reader::TYPE_RSS_090) { $xpathPrefix = '/rss/channel'; } else { $xpathPrefix = '/rdf:RDF/rss:channel'; } foreach ($this->_extensions as $extension) { $extension->setXpathPrefix($xpathPrefix); } }
public function testAddsPrefixPath() { Reader\Reader::addPrefixPath('A\\B\\C', '/A/B/C'); $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); $this->assertEquals('/A/B/C/', $prefixPaths['A\\B\\C\\'][0]); }
protected function _loadExtensions() { $all = Reader\Reader::getExtensions(); $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } $className = Reader\Reader::getPluginLoader()->getClassName($extension); $this->_extensions[$extension] = new $className($this->getDomDocument(), $this->_data['type'], $this->_xpath); } }
/** * 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']); } }
protected function _loadExtensions() { $all = Reader\Reader::getExtensions(); $feed = $all['feed']; foreach ($feed as $extension) { if (in_array($extension, $all['core'])) { continue; } if (!($className = Reader\Reader::getPluginLoader()->getClassName($extension))) { continue; } if (!class_exists($className)) { throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; cannot find class', $extension)); } $this->_extensions[$extension] = new $className($this->getDomDocument(), $this->_data['type'], $this->_xpath); } }
public function testAddsPrefixPath() { $path = str_replace('#', DIRECTORY_SEPARATOR, '#A#B#C'); Reader\Reader::addPrefixPath('A\\B\\C', $path); $prefixPaths = Reader\Reader::getPluginLoader()->getPaths(); $this->assertEquals($path . DIRECTORY_SEPARATOR, $prefixPaths['A\\B\\C\\'][0]); }