Class SimplePie

Description

SimplePie

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


	
			
Variable Summary
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 ()
mixed subscribe_service (string $feed_url, [string $site_url = null])
void subscribe_url ()
void subscribe_yahoo ()
void __toString ()
Variables
array $all_discovered_feeds = array() (line 656)
string $author_class = 'SimplePie_Author' (line 571)
int $autodiscovery = SIMPLEPIE_LOCATOR_ALL (line 529)
int $autodiscovery_cache_duration = 604800 (line 493)
bool $cache = true (line 479)
string $cache_class = 'SimplePie_Cache' (line 536)
int $cache_duration = 3600 (line 486)
string $cache_location = './cache' (line 500)
string $cache_name_function = 'md5' (line 507)
string $caption_class = 'SimplePie_Caption' (line 592)
string $category_class = 'SimplePie_Category' (line 578)
array $config_settings = null (line 690)
string $content_type_sniffer_class = 'SimplePie_Content_Type_Sniffer' (line 627)
string $copyright_class = 'SimplePie_Copyright' (line 599)
string $credit_class = 'SimplePie_Credit' (line 606)
array $data = array() (line 401)
  • var: Raw data
  • access: private
string $enclosure_class = 'SimplePie_Enclosure' (line 585)
  • var: Class used for enclosures
  • see: SimplePie::set_enclosures_class()
  • access: private
mixed $error (line 407)
  • var: Error string
  • access: private
string $favicon_handler = '' (line 663)
string $feed_url (line 428)
object Instance $file (line 435)
string $file_class = 'SimplePie_File' (line 557)
bool $force_feed = false (line 465)
  • var: Force the given data/URL to be treated as a feed no matter what it appears like
  • see: SimplePie::force_feed()
  • access: private
bool $force_fsockopen = false (line 457)
  • var: Forces fsockopen() to be used for remote files instead of cURL, even if a new enough version is installed
  • see: SimplePie::force_fsockopen()
  • access: private
string $image_handler = '' (line 670)
mixed $input_encoding = false (line 522)
  • var: Force input encoding to be set to the follow value (false, or anything type-cast to false, disables this feature)
  • see: SimplePie::set_input_encoding()
  • access: private
string $item_class = 'SimplePie_Item' (line 564)
integer $item_limit = 0 (line 697)
mixed $javascript = 'js' (line 642)
  • var: Set javascript query string parameter (false, or anything type-cast to false, disables this feature)
  • see: SimplePie::set_javascript()
  • access: private
string $locator_class = 'SimplePie_Locator' (line 543)
int $max_checked_feeds = 10 (line 649)
array $multifeed_objects = array() (line 683)
  • var: Stores SimplePie objects when multiple feeds initialized.
  • access: private
array $multifeed_url = array() (line 677)
bool $order_by_date = true (line 514)
string $parser_class = 'SimplePie_Parser' (line 550)
string $rating_class = 'SimplePie_Rating' (line 613)
string $raw_data (line 442)
string $restriction_class = 'SimplePie_Restriction' (line 620)
object Instance $sanitize (line 414)
string $source_class = 'SimplePie_Source' (line 634)
array $strip_attributes = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc') (line 704)
array $strip_htmltags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style') (line 711)
int $timeout = 10 (line 449)
string $useragent = SIMPLEPIE_USERAGENT (line 421)
bool $xml_dump = false (line 472)
Methods
static method merge_items (line 3060)
static void merge_items ( $urls, [ $start = 0], [ $end = 0], [ $limit = 0])
  • $urls
  • $start
  • $end
  • $limit
static method sort_items (line 3052)
static void sort_items ( $a,  $b)
  • $a
  • $b
Constructor SimplePie (line 734)

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 769)

Remove items that link back to this before destroying this object

void __destruct ()
enable_cache (line 930)

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 976)

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 915)

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 1414)
void encode_instead_of_strip ([ $enable = true])
  • $enable
error (line 1838)

Return the error message for the occured error

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

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 895)

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 2661)
void get_all_discovered_feeds ()
get_author (line 2412)
void get_author ([ $key = 0])
  • $key
get_authors (line 2425)
void get_authors ()
get_base (line 2285)
void get_base ([ $element = array()])
  • $element
get_categories (line 2355)
void get_categories ()
get_category (line 2342)
void get_category ([ $key = 0])
  • $key
get_channel_tags (line 2206)
void get_channel_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_contributor (line 2495)
void get_contributor ([ $key = 0])
  • $key
get_contributors (line 2508)
void get_contributors ()
get_copyright (line 2710)
void get_copyright ()
get_description (line 2666)
void get_description ()
get_encoding (line 1843)
void get_encoding ()
get_favicon (line 1952)

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 2172)
void get_feed_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_image_height (line 2906)
void get_image_height ()
get_image_link (line 2870)
void get_image_link ()
get_image_tags (line 2249)
void get_image_tags ( $namespace,  $tag)
  • $namespace
  • $tag
get_image_title (line 2810)
void get_image_title ()
get_image_url (line 2838)
void get_image_url ()
get_image_width (line 2890)
void get_image_width ()
get_item (line 2936)
void get_item ([ $key = 0])
  • $key
get_items (line 2949)
void get_items ([ $start = 0], [ $end = 0])
  • $start
  • $end
get_item_quantity (line 2922)
void get_item_quantity ([ $max = 0])
  • $max
get_language (line 2738)
void get_language ()
get_latitude (line 2774)
void get_latitude ()
get_link (line 2566)
void get_link ([ $key = 0], [ $rel = 'alternate'])
  • $key
  • $rel
get_links (line 2587)
void get_links ([ $rel = 'alternate'])
  • $rel
get_longitude (line 2790)
void get_longitude ()
get_permalink (line 2582)

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

void get_permalink ()
get_title (line 2306)
void get_title ()
get_type (line 1865)
void get_type ()
handle_content_type (line 1848)
void handle_content_type ([ $mime = 'text/html'])
  • $mime
init (line 1500)
void init ()
remove_div (line 1396)
void remove_div ([ $enable = true])
  • $enable
sanitize (line 2301)
void sanitize ( $data,  $type, [ $base = ''])
  • $data
  • $type
  • $base
set_author_class (line 1141)

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 954)

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 1013)

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 1027)

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 942)

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 965)

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 1339)

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 1198)

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 1160)

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 1293)

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 1217)

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 1236)

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 1179)

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 1458)

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 821)

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 844)

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 1084)

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 1477)

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 987)

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 1122)

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 1495)

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 1353)

Set javascript query string parameter

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

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 1391)

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 1428)
void set_output_encoding ([ $encoding = 'UTF-8'])
  • $encoding
set_parser_class (line 1065)

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 1255)

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 867)

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 1274)

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 1103)

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 1312)

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 1372)

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 882)

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 1446)

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 1328)

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 1419)
void strip_attributes ([ $attribs = ''])
  • $attribs
strip_comments (line 1433)
void strip_comments ([ $strip = false])
  • $strip
strip_htmltags (line 1401)
void strip_htmltags ([ $tags = ''], [ $encode = null])
  • $tags
  • $encode
subscribe_aol (line 2097)
void subscribe_aol ()
subscribe_bloglines (line 2102)
void subscribe_bloglines ()
subscribe_eskobo (line 2107)
void subscribe_eskobo ()
subscribe_feed (line 2023)
void subscribe_feed ()
subscribe_feedfeeds (line 2112)
void subscribe_feedfeeds ()
subscribe_feedster (line 2117)
void subscribe_feedster ()
subscribe_google (line 2122)
void subscribe_google ()
subscribe_gritwire (line 2127)
void subscribe_gritwire ()
subscribe_itunes (line 2059)
void subscribe_itunes ()
subscribe_msn (line 2132)
void subscribe_msn ()
subscribe_netvibes (line 2137)
void subscribe_netvibes ()
subscribe_newsburst (line 2142)
void subscribe_newsburst ()
subscribe_newsgator (line 2147)
void subscribe_newsgator ()
subscribe_odeo (line 2152)
void subscribe_odeo ()
subscribe_outlook (line 2035)
void subscribe_outlook ()
subscribe_podcast (line 2047)
void subscribe_podcast ()
subscribe_podnova (line 2157)
void subscribe_podnova ()
subscribe_rojo (line 2162)
void subscribe_rojo ()
subscribe_service (line 2080)

Creates the subscribe_* methods' return data

  • return: URL if feed exists, false otherwise
  • access: private
mixed subscribe_service (string $feed_url, [string $site_url = null])
  • string $feed_url: String to prefix to the feed URL
  • string $site_url: String to prefix to the site URL (and suffix to the feed URL)
subscribe_url (line 2011)
  • 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 2167)
void subscribe_yahoo ()
__toString (line 761)

Used for converting object to a string

void __toString ()

Documentation generated on Mon, 25 Jun 2012 13:59:33 -0500 by phpDocumentor 1.4.4