ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
|
Static Public Member Functions | |
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 | 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 | 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 | 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 | 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 | normalizeCharReferences ( $text) |
Ensure that any entities and character references are legal for XML and XHTML specifically. More... | |
static | validateCodepoint ( $codepoint) |
Returns true if a given Unicode codepoint is a valid character in XML. More... | |
static | decodeChar ( $codepoint) |
Return UTF-8 string for a codepoint if that is a valid character reference, otherwise U+FFFD REPLACEMENT CHARACTER. More... | |
Definition at line 330 of file Sanitizer.php.
|
staticprivate |
Regex replace callback for armoring links against further processing.
array | $matches |
Definition at line 777 of file Sanitizer.php.
|
static |
Fetch the whitelist of acceptable attributes for a given element name.
string | $element |
Definition at line 1046 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 611 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 1237 of file Sanitizer.php.
References $rest, $url, array, and decodeCharReferences().
Referenced by Parser\magicLinkCallback().
|
static |
Definition at line 937 of file Sanitizer.php.
References validateCodepoint().
Referenced by normalizeWhitespace().
|
staticprivate |
Return UTF-8 string for a codepoint if that is a valid character reference, otherwise U+FFFD REPLACEMENT CHARACTER.
int | $codepoint |
Definition at line 1010 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 978 of file Sanitizer.php.
Referenced by cleanUrl(), Title\escapeFragmentForURL(), hexCharReference(), Parser\magicLinkCallback(), and Title\newFromText().
|
static |
string | $matches |
Definition at line 989 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 1026 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 789 of file Sanitizer.php.
|
static |
Encode an attribute value for HTML output.
$text |
Definition at line 679 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 763 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 741 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 656 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 827 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 1227 of file Sanitizer.php.
Referenced by hexCharReference().
|
static |
Definition at line 946 of file Sanitizer.php.
References $out, $text, $wgHtmlEntities, $wgHtmlEntityAliases, array, attributeWhitelist(), codepointToUtf8(), decodeChar(), decodeCharReferences(), decodeCharReferencesCallback(), decodeEntity(), hackDocType(), MW_CHAR_REFS_REGEX, setupAttributeWhitelist(), stripAllTags(), UTF8_REPLACEMENT, and validateCodepoint().
Referenced by normalizeWhitespace().
|
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 861 of file Sanitizer.php.
|
staticprivate |
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 888 of file Sanitizer.php.
Referenced by normalizeWhitespace(), and Parser\setOutputType().
|
static |
string | $matches |
Definition at line 898 of file Sanitizer.php.
Referenced by normalizeWhitespace().
|
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 926 of file Sanitizer.php.
Referenced by normalizeWhitespace().
|
staticprivate |
Definition at line 867 of file Sanitizer.php.
References $ret, $text, $wgHtmlEntities, $wgHtmlEntityAliases, array, decCharReference(), hexCharReference(), MW_CHAR_REFS_REGEX, normalizeCharReferences(), normalizeCharReferencesCallback(), and normalizeEntity().
|
staticprivate |
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 526 of file Sanitizer.php.
Referenced by Parser\closeList().
|
staticprivate |
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 340 of file Sanitizer.php.
Referenced by Parser\closeList().
|
static |
Encode an attribute value for HTML tags, with extra armoring against further wiki processing.
$text |
Definition at line 700 of file Sanitizer.php.
|
static |
Definition at line 1060 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 1206 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 960 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 575 of file Sanitizer.php.
Referenced by Parser\fetchScaryTemplateMaybeFromCache().