: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'link'))
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'link'))
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
$keys = array_keys($this->data['links']);
if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
$this->data['links'][$key] = array_unique($this->data['links'][$key]);
if (isset($this->data['links'][$rel]))
return $this->data['links'][$rel];
* Get an enclosure from the item
* Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
* @todo Add ability to prefer one type of content over another (in a media group).
* @param int $key The enclosure that you want to return. Remember that arrays begin with 0, not 1
* @return SimplePie_Enclosure|null
public function get_enclosure($key = 0, $prefer = null)
$enclosures = $this->get_enclosures();
if (isset($enclosures[$key]))
return $enclosures[$key];
* Get all available enclosures (podcasts, etc.)
* Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
* At this point, we're pretty much assuming that all enclosures for an item
* are the same content. Anything else is too complicated to
* @todo Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
* @todo If an element exists at a level, but its value is empty, we should fall back to the value from the parent (if it exists).
* @return SimplePie_Enclosure[]|null List of SimplePie_Enclosure items
public function get_enclosures()
if (!isset($this->data['enclosures']))
$this->data['enclosures'] = array();
$categories_parent = null;
$copyrights_parent = null;
$description_parent = null;
$restrictions_parent = null;
$thumbnails_parent = null;
// Let's do the channel and item-level ones first, and just re-use them if we need to.
$parent = $this->get_feed();
if ($captions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
foreach ($captions as $caption)
$caption_startTime = null;
if (isset($caption['attribs']['']['type']))
$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['lang']))
$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['start']))
$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['end']))
$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['data']))
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
foreach ($captions as $caption)
$caption_startTime = null;
if (isset($caption['attribs']['']['type']))
$caption_type = $this->sanitize($caption['attribs']['']['type'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['lang']))
$caption_lang = $this->sanitize($caption['attribs']['']['lang'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['start']))
$caption_startTime = $this->sanitize($caption['attribs']['']['start'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['attribs']['']['end']))
$caption_endTime = $this->sanitize($caption['attribs']['']['end'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($caption['data']))
$caption_text = $this->sanitize($caption['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
if (is_array($captions_parent))
$captions_parent = array_values(array_unique($captions_parent));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
if (isset($category['data']))
$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($category['attribs']['']['scheme']))
$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
$scheme = 'http://search.yahoo.com/mrss/category_schema';
if (isset($category['attribs']['']['label']))
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
$categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label));
foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'category') as $category)
if (isset($category['data']))
$term = $this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($category['attribs']['']['scheme']))
$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
$scheme = 'http://search.yahoo.com/mrss/category_schema';
if (isset($category['attribs']['']['label']))
$label = $this->sanitize($category['attribs']['']['label'], SIMPLEPIE_CONSTRUCT_TEXT);
$categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label));
foreach ((array) $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'category') as $category)
$scheme = 'http://www.itunes.com/dtds/podcast-1.0.dtd';
if (isset($category['attribs']['']['text']))
$label = $this->sanitize($category['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
$categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label));
if (isset($category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category']))
foreach ((array) $category['child'][SIMPLEPIE_NAMESPACE_ITUNES]['category'] as $subcategory)
if (isset($subcategory['attribs']['']['text']))
$label = $this->sanitize($subcategory['attribs']['']['text'], SIMPLEPIE_CONSTRUCT_TEXT);
$categories_parent[] = $this->registry->create('Category', array($term, $scheme, $label));
if (is_array($categories_parent))
$categories_parent = array_values(array_unique($categories_parent));
if ($copyright = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
if (isset($copyright[0]['attribs']['']['url']))
$copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($copyright[0]['data']))
$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
if (isset($copyright[0]['attribs']['']['url']))
$copyright_url = $this->sanitize($copyright[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($copyright[0]['data']))
$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
if ($credits = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
foreach ($credits as $credit)
if (isset($credit['attribs']['']['role']))
$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($credit['attribs']['']['scheme']))
$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
$credit_scheme = 'urn:ebu';
if (isset($credit['data']))
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
foreach ($credits as $credit)
if (isset($credit['attribs']['']['role']))
$credit_role = $this->sanitize($credit['attribs']['']['role'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($credit['attribs']['']['scheme']))
$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
$credit_scheme = 'urn:ebu';
if (isset($credit['data']))
$credit_name = $this->sanitize($credit['data'], SIMPLEPIE_CONSTRUCT_TEXT);
$credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
if (is_array($credits_parent))
$credits_parent = array_values(array_unique($credits_parent));
if ($description_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
if (isset($description_parent[0]['data']))
$description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
if (isset($description_parent[0]['data']))
$description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if ($duration_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'duration'))
if (isset($duration_parent[0]['data']))
$temp = explode(':', $this->sanitize($duration_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
$seconds = (int) array_pop($temp);
$minutes = (int) array_pop($temp);
$seconds += $minutes * 60;
$hours = (int) array_pop($temp);
$seconds += $hours * 3600;
$duration_parent = $seconds;
if ($hashes_iterator = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
foreach ($hashes_iterator as $hash)
if (isset($hash['data']))
$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($hash['attribs']['']['algo']))
$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
$hashes_parent[] = $algo.':'.$value;
elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
foreach ($hashes_iterator as $hash)
if (isset($hash['data']))
$value = $this->sanitize($hash['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($hash['attribs']['']['algo']))
$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
$hashes_parent[] = $algo.':'.$value;
if (is_array($hashes_parent))
$hashes_parent = array_values(array_unique($hashes_parent));
if ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
if (isset($keywords[0]['data']))
$temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
$keywords_parent[] = trim($word);
elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
if (isset($keywords[0]['data']))
$temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
$keywords_parent[] = trim($word);
elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
if (isset($keywords[0]['data']))
$temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
$keywords_parent[] = trim($word);
elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
if (isset($keywords[0]['data']))
$temp = explode(',', $this->sanitize($keywords[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT));
$keywords_parent[] = trim($word);
if (is_array($keywords_parent))
$keywords_parent = array_values(array_unique($keywords_parent));
if ($player_parent = $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
if (isset($player_parent[0]['attribs']['']['url']))
$player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
if (isset($player_parent[0]['attribs']['']['url']))
$player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);