Handles referencing and derefencing character entities
Methods | ||||
---|---|---|---|---|
public
|
__construct()
|
# | ||
public
|
substituteTextEntities(string $string): string
Substitute entities with the parsed equivalents. Use this on
textual data in an HTML document (as opposed to…
Substitute entities with the parsed equivalents. Use this on textual data in an HTML document (as opposed to attributes.) Parameters
ReturnsParsed string. |
# | ||
public
|
substituteAttrEntities(string $string): string
Substitute entities with the parsed equivalents. Use this on
attribute contents in documents.
Substitute entities with the parsed equivalents. Use this on attribute contents in documents. Parameters
ReturnsParsed string. |
# | ||
protected
|
entityCallback(array $matches): string
Callback function for substituteNonSpecialEntities() that does the work.
Callback function for substituteNonSpecialEntities() that does the work. Parameters
ReturnsReplacement string. |
# | ||
public
|
substituteNonSpecialEntities(string $string): string
Substitutes non-special entities with their parsed equivalents. Since
running this whenever you have parsed character…
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
ReturnsParsed string. |
# | ||
protected
|
nonSpecialEntityCallback(array $matches): string
Callback function for substituteNonSpecialEntities() that does the work.
Callback function for substituteNonSpecialEntities() that does the work. Parameters
ReturnsReplacement string. |
# | ||
public
|
substituteSpecialEntities(string $string): string
Substitutes only special entities with their parsed equivalents.
Substitutes only special entities with their parsed equivalents. Parameters
ReturnsParsed string. |
# | ||
protected
|
specialEntityCallback(array $matches): string
Callback function for substituteSpecialEntities() that does the work.
Callback function for substituteSpecialEntities() that does the work. This callback has same syntax as nonSpecialEntityCallback(). Parameters
ReturnsReplacement string. |
# |
Properties | |||
---|---|---|---|
protected
|
|
$_entity_lookup
Reference to entity lookup table.
Reference to entity lookup table. |
# |
protected
|
|
$_textEntitiesRegex
Callback regex string for entities in text.
Callback regex string for entities in text. |
# |
protected
|
|
$_attrEntitiesRegex
Callback regex string for entities in attributes.
Callback regex string for entities in attributes. |
# |
protected
|
|
$_semiOptionalPrefixRegex
Tests if the beginning of a string is a semi-optional regex
Tests if the beginning of a string is a semi-optional regex |
# |
protected
|
|
$_substituteEntitiesRegex = '/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z_:][A-Za-z0-9.\-_:]*));?/'
Callback regex string for parsing entities.
Callback regex string for parsing entities. |
# |
protected
|
|
$_special_dec2str = [34 => '"', 38 => '&', 39 => "'", 60 => '<', 62 => '>']
Decimal to parsed string conversion table for special entities.
Decimal to parsed string conversion table for special entities. |
# |
protected
|
|
$_special_ent2dec = ['quot' => 34, 'amp' => 38, 'lt' => 60, 'gt' => 62]
Stripped entity names to decimal conversion table for special entities.
Stripped entity names to decimal conversion table for special entities. |
# |