File manager - Edit - /home/opticamezl/www/newok/FeedParser.php.tar
Back
home/opticamezl/www/newok/libraries/src/Feed/FeedParser.php 0000644 00000017701 15173373076 0017773 0 ustar 00 <?php /** * Joomla! Content Management System * * @copyright (C) 2012 Open Source Matters, Inc. <https://www.joomla.org> * @license GNU General Public License version 2 or later; see LICENSE.txt */ namespace Joomla\CMS\Feed; use Joomla\CMS\Feed\Parser\NamespaceParserInterface; use Joomla\CMS\Filter\InputFilter; // phpcs:disable PSR1.Files.SideEffects \defined('JPATH_PLATFORM') or die; // phpcs:enable PSR1.Files.SideEffects /** * Feed Parser class. * * @since 3.1.4 */ abstract class FeedParser { /** * The feed element name for the entry elements. * * @var string * @since 3.1.4 */ protected $entryElementName = 'entry'; /** * Array of NamespaceParserInterface objects * * @var array * @since 3.1.4 */ protected $namespaces = []; /** * The XMLReader stream object for the feed. * * @var \XMLReader * @since 3.1.4 */ protected $stream; /** * The InputFilter * * @var InputFilter * @since 3.9.25 */ protected $inputFilter; /** * Constructor. * * @param \XMLReader $stream The XMLReader stream object for the feed. * @param InputFilter $inputFilter The InputFilter object to be used * * @since 3.1.4 */ public function __construct(\XMLReader $stream, InputFilter $inputFilter = null) { $this->stream = $stream; $this->inputFilter = $inputFilter ?: InputFilter::getInstance([], [], 1, 1); } /** * Method to parse the feed into a JFeed object. * * @return Feed * * @since 3.1.4 */ public function parse() { $feed = new Feed(); // Detect the feed version. $this->initialise(); // Let's get this party started... do { // Expand the element for processing. $el = new \SimpleXMLElement($this->stream->readOuterXml()); // Get the list of namespaces used within this element. $ns = $el->getNamespaces(true); // Get an array of available namespace objects for the element. $namespaces = []; foreach ($ns as $prefix => $uri) { // Ignore the empty namespace prefix. if (empty($prefix)) { continue; } // Get the necessary namespace objects for the element. $namespace = $this->fetchNamespace($prefix); if ($namespace) { $namespaces[] = $namespace; } } // Process the element. $this->processElement($feed, $el, $namespaces); // Skip over this element's children since it has been processed. $this->moveToClosingElement(); } while ($this->moveToNextElement()); return $feed; } /** * Method to register a namespace handler object. * * @param string $prefix The XML namespace prefix for which to register the namespace object. * @param NamespaceParserInterface $namespace The namespace object to register. * * @return FeedParser * * @since 3.1.4 */ public function registerNamespace($prefix, NamespaceParserInterface $namespace) { $this->namespaces[$prefix] = $namespace; return $this; } /** * Method to initialise the feed for parsing. If child parsers need to detect versions or other * such things
| ver. 1.4 |
Github
|
.
| PHP 8.3.23 | Generation time: 0 |
proxy
|
phpinfo
|
Settings