ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
|
Static Public Member Functions | |
static | removeHTMLtags ($text, $processCallback=null, $args=array()) |
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments. More... | |
static | removeHTMLcomments ($text) |
Remove '', and everything between. More... | |
static | validateTagAttributes ($attribs, $element) |
Take an array of attribute names and values and normalize or discard illegal values for the given element type. More... | |
static | checkCss ($value) |
Pick apart some CSS and check it for forbidden or unsafe structures. More... | |
static | fixTagAttributes ($text, $element) |
Take a tag soup fragment listing an HTML element's attributes and normalize it to well-formed XML, discarding unwanted attributes. More... | |
static | encodeAttribute ($text) |
Encode an attribute value for HTML output. More... | |
static | safeEncodeAttribute ($text) |
Encode an attribute value for HTML tags, with extra armoring against further wiki processing. More... | |
static | escapeId ($id) |
Given a value escape it so that it can be used in an id attribute and return it, this does not validate the value however (see first link) More... | |
static | escapeClass ($class) |
Given a value, escape it so that it can be used as a CSS class and return it. More... | |
static | decodeTagAttributes ($text) |
Return an associative array of attribute names and values from a partial tag string. More... | |
static | normalizeCharReferences ($text) |
Ensure that any entities and character references are legal for XML and XHTML specifically. More... | |
static | normalizeCharReferencesCallback ($matches) |
static | normalizeEntity ($name) |
If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, return the named entity reference as is. More... | |
static | decCharReference ($codepoint) |
static | hexCharReference ($codepoint) |
static | decodeCharReferences ($text) |
Decode any character references, numeric or named entities, in the text and return a UTF-8 string. More... | |
static | decodeCharReferencesCallback ($matches) |
static | decodeChar ($codepoint) |
Return UTF-8 string for a codepoint if that is a valid character reference, otherwise U+FFFD REPLACEMENT CHARACTER. More... | |
static | decodeEntity ($name) |
If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, return the UTF-8 encoding of that character. More... | |
static | attributeWhitelist ($element) |
Fetch the whitelist of acceptable attributes for a given element name. More... | |
static | setupAttributeWhitelist () |
static | stripAllTags ($text) |
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text. More... | |
static | hackDocType () |
Hack up a private DOCTYPE with HTML's standard entity declarations. More... | |
static | cleanUrl ($url, $hostname=true) |
Static Private Member Functions | |
static | armorLinksCallback ($matches) |
Regex replace callback for armoring links against further processing. More... | |
static | getTagAttributeCallback ($set) |
Pick the appropriate attribute value from a match set from the MW_ATTRIBS_REGEX matches. More... | |
static | normalizeAttributeValue ($text) |
Normalize whitespace and character references in an XML source- encoded text for an attribute value. More... | |
static | normalizeWhitespace ($text) |
static | validateCodepoint ($codepoint) |
Returns true if a given Unicode codepoint is a valid character in XML. More... | |
Definition at line 332 of file Sanitizer.php.
|
staticprivate |
Regex replace callback for armoring links against further processing.
array | $matches |
Definition at line 799 of file Sanitizer.php.
|
static |
Fetch the whitelist of acceptable attributes for a given element name.
string | $element |
Definition at line 1091 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Pick apart some CSS and check it for forbidden or unsafe structures.
Returns a sanitized string, or false if it was just too evil.
Currently URL references, 'expression', 'tps' are forbidden.
string | $value |
Definition at line 621 of file Sanitizer.php.
|
static |
NOTE: The original preg_replace/e IMPLICITLY adds a forward-slash on double quotes This could be a bug, but we will just mimic this behaviour 1:1 for now.
Definition at line 1288 of file Sanitizer.php.
References GuzzleHttp\Psr7\$protocol, $rest, $url, array, and decodeCharReferences().
Referenced by Parser\magicLinkCallback().
|
static |
Definition at line 974 of file Sanitizer.php.
References validateCodepoint().
|
static |
Return UTF-8 string for a codepoint if that is a valid character reference, otherwise U+FFFD REPLACEMENT CHARACTER.
int | $codepoint |
Definition at line 1053 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Decode any character references, numeric or named entities, in the text and return a UTF-8 string.
string | $text |
Definition at line 1018 of file Sanitizer.php.
Referenced by cleanUrl(), Title\escapeFragmentForURL(), hexCharReference(), Parser\magicLinkCallback(), and Title\newFromText().
|
static |
string | $matches |
Definition at line 1031 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, return the UTF-8 encoding of that character.
Otherwise, returns pseudo-entity source (eg )
string | $name |
Definition at line 1070 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Return an associative array of attribute names and values from a partial tag string.
Attribute names are forces to lowercase, character references are decoded to UTF-8 text.
string |
Definition at line 812 of file Sanitizer.php.
|
static |
Encode an attribute value for HTML output.
$text |
Definition at line 695 of file Sanitizer.php.
|
static |
Given a value, escape it so that it can be used as a CSS class and return it.
string | $class |
Definition at line 783 of file Sanitizer.php.
|
static |
Given a value escape it so that it can be used in an id attribute and return it, this does not validate the value however (see first link)
string | $id |
Definition at line 760 of file Sanitizer.php.
Referenced by Parser\fetchScaryTemplateMaybeFromCache().
|
static |
Take a tag soup fragment listing an HTML element's attributes and normalize it to well-formed XML, discarding unwanted attributes.
Output is safe for further wikitext processing, with escaping of values that could trigger problems.
string | $text | |
string | $element |
Definition at line 669 of file Sanitizer.php.
|
staticprivate |
Pick the appropriate attribute value from a match set from the MW_ATTRIBS_REGEX matches.
array | $set |
Definition at line 852 of file Sanitizer.php.
|
static |
Hack up a private DOCTYPE with HTML's standard entity declarations.
PHP 4 seemed to know these if you gave it an HTML doctype, but PHP 5.1 doesn't.
Use for passing XHTML fragments to PHP's XML parsing functions
Definition at line 1277 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Definition at line 984 of file Sanitizer.php.
References $list, $name, $out, $text, $wgHtmlEntities, $wgHtmlEntityAliases, array, attributeWhitelist(), codepointToUtf8(), decodeChar(), decodeCharReferences(), decodeCharReferencesCallback(), decodeEntity(), hackDocType(), ILIAS\FileDelivery\http(), MW_CHAR_REFS_REGEX, setupAttributeWhitelist(), stripAllTags(), UTF8_REPLACEMENT, and validateCodepoint().
|
staticprivate |
Normalize whitespace and character references in an XML source- encoded text for an attribute value.
See http://www.w3.org/TR/REC-xml/#AVNormalize for background, but note that we're not returning the value, but are returning XML source fragments that will be slapped into output.
string | $text |
Definition at line 887 of file Sanitizer.php.
|
static |
Ensure that any entities and character references are legal for XML and XHTML specifically.
Any stray bits will be &-escaped to result in a valid text fragment.
a. any named char refs must be known in XHTML b. any numeric char refs must be legal chars, not invalid or forbidden c. use &#x, not &#X d. fix or reject non-valid attributes
string | $text |
Definition at line 921 of file Sanitizer.php.
Referenced by Parser\setOutputType().
|
static |
string | $matches |
Definition at line 933 of file Sanitizer.php.
|
static |
If the named entity is defined in the HTML 4.0/XHTML 1.0 DTD, return the named entity reference as is.
If the entity is a MediaWiki-specific alias, returns the HTML equivalent. Otherwise, returns HTML-escaped text of pseudo-entity source (eg &foo;)
string | $name |
Definition at line 962 of file Sanitizer.php.
|
staticprivate |
Definition at line 898 of file Sanitizer.php.
|
static |
Remove '', and everything between.
To avoid leaving blank lines, when a comment is both preceded and followed by a newline (ignoring spaces), trim leading and trailing spaces and one of the newlines.
string | $text |
Definition at line 533 of file Sanitizer.php.
Referenced by Parser\createAssocArgs().
|
static |
Cleans up HTML, removes dangerous tags and attributes, and removes HTML comments.
string | $text | |
callback | $processCallback | to do any variable or parameter replacements in HTML attribute values |
array | $args | for the processing callback |
Definition at line 343 of file Sanitizer.php.
Referenced by Parser\createAssocArgs().
|
static |
Encode an attribute value for HTML tags, with extra armoring against further wiki processing.
$text |
Definition at line 717 of file Sanitizer.php.
|
static |
Definition at line 1106 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Take a fragment of (potentially invalid) HTML and return a version with any tags removed, encoded as plain text.
Warning: this return value must be further escaped for literal inclusion in HTML output as of 1.10!
string | $text | HTML fragment |
Definition at line 1255 of file Sanitizer.php.
Referenced by Parser\fetchScaryTemplateMaybeFromCache(), and hexCharReference().
|
staticprivate |
Returns true if a given Unicode codepoint is a valid character in XML.
int | $codepoint |
Definition at line 999 of file Sanitizer.php.
Referenced by decCharReference(), and hexCharReference().
|
static |
Take an array of attribute names and values and normalize or discard illegal values for the given element type.
array | $attribs | |
string | $element |
Check for legal values where the DTD limits things.
Check for unique id attribute :P
Definition at line 583 of file Sanitizer.php.
Referenced by Parser\fetchScaryTemplateMaybeFromCache().