Supports the RSS tag, as well as Media RSS and iTunes RSS.
public get_enclosure ( integer $key, $prefer = null ) : SimplePie_Enclosure | null | ||
$key | integer | The enclosure that you want to return. Remember that arrays begin with 0, not 1 |
return | SimplePie_Enclosure | null |
protected function getLinkFromItem(SimplePie_Item $i) { /* @var $e SimplePie_Enclosure */ $e = $i->get_enclosure(0); if (empty($e)) { return ''; } return $e->get_link(); }
/** * Sets special classnames if $item contains an enclosure. * * @access public * @param SimplePie_Item $item The item object to check. * @return array Class and Type values. */ function has_enclosure($item) { // Set default values $class = ''; $type = ''; // Check to see if we have an enclosure so we can add a special icon if ($enclosure = $item->get_enclosure()) { // Figure out the mime type of the enclosure $type = $enclosure->get_real_type(); // Is it a video? if (stristr($type, 'video/') || stristr($type, 'x-shockwave-flash')) { $class = 'enclosure video'; } elseif (stristr($type, 'audio/')) { $class = 'enclosure audio'; } elseif (stristr($type, 'image/')) { $class = 'enclosure image'; } } return array('class' => $class, 'type' => $type); }