Class SimplePie

Description

SimplePie

Located in /libraries/simplepie/simplepie.php (line 399)


	
			
Method Summary
 static void merge_items ( $urls, [ $start = 0], [ $end = 0], [ $limit = 0])
 static void sort_items ( $a,  $b)
 SimplePie SimplePie ([string $feed_url = null], [string $cache_location = null], [int $cache_duration = null])
 void __destruct ()
 void enable_cache ([bool $enable = true])
 void enable_order_by_date ([bool $enable = true])
 void enable_xml_dump ([bool $enable = false])
 void encode_instead_of_strip ([ $enable = true])
 string error ()
 void force_feed ([bool $enable = false])
 void force_fsockopen ([bool $enable = false])
 void get_author ([ $key = 0])
 void get_authors ()
 void get_base ([ $element = array()])
 void get_categories ()
 void get_category ([ $key = 0])
 void get_channel_tags ( $namespace,  $tag)
 void get_contributor ([ $key = 0])
 void get_copyright ()
 void get_description ()
 void get_encoding ()
 void get_favicon ()
 void get_feed_tags ( $namespace,  $tag)
 void get_image_link ()
 void get_image_tags ( $namespace,  $tag)
 void get_image_title ()
 void get_image_url ()
 void get_image_width ()
 void get_item ([ $key = 0])
 void get_items ([ $start = 0], [ $end = 0])
 void get_item_quantity ([ $max = 0])
 void get_language ()
 void get_latitude ()
 void get_link ([ $key = 0], [ $rel = 'alternate'])
 void get_links ([ $rel = 'alternate'])
 void get_longitude ()
 void get_permalink ()
 void get_title ()
 void get_type ()
 void handle_content_type ([ $mime = 'text/html'])
 void init ()
 void remove_div ([ $enable = true])
 void sanitize ( $data,  $type, [ $base = ''])
 void set_author_class ([string $class = 'SimplePie_Author'])
 void set_autodiscovery_cache_duration ([int $seconds = 604800])
 void set_autodiscovery_level ([int $level = SIMPLEPIE_LOCATOR_ALL])
 void set_cache_class ([string $class = 'SimplePie_Cache'])
 void set_cache_duration ([int $seconds = 3600])
 void set_cache_location ([string $location = './cache'])
 void set_cache_name_function ([mixed $function = 'md5'])
 void set_caption_class ([string $class = 'SimplePie_Caption'])
 void set_category_class ([string $class = 'SimplePie_Category'])
 void set_content_type_sniffer_class ([string $class = 'SimplePie_Content_Type_Sniffer'])
 void set_copyright_class ([string $class = 'SimplePie_Copyright'])
 void set_credit_class ([string $class = 'SimplePie_Credit'])
 void set_enclosure_class ([string $class = 'SimplePie_Enclosure'])
 void set_favicon_handler ([str $page = false], [str $qs = 'i'])
 void set_feed_url (mixed $url)
 bool set_file (object &$file)
 void set_file_class ([string $class = 'SimplePie_File'])
 void set_image_handler ([str $page = false], [str $qs = 'i'])
 void set_input_encoding ([string $encoding = false])
 void set_item_class ([string $class = 'SimplePie_Item'])
 void set_item_limit ([integer $limit = 0])
 void set_javascript ([mixed $get = 'js'])
 void set_locator_class ([string $class = 'SimplePie_Locator'])
 void set_max_checked_feeds ([int $max = 10])
 void set_output_encoding ([ $encoding = 'UTF-8'])
 void set_parser_class ([string $class = 'SimplePie_Parser'])
 void set_rating_class ([string $class = 'SimplePie_Rating'])
 void set_raw_data (string $data)
 void set_restriction_class ([string $class = 'SimplePie_Restriction'])
 void set_sanitize_class ([string $class = 'SimplePie_Sanitize'])
 void set_source_class ([string $class = 'SimplePie_Source'])
 void set_stupidly_fast ([bool $set = false])
 void set_timeout ([int $timeout = 10])
 void set_url_replacements ([array $element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'),'input'=>'src','ins'=>'cite','q'=>'cite')])
 void set_useragent ([string $ua = SIMPLEPIE_USERAGENT])
 void strip_attributes ([ $attribs = ''])
 void strip_comments ([ $strip = false])
 void strip_htmltags ([ $tags = ''], [ $encode = null])
 void subscribe_aol ()
 void subscribe_feed ()
 void subscribe_msn ()
 void subscribe_odeo ()
 void subscribe_rojo ()
 void subscribe_url ()
 void subscribe_yahoo ()
 void __toString ()
Methods
static merge_items (line 3064)
static void merge_items ( $urls, [ $start = 0], [ $end = 0], [ $limit = 0])
  • $urls
  • $start
  • $end
  • $limit
static sort_items (line 3056)
static void sort_items ( $a,  $b)
  • $a
  • $b
Constructor SimplePie (line 738)

The SimplePie class contains feed level data and options

There are two ways that you can create a new SimplePie object. The first is by passing a feed URL as a parameter to the SimplePie constructor (as well as optionally setting the cache location and cache expiry). This will initialise the whole feed with all of the default settings, and you can begin accessing methods and properties immediately.

The second way is to create the SimplePie object with no parameters at all. This will enable you to set configuration options. After setting them, you must initialise the feed using $feed->init(). At that point the object's methods and properties will be available to you. This format is what is used throughout this documentation.

  • since: 1.0 Preview Release
  • access: public
SimplePie SimplePie ([string $feed_url = null], [string $cache_location = null], [int $cache_duration = null])
  • string $feed_url: This is the URL you want to parse.
  • string $cache_location: This is where you want the cache to be stored.
  • int $cache_duration: This is the number of seconds that you want to store the cache file for.
Destructor __destruct (line 773)

Remove items that link back to this before destroying this object

void __destruct ()
enable_cache (line 934)

Enables/disables caching in SimplePie.

This option allows you to disable caching all-together in SimplePie. However, disabling the cache can lead to longer load times.

  • since: 1.0 Preview Release
  • access: public
void enable_cache ([bool $enable = true])
  • bool $enable: Enable caching
enable_order_by_date (line 980)

Determines whether feed items should be sorted into reverse chronological order.

  • access: public
void enable_order_by_date ([bool $enable = true])
  • bool $enable: Sort as reverse chronological order.
enable_xml_dump (line 919)

Outputs the raw XML content of the feed, after it has gone through SimplePie's filters.

Used only for debugging, this function will output the XML content as text/xml. When SimplePie reads in a feed, it does a bit of cleaning up before trying to parse it. Many parts of the feed are re-written in memory, and in the end, you have a parsable feed. XML dump shows you the actual XML that SimplePie tries to parse, which may or may not be very different from the original feed.

  • since: 1.0 Preview Release
  • access: public
void enable_xml_dump ([bool $enable = false])
  • bool $enable: Enable XML dump
encode_instead_of_strip (line 1418)
void encode_instead_of_strip ([ $enable = true])
  • $enable
error (line 1842)

Return the error message for the occured error

  • return: Error message
  • access: public
string error ()
force_feed (line 804)

Force the given data/URL to be treated as a feed no matter what it appears like

  • since: 1.1
  • access: public
void force_feed ([bool $enable = false])
  • bool $enable: Force the given data/URL to be treated as a feed
force_fsockopen (line 899)

Forces SimplePie to use fsockopen() instead of the preferred cURL functions.

  • since: 1.0 Beta 3
  • access: public
void force_fsockopen ([bool $enable = false])
  • bool $enable: Force fsockopen() to be used
get_all_discovered_feeds (line 2665)
void get_all_discovered_feeds ()
get_author (line 2416)
void get_author ([ $key = 0])
  • $key
get_authors (line 2429)
void get_authors ()
get_base (line 2289)
void get_base ([ $element = array()])
  • $element
get_categories (line 2359)
void get_categories ()
get_category (line 2346)
void get_category ([ $key = 0])
  • $key
get_channel_tags (line 2210)
void get_channel_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_contributor (line 2499)
void get_contributor ([ $key = 0])
  • $key
get_contributors (line 2512)
void get_contributors ()
get_copyright (line 2714)
void get_copyright ()
get_description (line 2670)
void get_description ()
get_encoding (line 1847)
void get_encoding ()
get_favicon (line 1956)

Returns the URL for the favicon of the feed's website.

  • todo: Cache atom:icon
  • since: 1.0
  • access: public
void get_favicon ()
get_feed_tags (line 2176)
void get_feed_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_image_height (line 2910)
void get_image_height ()
get_image_link (line 2874)
void get_image_link ()
get_image_tags (line 2253)
void get_image_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_image_title (line 2814)
void get_image_title ()
get_image_url (line 2842)
void get_image_url ()
get_image_width (line 2894)
void get_image_width ()
get_item (line 2940)
void get_item ([ $key = 0])
  • $key
get_items (line 2953)
void get_items ([ $start = 0], [ $end = 0])
  • $start
  • $end
get_item_quantity (line 2926)
void get_item_quantity ([ $max = 0])
  • $max
get_language (line 2742)
void get_language ()
get_latitude (line 2778)
void get_latitude ()
get_link (line 2570)
void get_link ([ $key = 0], [ $rel = 'alternate'])
  • $key
  • $rel
get_links (line 2591)
void get_links ([ $rel = 'alternate'])
  • $rel
get_longitude (line 2794)
void get_longitude ()
get_permalink (line 2586)

Added for parity between the parent-level and the item/entry-level.

void get_permalink ()
get_title (line 2310)
void get_title ()
get_type (line 1869)
void get_type ()
handle_content_type (line 1852)
void handle_content_type ([ $mime = 'text/html'])
  • $mime
init (line 1504)
void init ()
remove_div (line 1400)
void remove_div ([ $enable = true])
  • $enable
sanitize (line 2305)
void sanitize ( $data,  $type, [ $base = ''])
  • $data
  • $type
  • $base
set_author_class (line 1145)

Allows you to change which class SimplePie uses for handling author data.

Useful when you are overloading or extending SimplePie's default classes.

void set_author_class ([string $class = 'SimplePie_Author'])
  • string $class: Name of custom class.
set_autodiscovery_cache_duration (line 958)

Set the length of time (in seconds) that the autodiscovered feed URL will be cached.

  • access: public
void set_autodiscovery_cache_duration ([int $seconds = 604800])
  • int $seconds: The autodiscovered feed URL cache duration.
set_autodiscovery_level (line 1017)

Set how much feed autodiscovery to do

void set_autodiscovery_level ([int $level = SIMPLEPIE_LOCATOR_ALL])
  • int $level: Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)
set_cache_class (line 1031)

Allows you to change which class SimplePie uses for caching.

Useful when you are overloading or extending SimplePie's default classes.

void set_cache_class ([string $class = 'SimplePie_Cache'])
  • string $class: Name of custom class.
set_cache_duration (line 946)

Set the length of time (in seconds) that the contents of a feed will be cached.

  • access: public
void set_cache_duration ([int $seconds = 3600])
  • int $seconds: The feed content cache duration.
set_cache_location (line 969)

Set the file system location where the cached files should be stored.

  • access: public
void set_cache_location ([string $location = './cache'])
  • string $location: The file system location.
set_cache_name_function (line 1343)

Set callback function to create cache filename with

  • access: public
void set_cache_name_function ([mixed $function = 'md5'])
  • mixed $function: Callback function
set_caption_class (line 1202)

Allows you to change which class SimplePie uses for <media:text> captions Useful when you are overloading or extending SimplePie's default classes.

void set_caption_class ([string $class = 'SimplePie_Caption'])
  • string $class: Name of custom class.
set_category_class (line 1164)

Allows you to change which class SimplePie uses for handling category data.

Useful when you are overloading or extending SimplePie's default classes.

void set_category_class ([string $class = 'SimplePie_Category'])
  • string $class: Name of custom class.
set_content_type_sniffer_class (line 1297)

Allows you to change which class SimplePie uses for content-type sniffing.

Useful when you are overloading or extending SimplePie's default classes.

void set_content_type_sniffer_class ([string $class = 'SimplePie_Content_Type_Sniffer'])
  • string $class: Name of custom class.
set_copyright_class (line 1221)

Allows you to change which class SimplePie uses for <media:copyright> Useful when you are overloading or extending SimplePie's default classes.

void set_copyright_class ([string $class = 'SimplePie_Copyright'])
  • string $class: Name of custom class.
set_credit_class (line 1240)

Allows you to change which class SimplePie uses for <media:credit> Useful when you are overloading or extending SimplePie's default classes.

void set_credit_class ([string $class = 'SimplePie_Credit'])
  • string $class: Name of custom class.
set_enclosure_class (line 1183)

Allows you to change which class SimplePie uses for feed enclosures.

Useful when you are overloading or extending SimplePie's default classes.

void set_enclosure_class ([string $class = 'SimplePie_Enclosure'])
  • string $class: Name of custom class.
set_favicon_handler (line 1462)

Set the handler to enable the display of cached favicons.

  • access: public
void set_favicon_handler ([str $page = false], [str $qs = 'i'])
  • str $page: Web-accessible path to the handler_favicon.php file.
  • str $qs: The query string that the value should be passed to.
set_feed_url (line 825)

This is the URL of the feed you want to parse.

This allows you to enter the URL of the feed you want to parse, or the website you want to try to use auto-discovery on. This takes priority over any set raw data.

You can set multiple feeds to mash together by passing an array instead of a string for the $url. Remember that with each additional feed comes additional processing and resources.

void set_feed_url (mixed $url)
  • mixed $url: This is the URL (or array of URLs) that you want to parse.
set_file (line 848)

Provides an instance of SimplePie_File to use as a feed

  • return: True on success, false on failure
  • access: public
bool set_file (object &$file)
  • object &$file: Instance of SimplePie_File (or subclass)
set_file_class (line 1088)

Allows you to change which class SimplePie uses for remote file fetching.

Useful when you are overloading or extending SimplePie's default classes.

void set_file_class ([string $class = 'SimplePie_File'])
  • string $class: Name of custom class.
set_image_handler (line 1481)

Set the handler to enable the display of cached images.

  • access: public
void set_image_handler ([str $page = false], [str $qs = 'i'])
  • str $page: Web-accessible path to the handler_image.php file.
  • str $qs: The query string that the value should be passed to.
set_input_encoding (line 991)

Allows you to override the character encoding reported by the feed.

  • access: public
void set_input_encoding ([string $encoding = false])
  • string $encoding: Character encoding.
set_item_class (line 1126)

Allows you to change which class SimplePie uses for handling feed items.

Useful when you are overloading or extending SimplePie's default classes.

void set_item_class ([string $class = 'SimplePie_Item'])
  • string $class: Name of custom class.
set_item_limit (line 1499)

Set the limit for items returned per-feed with multifeeds.

  • access: public
void set_item_limit ([integer $limit = 0])
  • integer $limit: The maximum number of items to return.
set_javascript (line 1357)

Set javascript query string parameter

  • access: public
void set_javascript ([mixed $get = 'js'])
  • mixed $get: Javascript query string parameter
set_locator_class (line 1050)

Allows you to change which class SimplePie uses for auto-discovery.

Useful when you are overloading or extending SimplePie's default classes.

void set_locator_class ([string $class = 'SimplePie_Locator'])
  • string $class: Name of custom class.
set_max_checked_feeds (line 1395)

Set maximum number of feeds to check with autodiscovery

  • access: public
void set_max_checked_feeds ([int $max = 10])
  • int $max: Maximum number of feeds to check
set_output_encoding (line 1432)
void set_output_encoding ([ $encoding = 'UTF-8'])
  • $encoding
set_parser_class (line 1069)

Allows you to change which class SimplePie uses for XML parsing.

Useful when you are overloading or extending SimplePie's default classes.

void set_parser_class ([string $class = 'SimplePie_Parser'])
  • string $class: Name of custom class.
set_rating_class (line 1259)

Allows you to change which class SimplePie uses for <media:rating> Useful when you are overloading or extending SimplePie's default classes.

void set_rating_class ([string $class = 'SimplePie_Rating'])
  • string $class: Name of custom class.
set_raw_data (line 871)

Allows you to use a string of RSS/Atom data instead of a remote feed.

If you have a feed available as a string in PHP, you can tell SimplePie to parse that data string instead of a remote feed. Any set feed URL takes precedence.

void set_raw_data (string $data)
  • string $data: RSS or Atom data as a string.
set_restriction_class (line 1278)

Allows you to change which class SimplePie uses for <media:restriction> Useful when you are overloading or extending SimplePie's default classes.

void set_restriction_class ([string $class = 'SimplePie_Restriction'])
  • string $class: Name of custom class.
set_sanitize_class (line 1107)

Allows you to change which class SimplePie uses for data sanitization.

Useful when you are overloading or extending SimplePie's default classes.

void set_sanitize_class ([string $class = 'SimplePie_Sanitize'])
  • string $class: Name of custom class.
set_source_class (line 1316)

Allows you to change which class SimplePie uses item sources.

Useful when you are overloading or extending SimplePie's default classes.

void set_source_class ([string $class = 'SimplePie_Source'])
  • string $class: Name of custom class.
set_stupidly_fast (line 1376)

Set options to make SP as fast as possible. Forgoes a substantial amount of data sanitization in favor of speed.

  • access: public
void set_stupidly_fast ([bool $set = false])
  • bool $set: Whether to set them or not
set_timeout (line 886)

Allows you to override the default timeout for fetching remote feeds.

This allows you to change the maximum time the feed's server to respond and send the feed back.

  • since: 1.0 Beta 3
  • access: public
void set_timeout ([int $timeout = 10])
  • int $timeout: The maximum number of seconds to spend waiting to retrieve a feed.
set_url_replacements (line 1450)

Set element/attribute key/value pairs of HTML attributes containing URLs that need to be resolved relative to the feed

  • since: 1.0
  • access: public
void set_url_replacements ([array $element_attribute = array('a' => 'href', 'area' => 'href', 'blockquote' => 'cite', 'del' => 'cite', 'form' => 'action', 'img' => array('longdesc', 'src'),'input'=>'src','ins'=>'cite','q'=>'cite')])
  • array $element_attribute: Element/attribute key/value pairs
set_useragent (line 1332)

Allows you to override the default user agent string.

  • access: public
void set_useragent ([string $ua = SIMPLEPIE_USERAGENT])
  • string $ua: New user agent string.
strip_attributes (line 1423)
void strip_attributes ([ $attribs = ''])
  • $attribs
strip_comments (line 1437)
void strip_comments ([ $strip = false])
  • $strip
strip_htmltags (line 1405)
void strip_htmltags ([ $tags = ''], [ $encode = null])
  • $tags
  • $encode
subscribe_aol (line 2101)
void subscribe_aol ()
subscribe_bloglines (line 2106)
void subscribe_bloglines ()
subscribe_eskobo (line 2111)
void subscribe_eskobo ()
subscribe_feed (line 2027)
void subscribe_feed ()
subscribe_feedfeeds (line 2116)
void subscribe_feedfeeds ()
subscribe_feedster (line 2121)
void subscribe_feedster ()
subscribe_google (line 2126)
void subscribe_google ()
subscribe_gritwire (line 2131)
void subscribe_gritwire ()
subscribe_itunes (line 2063)
void subscribe_itunes ()
subscribe_msn (line 2136)
void subscribe_msn ()
subscribe_netvibes (line 2141)
void subscribe_netvibes ()
subscribe_newsburst (line 2146)
void subscribe_newsburst ()
subscribe_newsgator (line 2151)
void subscribe_newsgator ()
subscribe_odeo (line 2156)
void subscribe_odeo ()
subscribe_outlook (line 2039)
void subscribe_outlook ()
subscribe_podcast (line 2051)
void subscribe_podcast ()
subscribe_podnova (line 2161)
void subscribe_podnova ()
subscribe_rojo (line 2166)
void subscribe_rojo ()
subscribe_url (line 2015)
  • todo: If we have a perm redirect we should return the new URL
  • todo: When we make the above change, let's support <itunes:new-feed-url> as well
  • todo: Also, |atom:link|@rel=self
void subscribe_url ()
subscribe_yahoo (line 2171)
void subscribe_yahoo ()
__toString (line 765)

Used for converting object to a string

void __toString ()

Documentation generated on Tue, 19 Nov 2013 15:13:48 +0100 by phpDocumentor 1.4.3