本文整理汇总了PHP中Zend\Feed\Reader\Reader::getExtensionManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::getExtensionManager方法的具体用法?PHP Reader::getExtensionManager怎么用?PHP Reader::getExtensionManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Feed\Reader\Reader
的用法示例。
在下文中一共展示了Reader::getExtensionManager方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param DOMElement $entry
* @param int $entryKey
* @param string $type
*/
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) . ']';
$manager = Reader\Reader::getExtensionManager();
$extensions = array('Atom\\Entry', 'Thread\\Entry', 'DublinCore\\Entry');
foreach ($extensions as $name) {
$extension = $manager->get($name);
$extension->setEntryElement($entry);
$extension->setEntryKey($entryKey);
$extension->setType($type);
$this->extensions[$name] = $extension;
}
}
示例2: __construct
/**
* Constructor
*
* @param DOMElement $entry
* @param string $entryKey
* @param string $type
*/
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) . ']';
$manager = Reader\Reader::getExtensionManager();
$extensions = array('DublinCore\\Entry', 'Content\\Entry', 'Atom\\Entry', 'WellFormedWeb\\Entry', 'Slash\\Entry', 'Thread\\Entry');
foreach ($extensions as $name) {
$extension = $manager->get($name);
$extension->setEntryElement($entry);
$extension->setEntryKey($entryKey);
$extension->setType($type);
$this->extensions[$name] = $extension;
}
}
示例3: __construct
/**
* Constructor
*
* @param DOMDocument $dom
* @param string $type
*/
public function __construct(DOMDocument $dom, $type = null)
{
parent::__construct($dom, $type);
$manager = Reader\Reader::getExtensionManager();
$atomFeed = $manager->get('Atom\\Feed');
$atomFeed->setDomDocument($dom);
$atomFeed->setType($this->data['type']);
$atomFeed->setXpath($this->xpath);
$this->extensions['Atom\\Feed'] = $atomFeed;
$atomFeed = $manager->get('DublinCore\\Feed');
$atomFeed->setDomDocument($dom);
$atomFeed->setType($this->data['type']);
$atomFeed->setXpath($this->xpath);
$this->extensions['DublinCore\\Feed'] = $atomFeed;
foreach ($this->extensions as $extension) {
$extension->setXpathPrefix('/atom:feed');
}
}
示例4: __construct
/**
* 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();
$manager = Reader\Reader::getExtensionManager();
$extensions = array('Atom\\Feed', 'DublinCore\\Feed');
foreach ($extensions as $name) {
$extension = $manager->get($name);
$extension->setDomDocument($this->domDocument);
$extension->setType($this->data['type']);
$extension->setXpath($this->xpath);
$this->extensions[$name] = $extension;
}
foreach ($this->extensions as $extension) {
$extension->setXpathPrefix(rtrim($xpathPrefix, '/') . '/atom:source');
}
}
示例5: __construct
/**
* Constructor
*
* @param DOMDocument $dom
* @param string $type
*/
public function __construct(DOMDocument $dom, $type = null)
{
parent::__construct($dom, $type);
$manager = Reader\Reader::getExtensionManager();
$feed = $manager->get('DublinCore\\Feed');
$feed->setDomDocument($dom);
$feed->setType($this->data['type']);
$feed->setXpath($this->xpath);
$this->extensions['DublinCore\\Feed'] = $feed;
$feed = $manager->get('Atom\\Feed');
$feed->setDomDocument($dom);
$feed->setType($this->data['type']);
$feed->setXpath($this->xpath);
$this->extensions['Atom\\Feed'] = $feed;
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);
}
}
示例6: loadExtensions
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;
}
}
示例7: testRegistersUserExtension
public function testRegistersUserExtension()
{
require_once __DIR__ . '/_files/My/Extension/JungleBooks/Entry.php';
require_once __DIR__ . '/_files/My/Extension/JungleBooks/Feed.php';
$manager = Reader\Reader::getExtensionManager();
$manager->setInvokableClass('JungleBooks\\Entry', 'My\\Extension\\JungleBooks\\Entry');
$manager->setInvokableClass('JungleBooks\\Feed', 'My\\Extension\\JungleBooks\\Feed');
Reader\Reader::registerExtension('JungleBooks');
$this->assertTrue(Reader\Reader::isRegistered('JungleBooks'));
}
示例8: loadExtensions
protected function loadExtensions()
{
$all = Reader\Reader::getExtensions();
$manager = Reader\Reader::getExtensionManager();
$feed = $all['feed'];
foreach ($feed as $extension) {
if (in_array($extension, $all['core'])) {
continue;
}
if (!$manager->has($extension)) {
throw new Exception\RuntimeException(sprintf('Unable to load extension "%s"; cannot find class', $extension));
}
$plugin = $manager->get($extension);
$plugin->setDomDocument($this->getDomDocument());
$plugin->setType($this->data['type']);
$plugin->setXpath($this->xpath);
$this->extensions[$extension] = $plugin;
}
}