[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/vendor/simplepie/simplepie/src/ -> Item.php (summary)

SimplePie A PHP-Based RSS and Atom Feed Framework. Takes the hard work out of managing a complete RSS/Atom solution.

Author: Ryan Parman
Author: Sam Sneddon
Author: Ryan McCue
Copyright: 2004-2016 Ryan Parman, Sam Sneddon, Ryan McCue
License: http://www.opensource.org/licenses/bsd-license.php BSD License
Link: http://simplepie.org/ SimplePie
File Size: 2360 lines (131 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Item:: (33 methods):
  __construct()
  set_registry()
  __toString()
  __destruct()
  get_item_tags()
  get_base()
  sanitize()
  get_feed()
  get_id()
  get_title()
  get_description()
  get_content()
  get_thumbnail()
  get_category()
  get_categories()
  get_author()
  get_contributor()
  get_contributors()
  get_authors()
  get_copyright()
  get_date()
  get_updated_date()
  get_local_date()
  get_gmdate()
  get_updated_gmdate()
  get_permalink()
  get_link()
  get_links()
  get_enclosure()
  get_enclosures()
  get_latitude()
  get_longitude()
  get_source()


Class: Item  - X-Ref

Manages all item-related data

Used by {@see \SimplePie\SimplePie::get_item()} and {@see \SimplePie\SimplePie::get_items()}

This class can be overloaded with {@see \SimplePie\SimplePie::set_item_class()}

__construct($feed, $data)   X-Ref
Create a new item object

This is usually used by {@see \SimplePie\SimplePie::get_items} and
{@see \SimplePie\SimplePie::get_item}. Avoid creating this manually.

param: \SimplePie\SimplePie $feed Parent feed
param: array $data Raw data

set_registry(\SimplePie\Registry $registry)   X-Ref
Set the registry handler

This is usually used by {@see \SimplePie\Registry::create}

param: \SimplePie\Registry $registry

__toString()   X-Ref
Get a string representation of the item

return: string

__destruct()   X-Ref
Remove items that link back to this before destroying this object


get_item_tags($namespace, $tag)   X-Ref
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 {@see \SimplePie\SimplePie::get_feed_tags()} for a description of the return value

see: http://simplepie.org/wiki/faq/supported_xml_namespaces
return: array
param: string $namespace The URL of the XML namespace of the elements you're trying to access
param: string $tag Tag name

get_base($element = [])   X-Ref
Get the base URL value.
Uses `<xml:base>`, or item link, or feed base URL.

return: string
param: array $element

sanitize($data, $type, $base = '')   X-Ref
Sanitize feed data

see: \SimplePie\SimplePie::sanitize()
return: string Sanitized data
param: string $data Data to sanitize
param: int $type One of the \SimplePie\SimplePie::CONSTRUCT_* constants
param: string $base Base URL to resolve URLs against

get_feed()   X-Ref
Get the parent feed

Note: this may not work as you think for multifeeds!

link: http://simplepie.org/faq/typical_multifeed_gotchas#missing_data_from_feed
return: \SimplePie\SimplePie

get_id($hash = false, $fn = 'md5')   X-Ref
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.

return: string|null
param: boolean $hash Should we force using a hash instead of the supplied ID?
param: string|false $fn User-supplied function to generate an hash

get_title()   X-Ref
Get the title of the item

Uses `<atom:title>`, `<title>` or `<dc:title>`

return: string|null

get_description($description_only = false)   X-Ref
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 {@see get_content}

Uses `<atom:summary>`, `<description>`, `<dc:description>` or
`<itunes:subtitle>`

return: string|null
param: boolean $description_only Should we avoid falling back to the content?

get_content($content_only = false)   X-Ref
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 {@see get_description}

Uses `<atom:content>` or `<content:encoded>` (RSS 1.0 Content Module)

return: string|null
param: boolean $content_only Should we avoid falling back to the description?

get_thumbnail()   X-Ref
Get the media:thumbnail of the item

Uses `<media:thumbnail>`


return: array|null

get_category($key = 0)   X-Ref
Get a category for the item

return: \SimplePie\Category|null
param: int $key The category that you want to return.  Remember that arrays begin with 0, not 1

get_categories()   X-Ref
Get all categories for the item

Uses `<atom:category>`, `<category>` or `<dc:subject>`

return: \SimplePie\Category[]|null List of {@see \SimplePie\Category} objects

get_author($key = 0)   X-Ref
Get an author for the item

return: \SimplePie\Author|null
param: int $key The author that you want to return.  Remember that arrays begin with 0, not 1

get_contributor($key = 0)   X-Ref
Get a contributor for the item

return: \SimplePie\Author|null
param: int $key The contrbutor that you want to return.  Remember that arrays begin with 0, not 1

get_contributors()   X-Ref
Get all contributors for the item

Uses `<atom:contributor>`

return: \SimplePie\Author[]|null List of {@see \SimplePie\Author} objects

get_authors()   X-Ref
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

get_copyright()   X-Ref
Get the copyright info for the item

Uses `<atom:rights>` or `<dc:rights>`

return: string

get_date($date_format = 'j F Y, g:i a')   X-Ref
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
{@see get_gmdate}

return: int|string|null
param: string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)

get_updated_date($date_format = 'j F Y, g:i a')   X-Ref
Get the update date/time for the item

Uses `<atom:updated>`

Note: obeys PHP's timezone setting. To get a UTC date/time, use
{@see get_gmdate}

return: int|string|null
param: string $date_format Supports any PHP date format from {@see http://php.net/date} (empty for the raw data)

get_local_date($date_format = '%c')   X-Ref
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.

return: int|string|null
param: string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)

get_gmdate($date_format = 'j F Y, g:i a')   X-Ref
Get the posting date/time for the item (UTC time)

see: get_date
return: int|string|null
param: string $date_format Supports any PHP date format from {@see http://php.net/date}

get_updated_gmdate($date_format = 'j F Y, g:i a')   X-Ref
Get the update date/time for the item (UTC time)

see: get_updated_date
return: int|string|null
param: string $date_format Supports any PHP date format from {@see http://php.net/date}

get_permalink()   X-Ref
Get the permalink for the item

Returns the first link available with a relationship of "alternate".
Identical to {@see get_link()} with key 0

see: get_link
return: string|null Permalink URL

get_link($key = 0, $rel = 'alternate')   X-Ref
Get a single link for the item

return: string|null Link URL
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

get_links($rel = 'alternate')   X-Ref
Get all links for the item

Uses `<atom:link>`, `<link>` or `<guid>`

return: array|null Links found for the item (strings)
param: string $rel The relationship of links to return

get_enclosure($key = 0, $prefer = null)   X-Ref
Get an enclosure from the item

Supports the <enclosure> RSS tag, as well as Media RSS and iTunes RSS.

return: \SimplePie\Enclosure|null
param: int $key The enclosure that you want to return.  Remember that arrays begin with 0, not 1

get_enclosures()   X-Ref
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.

return: \SimplePie\Enclosure[]|null List of \SimplePie\Enclosure items

get_latitude()   X-Ref
Get the latitude coordinates for the item

Compatible with the W3C WGS84 Basic Geo and GeoRSS specifications

Uses `<geo:lat>` or `<georss:point>`

link: http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
link: http://www.georss.org/ GeoRSS
return: string|null

get_longitude()   X-Ref
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>`

link: http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
link: http://www.georss.org/ GeoRSS
return: string|null

get_source()   X-Ref
Get the `<atom:source>` for the item

return: \SimplePie\Source|null