Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
HTMLPurifier_EntityParser Class Reference

Public Member Functions

 substituteAttrEntities ($string)
 Substitute entities with the parsed equivalents.
 
 substituteNonSpecialEntities ($string)
 Substitutes non-special entities with their parsed equivalents.
 
 substituteSpecialEntities ($string)
 Substitutes only special entities with their parsed equivalents.
 
 substituteTextEntities ($string)
 Substitute entities with the parsed equivalents.
 

Protected Member Functions

 entityCallback ($matches)
 Callback function for substituteNonSpecialEntities() that does the work.
 
 nonSpecialEntityCallback ($matches)
 Callback function for substituteNonSpecialEntities() that does the work.
 
 specialEntityCallback ($matches)
 Callback function for substituteSpecialEntities() that does the work.
 

Protected Attributes

 $_attrEntitiesRegex
 Callback regex string for entities in attributes.
 
 $_entity_lookup
 Reference to entity lookup table.
 
 $_semiOptionalPrefixRegex
 Tests if the beginning of a string is a semi-optional regex.
 
 $_special_dec2str
 Decimal to parsed string conversion table for special entities.
 
 $_special_ent2dec
 Stripped entity names to decimal conversion table for special entities.
 
 $_substituteEntitiesRegex
 Callback regex string for parsing entities.
 
 $_textEntitiesRegex
 Callback regex string for entities in text.
 

Member Function Documentation

◆ entityCallback()

HTMLPurifier_EntityParser::entityCallback ( $matches)
protected

Callback function for substituteNonSpecialEntities() that does the work.

Parameters
array$matchesPCRE 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 values
stringReplacement string.

◆ nonSpecialEntityCallback()

HTMLPurifier_EntityParser::nonSpecialEntityCallback ( $matches)
protected

Callback function for substituteNonSpecialEntities() that does the work.

Parameters
array$matchesPCRE 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 values
stringReplacement string.

◆ specialEntityCallback()

HTMLPurifier_EntityParser::specialEntityCallback ( $matches)
protected

Callback function for substituteSpecialEntities() that does the work.

This callback has same syntax as nonSpecialEntityCallback().

Parameters
array$matchesPCRE-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 values
stringReplacement string.

◆ substituteAttrEntities()

HTMLPurifier_EntityParser::substituteAttrEntities ( $string)

Substitute entities with the parsed equivalents.

Use this on attribute contents in documents.

Parameters
string$stringString to have entities parsed.
Return values
stringParsed string.

◆ substituteNonSpecialEntities()

HTMLPurifier_EntityParser::substituteNonSpecialEntities ( $string)

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
string$stringString to have non-special entities parsed.
Return values
stringParsed string.

◆ substituteSpecialEntities()

HTMLPurifier_EntityParser::substituteSpecialEntities ( $string)

Substitutes only special entities with their parsed equivalents.

@notice We try to avoid calling this function because otherwise, it would have to be called a lot (for every parsed section).

Parameters
string$stringString to have non-special entities parsed.
Return values
stringParsed string.

◆ substituteTextEntities()

HTMLPurifier_EntityParser::substituteTextEntities ( $string)

Substitute entities with the parsed equivalents.

Use this on textual data in an HTML document (as opposed to attributes.)

Parameters
string$stringString to have entities parsed.
Return values
stringParsed string.

Member Data Documentation

◆ $_attrEntitiesRegex

HTMLPurifier_EntityParser::$_attrEntitiesRegex
protected

Callback regex string for entities in attributes.

@type string

◆ $_entity_lookup

HTMLPurifier_EntityParser::$_entity_lookup
protected

Reference to entity lookup table.

@type HTMLPurifier_EntityLookup

◆ $_special_dec2str

HTMLPurifier_EntityParser::$_special_dec2str
protected
Initial value:
=
array(
34 => '"',
38 => '&',
39 => "'",
60 => '<',
62 => '>'
)

Decimal to parsed string conversion table for special entities.

@type array

◆ $_special_ent2dec

HTMLPurifier_EntityParser::$_special_ent2dec
protected
Initial value:
=
array(
'quot' => 34,
'amp' => 38,
'lt' => 60,
'gt' => 62
)

Stripped entity names to decimal conversion table for special entities.

@type array

◆ $_substituteEntitiesRegex

HTMLPurifier_EntityParser::$_substituteEntitiesRegex
protected
Initial value:
=
'/&(?:[#]x([a-fA-F0-9]+)|[#]0*(::d+)|([A-Za-z_:][A-Za-z0-9.::-_:]*));?/'

Callback regex string for parsing entities.

@type string

◆ $_textEntitiesRegex

HTMLPurifier_EntityParser::$_textEntitiesRegex
protected

Callback regex string for entities in text.

@type string


The documentation for this class was generated from the following file: