include/HTMLPurifier/standalone/HTMLPurifier/Lexer/PH5P.php

Show: inherited
Table of Contents

\HTML5

Package:

Constants

Constant  PCDATA = 0
Constant  RCDATA = 1
Constant  CDATA = 2
Constant  PLAINTEXT = 3
Constant  DOCTYPE = 0
Constant  STARTTAG = 1
Constant  ENDTAG = 2
Constant  COMMENT = 3
Constant  CHARACTR = 4
Constant  EOF = 5

Properties

Propertyprivate  $EOF= ''
Details
Type
n/a
Propertyprivate  $char= ''
Details
Type
n/a
Propertyprivate  $content_model= ''
Details
Type
n/a
Propertyprivate  $data= ''
Details
Type
n/a
Propertyprivate  $entities= 'array('AElig;','AElig','AMP;','AMP','Aacute;','Aacute', 'Acirc;','Acirc','Agrave;','Agrave','Alpha;','Aring;','Aring','Atilde;', 'Atilde','Auml;','Auml','Beta;','COPY;','COPY','Ccedil;','Ccedil','Chi;', 'Dagger;','Delta;','ETH;','ETH','Eacute;','Eacute','Ecirc;','Ecirc','Egrave;', 'Egrave','Epsilon;','Eta;','Euml;','Euml','GT;','GT','Gamma;','Iacute;', 'Iacute','Icirc;','Icirc','Igrave;','Igrave','Iota;','Iuml;','Iuml','Kappa;', 'LT;','LT','Lambda;','Mu;','Ntilde;','Ntilde','Nu;','OElig;','Oacute;', 'Oacute','Ocirc;','Ocirc','Ograve;','Ograve','Omega;','Omicron;','Oslash;', 'Oslash','Otilde;','Otilde','Ouml;','Ouml','Phi;','Pi;','Prime;','Psi;', 'QUOT;','QUOT','REG;','REG','Rho;','Scaron;','Sigma;','THORN;','THORN', 'TRADE;','Tau;','Theta;','Uacute;','Uacute','Ucirc;','Ucirc','Ugrave;', 'Ugrave','Upsilon;','Uuml;','Uuml','Xi;','Yacute;','Yacute','Yuml;','Zeta;', 'aacute;','aacute','acirc;','acirc','acute;','acute','aelig;','aelig', 'agrave;','agrave','alefsym;','alpha;','amp;','amp','and;','ang;','apos;', 'aring;','aring','asymp;','atilde;','atilde','auml;','auml','bdquo;','beta;', 'brvbar;','brvbar','bull;','cap;','ccedil;','ccedil','cedil;','cedil', 'cent;','cent','chi;','circ;','clubs;','cong;','copy;','copy','crarr;', 'cup;','curren;','curren','dArr;','dagger;','darr;','deg;','deg','delta;', 'diams;','divide;','divide','eacute;','eacute','ecirc;','ecirc','egrave;', 'egrave','empty;','emsp;','ensp;','epsilon;','equiv;','eta;','eth;','eth', 'euml;','euml','euro;','exist;','fnof;','forall;','frac12;','frac12', 'frac14;','frac14','frac34;','frac34','frasl;','gamma;','ge;','gt;','gt', 'hArr;','harr;','hearts;','hellip;','iacute;','iacute','icirc;','icirc', 'iexcl;','iexcl','igrave;','igrave','image;','infin;','int;','iota;', 'iquest;','iquest','isin;','iuml;','iuml','kappa;','lArr;','lambda;','lang;', 'laquo;','laquo','larr;','lceil;','ldquo;','le;','lfloor;','lowast;','loz;', 'lrm;','lsaquo;','lsquo;','lt;','lt','macr;','macr','mdash;','micro;','micro', 'middot;','middot','minus;','mu;','nabla;','nbsp;','nbsp','ndash;','ne;', 'ni;','not;','not','notin;','nsub;','ntilde;','ntilde','nu;','oacute;', 'oacute','ocirc;','ocirc','oelig;','ograve;','ograve','oline;','omega;', 'omicron;','oplus;','or;','ordf;','ordf','ordm;','ordm','oslash;','oslash', 'otilde;','otilde','otimes;','ouml;','ouml','para;','para','part;','permil;', 'perp;','phi;','pi;','piv;','plusmn;','plusmn','pound;','pound','prime;', 'prod;','prop;','psi;','quot;','quot','rArr;','radic;','rang;','raquo;', 'raquo','rarr;','rceil;','rdquo;','real;','reg;','reg','rfloor;','rho;', 'rlm;','rsaquo;','rsquo;','sbquo;','scaron;','sdot;','sect;','sect','shy;', 'shy','sigma;','sigmaf;','sim;','spades;','sub;','sube;','sum;','sup1;', 'sup1','sup2;','sup2','sup3;','sup3','sup;','supe;','szlig;','szlig','tau;', 'there4;','theta;','thetasym;','thinsp;','thorn;','thorn','tilde;','times;', 'times','trade;','uArr;','uacute;','uacute','uarr;','ucirc;','ucirc', 'ugrave;','ugrave','uml;','uml','upsih;','upsilon;','uuml;','uuml','weierp;', 'xi;','yacute;','yacute','yen;','yen','yuml;','yuml','zeta;','zwj;','zwnj;')'
Default valuearray('AElig;','AElig','AMP;','AMP','Aacute;','Aacute', 'Acirc;','Acirc','Agrave;','Agrave','Alpha;','Aring;','Aring','Atilde;', 'Atilde','Auml;','Auml','Beta;','COPY;','COPY','Ccedil;','Ccedil','Chi;', 'Dagger;','Delta;','ETH;','ETH','Eacute;','Eacute','Ecirc;','Ecirc','Egrave;', 'Egrave','Epsilon;','Eta;','Euml;','Euml','GT;','GT','Gamma;','Iacute;', 'Iacute','Icirc;','Icirc','Igrave;','Igrave','Iota;','Iuml;','Iuml','Kappa;', 'LT;','LT','Lambda;','Mu;','Ntilde;','Ntilde','Nu;','OElig;','Oacute;', 'Oacute','Ocirc;','Ocirc','Ograve;','Ograve','Omega;','Omicron;','Oslash;', 'Oslash','Otilde;','Otilde','Ouml;','Ouml','Phi;','Pi;','Prime;','Psi;', 'QUOT;','QUOT','REG;','REG','Rho;','Scaron;','Sigma;','THORN;','THORN', 'TRADE;','Tau;','Theta;','Uacute;','Uacute','Ucirc;','Ucirc','Ugrave;', 'Ugrave','Upsilon;','Uuml;','Uuml','Xi;','Yacute;','Yacute','Yuml;','Zeta;', 'aacute;','aacute','acirc;','acirc','acute;','acute','aelig;','aelig', 'agrave;','agrave','alefsym;','alpha;','amp;','amp','and;','ang;','apos;', 'aring;','aring','asymp;','atilde;','atilde','auml;','auml','bdquo;','beta;', 'brvbar;','brvbar','bull;','cap;','ccedil;','ccedil','cedil;','cedil', 'cent;','cent','chi;','circ;','clubs;','cong;','copy;','copy','crarr;', 'cup;','curren;','curren','dArr;','dagger;','darr;','deg;','deg','delta;', 'diams;','divide;','divide','eacute;','eacute','ecirc;','ecirc','egrave;', 'egrave','empty;','emsp;','ensp;','epsilon;','equiv;','eta;','eth;','eth', 'euml;','euml','euro;','exist;','fnof;','forall;','frac12;','frac12', 'frac14;','frac14','frac34;','frac34','frasl;','gamma;','ge;','gt;','gt', 'hArr;','harr;','hearts;','hellip;','iacute;','iacute','icirc;','icirc', 'iexcl;','iexcl','igrave;','igrave','image;','infin;','int;','iota;', 'iquest;','iquest','isin;','iuml;','iuml','kappa;','lArr;','lambda;','lang;', 'laquo;','laquo','larr;','lceil;','ldquo;','le;','lfloor;','lowast;','loz;', 'lrm;','lsaquo;','lsquo;','lt;','lt','macr;','macr','mdash;','micro;','micro', 'middot;','middot','minus;','mu;','nabla;','nbsp;','nbsp','ndash;','ne;', 'ni;','not;','not','notin;','nsub;','ntilde;','ntilde','nu;','oacute;', 'oacute','ocirc;','ocirc','oelig;','ograve;','ograve','oline;','omega;', 'omicron;','oplus;','or;','ordf;','ordf','ordm;','ordm','oslash;','oslash', 'otilde;','otilde','otimes;','ouml;','ouml','para;','para','part;','permil;', 'perp;','phi;','pi;','piv;','plusmn;','plusmn','pound;','pound','prime;', 'prod;','prop;','psi;','quot;','quot','rArr;','radic;','rang;','raquo;', 'raquo','rarr;','rceil;','rdquo;','real;','reg;','reg','rfloor;','rho;', 'rlm;','rsaquo;','rsquo;','sbquo;','scaron;','sdot;','sect;','sect','shy;', 'shy','sigma;','sigmaf;','sim;','spades;','sub;','sube;','sum;','sup1;', 'sup1','sup2;','sup2','sup3;','sup3','sup;','supe;','szlig;','szlig','tau;', 'there4;','theta;','thetasym;','thinsp;','thorn;','thorn','tilde;','times;', 'times','trade;','uArr;','uacute;','uacute','uarr;','ucirc;','ucirc', 'ugrave;','ugrave','uml;','uml','upsih;','upsilon;','uuml;','uuml','weierp;', 'xi;','yacute;','yacute','yen;','yen','yuml;','yuml','zeta;','zwj;','zwnj;')Details
Type
n/a
Propertyprivate  $escape= 'false'
Default valuefalseDetails
Type
n/a
Propertyprivate  $state= ''
Details
Type
n/a
Propertyprivate  $token= ''
Details
Type
n/a
Propertyprivate  $tree= ''
Details
Type
n/a

Methods

methodprivateEOF( ) : void

methodpublic__construct(  $data ) : void

Parameters
Name Type Description
$data
methodprivateafterAttributeNameState( ) : void

methodprivateafterDoctypeNameState( ) : void

methodprivateattributeNameState( ) : void

methodprivateattributeValueDoubleQuotedState( ) : void

methodprivateattributeValueSingleQuotedState( ) : void

methodprivateattributeValueUnquotedState( ) : void

methodprivatebeforeAttributeNameState( ) : void

methodprivatebeforeAttributeValueState( ) : void

methodprivatebeforeDoctypeNameState( ) : void

methodprivatebogusCommentState( ) : void

methodprivatebogusDoctypeState( ) : void

methodprivatechar( ) : void

methodprivatecharacter(  $s,  $l = 0 ) : void

Parameters
Name Type Description
$s
$l
methodprivatecharacters(  $char_class,  $start ) : void

Parameters
Name Type Description
$char_class
$start
methodprivatecloseTagOpenState( ) : void

methodprivatecommentDashState( ) : void

methodprivatecommentEndState( ) : void

methodprivatecommentState( ) : void

methodprivatedataState( ) : void

methodprivatedoctypeNameState( ) : void

methodprivatedoctypeState( ) : void

methodprivateemitToken(  $token ) : void

Parameters
Name Type Description
$token
methodprivateentity( ) : void

methodprivateentityDataState( ) : void

methodprivateentityInAttributeValueState( ) : void

methodprivatemarkupDeclarationOpenState( ) : void

methodpublicsave( ) : void

methodprivatetagNameState( ) : void

methodprivatetagOpenState( ) : void

\HTML5TreeConstructer

Package:

Constants

Constant  INIT_PHASE = 0
Constant  ROOT_PHASE = 1
Constant  MAIN_PHASE = 2
Constant  END_PHASE = 3
Constant  BEFOR_HEAD = 0
Constant  IN_HEAD = 1
Constant  AFTER_HEAD = 2
Constant  IN_BODY = 3
Constant  IN_TABLE = 4
Constant  IN_CAPTION = 5
Constant  IN_CGROUP = 6
Constant  IN_TBODY = 7
Constant  IN_ROW = 8
Constant  IN_CELL = 9
Constant  IN_SELECT = 10
Constant  AFTER_BODY = 11
Constant  IN_FRAME = 12
Constant  AFTR_FRAME = 13
Constant  SPECIAL = 0
Constant  SCOPING = 1
Constant  FORMATTING = 2
Constant  PHRASING = 3
Constant  MARKER = 0

Properties

Propertyprivate  $a_formatting= 'array()'
Default valuearray()Details
Type
n/a
Propertyprivate  $dom= ''
Details
Type
n/a
Propertyprivate  $form_pointer= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $formatting= 'array('a','b','big','em','font','i','nobr','s','small','strike','strong','tt','u')'
Default valuearray('a','b','big','em','font','i','nobr','s','small','strike','strong','tt','u')Details
Type
n/a
Propertyprivate  $foster_parent= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $head_pointer= 'null'
Default valuenullDetails
Type
n/a
Propertyprivate  $mode= ''
Details
Type
n/a
Propertyprivate  $phase= ''
Details
Type
n/a
Propertyprivate  $scoping= 'array('button','caption','html','marquee','object','table','td','th')'
Default valuearray('button','caption','html','marquee','object','table','td','th')Details
Type
n/a
Propertyprivate  $special= 'array('address','area','base','basefont','bgsound', 'blockquote','body','br','center','col','colgroup','dd','dir','div','dl', 'dt','embed','fieldset','form','frame','frameset','h1','h2','h3','h4','h5', 'h6','head','hr','iframe','image','img','input','isindex','li','link', 'listing','menu','meta','noembed','noframes','noscript','ol','optgroup', 'option','p','param','plaintext','pre','script','select','spacer','style', 'tbody','textarea','tfoot','thead','title','tr','ul','wbr')'
Default valuearray('address','area','base','basefont','bgsound', 'blockquote','body','br','center','col','colgroup','dd','dir','div','dl', 'dt','embed','fieldset','form','frame','frameset','h1','h2','h3','h4','h5', 'h6','head','hr','iframe','image','img','input','isindex','li','link', 'listing','menu','meta','noembed','noframes','noscript','ol','optgroup', 'option','p','param','plaintext','pre','script','select','spacer','style', 'tbody','textarea','tfoot','thead','title','tr','ul','wbr')Details
Type
n/a
Propertypublic  $stack= 'array()'
Default valuearray()Details
Type
n/a

Methods

methodpublic__construct( ) : void

methodprivateafterBody(  $token ) : void

Parameters
Name Type Description
$token
methodprivateafterFrameset(  $token ) : void

Parameters
Name Type Description
$token
methodprivateafterHead(  $token ) : void

Parameters
Name Type Description
$token
methodprivateappendToRealParent(  $node ) : void

Parameters
Name Type Description
$node
methodprivatebeforeHead(  $token ) : void

Parameters
Name Type Description
$token
methodprivateclearStackToTableContext(  $elements ) : void

Parameters
Name Type Description
$elements
methodprivateclearTheActiveFormattingElementsUpToTheLastMarker( ) : void

methodprivatecloseCell( ) : void

methodprivateelementInScope(  $el,  $table = false ) : void

Parameters
Name Type Description
$el
$table
methodpublicemitToken(  $token ) : void

Parameters
Name Type Description
$token
methodprivategenerateImpliedEndTags(  $exclude = array() ) : void

Parameters
Name Type Description
$exclude
methodprivategetElementCategory(  $node ) : void

Parameters
Name Type Description
$node
methodprivateinBody(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinCaption(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinCell(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinColumnGroup(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinFrameset(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinHead(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinRow(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinSelect(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinTable(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinTableBody(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinitPhase(  $token ) : void

Parameters
Name Type Description
$token
methodprivateinsertComment(  $data ) : void

Parameters
Name Type Description
$data
methodprivateinsertElement(  $token,  $append = true,  $check = false ) : void

Parameters
Name Type Description
$token
$append
$check
methodprivateinsertText(  $data ) : void

Parameters
Name Type Description
$data
methodprivatemainPhase(  $token ) : void

Parameters
Name Type Description
$token
methodprivatereconstructActiveFormattingElements( ) : void

methodprivateresetInsertionMode( ) : void

methodprivaterootElementPhase(  $token ) : void

Parameters
Name Type Description
$token
methodpublicsave( ) : void

methodprivatetrailingEndPhase(  $token ) : void

Parameters
Name Type Description
$token

\HTMLPurifier_Lexer_PH5P

Package: SugarCRM

Experimental HTML5-based parser using Jeroen van der Meer's PH5P library.

Occupies space in the HTML5 pseudo-namespace, which may cause conflicts.

Parent(s)
\HTMLPurifier_Lexer_DOMLex < \HTMLPurifier_Lexer
Note
Recent changes to PHP's DOM extension have resulted in some fatal error conditions with the original version of PH5P. Pending changes, this lexer will punt to DirectLex if DOM throughs an exception.  

Properties

Propertyprotected  $_special_entity2str= 'array( '&quot;' => '"', '&amp;' => '&', '&lt;' => '<', '&gt;' => '>', '&#39;' => "'", '&#039;' => "'", '&#x27;' => "'" )'
inherited

Most common entity to raw value conversion table for special entities.

Inherited from: \HTMLPurifier_Lexer::$$_special_entity2str\HTMLPurifier_Lexer_DOMLex::$$_special_entity2str
Default valuearray( '&quot;' => '"', '&amp;' => '&', '&lt;' => '<', '&gt;' => '>', '&#39;' => "'", '&#039;' => "'", '&#x27;' => "'" )Details
Type
n/a
Inherited_from
\HTMLPurifier_Lexer::$$_special_entity2str  
Inherited_from
\HTMLPurifier_Lexer_DOMLex::$$_special_entity2str  
Propertyprivate  $factory= ''
inheritedInherited from: \HTMLPurifier_Lexer_DOMLex::$$factory
Details
Type
n/a
Inherited_from
\HTMLPurifier_Lexer_DOMLex::$$factory  
Propertypublic  $tracksLineNumbers= 'false'
inherited

Whether or not this lexer implements line-number/column-number tracking.

Inherited from: \HTMLPurifier_Lexer::$$tracksLineNumbers\HTMLPurifier_Lexer_DOMLex::$$tracksLineNumbers

If it does, set to true.

Default valuefalseDetails
Type
n/a
Inherited_from
\HTMLPurifier_Lexer::$$tracksLineNumbers  
Inherited_from
\HTMLPurifier_Lexer_DOMLex::$$tracksLineNumbers  

Methods

methodprotectedCDATACallback(  $matches ) : void
staticinherited

Callback function for escapeCDATA() that does the work.

Inherited from: \HTMLPurifier_Lexer::CDATACallback()\HTMLPurifier_Lexer_DOMLex::CDATACallback()
Parameters
Name Type Description
$matches
Details
Params
$matches PCRE matches array, with index 0 the entire match and 1 the inside of the CDATA section.  
Returns
Escaped internals of the CDATA section.  
Warning
Though this is public in order to let the callback happen, calling it directly is not recommended.  
methodpublic__construct( ) : void
inherited

Inherited from: \HTMLPurifier_Lexer_DOMLex::__construct()
methodpubliccallbackArmorCommentEntities(  $matches ) : void
inherited

Callback function that entity-izes ampersands in comments so that callbackUndoCommentSubst doesn't clobber them

Inherited from: \HTMLPurifier_Lexer_DOMLex::callbackArmorCommentEntities()
Parameters
Name Type Description
$matches
methodpubliccallbackUndoCommentSubst(  $matches ) : void
inherited

Callback function for undoing escaping of stray angled brackets in comments

Inherited from: \HTMLPurifier_Lexer_DOMLex::callbackUndoCommentSubst()
Parameters
Name Type Description
$matches
methodpubliccreate( \$config $config ) : \Concrete
staticinherited

Retrieves or sets the default Lexer as a Prototype Factory.

Inherited from: \HTMLPurifier_Lexer::create()\HTMLPurifier_Lexer_DOMLex::create()

By default HTMLPurifier_Lexer_DOMLex will be returned. There are a few exceptions involving special features that only DirectLex implements.

Parameters
Name Type Description
$config \$config

Instance of HTMLPurifier_Config

Returns
Type Description
\Concrete lexer.
Details
Note
The behavior of this class has changed, rather than accepting a prototype object, it now accepts a configuration object. To specify your own prototype, set %Core.LexerImpl to it. This change in behavior de-singletonizes the lexer object.  
methodprotectedcreateEndNode(  $node,  $tokens ) : void
Parameters
Name Type Description
$node
$tokens
methodprotectedcreateStartNode( \$node $node, \$tokens $tokens, \$collect $collect ) : void
Parameters
Name Type Description
$node \$node

DOMNode to be tokenized.

$tokens \$tokens

Array-list of already tokenized tokens.

$collect \$collect

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.

Details
Returns
bool if the token needs an endtoken  
methodprotectedescapeCDATA( \$string $string ) : void
staticinherited

Translates CDATA sections into regular sections (through escaping).

Inherited from: \HTMLPurifier_Lexer::escapeCDATA()\HTMLPurifier_Lexer_DOMLex::escapeCDATA()
Parameters
Name Type Description
$string \$string

HTML string to process.

Details
Returns
HTML with CDATA sections escaped.  
methodprotectedescapeCommentedCDATA(  $string ) : void
staticinherited

Special CDATA case that is especially convoluted for