Overview

Packages

  • None
  • SimplePie

Classes

  • SimplePie
  • SimplePie_Author
  • SimplePie_Autoloader
  • SimplePie_Cache
  • SimplePie_Cache_DB
  • SimplePie_Cache_File
  • SimplePie_Cache_Memcache
  • SimplePie_Cache_MySQL
  • SimplePie_Caption
  • SimplePie_Category
  • SimplePie_Content_Type_Sniffer
  • SimplePie_Copyright
  • SimplePie_Core
  • SimplePie_Credit
  • SimplePie_Decode_HTML_Entities
  • SimplePie_Enclosure
  • SimplePie_File
  • SimplePie_gzdecode
  • SimplePie_HTTP_Parser
  • SimplePie_IRI
  • SimplePie_Item
  • SimplePie_Locator
  • SimplePie_Misc
  • SimplePie_Net_IPv6
  • SimplePie_Parse_Date
  • SimplePie_Parser
  • SimplePie_Rating
  • SimplePie_Registry
  • SimplePie_Restriction
  • SimplePie_Sanitize
  • SimplePie_Source
  • SimplePie_XML_Declaration_Parser

Interfaces

  • SimplePie_Cache_Base
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class SimplePie_Core

SimplePie

Direct known subclasses

SimplePie
Package: SimplePie
Located at SimplePie/Core.php
Methods summary
public
# __construct( )

The SimplePie class contains feed level data and options

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
public
# __toString( )

Used for converting object to a string

Used for converting object to a string

public
# __destruct( )

Remove items that link back to this before destroying this object

Remove items that link back to this before destroying this object

public
# force_feed( boolean $enable = false )

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

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

Parameters

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

Since

1.1
public
# set_feed_url( mixed $url )

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

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

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

Since

1.0 Preview Release

See

SimplePie_Core::set_raw_data()
public boolean
# set_file( object & $file )

Provides an instance of SimplePie_File to use as a feed

Provides an instance of SimplePie_File to use as a feed

Parameters

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

Returns

boolean
True on success, false on failure
public
# set_raw_data( string $data )

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

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

$data
string
RSS or Atom data as a string.

Since

1.0 Beta 3

See

SimplePie_Core::set_feed_url()
public
# set_timeout( integer $timeout = 10 )

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

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

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

Since

1.0 Beta 3
public
# force_fsockopen( boolean $enable = false )

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

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

Parameters

$enable
boolean
Force fsockopen() to be used

Since

1.0 Beta 3
public
# enable_cache( boolean $enable = true )

Enables/disables caching in SimplePie.

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

$enable
boolean
Enable caching

Since

1.0 Preview Release
public
# set_cache_duration( integer $seconds = 3600 )

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

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

Parameters

$seconds
integer
The feed content cache duration.
public
# set_autodiscovery_cache_duration( integer $seconds = 604800 )

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

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

Parameters

$seconds
integer
The autodiscovered feed URL cache duration.
public
# set_cache_location( string $location = './cache' )

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

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

Parameters

$location
string
The file system location.
public
# enable_order_by_date( boolean $enable = true )

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

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

Parameters

$enable
boolean
Sort as reverse chronological order.
public
# set_input_encoding( string $encoding = false )

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

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

Parameters

$encoding
string
Character encoding.
public
# set_autodiscovery_level( integer $level = SIMPLEPIE_LOCATOR_ALL )

Set how much feed autodiscovery to do

Set how much feed autodiscovery to do

Parameters

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

See

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
public SimplePie_Registry &
# get_registry( )

Get the class registry

Get the class registry

Use this to override SimplePie's default classes

Returns

SimplePie_Registry

See

SimplePie_Registry
deprecated public
# set_cache_class( string $class = 'SimplePie_Cache' )

Allows you to change which class SimplePie uses for caching.

Allows you to change which class SimplePie uses for caching.

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_locator_class( string $class = 'SimplePie_Locator' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_parser_class( string $class = 'SimplePie_Parser' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_file_class( string $class = 'SimplePie_File' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_sanitize_class( string $class = 'SimplePie_Sanitize' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_item_class( string $class = 'SimplePie_Item' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_author_class( string $class = 'SimplePie_Author' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_category_class( string $class = 'SimplePie_Category' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_enclosure_class( string $class = 'SimplePie_Enclosure' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_caption_class( string $class = 'SimplePie_Caption' )

Allows you to change which class SimplePie uses for <media:text> captions

Allows you to change which class SimplePie uses for <media:text> captions

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_copyright_class( string $class = 'SimplePie_Copyright' )

Allows you to change which class SimplePie uses for <media:copyright>

Allows you to change which class SimplePie uses for <media:copyright>

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_credit_class( string $class = 'SimplePie_Credit' )

Allows you to change which class SimplePie uses for <media:credit>

Allows you to change which class SimplePie uses for <media:credit>

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_rating_class( string $class = 'SimplePie_Rating' )

Allows you to change which class SimplePie uses for <media:rating>

Allows you to change which class SimplePie uses for <media:rating>

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_restriction_class( string $class = 'SimplePie_Restriction' )

Allows you to change which class SimplePie uses for <media:restriction>

Allows you to change which class SimplePie uses for <media:restriction>

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_content_type_sniffer_class( string $class = 'SimplePie_Content_Type_Sniffer' )

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

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

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
deprecated public
# set_source_class( string $class = 'SimplePie_Source' )

Allows you to change which class SimplePie uses item sources.

Allows you to change which class SimplePie uses item sources.

Deprecated

Use SimplePie_Core::get_registry() instead

Parameters

$class
string
Name of custom class.

Link

http://php.net/manual/en/language.oop5.basic.php#language.oop5.basic.extends PHP5 extends documentation
public
# set_useragent( string $ua = SIMPLEPIE_USERAGENT )

Allows you to override the default user agent string.

Allows you to override the default user agent string.

Parameters

$ua
string
New user agent string.
public
# set_cache_name_function( mixed $function = 'md5' )

Set callback function to create cache filename with

Set callback function to create cache filename with

Parameters

$function
mixed
Callback function
public
# set_stupidly_fast( boolean $set = false )

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

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

Parameters

$set
boolean
Whether to set them or not
public
# set_max_checked_feeds( integer $max = 10 )

Set maximum number of feeds to check with autodiscovery

Set maximum number of feeds to check with autodiscovery

Parameters

$max
integer
Maximum number of feeds to check
public
# remove_div( $enable = true )
public
# strip_htmltags( $tags = '', $encode = null )
public
# encode_instead_of_strip( $enable = true )
public
# strip_attributes( $attribs = '' )
public
# set_output_encoding( $encoding = 'UTF-8' )
public
# strip_comments( $strip = false )
public
# 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 element/attribute key/value pairs of HTML attributes containing URLs that need to be resolved relative to the feed

Parameters

$element_attribute
array
Element/attribute key/value pairs

Since

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

Set the handler to enable the display of cached images.

Set the handler to enable the display of cached images.

Parameters

$page
str
Web-accessible path to the handler_image.php file.
$qs
str
The query string that the value should be passed to.
public
# set_item_limit( integer $limit = 0 )

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

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

Parameters

$limit
integer
The maximum number of items to return.
public
# init( )
public string
# error( )

Return the error message for the occured error

Return the error message for the occured error

Returns

string
Error message
public string|boolean
# get_raw_data( )

Return the raw XML

Return the raw XML

This is the same as setting $xml_dump = true;, but returns the data instead of printing it.

Returns

string|boolean
Raw XML data, false if the cache is used
public
# get_encoding( )
public
# handle_content_type( $mime = 'text/html' )
public
# get_type( )
public
# subscribe_url( )

Todo

If we have a perm redirect we should return the new URL
When we make the above change, let's support <itunes:new-feed-url> as well
Also, |atom:link|@rel=self
public
# get_feed_tags( $namespace, $tag )
public
# get_channel_tags( $namespace, $tag )
public
# get_image_tags( $namespace, $tag )
public
# get_base( $element = array() )
public
# sanitize( $data, $type, $base = '' )
public
# get_title( )
public
# get_category( $key = 0 )
public
# get_categories( )
public
# get_author( $key = 0 )
public
# get_authors( )
public
# get_contributor( $key = 0 )
public
# get_contributors( )
public
# get_link( $key = 0, $rel = 'alternate' )
public
# get_permalink( )

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

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

public
# get_links( $rel = 'alternate' )
public
# get_all_discovered_feeds( )
public
# get_description( )
public
# get_copyright( )
public
# get_language( )
public
# get_latitude( )
public
# get_longitude( )
public
# get_image_title( )
public
# get_image_url( )
public
# get_image_link( )
public
# get_image_width( )
public
# get_image_height( )
public
# get_item_quantity( $max = 0 )
public
# get_item( $key = 0 )
public
# get_items( $start = 0, $end = 0 )
public static
# sort_items( $a, $b )
public static
# merge_items( $urls, $start = 0, $end = 0, $limit = 0 )
Properties summary
public array $data array()
#

Raw data

Raw data

public mixed $error
#

Error string

Error string

public object $sanitize
#

Instance of SimplePie_Sanitize (or other class)

Instance of SimplePie_Sanitize (or other class)

See

SimplePie_Core::set_sanitize_class()
public string $useragent SIMPLEPIE_USERAGENT
#

SimplePie Useragent

SimplePie Useragent

See

SimplePie_Core::set_useragent()
public string $feed_url
#

Feed URL

Feed URL

See

SimplePie_Core::set_feed_url()
public object $file
#

Instance of SimplePie_File to use as a feed

Instance of SimplePie_File to use as a feed

See

SimplePie_Core::set_file()
public string $raw_data
#

Raw feed data

Raw feed data

See

SimplePie_Core::set_raw_data()
public integer $timeout 10
#

Timeout for fetching remote files

Timeout for fetching remote files

See

SimplePie_Core::set_timeout()
public boolean $force_fsockopen false
#

Forces fsockopen() to be used for remote files instead of cURL, even if a new enough version is installed

Forces fsockopen() to be used for remote files instead of cURL, even if a new enough version is installed

See

SimplePie_Core::force_fsockopen()
public boolean $force_feed false
#

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

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

See

SimplePie_Core::force_feed()
public boolean $xml_dump false
#

Enable/Disable XML dump

Enable/Disable XML dump

See

SimplePie::enable_xml_dump()
public boolean $cache true
#

Enable/Disable Caching

Enable/Disable Caching

See

SimplePie_Core::enable_cache()
public integer $cache_duration 3600
#

Cache duration (in seconds)

Cache duration (in seconds)

See

SimplePie_Core::set_cache_duration()
public integer $autodiscovery_cache_duration 604800
#

Auto-discovery cache duration (in seconds)

Auto-discovery cache duration (in seconds)

See

SimplePie_Core::set_autodiscovery_cache_duration()
public string $cache_location './cache'
#

Cache location (relative to executing script)

Cache location (relative to executing script)

See

SimplePie_Core::set_cache_location()
public string $cache_name_function 'md5'
#

Function that creates the cache filename

Function that creates the cache filename

See

SimplePie_Core::set_cache_name_function()
public boolean $order_by_date true
#

Reorder feed by date descending

Reorder feed by date descending

See

SimplePie_Core::enable_order_by_date()
public mixed $input_encoding false
#

Force input encoding to be set to the follow value (false, or anything type-cast to false, disables this feature)

Force input encoding to be set to the follow value (false, or anything type-cast to false, disables this feature)

See

SimplePie_Core::set_input_encoding()
public integer $autodiscovery SIMPLEPIE_LOCATOR_ALL
#

Feed Autodiscovery Level

Feed Autodiscovery Level

See

SimplePie_Core::set_autodiscovery_level()
public $registry
#
public integer $max_checked_feeds 10
#

Maximum number of feeds to check with autodiscovery

Maximum number of feeds to check with autodiscovery

See

SimplePie_Core::set_max_checked_feeds()
public array $all_discovered_feeds array()
#

All the feeds found during the autodiscovery process

All the feeds found during the autodiscovery process

See

SimplePie_Core::get_all_discovered_feeds()
public string $image_handler ''
#

Web-accessible path to the handler_image.php file.

Web-accessible path to the handler_image.php file.

See

SimplePie_Core::set_image_handler()
public array $multifeed_url array()
#

Stores the URLs when multiple feeds are being initialized.

Stores the URLs when multiple feeds are being initialized.

See

SimplePie_Core::set_feed_url()
public array $multifeed_objects array()
#

Stores SimplePie objects when multiple feeds initialized.

Stores SimplePie objects when multiple feeds initialized.

public array $config_settings null
#

Stores the get_object_vars() array for use with multifeeds.

Stores the get_object_vars() array for use with multifeeds.

See

SimplePie_Core::set_feed_url()
public integer $item_limit 0
#

Stores the number of items to return per-feed with multifeeds.

Stores the number of items to return per-feed with multifeeds.

See

SimplePie_Core::set_item_limit()
public array $strip_attributes array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')
#

Stores the default attributes to be stripped by strip_attributes().

Stores the default attributes to be stripped by strip_attributes().

See

SimplePie_Core::strip_attributes()
public array $strip_htmltags array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')
#

Stores the default tags to be stripped by strip_htmltags().

Stores the default tags to be stripped by strip_htmltags().

See

SimplePie_Core::strip_htmltags()
SimplePie Documentation API documentation generated by ApiGen 2.4.0