ILIAS
release_4-3 Revision
|
Forgivingly lexes HTML (SGML-style) markup into tokens. More...
Public Member Functions | |
__construct () | |
parseData ($string) | |
Parses special entities into the proper characters. | |
tokenizeHTML ($string, $config, $context) | |
Lexes an HTML string into tokens. | |
normalize ($html, $config, $context) | |
Takes a piece of HTML and normalizes it by converting entities, fixing encoding, extracting bits, and other good stuff. | |
extractBody ($html) | |
Takes a string of HTML (fragment or document) and returns the content. |
Static Public Member Functions | |
static | create ($config) |
Retrieves or sets the default Lexer as a Prototype Factory. |
Data Fields | |
$tracksLineNumbers = false | |
Whether or not this lexer implements line-number/column-number tracking. |
Static Protected Member Functions | |
static | escapeCDATA ($string) |
Translates CDATA sections into regular sections (through escaping). | |
static | escapeCommentedCDATA ($string) |
Special CDATA case that is especially convoluted for <script> | |
static | removeIEConditional ($string) |
Special Internet Explorer conditional comments should be removed. | |
static | CDATACallback ($matches) |
Callback function for escapeCDATA() that does the work. |
Protected Attributes | |
$_special_entity2str | |
Most common entity to raw value conversion table for special entities. |
Forgivingly lexes HTML (SGML-style) markup into tokens.
A lexer parses a string of SGML-style markup and converts them into corresponding tokens. It doesn't check for well-formedness, although its internal mechanism may make this automatic (such as the case of HTMLPurifier_Lexer_DOMLex). There are several implementations to choose from.
A lexer is HTML-oriented: it might work with XML, but it's not recommended, as we adhere to a subset of the specification for optimization reasons. This might change in the future. Also, most tokenizers are not expected to handle DTDs or PIs.
This class should not be directly instantiated, but you may use create() to retrieve a default copy of the lexer. Being a supertype, this class does not actually define any implementation, but offers commonly used convenience functions for subclasses.
HTMLPurifier_Lexer::__construct | ( | ) |
Reimplemented in HTMLPurifier_Lexer_DOMLex.
|
staticprotected |
Callback function for escapeCDATA() that does the work.
Definition at line 253 of file Lexer.php.
|
static |
Retrieves or sets the default Lexer as a Prototype Factory.
By default HTMLPurifier_Lexer_DOMLex will be returned. There are a few exceptions involving special features that only DirectLex implements.
$config | Instance of HTMLPurifier_Config |
Definition at line 68 of file Lexer.php.
Referenced by HTMLPurifier\purify().
|
staticprotected |
Translates CDATA sections into regular sections (through escaping).
$string | HTML string to process. |
Definition at line 214 of file Lexer.php.
Referenced by normalize().
|
staticprotected |
Special CDATA case that is especially convoluted for <script>
Definition at line 225 of file Lexer.php.
Referenced by normalize().
HTMLPurifier_Lexer::extractBody | ( | $html | ) |
Takes a string of HTML (fragment or document) and returns the content.
Definition at line 314 of file Lexer.php.
References $result.
Referenced by normalize().
HTMLPurifier_Lexer::normalize | ( | $html, | |
$config, | |||
$context | |||
) |
Takes a piece of HTML and normalizes it by converting entities, fixing encoding, extracting bits, and other good stuff.
Definition at line 263 of file Lexer.php.
References HTMLPurifier_Encoder\cleanUTF8(), escapeCDATA(), escapeCommentedCDATA(), extractBody(), and removeIEConditional().
Referenced by HTMLPurifier_Lexer_PH5P\tokenizeHTML(), HTMLPurifier_Lexer_DirectLex\tokenizeHTML(), and HTMLPurifier_Lexer_DOMLex\tokenizeHTML().
HTMLPurifier_Lexer::parseData | ( | $string | ) |
Parses special entities into the proper characters.
This string will translate escaped versions of the special characters into the correct ones.
$string | String character data to be parsed. |
Definition at line 174 of file Lexer.php.
Referenced by HTMLPurifier_Lexer_DOMLex\createStartNode(), HTMLPurifier_Lexer_DirectLex\parseAttributeString(), and HTMLPurifier_Lexer_DirectLex\tokenizeHTML().
|
staticprotected |
Special Internet Explorer conditional comments should be removed.
Definition at line 236 of file Lexer.php.
Referenced by normalize().
HTMLPurifier_Lexer::tokenizeHTML | ( | $string, | |
$config, | |||
$context | |||
) |
Lexes an HTML string into tokens.
$string | String HTML. |
Reimplemented in HTMLPurifier_Lexer_DOMLex, HTMLPurifier_Lexer_DirectLex, and HTMLPurifier_Lexer_PH5P.
Definition at line 204 of file Lexer.php.
|
protected |
HTMLPurifier_Lexer::$tracksLineNumbers = false |