Documentation

Purifier
in package

Purifier basic class.

Table of Contents

ALNUM  = 'Alnum'
ALNUM2  = 'AlnumType2'
ALNUM_EXTENDED  = 'AlnumExtended'
BOOL  = 'Bool'
DATE_USER_FORMAT  = 'DateInUserFormat'
DIGITS  = 'Digits'
EMAIL  = 'Email'
HTML  = 'Html'
HTML_TEXT_PARSER  = 'HtmlTextParser'
INTEGER  = 'Integer'
NUMBER  = 'Number'
PATH  = 'Path'
SQL  = 'Sql'
STANDARD  = 'Standard'
TEXT  = 'Text'
URL  = '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

public string ALNUM = 'Alnum'

Purify type Alnum.

ALNUM2

public string ALNUM2 = 'AlnumType2'

Purify type Alnum 2 (A-Za-z0-9/+-).

ALNUM_EXTENDED

public string ALNUM_EXTENDED = 'AlnumExtended'

Purify type AlnumExtended.

BOOL

public string BOOL = 'Bool'

Purify type boolean.

DATE_USER_FORMAT

public string DATE_USER_FORMAT = 'DateInUserFormat'

Purify type date in user format.

DIGITS

public string DIGITS = 'Digits'

Purify type Digits.

EMAIL

public string EMAIL = 'Email'

Purify type email.

HTML

public string HTML = 'Html'

Purify type html.

HTML_TEXT_PARSER

public string HTML_TEXT_PARSER = 'HtmlTextParser'

Purify type HTML text parser

INTEGER

public string INTEGER = 'Integer'

Purify type integer.

NUMBER

public string NUMBER = 'Number'

Purify type number.

PATH

public string PATH = 'Path'

Purify type Path.

SQL

public string SQL = 'Sql'

Purify type sql.

STANDARD

public string STANDARD = 'Standard'

Purify type standard.

TEXT

public string TEXT = 'Text'

Purify type text.

URL

public string URL = 'Url'

Purify type 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