Support Joomla!

Packages

Package: SimplePie

License

Content on this site is copyright © 2005 - 2008 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 Class SimplePie

Description

SimplePie

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

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

  • since: 1.0
  • access: public
  • todo: Cache atom:icon
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)
  • $key
get_items (line 2949)
void get_items ( $start,  $end)
  • $start
  • $end
get_item_quantity (line 2922)
void get_item_quantity ( $max)
  • $max
get_language (line 2738)
void get_language ()
get_latitude (line 2774)
void get_latitude ()
get_link (line 2566)
void get_link ( $key, [ $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 ()
merge_items (line 3060)
void merge_items ( $urls,  $start,  $end,  $limit)
  • $urls
  • $start
  • $end
  • $limit
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)
  • 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.
sort_items (line 3052)
void sort_items ( $a,  $b)
  • $a
  • $b
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_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 Sat, 14 Nov 2009 11:20:25 +0000 by phpDocumentor 1.3.1