Back to RssParser class

Method handleImage

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

Method handleImage - Source code

/**
 * Method to handle the `<image>` element for the feed.
 *
 * @param   Feed               $feed  The Feed object being built from the parsed feed.
 * @param   \SimpleXMLElement  $el    The current XML element object to handle.
 *
 * @return  void
 *
 * @since   3.1.4
 */
protected function handleImage(Feed $feed, \SimpleXMLElement $el)
{
    // Create a feed link object for the image.
    $image = new FeedLink((string) $el->url, null, 'logo', null, $this->inputFilter->clean((string) $el->title, 'html'));
    // Populate extra fields if they exist.
    $image->link = (string) filter_var($el->link, FILTER_VALIDATE_URL);
    $image->description = $this->inputFilter->clean((string) $el->description, 'html');
    $image->height = (string) $el->height;
    $image->width = (string) $el->width;
    $feed->image = $image;
}