Back to RssParser class

Method handleWebmaster

protected void
handleWebmaster
(\Joomla\CMS\Feed\Feed $feed, \SimpleXMLElement $el)
Method to handle the `<webmaster>` 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 handleWebmaster - Source code

/**
 * Method to handle the `<webmaster>` 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 handleWebmaster(Feed $feed, \SimpleXMLElement $el)
{
    // Get the tag contents and split it over the first space.
    $tmp = (string) $el;
    $tmp = explode(' ', $tmp, 2);
    // This is really cheap parsing.  Probably need to create a method to do this more robustly.
    $name = null;
    if (isset($tmp[1])) {
        $name = trim($this->inputFilter->clean($tmp[1], 'html'), ' ()');
    }
    $email = trim(filter_var((string) $tmp[0], FILTER_VALIDATE_EMAIL));
    $feed->addContributor($name, $email, null, 'webmaster');
}