24 '/&(?:[#]x([a-fA-F0-9]+)|[#]0*(\d+)|([A-Za-z_:][A-Za-z0-9.\-_:]*));?/';
63 return preg_replace_callback(
64 $this->_substituteEntitiesRegex,
65 array($this,
'nonSpecialEntityCallback'),
82 $entity = $matches[0];
83 $is_num = (@$matches[0][1] ===
'#');
85 $is_hex = (@$entity[2] ===
'x');
86 $code = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
88 if (isset($this->_special_dec2str[
$code])) {
93 if (isset($this->_special_ent2dec[$matches[3]])) {
96 if (!$this->_entity_lookup) {
99 if (isset($this->_entity_lookup->table[$matches[3]])) {
100 return $this->_entity_lookup->table[$matches[3]];
118 return preg_replace_callback(
119 $this->_substituteEntitiesRegex,
120 array($this,
'specialEntityCallback'),
137 $entity = $matches[0];
138 $is_num = (@$matches[0][1] ===
'#');
140 $is_hex = (@$entity[2] ===
'x');
141 $int = $is_hex ? hexdec($matches[1]) : (int) $matches[2];
142 return isset($this->_special_dec2str[$int]) ?
143 $this->_special_dec2str[$int] :
146 return isset($this->_special_ent2dec[$matches[3]]) ?
147 $this->_special_ent2dec[$matches[3]] :
$_special_dec2str
Decimal to parsed string conversion table for special entities.
static unichr($code)
Translates a Unicode codepoint into its corresponding UTF-8 character.
$_substituteEntitiesRegex
Callback regex string for parsing entities.
specialEntityCallback($matches)
Callback function for substituteSpecialEntities() that does the work.
$_special_ent2dec
Stripped entity names to decimal conversion table for special entities.
static instance($prototype=false)
Retrieves sole instance of the object.
substituteSpecialEntities($string)
Substitutes only special entities with their parsed equivalents.
Handles referencing and derefencing character entities.
nonSpecialEntityCallback($matches)
Callback function for substituteNonSpecialEntities() that does the work.
Create styles array
The data for the language used.
$_entity_lookup
Reference to entity lookup table.
substituteNonSpecialEntities($string)
Substitutes non-special entities with their parsed equivalents.