Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Manages all item-related data. More...
Public Member Functions | |
__construct ($feed, $data) | |
Create a new item object. | |
__destruct () | |
Remove items that link back to this before destroying this object. | |
__toString () | |
Get a string representation of the item. | |
get_author ($key=0) | |
Get an author for the item. | |
get_authors () | |
Get all authors for the item. | |
get_base ($element=[]) | |
Get the base URL value. | |
get_categories () | |
Get all categories for the item. | |
get_category ($key=0) | |
Get a category for the item. | |
get_content ($content_only=false) | |
Get the content for the item. | |
get_contributor ($key=0) | |
Get a contributor for the item. | |
get_contributors () | |
Get all contributors for the item. | |
get_copyright () | |
Get the copyright info for the item. | |
get_date ($date_format='j F Y, g:i a') | |
Get the posting date/time for the item. | |
get_description ($description_only=false) | |
Get the content for the item. | |
get_enclosure ($key=0, $prefer=null) | |
Get an enclosure from the item. | |
get_enclosures () | |
Get all available enclosures (podcasts, etc.) | |
get_feed () | |
Get the parent feed. | |
get_gmdate ($date_format='j F Y, g:i a') | |
Get the posting date/time for the item (UTC time) | |
get_id ($hash=false, $fn='md5') | |
Get the unique identifier for the item. | |
get_item_tags ($namespace, $tag) | |
Get data for an item-level element. | |
get_latitude () | |
Get the latitude coordinates for the item. | |
get_link ($key=0, $rel='alternate') | |
Get a single link for the item. | |
get_links ($rel='alternate') | |
Get all links for the item. | |
get_local_date ($date_format='%c') | |
Get the localized posting date/time for the item. | |
get_longitude () | |
Get the longitude coordinates for the item. | |
get_permalink () | |
Get the permalink for the item. | |
get_source () | |
Get the <atom:source> for the item. | |
get_thumbnail () | |
Get the media:thumbnail of the item. | |
get_title () | |
Get the title of the item. | |
get_updated_date ($date_format='j F Y, g:i a') | |
Get the update date/time for the item. | |
get_updated_gmdate ($date_format='j F Y, g:i a') | |
Get the update date/time for the item (UTC time) | |
sanitize ($data, $type, $base='') | |
Sanitize feed data. | |
set_registry (\SimplePie\Registry $registry) | |
Set the registry handler. | |
set_registry (Registry $registry) | |
Set the Registry into the class. | |
Public Attributes | |
array | $data = [] |
Raw data. | |
SimplePie SimplePie | $feed |
Parent feed. | |
Protected Attributes | |
SimplePie Registry | $registry |
Registry object. | |
Manages all item-related data.
Used by {
This class can be overloaded with {
:: @subpackage API
Item::__construct | ( | $feed, | |
$data ) |
Create a new item object.
This is usually used by {
SimplePie\SimplePie | $feed | Parent feed |
array | $data | Raw data |
Item::__toString | ( | ) |
Get a string representation of the item.
string |
Item::get_author | ( | $key = 0 | ) |
Get an author for the item.
int | $key | The author that you want to return. Remember that arrays begin with 0, not 1 |
SimplePie\Author|null |
Item::get_authors | ( | ) |
Get all authors for the item.
Uses <atom:author>
, <author>
, <dc:creator>
or <itunes:author>
SimplePie\Author[]|null | List of { |
Item::get_base | ( | $element = [] | ) |
Get the base URL value.
Uses <xml:base>
, or item link, or feed base URL.
array | $element |
string |
Item::get_categories | ( | ) |
Get all categories for the item.
Uses <atom:category>
, <category>
or <dc:subject>
SimplePie\Category[]|null | List of { |
Item::get_category | ( | $key = 0 | ) |
Get a category for the item.
get_categories()
since Beta 2) int | $key | The category that you want to return. Remember that arrays begin with 0, not 1 |
SimplePie\Category|null |
Item::get_content | ( | $content_only = false | ) |
Get the content for the item.
Prefers full content over summaries, but will return a summary if full content does not exist.
To prefer summaries instead, use {
Uses <atom:content>
or <content:encoded>
(RSS 1.0 Content Module)
boolean | $content_only | Should we avoid falling back to the description? |
string|null |
Item::get_contributor | ( | $key = 0 | ) |
Get a contributor for the item.
int | $key | The contrbutor that you want to return. Remember that arrays begin with 0, not 1 |
SimplePie\Author|null |
Item::get_contributors | ( | ) |
Get all contributors for the item.
Uses <atom:contributor>
SimplePie\Author[]|null | List of { |
Item::get_copyright | ( | ) |
Get the copyright info for the item.
Uses <atom:rights>
or <dc:rights>
string |
Item::get_date | ( | $date_format = 'j F Y, | |
g:i a' | ) |
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 {
get_item_date
since 0.8)string | $date_format | Supports any PHP date format from { |
int|string|null |
Item::get_description | ( | $description_only = false | ) |
Get the content for the item.
Prefers summaries over full content , but will return full content if a summary does not exist.
To prefer full content instead, use {
Uses <atom:summary>
, <description>
, <dc:description>
or <itunes:subtitle>
boolean | $description_only | Should we avoid falling back to the content? |
string|null |
Item::get_enclosure | ( | $key = 0, | |
$prefer = null ) |
Get an enclosure from the item.
Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.
int | $key | The enclosure that you want to return. Remember that arrays begin with 0, not 1 |
SimplePie\Enclosure|null |
Item::get_enclosures | ( | ) |
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 properly support.
Add support for end-user defined sorting of enclosures by type/handler (so we can prefer the faster-loading FLV over MP4).
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).
SimplePie\Enclosure[]|null | List of SimplePie\Enclosure items |
Item::get_feed | ( | ) |
Get the parent feed.
Note: this may not work as you think for multifeeds!
@externalurl http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed
SimplePie\SimplePie |
Item::get_gmdate | ( | $date_format = 'j F Y, | |
g:i a' | ) |
Get the posting date/time for the item (UTC time)
string | $date_format | Supports any PHP date format from { |
int|string|null |
Item::get_id | ( | $hash = false, | |
$fn = 'md5' ) |
Get the unique identifier for the item.
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.
boolean | $hash | Should we force using a hash instead of the supplied ID? |
string | false | $fn | User-supplied function to generate an hash |
string|null |
Item::get_item_tags | ( | $namespace, | |
$tag ) |
Get data for an item-level element.
This method allows you to get access to ANY element/attribute that is a sub-element of the item/entry tag.
See {
string | $namespace | The URL of the XML namespace of the elements you're trying to access |
string | $tag | Tag name |
array |
Item::get_latitude | ( | ) |
Get the latitude coordinates for the item.
Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
Uses <geo:lat>
or <georss:point>
string|null |
Item::get_link | ( | $key = 0, | |
$rel = 'alternate' ) |
Get a single link for the item.
int | $key | The link that you want to return. Remember that arrays begin with 0, not 1 |
string | $rel | The relationship of the link to return |
string|null | Link URL |
Item::get_links | ( | $rel = 'alternate' | ) |
Get all links for the item.
Uses <atom:link>
, <link>
or <guid>
string | $rel | The relationship of links to return |
array|null | Links found for the item (strings) |
Item::get_local_date | ( | $date_format = '%c' | ) |
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 setlocale(). The available localizations depend on which ones are installed on your web server.
string | $date_format | Supports any PHP date format from { |
int|string|null |
Item::get_longitude | ( | ) |
Get the longitude coordinates for the item.
Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications
Uses <geo:long>
, <geo:lon>
or <georss:point>
string|null |
Item::get_permalink | ( | ) |
Get the permalink for the item.
Returns the first link available with a relationship of "alternate". Identical to {
string|null | Permalink URL |
Item::get_source | ( | ) |
Get the <atom:source>
for the item.
SimplePie\Source|null |
Item::get_thumbnail | ( | ) |
Get the media:thumbnail of the item.
Uses <media:thumbnail>
array|null |
Item::get_title | ( | ) |
Get the title of the item.
Uses <atom:title>
, <title>
or <dc:title>
get_item_title
since 0.8) string|null |
Item::get_updated_date | ( | $date_format = 'j F Y, | |
g:i a' | ) |
Get the update date/time for the item.
Uses <atom:updated>
Note: obeys PHP's timezone setting. To get a UTC date/time, use {
string | $date_format | Supports any PHP date format from { |
int|string|null |
Item::get_updated_gmdate | ( | $date_format = 'j F Y, | |
g:i a' | ) |
Get the update date/time for the item (UTC time)
string | $date_format | Supports any PHP date format from { |
int|string|null |
Item::sanitize | ( | $data, | |
$type, | |||
$base = '' ) |
Item::set_registry | ( | \SimplePie\Registry | $registry | ) |
Set the registry handler.
This is usually used by {
SimplePie\Registry | $registry |
|
inherited |