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.
Inheritance: extends HTMLPurifier_Lexer
Afficher le fichier Open project: yiisoft/yii

Méthodes publiques

Méthode Description
__construct ( )
callbackArmorCommentEntities ( array $matches ) : string Callback function that entity-izes ampersands in comments so that callbackUndoCommentSubst doesn't clobber them
callbackUndoCommentSubst ( array $matches ) : string Callback function for undoing escaping of stray angled brackets in comments
muteErrorHandler ( integer $errno, string $errstr ) An error handler that mutes all errors
tokenizeHTML ( string $html, HTMLPurifier_Config $config, HTMLPurifier_Context $context ) : HTMLPurifier_Token[]

Méthodes protégées

Méthode 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 méthode

public __construct ( )

callbackArmorCommentEntities() public méthode

Callback function that entity-izes ampersands in comments so that callbackUndoCommentSubst doesn't clobber them
public callbackArmorCommentEntities ( array $matches ) : string
$matches array
Résultat string

callbackUndoCommentSubst() public méthode

Callback function for undoing escaping of stray angled brackets in comments
public callbackUndoCommentSubst ( array $matches ) : string
$matches array
Résultat string

createEndNode() protected méthode

protected createEndNode ( DOMNode $node, HTMLPurifier_Token[] &$tokens )
$node DOMNode
$tokens HTMLPurifier_Token[]

createStartNode() protected méthode

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.
Résultat boolean if the token needs an endtoken

muteErrorHandler() public méthode

An error handler that mutes all errors
public muteErrorHandler ( integer $errno, string $errstr )
$errno integer
$errstr string

tokenizeDOM() protected méthode

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.
Résultat HTMLPurifier_Token of node appended to previously passed tokens.

tokenizeHTML() public méthode

public tokenizeHTML ( string $html, HTMLPurifier_Config $config, HTMLPurifier_Context $context ) : HTMLPurifier_Token[]
$html string
$config HTMLPurifier_Config
$context HTMLPurifier_Context
Résultat HTMLPurifier_Token[]

transformAttrToAssoc() protected méthode

Converts a DOMNamedNodeMap of DOMAttr objects into an assoc array.
protected transformAttrToAssoc ( DOMNamedNodeMap $node_map ) : array
$node_map DOMNamedNodeMap DOMNamedNodeMap of DOMAttr objects.
Résultat array Associative array of attributes.

wrapHTML() protected méthode

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
Résultat string