Moodle  2.2.1
http://www.collinsharper.com
HTMLPurifier_EntityParser Class Reference

Public Member Functions

 substituteNonSpecialEntities ($string)
 substituteSpecialEntities ($string)

Protected Member Functions

 nonSpecialEntityCallback ($matches)
 specialEntityCallback ($matches)

Protected Attributes

 $_entity_lookup
 $_substituteEntitiesRegex
 $_special_dec2str
 $_special_ent2dec

Detailed Description

Handles referencing and derefencing character entities

Definition at line 10 of file EntityParser.php.


Member Function Documentation

nonSpecialEntityCallback ( matches) [protected]

Callback function for substituteNonSpecialEntities() that does the work.

Parameters:
$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).
Returns:
Replacement string.

Definition at line 75 of file EntityParser.php.

Here is the call graph for this function:

specialEntityCallback ( matches) [protected]

Callback function for substituteSpecialEntities() that does the work.

This callback has same syntax as nonSpecialEntityCallback().

Parameters:
$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).
Returns:
Replacement string.

Definition at line 126 of file EntityParser.php.

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:
$stringString to have non-special entities parsed.
Returns:
Parsed string.

Definition at line 57 of file EntityParser.php.

Substitutes only special entities with their parsed equivalents.

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

Parameters:
$stringString to have non-special entities parsed.
Returns:
Parsed string.

Definition at line 109 of file EntityParser.php.


Field Documentation

$_entity_lookup [protected]

Reference to entity lookup table.

Definition at line 16 of file EntityParser.php.

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

Decimal to parsed string conversion table for special entities.

Definition at line 29 of file EntityParser.php.

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

Stripped entity names to decimal conversion table for special entities.

Definition at line 41 of file EntityParser.php.

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

Callback regex string for parsing entities.

Definition at line 21 of file EntityParser.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations