SimplePie
[ class tree: SimplePie ] [ index: SimplePie ] [ all elements ]

Class: SimplePie

Source Location: /modules/Feeds/pnincludes/simplepie.inc

Class Overview


SimplePie


Author(s):

  • Ryan Parman
  • Geoffrey Sneddon

Version:

  • "Razzleberry"

Copyright:

  • 2004-2007 Ryan Parman, Geoffrey Sneddon

Methods



Class Details

[line 374]
SimplePie



Tags:

author:  Ryan Parman
author:  Geoffrey Sneddon
version:  "Razzleberry"
copyright:  2004-2007 Ryan Parman, Geoffrey Sneddon
todo:  Option for type of fetching (cache, not modified header, fetch, etc.)


[ Top ]


Class Methods


constructor SimplePie [line 706]

SimplePie SimplePie( [string $feed_url = null], [string $cache_location = null], [int $cache_duration = null])

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.




Tags:

since:  1.0 Preview Release
access:  public


Parameters:

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.

[ Top ]

destructor __destruct [line 741]

void __destruct( )

Remove items that link back to this before destroying this object



[ Top ]

method enable_cache [line 899]

void enable_cache( [bool $enable = true])

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.




Tags:

since:  1.0 Preview Release
access:  public


Parameters:

bool   $enable   Enable caching

[ Top ]

method enable_order_by_date [line 945]

void enable_order_by_date( [bool $enable = true])

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



Tags:

access:  public


Parameters:

bool   $enable   Sort as reverse chronological order.

[ Top ]

method enable_xml_dump [line 884]

void enable_xml_dump( [bool $enable = false])

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.




Tags:

since:  1.0 Preview Release
access:  public


Parameters:

bool   $enable   Enable XML dump

[ Top ]

method encode_instead_of_strip [line 1383]

void encode_instead_of_strip( [ $enable = true])



Parameters:

   $enable  

[ Top ]

method error [line 1813]

string error( )

Return the error message for the occured error



Tags:

return:  Error message
access:  public


[ Top ]

method force_feed [line 769]

void force_feed( [bool $enable = false])

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



Tags:

since:  1.1
access:  public


Parameters:

bool   $enable   Force the given data/URL to be treated as a feed

[ Top ]

method force_fsockopen [line 864]

void force_fsockopen( [bool $enable = false])

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



Tags:

since:  1.0 Beta 3
access:  public


Parameters:

bool   $enable   Force fsockopen() to be used

[ Top ]

method get_author [line 2371]

void get_author( [ $key = 0])



Parameters:

   $key  

[ Top ]

method get_authors [line 2384]

void get_authors( )



[ Top ]

method get_base [line 2255]

void get_base( [ $element = array()])



Parameters:

   $element  

[ Top ]

method get_categories [line 2325]

void get_categories( )



[ Top ]

method get_category [line 2312]

void get_category( [ $key = 0])



Parameters:

   $key  

[ Top ]

method get_channel_tags [line 2176]

void get_channel_tags( $namespace, $tag)



Parameters:

   $namespace  
   $tag  

[ Top ]

method get_contributor [line 2454]

void get_contributor( [ $key = 0])



Parameters:

   $key  

[ Top ]

method get_contributors [line 2467]

void get_contributors( )



[ Top ]

method get_copyright [line 2664]

void get_copyright( )



[ Top ]

method get_description [line 2620]

void get_description( )



[ Top ]

method get_encoding [line 1818]

void get_encoding( )



[ Top ]

method get_favicon [line 1927]

void get_favicon( )

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



Tags:

todo:  Cache atom:icon
since:  1.0
access:  public


[ Top ]

method get_feed_tags [line 2142]

void get_feed_tags( $namespace, $tag)



Parameters:

   $namespace  
   $tag  

[ Top ]

method get_image_height [line 2860]

void get_image_height( )



[ Top ]

method get_image_link [line 2824]

void get_image_link( )



[ Top ]

method get_image_tags [line 2219]

void get_image_tags( $namespace, $tag)



Parameters:

   $namespace  
   $tag  

[ Top ]

method get_image_title [line 2764]

void get_image_title( )



[ Top ]

method get_image_url [line 2792]

void get_image_url( )



[ Top ]

method get_image_width [line 2844]

void get_image_width( )



[ Top ]

method get_item [line 2889]

void get_item( [ $key = 0])



Parameters:

   $key  

[ Top ]

method get_items [line 2902]

void get_items( [ $start = 0], [ $end = 0])



Parameters:

   $start  
   $end  

[ Top ]

method get_item_quantity [line 2876]

void get_item_quantity( [ $max = 0])



Parameters:

   $max  

[ Top ]

method get_language [line 2692]

void get_language( )



[ Top ]

method get_latitude [line 2728]

void get_latitude( )



[ Top ]

method get_link [line 2525]

void get_link( [ $key = 0], [ $rel = 'alternate'])



Parameters:

   $key  
   $rel  

[ Top ]

method get_links [line 2546]

void get_links( [ $rel = 'alternate'])



Parameters:

   $rel  

[ Top ]

method get_longitude [line 2744]

void get_longitude( )



[ Top ]

method get_permalink [line 2541]

void get_permalink( )

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



[ Top ]

method get_title [line 2276]

void get_title( )



[ Top ]

method get_type [line 1840]

void get_type( )



[ Top ]

method handle_content_type [line 1823]

void handle_content_type( [ $mime = 'text/html'])



Parameters:

   $mime  

[ Top ]

method init [line 1469]

void init( )



[ Top ]

method merge_items [line 3003]

void merge_items( $urls, [ $start = 0], [ $end = 0], [ $limit = 0])



Parameters:

   $urls  
   $start  
   $end  
   $limit  

[ Top ]

method remove_div [line 1365]

void remove_div( [ $enable = true])



Parameters:

   $enable  

[ Top ]

method sanitize [line 2271]

void sanitize( $data, $type, [ $base = ''])



Parameters:

   $data  
   $type  
   $base  

[ Top ]

method set_author_class [line 1110]

void set_author_class( [string $class = 'SimplePie_Author'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_autodiscovery_cache_duration [line 923]

void set_autodiscovery_cache_duration( [int $seconds = 604800])

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



Tags:

access:  public


Parameters:

int   $seconds   The autodiscovered feed URL cache duration.

[ Top ]

method set_autodiscovery_level [line 982]

void set_autodiscovery_level( [int $level = SIMPLEPIE_LOCATOR_ALL])

Set how much feed autodiscovery to do



Tags:



Parameters:

int   $level   Feed Autodiscovery Level (level can be a combination of the above constants, see bitwise OR operator)

[ Top ]

method set_cache_class [line 996]

void set_cache_class( [string $class = 'SimplePie_Cache'])

Allows you to change which class SimplePie uses for caching.

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_cache_duration [line 911]

void set_cache_duration( [int $seconds = 3600])

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



Tags:

access:  public


Parameters:

int   $seconds   The feed content cache duration.

[ Top ]

method set_cache_location [line 934]

void set_cache_location( [string $location = './cache'])

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



Tags:

access:  public


Parameters:

string   $location   The file system location.

[ Top ]

method set_cache_name_function [line 1308]

void set_cache_name_function( [mixed $function = 'md5'])

Set callback function to create cache filename with



Tags:

access:  public


Parameters:

mixed   $function   Callback function

[ Top ]

method set_caption_class [line 1167]

void set_caption_class( [string $class = 'SimplePie_Caption'])

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



Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_category_class [line 1129]

void set_category_class( [string $class = 'SimplePie_Category'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_content_type_sniffer_class [line 1262]

void set_content_type_sniffer_class( [string $class = 'SimplePie_Content_Type_Sniffer'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_copyright_class [line 1186]

void set_copyright_class( [string $class = 'SimplePie_Copyright'])

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



Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_credit_class [line 1205]

void set_credit_class( [string $class = 'SimplePie_Credit'])

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



Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_enclosure_class [line 1148]

void set_enclosure_class( [string $class = 'SimplePie_Enclosure'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_favicon_handler [line 1427]

void set_favicon_handler( [str $page = false], [str $qs = 'i'])

Set the handler to enable the display of cached favicons.



Tags:

access:  public


Parameters:

str   $page   Web-accessible path to the handler_favicon.php file.
str   $qs   The query string that the value should be passed to.

[ Top ]

method set_feed_url [line 790]

void set_feed_url( mixed $url)

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.




Tags:

see:  SimplePie::set_raw_data()
since:  1.0 Preview Release
access:  public


Parameters:

mixed   $url   This is the URL (or array of URLs) that you want to parse.

[ Top ]

method set_file [line 813]

bool set_file( object &$file)

Provides an instance of SimplePie_File to use as a feed



Tags:

return:  True on success, false on failure
access:  public


Parameters:

object   &$file   Instance of SimplePie_File (or subclass)

[ Top ]

method set_file_class [line 1053]

void set_file_class( [string $class = 'SimplePie_File'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_image_handler [line 1446]

void set_image_handler( [str $page = false], [str $qs = 'i'])

Set the handler to enable the display of cached images.



Tags:

access:  public


Parameters:

str   $page   Web-accessible path to the handler_image.php file.
str   $qs   The query string that the value should be passed to.

[ Top ]

method set_input_encoding [line 956]

void set_input_encoding( [string $encoding = false])

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



Tags:

access:  public


Parameters:

string   $encoding   Character encoding.

[ Top ]

method set_item_class [line 1091]

void set_item_class( [string $class = 'SimplePie_Item'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_item_limit [line 1464]

void set_item_limit( [integer $limit = 0])

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



Tags:

access:  public


Parameters:

integer   $limit   The maximum number of items to return.

[ Top ]

method set_javascript [line 1322]

void set_javascript( [mixed $get = 'js'])

Set javascript query string parameter



Tags:

access:  public


Parameters:

mixed   $get   Javascript query string parameter

[ Top ]

method set_locator_class [line 1015]

void set_locator_class( [string $class = 'SimplePie_Locator'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_max_checked_feeds [line 1360]

void set_max_checked_feeds( [int $max = 10])

Set maximum number of feeds to check with autodiscovery



Tags:

access:  public


Parameters:

int   $max   Maximum number of feeds to check

[ Top ]

method set_output_encoding [line 1397]

void set_output_encoding( [ $encoding = 'UTF-8'])



Parameters:

   $encoding  

[ Top ]

method set_parser_class [line 1034]

void set_parser_class( [string $class = 'SimplePie_Parser'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_rating_class [line 1224]

void set_rating_class( [string $class = 'SimplePie_Rating'])

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



Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_raw_data [line 836]

void set_raw_data( string $data)

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.




Tags:

see:  SimplePie::set_feed_url()
since:  1.0 Beta 3
access:  public


Parameters:

string   $data   RSS or Atom data as a string.

[ Top ]

method set_restriction_class [line 1243]

void set_restriction_class( [string $class = 'SimplePie_Restriction'])

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



Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_sanitize_class [line 1072]

void set_sanitize_class( [string $class = 'SimplePie_Sanitize'])

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

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_source_class [line 1281]

void set_source_class( [string $class = 'SimplePie_Source'])

Allows you to change which class SimplePie uses item sources.

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




Tags:



Parameters:

string   $class   Name of custom class.

[ Top ]

method set_stupidly_fast [line 1341]

void set_stupidly_fast( [bool $set = false])

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



Tags:

access:  public


Parameters:

bool   $set   Whether to set them or not

[ Top ]

method set_timeout [line 851]

void set_timeout( [int $timeout = 10])

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.




Tags:

since:  1.0 Beta 3
access:  public


Parameters:

int   $timeout   The maximum number of seconds to spend waiting to retrieve a feed.

[ Top ]

method set_url_replacements [line 1415]

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')])

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



Tags:

since:  1.0
access:  public


Parameters:

array   $element_attribute   Element/attribute key/value pairs

[ Top ]

method set_useragent [line 1297]

void set_useragent( [string $ua = SIMPLEPIE_USERAGENT])

Allows you to override the default user agent string.



Tags:

access:  public


Parameters:

string   $ua   New user agent string.

[ Top ]

method sort_items [line 2998]

void sort_items( $a, $b)



Parameters:

   $a  
   $b  

[ Top ]

method strip_attributes [line 1388]

void strip_attributes( [ $attribs = ''])



Parameters:

   $attribs  

[ Top ]

method strip_comments [line 1402]

void strip_comments( [ $strip = false])



Parameters:

   $strip  

[ Top ]

method strip_htmltags [line 1370]

void strip_htmltags( [ $tags = ''], [ $encode = null])



Parameters:

   $tags  
   $encode  

[ Top ]

method subscribe_aol [line 2067]

void subscribe_aol( )



[ Top ]

method subscribe_bloglines [line 2072]

void subscribe_bloglines( )



[ Top ]

method subscribe_eskobo [line 2077]

void subscribe_eskobo( )



[ Top ]

method subscribe_feed [line 1993]

void subscribe_feed( )



[ Top ]

method subscribe_feedfeeds [line 2082]

void subscribe_feedfeeds( )



[ Top ]

method subscribe_feedster [line 2087]

void subscribe_feedster( )



[ Top ]

method subscribe_google [line 2092]

void subscribe_google( )



[ Top ]

method subscribe_gritwire [line 2097]

void subscribe_gritwire( )



[ Top ]

method subscribe_itunes [line 2029]

void subscribe_itunes( )



[ Top ]

method subscribe_msn [line 2102]

void subscribe_msn( )



[ Top ]

method subscribe_netvibes [line 2107]

void subscribe_netvibes( )



[ Top ]

method subscribe_newsburst [line 2112]

void subscribe_newsburst( )



[ Top ]

method subscribe_newsgator [line 2117]

void subscribe_newsgator( )



[ Top ]

method subscribe_odeo [line 2122]

void subscribe_odeo( )



[ Top ]

method subscribe_outlook [line 2005]

void subscribe_outlook( )



[ Top ]

method subscribe_podcast [line 2017]

void subscribe_podcast( )



[ Top ]

method subscribe_podnova [line 2127]

void subscribe_podnova( )



[ Top ]

method subscribe_rojo [line 2132]

void subscribe_rojo( )



[ Top ]

method subscribe_url [line 1981]

void subscribe_url( )



Tags:

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


[ Top ]

method subscribe_yahoo [line 2137]

void subscribe_yahoo( )



[ Top ]

method __toString [line 733]

void __toString( )

Used for converting object to a string



[ Top ]


Documentation generated on Fri, 18 Jul 2008 21:57:53 +0200 by phpDocumentor 1.4.1