HTMLPurifier_EntityParser
Handles referencing and derefencing character entities
- Full name:
\HTMLPurifier_EntityParser
Properties
_entity_lookup
Reference to entity lookup table.
_textEntitiesRegex
Callback regex string for entities in text.
_attrEntitiesRegex
Callback regex string for entities in attributes.
_semiOptionalPrefixRegex
Tests if the beginning of a string is a semi-optional regex
_substituteEntitiesRegex
Callback regex string for parsing entities.
_special_dec2str
Decimal to parsed string conversion table for special entities.
_special_ent2dec
Stripped entity names to decimal conversion table for special entities.
Methods
__construct
substituteTextEntities
Substitute entities with the parsed equivalents. Use this on textual data in an HTML document (as opposed to attributes.)
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to have entities parsed. |
Return Value:
Parsed string.
substituteAttrEntities
Substitute entities with the parsed equivalents. Use this on attribute contents in documents.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to have entities parsed. |
Return Value:
Parsed string.
entityCallback
Callback function for substituteNonSpecialEntities() that does the work.
Parameters:
Parameter | Type | Description |
---|---|---|
$matches |
array | PCRE matches array, with 0 the entire match, and either index 1, 2 or 3 set with a hex value, dec value, or string (respectively). |
Return Value:
Replacement string.
substituteNonSpecialEntities
Substitutes non-special entities with their parsed equivalents. Since running this whenever you have parsed character is t3h 5uck, we run it before everything else.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to have non-special entities parsed. |
Return Value:
Parsed string.
nonSpecialEntityCallback
Callback function for substituteNonSpecialEntities() that does the work.
Parameters:
Parameter | Type | Description |
---|---|---|
$matches |
array | PCRE matches array, with 0 the entire match, and either index 1, 2 or 3 set with a hex value, dec value, or string (respectively). |
Return Value:
Replacement string.
substituteSpecialEntities
Substitutes only special entities with their parsed equivalents.
Parameters:
Parameter | Type | Description |
---|---|---|
$string |
string | String to have non-special entities parsed. |
Return Value:
Parsed string.
specialEntityCallback
Callback function for substituteSpecialEntities() that does the work.
This callback has same syntax as nonSpecialEntityCallback().
Parameters:
Parameter | Type | Description |
---|---|---|
$matches |
array | PCRE-style matches array, with 0 the entire match, and either index 1, 2 or 3 set with a hex value, dec value, or string (respectively). |
Return Value:
Replacement string.
Automatically generated on 2025-03-18