: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, $type) as $category)
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, $type) as $category)
$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null, $type));
return array_unique($categories);
* Get an author for the item
* @param int $key The author that you want to return. Remember that arrays begin with 0, not 1
* @return SimplePie_Author|null
public function get_author($key = 0)
$authors = $this->get_authors();
if (isset($authors[$key]))
* Get a contributor for the item
* @param int $key The contrbutor that you want to return. Remember that arrays begin with 0, not 1
* @return SimplePie_Author|null
public function get_contributor($key = 0)
$contributors = $this->get_contributors();
if (isset($contributors[$key]))
return $contributors[$key];
* Get all contributors for the item
* Uses `<atom:contributor>`
* @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects
public function get_contributors()
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'contributor') as $contributor)
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
$uri = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if ($name !== null || $email !== null || $uri !== null)
$contributors[] = $this->registry->create('Author', array($name, $uri, $email));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'contributor') as $contributor)
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
$name = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
$url = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
if (isset($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
$email = $this->sanitize($contributor['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if ($name !== null || $email !== null || $url !== null)
$contributors[] = $this->registry->create('Author', array($name, $url, $email));
if (!empty($contributors))
return array_unique($contributors);
* Get all authors for the item
* Uses `<atom:author>`, `<author>`, `<dc:creator>` or `<itunes:author>`
* @return SimplePie_Author[]|null List of {@see SimplePie_Author} objects
public function get_authors()
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']))
$name = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']))
$uri = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]));
if (isset($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data']))
$email = $this->sanitize($author['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if ($name !== null || $email !== null || $uri !== null)
$authors[] = $this->registry->create('Author', array($name, $uri, $email));
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'author'))
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data']))
$name = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['name'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data']))
$url = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['url'][0]));
if (isset($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data']))
$email = $this->sanitize($author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_03]['email'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
if ($name !== null || $email !== null || $url !== null)
$authors[] = $this->registry->create('Author', array($name, $url, $email));
if ($author = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'author'))
$authors[] = $this->registry->create('Author', array(null, null, $this->sanitize($author[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT)));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'creator') as $author)
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'creator') as $author)
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'author') as $author)
$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
return array_unique($authors);
elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
elseif ($authors = $this->feed->get_authors())
* Get the copyright info for the item
* Uses `<atom:rights>` or `<dc:rights>`
public function get_copyright()
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
* Get the posting date/time for the item
* Uses `<atom:published>`, `<atom:updated>`, `<atom:issued>`,
* `<atom:modified>`, `<pubDate>` or `<dc:date>`
* Note: obeys PHP's timezone setting. To get a UTC date/time, use
* @since Beta 2 (previously called `get_item_date` since 0.8)
* @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
* @return int|string|null
public function get_date($date_format = 'j F Y, g:i a')
if (!isset($this->data['date']))
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
$this->data['date']['raw'] = $return[0]['data'];
elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
$this->data['date']['raw'] = $return[0]['data'];
if (!empty($this->data['date']['raw']))
$parser = $this->registry->call('Parse_Date', 'get');
$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
$this->data['date'] = null;
$date_format = (string) $date_format;
return $this->sanitize($this->data['date']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
return $this->data['date']['parsed'];
return date($date_format, $this->data['date']['parsed']);
* Get the update date/time for the item
* Note: obeys PHP's timezone setting. To get a UTC date/time, use
* @param string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)
* @return int|string|null
public function get_updated_date($date_format = 'j F Y, g:i a')
if (!isset($this->data['updated']))
if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
$this->data['updated']['raw'] = $return[0]['data'];
if (!empty($this->data['updated']['raw']))
$parser = $this->registry->call('Parse_Date', 'get');
$this->data['updated']['parsed'] = $parser->parse($this->data['updated']['raw']);
$this->data['updated'] = null;
if ($this->data['updated'])
$date_format = (string) $date_format;
return $this->sanitize($this->data['updated']['raw'], SIMPLEPIE_CONSTRUCT_TEXT);
return $this->data['updated']['parsed'];
return date($date_format, $this->data['updated']['parsed']);
* Get the localized posting date/time for the item
* Returns the date formatted in the localized language. To display in
* languages other than the server's default, you need to change the locale
* with {@link http://php.net/setlocale setlocale()}. The available
* localizations depend on which ones are installed on your web server.
* @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
* @return int|string|null
public function get_local_date($date_format = '%c')
return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
elseif (($date = $this->get_date('U')) !== null && $date !== false)
return strftime($date_format, $date);
* Get the posting date/time for the item (UTC time)
* @param string $date_format Supports any PHP date format from {@see http://php.net/date}
* @return int|string|null
public function get_gmdate($date_format = 'j F Y, g:i a')
$date = $this->get_date('U');
return gmdate($date_format, $date);
* Get the update date/time for the item (UTC time)
* @param string $date_format Supports any PHP date format from {@see http://php.net/date}
* @return int|string|null
public function get_updated_gmdate($date_format = 'j F Y, g:i a')
$date = $this->get_updated_date('U');
return gmdate($date_format, $date);
* Get the permalink for the item
* Returns the first link available with a relationship of "alternate".
* Identical to {@see get_link()} with key 0
* @return string|null Permalink URL
public function get_permalink()
$link = $this->get_link();
$enclosure = $this->get_enclosure(0);
elseif ($enclosure !== null)
return $enclosure->get_link();
* Get a single link for the item
* @param int $key The link that you want to return. Remember that arrays begin with 0, not 1
* @param string $rel The relationship of the link to return
* @return string|null Link URL
public function get_link($key = 0, $rel = 'alternate')
$links = $this->get_links($rel);
if ($links && $links[$key] !== null)
* Get all links for the item
* Uses `<atom:link>`, `<link>` or `<guid>`
* @param string $rel The relationship of links to return
* @return array|null Links found for the item (strings)
public function get_links($rel = 'alternate')
if (!isset($this->data['links']))
$this->data['links'] = array();
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
if (isset($link['attribs']['']['href']))
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
if (isset($link['attribs']['']['href']))
$link_rel = (isset($link['attribs']['']['rel'])) ? $link['attribs']['']['rel'] : 'alternate';
$this->data['links'][$link_rel][] = $this->sanitize($link['attribs']['']['href'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($link));
if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'link'))