PHP Class HTMLPurifier_Lexer_DOMLex, yii
In PHP 5, the DOM XML extension was revamped into DOM and added to the core.
It gives us a forgiving HTML parser, which we use to transform the HTML
into a DOM, and then into the tokens. It is blazingly fast (for large
documents, it performs twenty times faster than
HTMLPurifier_Lexer_DirectLex,and is the default choice for PHP 5.
ファイルを表示
Open project: yiisoft/yii
Public Methods
Protected Methods
Method |
Description |
|
createEndNode ( DOMNode $node, HTMLPurifier_Token[] &$tokens ) |
|
|
createStartNode ( DOMNode $node, HTMLPurifier_Token[] &$tokens, boolean $collect ) : boolean |
|
|
tokenizeDOM ( DOMNode $node, HTMLPurifier_Token[] &$tokens ) : HTMLPurifier_Token |
Iterative function that tokenizes a node, putting it into an accumulator. |
|
transformAttrToAssoc ( DOMNamedNodeMap $node_map ) : array |
Converts a DOMNamedNodeMap of DOMAttr objects into an assoc array. |
|
wrapHTML ( string $html, HTMLPurifier_Config $config, HTMLPurifier_Context $context ) : string |
Wraps an HTML fragment in the necessary HTML |
|
Method Details
__construct()
public method
createEndNode()
protected method
protected createEndNode ( DOMNode $node, HTMLPurifier_Token[] &$tokens ) |
$node |
DOMNode |
|
$tokens |
HTMLPurifier_Token[] |
|
createStartNode()
protected method
protected createStartNode ( DOMNode $node, HTMLPurifier_Token[] &$tokens, boolean $collect ) : boolean |
$node |
DOMNode |
DOMNode to be tokenized. |
$tokens |
HTMLPurifier_Token[] |
Array-list of already tokenized tokens. |
$collect |
boolean |
Says whether or start and close are collected, set to
false at first recursion because it's the implicit DIV
tag you're dealing with. |
return |
boolean |
if the token needs an endtoken |
muteErrorHandler()
public method
An error handler that mutes all errors
tokenizeDOM()
protected method
To iterate is human, to recurse divine - L. Peter Deutsch
protected tokenizeDOM ( DOMNode $node, HTMLPurifier_Token[] &$tokens ) : HTMLPurifier_Token |
$node |
DOMNode |
DOMNode to be tokenized. |
$tokens |
HTMLPurifier_Token[] |
Array-list of already tokenized tokens. |
return |
HTMLPurifier_Token |
of node appended to previously passed tokens. |
tokenizeHTML()
public method
public tokenizeHTML ( string $html, HTMLPurifier_Config $config, HTMLPurifier_Context $context ) : HTMLPurifier_Token[] |
$html |
string |
|
$config |
HTMLPurifier_Config |
|
$context |
HTMLPurifier_Context |
|
return |
HTMLPurifier_Token[] |
|
wrapHTML()
protected method
Wraps an HTML fragment in the necessary HTML
protected wrapHTML ( string $html, HTMLPurifier_Config $config, HTMLPurifier_Context $context ) : string |
$html |
string |
|
$config |
HTMLPurifier_Config |
|
$context |
HTMLPurifier_Context |
|
return |
string |
|