class HtmlCleaner (View source)

Html Cleaner object.

Forked from the php input filter library by: Daniel Morris dan@rootcube.com Original Contributors: Gianpaolo Racca, Ghislain Picard, Marco Wandschneider, Chris Tobin and Andrew Eddie.

Constants

USE_WHITE_LIST

USE_BLACK_LIST

ONLY_ESSENTIAL

Properties

array $tagsArray The array of permitted tags (white list).
array $attrArray The array of permitted tag attributes (white list).
integer $tagsMethod The method for sanitising tags: WhiteList method = 0 (default), BlackList method = 1
integer $attrMethod The method for sanitising attributes: WhiteList method = 0 (default), BlackList method = 1
integer $xssAuto A flag for XSS checks. Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1
array $tagBlacklist The list of the default blacklisted tags.
array $attrBlacklist The list of the default blacklisted tag attributes. All event handlers implicit.

Methods

__construct(array $tagsArray = array(), array $attrArray = array(), integer $tagsMethod = self::USE_BLACK_LIST, integer $attrMethod = self::USE_BLACK_LIST, integer $xssAuto = 1)

Constructor for inputFilter class. Only first parameter is required.

static boolean
isBadAttribute(array $attrSubSet)

Function to determine if contents of an attribute are safe

string
remove(string $source)

Internal method to iteratively remove all unwanted tags and attributes

string
decode(string $source)

Try to convert to plaintext

int
getTagsMethod()

getTagsMethod

setTagsMethod(int $tagsMethod)

setTagsMethod

int
getAttrMethod()

getAttrMethod

setAttrMethod(int $attrMethod)

setAttrMethod

int
getXssMethod()

getXssAuto

setXssMethod(int $xssAuto)

setXssAuto

Details

at line line 123
__construct(array $tagsArray = array(), array $attrArray = array(), integer $tagsMethod = self::USE_BLACK_LIST, integer $attrMethod = self::USE_BLACK_LIST, integer $xssAuto = 1)

Constructor for inputFilter class. Only first parameter is required.

Parameters

array $tagsArray List of user-defined tags
array $attrArray List of user-defined attributes
integer $tagsMethod WhiteList method = 0, BlackList method = 1
integer $attrMethod WhiteList method = 0, BlackList method = 1
integer $xssAuto Only auto clean essentials = 0, Allow clean blacklisted tags/attr = 1

at line line 146
static boolean isBadAttribute(array $attrSubSet)

Function to determine if contents of an attribute are safe

Parameters

array $attrSubSet A 2 element array for attribute's name, value

Return Value

boolean True if bad code is detected

at line line 170
string remove(string $source)

Internal method to iteratively remove all unwanted tags and attributes

Parameters

string $source Input string to be 'cleaned'

Return Value

string 'Cleaned' version of input parameter

at line line 529
string decode(string $source)

Try to convert to plaintext

Parameters

string $source The source string.

Return Value

string Plaintext string

at line line 629
int getTagsMethod()

getTagsMethod

Return Value

int

at line line 641
HtmlCleaner setTagsMethod(int $tagsMethod)

setTagsMethod

Parameters

int $tagsMethod

Return Value

HtmlCleaner Return self to support chaining.

at line line 653
int getAttrMethod()

getAttrMethod

Return Value

int

at line line 665
HtmlCleaner setAttrMethod(int $attrMethod)

setAttrMethod

Parameters

int $attrMethod

Return Value

HtmlCleaner Return self to support chaining.

at line line 677
int getXssMethod()

getXssAuto

Return Value

int

at line line 689
HtmlCleaner setXssMethod(int $xssAuto)

setXssAuto

Parameters

int $xssAuto

Return Value

HtmlCleaner Return self to support chaining.