Documentation

Purifier
in package

Purifier basic class.

Tags
license

YetiForce Public License 4.0 (licenses/LicenseEN.txt or yetiforce.com)

copyright

YetiForce Sp. z o.o

author

Mariusz Krzaczkowski m.krzaczkowski@yetiforce.com

author

Radosław Skrzypczak r.skrzypczak@yetiforce.com

Table of Contents

ALNUM  = 'Alnum'
Purify type Alnum.
ALNUM_EXTENDED  = 'AlnumExtended'
Purify type Alnum.
BOOL  = 'Bool'
Purify type boolean.
DATE_USER_FORMAT  = 'DateInUserFormat'
Purify type date in user format.
HTML  = 'Html'
Purify type html.
HTML_TEXT_PARSER  = 'HtmlTextParser'
Purify type HTML text parser.
INTEGER  = 'Integer'
Purify type integer.
NUMBER  = 'Number'
Purify type number.
SQL  = 'Sql'
Purify type sql.
STANDARD  = 'Standard'
Purify type standard.
TEXT  = 'Text'
Purify type text.
URL  = 'Url'
Purify type url.
$defaultCharset  : string
Default charset.
$htmlEventAttributes  : string
Html events attributes.
$purifyHtmlInstanceCache  : bool|HTMLPurifier
Cache for Html purify instance.
$purifyInstanceCache  : bool|HTMLPurifier
Cache for purify instance.
$purifyTextParserInstanceCache  : bool|HTMLPurifier
$removeUnnecessaryCode  : array<string|int, string>
Remove unnecessary code list.
bool()  : bool|null
Function to convert the given value to bool.
decodeHtml()  : string
Function to decode html.
encodeHtml()  : string
Function to convert the given string to html.
getHtmlConfig()  : HTMLPurifier_Config
Get html config.
purify()  : string
Purify (Cleanup) malicious snippets of code from the input.
purifyByType()  : mixed
Purify by data type.
purifyHtml()  : string
Purify HTML (Cleanup) malicious snippets of code from the input.
purifyHtmlEventAttributes()  : void
To purify malicious html event attributes.
purifySql()  : bool|string
Function to return the valid SQl input.
purifyTextParser()  : string
Purify HTML (Cleanup) malicious snippets of code from text parser.
removeUnnecessaryCode()  : string
Remove unnecessary code.

Constants

ALNUM

Purify type Alnum.

public mixed ALNUM = 'Alnum'

ALNUM_EXTENDED

Purify type Alnum.

public mixed ALNUM_EXTENDED = 'AlnumExtended'

BOOL

Purify type boolean.

public mixed BOOL = 'Bool'

DATE_USER_FORMAT

Purify type date in user format.

public mixed DATE_USER_FORMAT = 'DateInUserFormat'

HTML

Purify type html.

public mixed HTML = 'Html'

HTML_TEXT_PARSER

Purify type HTML text parser.

public mixed HTML_TEXT_PARSER = 'HtmlTextParser'

INTEGER

Purify type integer.

public mixed INTEGER = 'Integer'

NUMBER

Purify type number.

public mixed NUMBER = 'Number'

SQL

Purify type sql.

public mixed SQL = 'Sql'

STANDARD

Purify type standard.

public mixed STANDARD = 'Standard'

TEXT

Purify type text.

public mixed TEXT = 'Text'

URL

Purify type url.

public mixed URL = 'Url'

Properties

$defaultCharset

Default charset.

public static string $defaultCharset

$htmlEventAttributes

Html events attributes.

private static string $htmlEventAttributes = 'onerror|onblur|onchange|oncontextmenu|onfocus|oninput|oninvalid|onreset|onsearch|onselect|onsubmit|onkeydown|onkeypress|onkeyup|' . 'onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondragstart|ondrop|onmousedown|onmousemove|onmouseout|onmouseover|onbeforepaste|onresizestart|onactivate|' . 'onmouseup|onmousewheel|onscroll|onwheel|oncopy|oncut|onpaste|onload|onselectionchange|onabort|onselectstart|ondragdrop|onmouseleave|onmouseenter|onunload|onresize|onmessage|' . 'onpropertychange|onfilterchange|onstart|onfinish|onbounce|onrowsinserted|onrowsdelete|onrowexit|onrowenter|ondatasetcomplete|ondatasetchanged|ondataavailable|oncellchange|' . 'onbeforeupdate|onafterupdate|onerrorupdate|onhelp|onbeforeprint|onafterprint|oncontrolselect|onfocusout|onfocusin|ondeactivate|onbeforeeditfocus|onbeforedeactivate|onbeforeactivate|' . 'onresizeend|onmovestart|onmoveend|onmove|onbeforecopy|onbeforecut|onbeforeunload|onhashchange|onoffline|ononline|onreadystatechange|onstop|onlosecapture'

$purifyHtmlInstanceCache

Cache for Html purify instance.

private static bool|HTMLPurifier $purifyHtmlInstanceCache = false

$purifyInstanceCache

Cache for purify instance.

private static bool|HTMLPurifier $purifyInstanceCache = false

$purifyTextParserInstanceCache

private static bool|HTMLPurifier $purifyTextParserInstanceCache = false

Cache for Html template purify instance.

$removeUnnecessaryCode

Remove unnecessary code list.

private static array<string|int, string> $removeUnnecessaryCode = ['href="javascript:window.history.back();"', 'href="javascript:void(0);"']

Methods

bool()

Function to convert the given value to bool.

public static bool(int|string $value) : bool|null
Parameters
$value : int|string
Return values
bool|null

decodeHtml()

Function to decode html.

public static decodeHtml(string $string) : string
Parameters
$string : string
Return values
string

encodeHtml()

Function to convert the given string to html.

public static encodeHtml(string $string) : string
Parameters
$string : string
Return values
string

getHtmlConfig()

Get html config.

public static getHtmlConfig([array<string|int, mixed> $options = [] ]) : HTMLPurifier_Config
Parameters
$options : array<string|int, mixed> = []
Return values
HTMLPurifier_Config

purify()

Purify (Cleanup) malicious snippets of code from the input.

public static purify(string $input[, bool $loop = true ]) : string
Parameters
$input : string
$loop : bool = true

Purify values in the loop

Return values
string

purifyByType()

Purify by data type.

public static purifyByType(mixed $input, string $type[, mixed $convert = false ]) : mixed

Type list: Standard - only words 1 - only words Alnum - word and int 2 - word and int

Parameters
$input : mixed
$type : string

Data type that is only acceptable

$convert : mixed = false
Return values
mixed

purifyHtml()

Purify HTML (Cleanup) malicious snippets of code from the input.

public static purifyHtml(string $input[, bool $loop = true ]) : string
Parameters
$input : string
$loop : bool = true

Purify values in the loop

Return values
string

purifyHtmlEventAttributes()

To purify malicious html event attributes.

public static purifyHtmlEventAttributes(string $value) : void
Parameters
$value : string
Return values
void

purifySql()

Function to return the valid SQl input.

public static purifySql(string $input[, bool $skipEmpty = true ]) : bool|string
Parameters
$input : string
$skipEmpty : bool = true

Skip the check if string is empty

Return values
bool|string

purifyTextParser()

Purify HTML (Cleanup) malicious snippets of code from text parser.

public static purifyTextParser(string $input[, bool $loop = true ]) : string
Parameters
$input : string
$loop : bool = true

Purify values in the loop

Return values
string

removeUnnecessaryCode()

Remove unnecessary code.

public static removeUnnecessaryCode(string $value) : string
Parameters
$value : string
Return values
string

        

Search results