|
1C-Bitrix 25.700.0
|
Открытые члены | |
| __construct () | |
| allowAttributes (array $attrs) | |
| AddTags ($arTags) | |
| UpdateTags ($arTags) | |
| DelTags ($arTagNames) | |
| DeleteAttributes (array $arDeleteAttrs) | |
| DelAllTags () | |
| ApplyDoubleEncode ($bApply=true) | |
| ApplyHtmlSpecChars ($bApply=true) | |
| DeleteSanitizedTags ($bApply=true) | |
| SetLevel ($secLevel) | |
| GetTags () | |
| SanitizeHtml ($html) | |
| Decode ($str) | |
| setDelTagsWithContent (array $tags) | |
| getDelTagsWithContent () | |
Открытые статические члены | |
| static | SetTags ($arTags) |
| static | Sanitize ($html, $secLevel='HIGH', $htmlspecialchars=true, $delTags=true) |
Поля данных | |
| const | SECURE_LEVEL_CUSTOM = 0 |
| const | SECURE_LEVEL_HIGH = 1 |
| const | SECURE_LEVEL_MIDDLE = 2 |
| const | SECURE_LEVEL_LOW = 3 |
| const | TABLE_TOP = 0 |
| const | TABLE_CAPT = 1 |
| const | TABLE_GROUP = 2 |
| const | TABLE_ROWS = 3 |
| const | TABLE_COLS = 4 |
| const | ACTION_DEL = 'del' |
| const | ACTION_ADD = 'add' |
| const | ACTION_DEL_WITH_CONTENT = 'del_with_content' |
Защищенные члены | |
| IsValidAttr (&$arAttr) | |
| encodeAttributeValue (array $attr) | |
| splitHtml ($html) | |
| extractAttributes (string $attrData) | |
| processAttributes (string $attrData, string $currTag) | |
| CleanTable (&$seg, &$openTagsStack, $segIndex, $delTextBetweenTags=true) | |
| _decode_cb ($in) | |
| _decode_cb_hex ($in) | |
| _decode ($str) | |
Защищенные данные | |
| $arHtmlTags = array() | |
| $bHtmlSpecChars = true | |
| $bDelSanitizedTags = true | |
| $bDoubleEncode = true | |
| $secLevel = self::SECURE_LEVEL_HIGH | |
| $additionalAttrs = array() | |
| $arNoClose | |
| $localAlph | |
| $arTableTags | |
| $delTagsWithContent = ['script', 'style'] | |
Статические защищенные данные | |
| static | $arOldTags = array() |
CBXSanitizer Class to cut all tags and attributies from html not contained in white list
Example to use:
$Sanitizer = new CBXSanitizer;
$Sanitizer->SetLevel(CBXSanitizer::SECURE_LEVEL_MIDDLE);
or
$Sanitizer->AddTags( array (
'a' = > array('href','id','style','alt'...),
'br' => array(),
.... ));
$Sanitizer->SanitizeHtml($html);
См. определение в файле sanitizer.php строка 22
| __construct | ( | ) |
CBXSanitizer constructor.
См. определение в файле sanitizer.php строка 81
|
protected |
См. определение в файле sanitizer.php строка 1063
|
protected |
См. определение в файле sanitizer.php строка 1037
|
protected |
См. определение в файле sanitizer.php строка 1049
| AddTags | ( | $arTags | ) |
Adds HTML tags and attributes to white list
| mixed | $arTags | array('tagName1' = > array('attribute1','attribute2',...), 'tagName2' => ........) |
См. определение в файле sanitizer.php строка 136
| allowAttributes | ( | array | $attrs | ) |
Allow additional attributes in html.
| array | $attrs | Additional attrs Example: $sanitizer->allowAttributes(array( 'aria-label' => array( 'tag' => function($tag) { return ($tag == 'div'); }, 'content' => function($value) { return !preg_match("#[^\\s\\w\\-\\#\\.;]#iu", $value); } ) )); |
См. определение в файле sanitizer.php строка 117
| ApplyDoubleEncode | ( | $bApply = true | ) |
If is turned off Sanitizer will not encode existing html entities, in text blocks. The default is to convert everything. http://php.net/manual/ru/function.htmlspecialchars.php (double_encode)
| bool | $bApply | true|false |
См. определение в файле sanitizer.php строка 218
| ApplyHtmlSpecChars | ( | $bApply = true | ) |
Apply or not function htmlspecialchars to filtered tags and text !WARNING! if DeleteSanitizedTags = false and ApplyHtmlSpecChars = false html will not be sanitized!
| bool | $bApply | true|false |
См. определение в файле sanitizer.php строка 233
|
protected |
function CleanTable Check if table code is valid, and corrects. If need deletes all text and tags between diferent table tags if $delTextBetweenTags=true. Checks if where are open tags from upper level if not - self-distructs.
См. определение в файле sanitizer.php строка 935
| Decode | ( | $str | ) |
Decodes text from codes like &#***, html-entities wich may be coded several times;
| string | $str |
См. определение в файле sanitizer.php строка 1018
| DelAllTags | ( | ) |
Deletes all tags from white list
См. определение в файле sanitizer.php строка 205
| DeleteAttributes | ( | array | $arDeleteAttrs | ) |
| array | $arDeleteAttrs |
См. определение в файле sanitizer.php строка 191
| DeleteSanitizedTags | ( | $bApply = true | ) |
Delete or not filtered tags !WARNING! if DeleteSanitizedTags = false and ApplyHtmlSpecChars = false html will not be sanitized!
| bool | $bApply | true|false |
См. определение в файле sanitizer.php строка 252
| DelTags | ( | $arTagNames | ) |
Deletes tags from white list
| mixed | $arTagNames | array('tagName1','tagname2',...) |
См. определение в файле sanitizer.php строка 168
|
protected |
См. определение в файле sanitizer.php строка 477
|
protected |
См. определение в файле sanitizer.php строка 884
| getDelTagsWithContent | ( | ) |
См. определение в файле sanitizer.php строка 1081
| GetTags | ( | ) |
Returns allowed tags and attributies
См. определение в файле sanitizer.php строка 510
|
protected |
См. определение в файле sanitizer.php строка 410
|
protected |
См. определение в файле sanitizer.php строка 898
См. определение в файле sanitizer.php строка 546
| SanitizeHtml | ( | $html | ) |
Erases, or HtmlSpecChares Tags and attributies wich not contained in white list from inputted HTML
| string | $html | Dirty HTML |
count($this->arHtmlTags[$seg[$i]['tagName']]) || fix:
См. определение в файле sanitizer.php строка 598
| setDelTagsWithContent | ( | array | $tags | ) |
| array | $tags |
См. определение в файле sanitizer.php строка 1073
| SetLevel | ( | $secLevel | ) |
Sets security level from predefined
| int | $secLevel | { CBXSanitizer\SECURE_LEVEL_HIGH | CBXSanitizer\SECURE_LEVEL_MIDDLE | CBXSanitizer\SECURE_LEVEL_LOW } |
См. определение в файле sanitizer.php строка 266
|
static |
См. определение в файле sanitizer.php строка 532
|
protected |
Split html to tags and simple text chunks
| string | $html |
См. определение в файле sanitizer.php строка 570
| UpdateTags | ( | $arTags | ) |
См. определение в файле sanitizer.php строка 158
|
protected |
См. определение в файле sanitizer.php строка 53
|
protected |
См. определение в файле sanitizer.php строка 48
|
protected |
См. определение в файле sanitizer.php строка 54
|
staticprotected |
См. определение в файле sanitizer.php строка 46
|
protected |
См. определение в файле sanitizer.php строка 61
|
protected |
См. определение в файле sanitizer.php строка 50
|
protected |
См. определение в файле sanitizer.php строка 51
|
protected |
См. определение в файле sanitizer.php строка 49
|
protected |
См. определение в файле sanitizer.php строка 76
|
protected |
См. определение в файле sanitizer.php строка 59
|
protected |
См. определение в файле sanitizer.php строка 52
| const ACTION_ADD = 'add' |
См. определение в файле sanitizer.php строка 39
| const ACTION_DEL = 'del' |
См. определение в файле sanitizer.php строка 38
| const ACTION_DEL_WITH_CONTENT = 'del_with_content' |
См. определение в файле sanitizer.php строка 40
| const SECURE_LEVEL_CUSTOM = 0 |
Security levels
См. определение в файле sanitizer.php строка 27
| const SECURE_LEVEL_HIGH = 1 |
См. определение в файле sanitizer.php строка 28
| const SECURE_LEVEL_LOW = 3 |
См. определение в файле sanitizer.php строка 30
| const SECURE_LEVEL_MIDDLE = 2 |
См. определение в файле sanitizer.php строка 29
| const TABLE_CAPT = 1 |
См. определение в файле sanitizer.php строка 33
| const TABLE_COLS = 4 |
См. определение в файле sanitizer.php строка 36
| const TABLE_GROUP = 2 |
См. определение в файле sanitizer.php строка 34
| const TABLE_ROWS = 3 |
См. определение в файле sanitizer.php строка 35
| const TABLE_TOP = 0 |
См. определение в файле sanitizer.php строка 32