You are here: Documentation » API Reference » SimplePie » strip_attributes()
Table of Contents
strip_attributes()
Description
class SimplePie { strip_attributes ( [$attribs = array('bgsound', 'class', 'expr', 'id', 'style', 'onclick', 'onerror', 'onfinish', 'onmouseover', 'onmouseout', 'onfocus', 'onblur', 'lowsrc', 'dynsrc')] ) }
Set which attributes get stripped from an entry's content.
The default set of attributes is stored in the property SimplePie→strip_attributes, not to be confused with the method SimplePie→strip_attributes(). This way, you can modify the existing list without having to create a whole new one.
Availability
- Available since SimplePie Beta 2.
Parameters
attribs
An array of the attributes you want to strip.
Examples
Don't strip any attributes (not recommended)
$feed = new SimplePie(); $feed->set_feed_url('http://simplepie.org/blog/feed/'); $feed->strip_attributes(false); $feed->init(); $feed->handle_content_type(); echo $feed->get_title();
Strip only ''src'', ''alt'', and ''title''
$feed = new SimplePie(); $feed->set_feed_url('http://simplepie.org/blog/feed/'); $feed->strip_attributes(array('src', 'alt', 'title')); $feed->init(); $feed->handle_content_type(); echo $feed->get_title();
Add ''src'', ''alt'', and ''title'' to the default list
$feed = new SimplePie(); $feed->set_feed_url('http://simplepie.org/blog/feed/'); $feed->strip_attributes(array_merge($feed->strip_attributes, array('src', 'alt', 'title'))); $feed->init(); $feed->handle_content_type(); echo $feed->get_title();
See Also
reference/simplepie/strip_attributes.txt · Last modified: 2011/03/06 03:56 (external edit)