class SimplePie


Located at : UKNOWVA_ROOT/libraries/simplepie/simplepie.php

SimplePie

Properties

array $data
mixed $error
object $sanitize
string $useragent
string $feed_url
object $file
string $raw_data
int $timeout
bool $force_fsockopen
bool $force_feed
bool $xml_dump
bool $cache
int $cache_duration
int $autodiscovery_cache_duration
string $cache_location
string $cache_name_function
bool $order_by_date
mixed $input_encoding
int $autodiscovery
string $cache_class
string $locator_class
string $parser_class
string $file_class
string $item_class
string $author_class
string $category_class
string $enclosure_class
string $caption_class
$copyright_class
string $credit_class
string $rating_class
string $restriction_class
string $content_type_sniffer_class
string $source_class
mixed $javascript
int $max_checked_feeds
array $all_discovered_feeds
string $favicon_handler
string $image_handler
array $multifeed_url
array $multifeed_objects
array $config_settings
integer $item_limit
array $strip_attributes
array $strip_htmltags

Methods

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

The SimplePie class contains feed level data and options

__toString()

Used for converting object to a string

__destruct()

Remove items that link back to this before destroying this object

force_feed(bool $enable = false)

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

set_feed_url(mixed $url)

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

bool
set_file(object $file)

Provides an instance of SimplePie_File to use as a feed

set_raw_data(string $data)

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

set_timeout(int $timeout = 10)

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

force_fsockopen(bool $enable = false)

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

enable_xml_dump(bool $enable = false)

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

enable_cache(bool $enable = true)

Enables/disables caching in SimplePie.

set_cache_duration(int $seconds = 3600)

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

set_autodiscovery_cache_duration(int $seconds = 604800)

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

set_cache_location(string $location = './cache')

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

enable_order_by_date(bool $enable = true)

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

set_input_encoding(string $encoding = false)

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

set_autodiscovery_level(int $level = SIMPLEPIE_LOCATOR_ALL)

Set how much feed autodiscovery to do

set_cache_class(string $class = 'SimplePie_Cache')

Allows you to change which class SimplePie uses for caching.

set_locator_class(string $class = 'SimplePie_Locator')

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

set_parser_class(string $class = 'SimplePie_Parser')

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

set_file_class(string $class = 'SimplePie_File')

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

set_sanitize_class(string $class = 'SimplePie_Sanitize')

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

set_item_class(string $class = 'SimplePie_Item')

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

set_author_class(string $class = 'SimplePie_Author')

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

set_category_class(string $class = 'SimplePie_Category')

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

set_enclosure_class(string $class = 'SimplePie_Enclosure')

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

set_caption_class(string $class = 'SimplePie_Caption')

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

set_copyright_class(string $class = 'SimplePie_Copyright')

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

set_credit_class(string $class = 'SimplePie_Credit')

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

set_rating_class(string $class = 'SimplePie_Rating')

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

set_restriction_class(string $class = 'SimplePie_Restriction')

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

set_content_type_sniffer_class(string $class = 'SimplePie_Content_Type_Sniffer')

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

set_source_class(string $class = 'SimplePie_Source')

Allows you to change which class SimplePie uses item sources.

set_useragent(string $ua = SIMPLEPIE_USERAGENT)

Allows you to override the default user agent string.

set_cache_name_function(mixed $function = 'md5')

Set callback function to create cache filename with

set_javascript(mixed $get = 'js')

Set javascript query string parameter

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.

set_max_checked_feeds(int $max = 10)

Set maximum number of feeds to check with autodiscovery

remove_div($enable = true)

No description

strip_htmltags($tags = '', $encode = null)

No description

encode_instead_of_strip($enable = true)

No description

strip_attributes($attribs = '')

No description

set_output_encoding($encoding = 'UTF-8')

No description

strip_comments($strip = false)

No description

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

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

Set the handler to enable the display of cached favicons.

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

Set the handler to enable the display of cached images.

set_item_limit(integer $limit)

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

init()

No description

string
error()

Return the error message for the occured error

get_encoding()

No description

handle_content_type($mime = 'text/html')

No description

get_type()

No description

get_favicon()

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

subscribe_url()

No description

subscribe_feed()

No description

subscribe_outlook()

No description

subscribe_podcast()

No description

subscribe_itunes()

No description

mixed
subscribe_service(string $feed_url, string $site_url = null)

Creates the subscribe_* methods' return data

subscribe_aol()

No description

subscribe_bloglines()

No description

subscribe_eskobo()

No description

subscribe_feedfeeds()

No description

subscribe_feedster()

No description

subscribe_google()

No description

subscribe_gritwire()

No description

subscribe_msn()

No description

subscribe_netvibes()

No description

subscribe_newsburst()

No description

subscribe_newsgator()

No description

subscribe_odeo()

No description

subscribe_podnova()

No description

subscribe_rojo()

No description

subscribe_yahoo()

No description

get_feed_tags($namespace, $tag)

No description

get_channel_tags($namespace, $tag)

No description

get_image_tags($namespace, $tag)

No description

get_base($element = array())

No description

sanitize($data, $type, $base = '')

No description

get_title()

No description

get_category($key)

No description

get_categories()

No description

get_author($key)

No description

get_authors()

No description

get_contributor($key)

No description

get_contributors()

No description

get_link($key, $rel = 'alternate')

No description

get_permalink()

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

get_links($rel = 'alternate')

No description

get_all_discovered_feeds()

No description

get_description()

No description

get_copyright()

No description

get_language()

No description

get_latitude()

No description

get_longitude()

No description

get_image_title()

No description

get_image_url()

No description

get_image_link()

No description

get_image_width()

No description

get_image_height()

No description

get_item_quantity($max)

No description

get_item($key)

No description

get_items($start, $end)

No description

sort_items($a, $b)

No description

merge_items($urls, $start, $end, $limit)

No description

Details

at line 734
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.

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.

at line 761
__toString()

Used for converting object to a string

at line 769
__destruct()

Remove items that link back to this before destroying this object

at line 800
force_feed(bool $enable = false)

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

Parameters

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

at line 821
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.

Parameters

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

See also

SimplePie::set_raw_data()

at line 844
bool set_file(object $file)

Provides an instance of SimplePie_File to use as a feed

Parameters

object $file &$file Instance of SimplePie_File (or subclass)

Return Value

bool True on success, false on failure

at line 867
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.

Parameters

string $data RSS or Atom data as a string.

See also

SimplePie::set_feed_url()

at line 882
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.

Parameters

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

at line 895
force_fsockopen(bool $enable = false)

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

Parameters

bool $enable Force fsockopen() to be used

at line 915
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.

Parameters

bool $enable Enable XML dump

at line 930
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.

Parameters

bool $enable Enable caching

at line 942
set_cache_duration(int $seconds = 3600)

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

Parameters

int $seconds The feed content cache duration.

at line 954
set_autodiscovery_cache_duration(int $seconds = 604800)

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

Parameters

int $seconds The autodiscovered feed URL cache duration.

at line 965
set_cache_location(string $location = './cache')

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

Parameters

string $location The file system location.

at line 976
enable_order_by_date(bool $enable = true)

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

Parameters

bool $enable Sort as reverse chronological order.

at line 987
set_input_encoding(string $encoding = false)

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

Parameters

string $encoding Character encoding.

at line 1013
set_autodiscovery_level(int $level = SIMPLEPIE_LOCATOR_ALL)

Set how much feed autodiscovery to do

Parameters

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

See also

SIMPLEPIE_LOCATOR_NONE
SIMPLEPIE_LOCATOR_AUTODISCOVERY
SIMPLEPIE_LOCATOR_LOCAL_EXTENSION
SIMPLEPIE_LOCATOR_LOCAL_BODY
SIMPLEPIE_LOCATOR_REMOTE_EXTENSION
SIMPLEPIE_LOCATOR_REMOTE_BODY
SIMPLEPIE_LOCATOR_ALL

at line 1027
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.

Parameters

string $class Name of custom class.

at line 1046
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.

Parameters

string $class Name of custom class.

at line 1065
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.

Parameters

string $class Name of custom class.

at line 1084
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.

Parameters

string $class Name of custom class.

at line 1103
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.

Parameters

string $class Name of custom class.

at line 1122
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.

Parameters

string $class Name of custom class.

at line 1141
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.

Parameters

string $class Name of custom class.

at line 1160
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.

Parameters

string $class Name of custom class.

at line 1179
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.

Parameters

string $class Name of custom class.

at line 1198
set_caption_class(string $class = 'SimplePie_Caption')

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

Parameters

string $class Name of custom class.

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

Parameters

string $class Name of custom class.

at line 1236
set_credit_class(string $class = 'SimplePie_Credit')

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

Parameters

string $class Name of custom class.

at line 1255
set_rating_class(string $class = 'SimplePie_Rating')

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

Parameters

string $class Name of custom class.

at line 1274
set_restriction_class(string $class = 'SimplePie_Restriction')

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

Parameters

string $class Name of custom class.

at line 1293
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.

Parameters

string $class Name of custom class.

at line 1312
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.

Parameters

string $class Name of custom class.

at line 1328
set_useragent(string $ua = SIMPLEPIE_USERAGENT)

Allows you to override the default user agent string.

Parameters

string $ua New user agent string.

at line 1339
set_cache_name_function(mixed $function = 'md5')

Set callback function to create cache filename with

Parameters

mixed $function Callback function

at line 1353
set_javascript(mixed $get = 'js')

Set javascript query string parameter

Parameters

mixed $get Javascript query string parameter

at line 1372
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.

Parameters

bool $set Whether to set them or not

at line 1391
set_max_checked_feeds(int $max = 10)

Set maximum number of feeds to check with autodiscovery

Parameters

int $max Maximum number of feeds to check

at line 1396
remove_div($enable = true)

Parameters

$enable

at line 1401
strip_htmltags($tags = '', $encode = null)

Parameters

$tags
$encode

at line 1414
encode_instead_of_strip($enable = true)

Parameters

$enable

at line 1419
strip_attributes($attribs = '')

Parameters

$attribs

at line 1428
set_output_encoding($encoding = 'UTF-8')

Parameters

$encoding

at line 1433
strip_comments($strip = false)

Parameters

$strip

at line 1446
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

Parameters

array $element_attribute Element/attribute key/value pairs

at line 1458
set_favicon_handler(str $page = false, str $qs = 'i')

Set the handler to enable the display of cached favicons.

Parameters

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

at line 1477
set_image_handler(str $page = false, str $qs = 'i')

Set the handler to enable the display of cached images.

Parameters

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

at line 1495
set_item_limit(integer $limit)

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

Parameters

integer $limit The maximum number of items to return.

at line 1500
init()

at line 1838
string error()

Return the error message for the occured error

Return Value

string Error message

at line 1843
get_encoding()

at line 1848
handle_content_type($mime = 'text/html')

Parameters

$mime

at line 1865
get_type()

at line 1952
get_favicon()

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

at line 2011
subscribe_url()

at line 2023
subscribe_feed()

at line 2035
subscribe_outlook()

at line 2047
subscribe_podcast()

at line 2059
subscribe_itunes()

at line 2080
mixed subscribe_service(string $feed_url, string $site_url = null)

Creates the subscribe_* methods' return data

Parameters

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)

Return Value

mixed URL if feed exists, false otherwise

at line 2097
subscribe_aol()

at line 2102
subscribe_bloglines()

at line 2107
subscribe_eskobo()

at line 2112
subscribe_feedfeeds()

at line 2117
subscribe_feedster()

at line 2122
subscribe_google()

at line 2127
subscribe_gritwire()

at line 2132
subscribe_msn()

at line 2137
subscribe_netvibes()

at line 2142
subscribe_newsburst()

at line 2147
subscribe_newsgator()

at line 2152
subscribe_odeo()

at line 2157
subscribe_podnova()

at line 2162
subscribe_rojo()

at line 2167
subscribe_yahoo()

at line 2172
get_feed_tags($namespace, $tag)

Parameters

$namespace
$tag

at line 2206
get_channel_tags($namespace, $tag)

Parameters

$namespace
$tag

at line 2249
get_image_tags($namespace, $tag)

Parameters

$namespace
$tag

at line 2285
get_base($element = array())

Parameters

$element

at line 2301
sanitize($data, $type, $base = '')

Parameters

$data
$type
$base

at line 2306
get_title()

at line 2342
get_category($key)

Parameters

$key

at line 2355
get_categories()

at line 2412
get_author($key)

Parameters

$key

at line 2425
get_authors()

at line 2495
get_contributor($key)

Parameters

$key

at line 2508
get_contributors()

Parameters

$key
$rel

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

Parameters

$rel

at line 2661
get_all_discovered_feeds()

at line 2666
get_description()

at line 2738
get_language()

at line 2774
get_latitude()

at line 2790
get_longitude()

at line 2810
get_image_title()

at line 2838
get_image_url()

at line 2890
get_image_width()

at line 2906
get_image_height()

at line 2922
get_item_quantity($max)

Parameters

$max

at line 2936
get_item($key)

Parameters

$key

at line 2949
get_items($start, $end)

Parameters

$start
$end

at line 3052
sort_items($a, $b)

Parameters

$a
$b

at line 3060
merge_items($urls, $start, $end, $limit)

Parameters

$urls
$start
$end
$limit