SimplePie_Item
in package
Table of Contents
Properties
Methods
- __construct() : mixed
- __destruct() : mixed
- Remove items that link back to this before destroying this object
- __toString() : string
- Get a string representation of the item
- get_author() : SimplePie_Author|null
- Get an author for the item
- get_authors() : array<string|int, mixed>|null
- Get all authors for the item
- get_base() : string
- Get the base URL value from the parent feed
- get_content() : string|null
- Get the content for the item
- get_date() : int|string|null
- Get the posting date/time for the item
- get_description() : string|null
- Get the content for the item
- get_enclosure() : SimplePie_Enclosure|null
- Get an enclosure from the item
- get_enclosures() : array<string|int, SimplePie_Enclosure>|null
- Get all available enclosures (podcasts, etc.)
- get_feed() : SimplePie
- Get the parent feed
- get_id() : string|null
- Get the unique identifier for the item
- get_item_tags() : array<string|int, mixed>
- Get data for an item-level element
- get_link() : string|null
- Get a single link for the item
- get_links() : array<string|int, mixed>|null
- Get all links for the item
- get_permalink() : string|null
- Get the permalink for the item
- get_source() : SimplePie_Source|null
- Get the `<atom:source>` for the item
- get_title() : string|null
- Get the title of the item
- sanitize() : string
- Sanitize feed data
- set_registry() : mixed
- Set the registry handler
Properties
$data
public
mixed
$data
= array()
$feed
public
mixed
$feed
$registry
protected
mixed
$registry
Methods
__construct()
public
__construct(mixed $feed, mixed $data) : mixed
Parameters
- $feed : mixed
- $data : mixed
__destruct()
Remove items that link back to this before destroying this object
public
__destruct() : mixed
__toString()
Get a string representation of the item
public
__toString() : string
Return values
stringget_author()
Get an author for the item
public
get_author([int $key = 0 ]) : SimplePie_Author|null
Parameters
- $key : int = 0
-
The author that you want to return. Remember that arrays begin with 0, not 1
Tags
Return values
SimplePie_Author|nullget_authors()
Get all authors for the item
public
get_authors() : array<string|int, mixed>|null
Uses <atom:author>
, <author>
, <dc:creator>
or <itunes:author>
Tags
Return values
array<string|int, mixed>|null —List of SimplePie_Author objects
get_base()
Get the base URL value from the parent feed
public
get_base([array<string|int, mixed> $element = array() ]) : string
Uses <xml:base>
Parameters
- $element : array<string|int, mixed> = array()
Return values
stringget_content()
Get the content for the item
public
get_content([bool $content_only = false ]) : string|null
Prefers full content over summaries, but will return a summary if full content does not exist.
To prefer summaries instead, use get_description
Uses <atom:content>
or <content:encoded>
(RSS 1.0 Content Module)
Parameters
- $content_only : bool = false
-
Should we avoid falling back to the description?
Tags
Return values
string|nullget_date()
Get the posting date/time for the item
public
get_date([string $date_format = 'j F Y, g:i a' ]) : int|string|null
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 get_gmdate
Parameters
- $date_format : string = 'j F Y, g:i a'
-
Supports any PHP date format from http://php.net/date (empty for the raw data)
Tags
Return values
int|string|nullget_description()
Get the content for the item
public
get_description([bool $description_only = false ]) : string|null
Prefers summaries over full content , but will return full content if a summary does not exist.
To prefer full content instead, use get_content
Uses <atom:summary>
, <description>
, <dc:description>
or
<itunes:subtitle>
Parameters
- $description_only : bool = false
-
Should we avoid falling back to the content?
Tags
Return values
string|nullget_enclosure()
Get an enclosure from the item
public
get_enclosure([int $key = 0 ][, mixed $prefer = null ]) : SimplePie_Enclosure|null
Supports the
Parameters
- $key : int = 0
-
The enclosure that you want to return. Remember that arrays begin with 0, not 1
- $prefer : mixed = null
Tags
Return values
SimplePie_Enclosure|nullget_enclosures()
Get all available enclosures (podcasts, etc.)
public
get_enclosures() : array<string|int, SimplePie_Enclosure>|null
Supports the
At this point, we're pretty much assuming that all enclosures for an item are the same content. Anything else is too complicated to properly support.
Tags
Return values
array<string|int, SimplePie_Enclosure>|null —List of SimplePie_Enclosure items
get_feed()
Get the parent feed
public
get_feed() : SimplePie
Note: this may not work as you think for multifeeds!
Tags
Return values
SimplePieget_id()
Get the unique identifier for the item
public
get_id([bool $hash = false ][, string|false $fn = 'md5' ]) : string|null
This is usually used when writing code to check for new items in a feed.
Uses <atom:id>
, <guid>
, <dc:identifier>
or the about
attribute
for RDF. If none of these are supplied (or $hash
is true), creates an
MD5 hash based on the permalink, title and content.
Parameters
- $hash : bool = false
-
Should we force using a hash instead of the supplied ID?
- $fn : string|false = 'md5'
-
User-supplied function to generate an hash
Tags
Return values
string|nullget_item_tags()
Get data for an item-level element
public
get_item_tags(string $namespace, string $tag) : array<string|int, mixed>
This method allows you to get access to ANY element/attribute that is a sub-element of the item/entry tag.
See SimplePie::get_feed_tags() for a description of the return value
Parameters
- $namespace : string
-
The URL of the XML namespace of the elements you're trying to access
- $tag : string
-
Tag name
Tags
Return values
array<string|int, mixed>get_link()
Get a single link for the item
public
get_link([int $key = 0 ][, string $rel = 'alternate' ]) : string|null
Parameters
- $key : int = 0
-
The link that you want to return. Remember that arrays begin with 0, not 1
- $rel : string = 'alternate'
-
The relationship of the link to return
Tags
Return values
string|null —Link URL
get_links()
Get all links for the item
public
get_links([string $rel = 'alternate' ]) : array<string|int, mixed>|null
Uses <atom:link>
, <link>
or <guid>
Parameters
- $rel : string = 'alternate'
-
The relationship of links to return
Tags
Return values
array<string|int, mixed>|null —Links found for the item (strings)
get_permalink()
Get the permalink for the item
public
get_permalink() : string|null
Returns the first link available with a relationship of "alternate". Identical to get_link() with key 0
Tags
Return values
string|null —Permalink URL
get_source()
Get the `<atom:source>` for the item
public
get_source() : SimplePie_Source|null
Tags
Return values
SimplePie_Source|nullget_title()
Get the title of the item
public
get_title() : string|null
Uses <atom:title>
, <title>
or <dc:title>
Tags
Return values
string|nullsanitize()
Sanitize feed data
public
sanitize(string $data, int $type[, string $base = '' ]) : string
Parameters
- $data : string
-
Data to sanitize
- $type : int
-
One of the SIMPLEPIE_CONSTRUCT_* constants
- $base : string = ''
-
Base URL to resolve URLs against
Tags
Return values
string —Sanitized data
set_registry()
Set the registry handler
public
set_registry(SimplePie_Registry $registry) : mixed
This is usually used by SimplePie_Registry::create
Parameters
- $registry : SimplePie_Registry