Back to RssParser class

Method processFeedEntry

protected void
processFeedEntry
(\Joomla\CMS\Feed\FeedEntry $entry, \SimpleXMLElement $el)
Method to handle a `<item>` element for the feed.
Parameters
  • \Joomla\CMS\Feed\FeedEntry $entry The FeedEntry object being built from the parsed feed entry.
  • \SimpleXMLElement $el The current XML element object to handle.
Returns
  • void
Since
  • 3.1.4
Class: RssParser
Project: Joomla

Method processFeedEntry - Source code

/**
 * Method to handle a `<item>` element for the feed.
 *
 * @param   FeedEntry          $entry  The FeedEntry object being built from the parsed feed entry.
 * @param   \SimpleXMLElement  $el     The current XML element object to handle.
 *
 * @return  void
 *
 * @since   3.1.4
 */
protected function processFeedEntry(FeedEntry $entry, \SimpleXMLElement $el)
{
    $entry->uri = (string) filter_var($el->link, FILTER_VALIDATE_URL);
    $entry->title = $this->inputFilter->clean((string) $el->title, 'html');
    $entry->publishedDate = $this->inputFilter->clean((string) $el->pubDate, 'html');
    $entry->updatedDate = $this->inputFilter->clean((string) $el->pubDate, 'html');
    $entry->content = $this->inputFilter->clean((string) $el->description, 'html');
    $entry->guid = $this->inputFilter->clean((string) $el->guid, 'html');
    $entry->isPermaLink = $entry->guid !== '' && (string) $el->guid['isPermaLink'] !== 'false';
    $entry->comments = $this->inputFilter->clean((string) $el->comments, 'html');
    // Add the feed entry author if available.
    $author = $this->inputFilter->clean((string) $el->author, 'html');
    if (!empty($author)) {
        $entry->author = $this->processPerson($author);
    }
    // Add any categories to the entry.
    foreach ($el->category as $category) {
        $entry->addCategory((string) $category, (string) $category['domain']);
    }
    // Add any enclosures to the entry.
    foreach ($el->enclosure as $enclosure) {
        $link = new FeedLink((string) $enclosure['url'], null, (string) $enclosure['type'], null, null, (int) $enclosure['length']);
        $entry->addLink($link);
    }
}