Used for data cleanup and post-processing

This class can be overloaded with \SimplePie::set_sanitize_class()

package SimplePie
todo Move to using an actual HTML parser (this will allow tags to be properly stripped, and to switch between HTML and XHTML), this will also make it easier to shorten a string while preserving HTML tags

 Methods

__construct()

__construct() 

do_strip_htmltags()

do_strip_htmltags($match) 

Parameters

$match

encode_instead_of_strip()

encode_instead_of_strip($encode = false

Parameters

$encode

pass_cache_data()

pass_cache_data($enable_cache = true, $cache_location = './cache', $cache_name_function = 'md5', $cache_class = 'SimplePie_Cache'

Parameters

$enable_cache

$cache_location

$cache_name_function

$cache_class

pass_file_data()

pass_file_data($file_class = 'SimplePie_File', $timeout = 10, $useragent = '', $force_fsockopen = false

Parameters

$file_class

$timeout

$useragent

$force_fsockopen

remove_div()

remove_div($enable = true

Parameters

$enable

replace_urls()

replace_urls($document, $tag, $attributes) 

Parameters

$document

$tag

$attributes

sanitize()

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

Parameters

$data

$type

$base

set_image_handler()

set_image_handler($page = false

Parameters

$page

set_output_encoding()

set_output_encoding($encoding = 'UTF-8'

Parameters

$encoding

set_registry()

set_registry(\SimplePie_Registry $registry) 

Parameters

$registry

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

set_url_replacements(array|null $element_attribute = null

Defaults to |a|@href, |area|@href, |blockquote|@cite, |del|@cite, |form|@action, |img|@longdesc, |img|@src, |input|@src, |ins|@cite, |q|@cite

since 1.0

Parameters

$element_attribute

arraynull

Element/attribute key/value pairs, null for default

strip_attributes()

strip_attributes($attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')

Parameters

$attribs

strip_comments()

strip_comments($strip = false

Parameters

$strip

strip_htmltags()

strip_htmltags($tags = array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')

Parameters

$tags

preprocess()

preprocess($html, $type) 

Parameters

$html

$type

strip_attr()

strip_attr($attrib, $document) 

Parameters

$attrib

$document

strip_tag()

strip_tag($tag, $document, $type) 

Parameters

$tag

$document

$type

 Properties

 

$base

$base 

Default

 

$cache_location

$cache_location 

Default

'./cache'
 

$cache_name_function

$cache_name_function 

Default

'md5'
 

$enable_cache

$enable_cache 

Default

true
 

$encode_instead_of_strip

$encode_instead_of_strip 

Default

false
 

$force_fsockopen

$force_fsockopen 

Default

false
 

$image_handler

$image_handler 

Default

''
 

$output_encoding

$output_encoding 

Default

'UTF-8'
 

$remove_div

$remove_div 

Default

true
 

$replace_url_attributes

$replace_url_attributes 

Default

null
 

$strip_attributes

$strip_attributes 

Default

array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')
 

$strip_comments

$strip_comments 

Default

false
 

$strip_htmltags

$strip_htmltags 

Default

array('base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', 'iframe', 'input', 'marquee', 'meta', 'noscript', 'object', 'param', 'script', 'style')
 

$timeout

$timeout 

Default

10
 

$useragent

$useragent 

Default

''