Definition at line 63 of file PH5P.php.
◆ __construct()
HTML5::__construct |
( |
|
$data | ) |
|
Definition at line 127 of file PH5P.php.
References $data, and EOF.
133 $this->content_model = self::PCDATA;
135 $this->state =
'data';
137 while($this->state !== null) {
138 $this->{$this->state.
'State'}();
◆ afterAttributeNameState()
HTML5::afterAttributeNameState |
( |
| ) |
|
|
private |
Definition at line 584 of file PH5P.php.
References EOF.
589 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
596 $this->state =
'afterAttributeName';
598 } elseif(
$char ===
'=') {
601 $this->state =
'beforeAttributeValue';
603 } elseif(
$char ===
'>') {
607 $this->state =
'data';
609 } elseif(
$char ===
'/' && $this->
character($this->
char + 1) !==
'>') {
613 $this->state =
'beforeAttributeName';
615 } elseif($this->
char === $this->
EOF) {
622 $this->state =
'data';
629 $this->token[
'attr'][] = array(
630 'name' => strtolower(
$char),
634 $this->state =
'attributeName';
◆ afterDoctypeNameState()
HTML5::afterDoctypeNameState |
( |
| ) |
|
|
private |
Definition at line 1027 of file PH5P.php.
References EOF.
1032 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1035 } elseif(
$char ===
'>') {
1037 $this->state =
'data';
1039 } elseif($this->
char === $this->
EOF) {
1042 $this->state =
'data';
1045 $this->token[
'error'] =
true;
1046 $this->state =
'bogusDoctype';
◆ attributeNameState()
HTML5::attributeNameState |
( |
| ) |
|
|
private |
Definition at line 533 of file PH5P.php.
References EOF.
538 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
545 $this->state =
'afterAttributeName';
547 } elseif(
$char ===
'=') {
550 $this->state =
'beforeAttributeValue';
552 } elseif(
$char ===
'>') {
556 $this->state =
'data';
558 } elseif(
$char ===
'/' && $this->
character($this->
char + 1) !==
'>') {
562 $this->state =
'beforeAttributeName';
564 } elseif($this->
char === $this->
EOF) {
571 $this->state =
'data';
577 $last = count($this->token[
'attr']) - 1;
578 $this->token[
'attr'][$last][
'name'] .= strtolower(
$char);
580 $this->state =
'attributeName';
◆ attributeValueDoubleQuotedState()
HTML5::attributeValueDoubleQuotedState |
( |
| ) |
|
|
private |
Definition at line 686 of file PH5P.php.
References EOF.
694 $this->state =
'beforeAttributeName';
696 } elseif(
$char ===
'&') {
701 } elseif($this->
char === $this->
EOF) {
708 $this->state =
'data';
714 $last = count($this->token[
'attr']) - 1;
715 $this->token[
'attr'][$last][
'value'] .=
$char;
717 $this->state =
'attributeValueDoubleQuoted';
entityInAttributeValueState()
◆ attributeValueSingleQuotedState()
HTML5::attributeValueSingleQuotedState |
( |
| ) |
|
|
private |
Definition at line 721 of file PH5P.php.
References EOF.
729 $this->state =
'beforeAttributeName';
731 } elseif(
$char ===
'&') {
736 } elseif($this->
char === $this->
EOF) {
743 $this->state =
'data';
749 $last = count($this->token[
'attr']) - 1;
750 $this->token[
'attr'][$last][
'value'] .=
$char;
752 $this->state =
'attributeValueSingleQuoted';
entityInAttributeValueState()
◆ attributeValueUnquotedState()
HTML5::attributeValueUnquotedState |
( |
| ) |
|
|
private |
Definition at line 756 of file PH5P.php.
761 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
768 $this->state =
'beforeAttributeName';
770 } elseif(
$char ===
'&') {
775 } elseif(
$char ===
'>') {
779 $this->state =
'data';
785 $last = count($this->token[
'attr']) - 1;
786 $this->token[
'attr'][$last][
'value'] .=
$char;
788 $this->state =
'attributeValueUnquoted';
entityInAttributeValueState()
◆ beforeAttributeNameState()
HTML5::beforeAttributeNameState |
( |
| ) |
|
|
private |
Definition at line 484 of file PH5P.php.
References EOF.
489 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
496 $this->state =
'beforeAttributeName';
498 } elseif(
$char ===
'>') {
502 $this->state =
'data';
504 } elseif(
$char ===
'/') {
508 $this->state =
'beforeAttributeName';
510 } elseif($this->
char === $this->
EOF) {
517 $this->state =
'data';
524 $this->token[
'attr'][] = array(
525 'name' => strtolower(
$char),
529 $this->state =
'attributeName';
◆ beforeAttributeValueState()
HTML5::beforeAttributeValueState |
( |
| ) |
|
|
private |
Definition at line 638 of file PH5P.php.
643 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
650 $this->state =
'beforeAttributeValue';
652 } elseif(
$char ===
'"') {
655 $this->state =
'attributeValueDoubleQuoted';
657 } elseif(
$char ===
'&') {
662 $this->state =
'attributeValueUnquoted';
664 } elseif(
$char ===
'\'') {
667 $this->state =
'attributeValueSingleQuoted';
669 } elseif(
$char ===
'>') {
673 $this->state =
'data';
679 $last = count($this->token[
'attr']) - 1;
680 $this->token[
'attr'][$last][
'value'] .=
$char;
682 $this->state =
'attributeValueUnquoted';
◆ beforeDoctypeNameState()
HTML5::beforeDoctypeNameState |
( |
| ) |
|
|
private |
Definition at line 951 of file PH5P.php.
References EOF.
956 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
959 } elseif(preg_match(
'/^[a-z]$/',
$char)) {
960 $this->token = array(
961 'name' => strtoupper(
$char),
962 'type' => self::DOCTYPE,
966 $this->state =
'doctypeName';
968 } elseif(
$char ===
'>') {
971 'type' => self::DOCTYPE,
975 $this->state =
'data';
977 } elseif($this->
char === $this->
EOF) {
980 'type' => self::DOCTYPE,
985 $this->state =
'data';
988 $this->token = array(
990 'type' => self::DOCTYPE,
994 $this->state =
'doctypeName';
◆ bogusCommentState()
HTML5::bogusCommentState |
( |
| ) |
|
|
private |
Definition at line 807 of file PH5P.php.
References $data, and EOF.
819 'type' => self::COMMENT
822 $this->
char += strlen(
$data);
825 $this->state =
'data';
828 if($this->
char === $this->
EOF) {
829 $this->
char = $this->
EOF - 1;
characters($char_class, $start)
◆ bogusDoctypeState()
HTML5::bogusDoctypeState |
( |
| ) |
|
|
private |
Definition at line 1050 of file PH5P.php.
References EOF.
1057 $this->state =
'data';
1059 } elseif($this->
char === $this->
EOF) {
1062 $this->state =
'data';
◆ char()
Definition at line 146 of file PH5P.php.
References EOF.
147 return ($this->char < $this->
EOF)
◆ character()
HTML5::character |
( |
|
$s, |
|
|
|
$l = 0 |
|
) |
| |
|
private |
Definition at line 152 of file PH5P.php.
References EOF.
153 if($s + $l < $this->
EOF) {
155 return $this->data[$s];
157 return substr($this->data, $s, $l);
◆ characters()
HTML5::characters |
( |
|
$char_class, |
|
|
|
$start |
|
) |
| |
|
private |
Definition at line 162 of file PH5P.php.
163 return preg_replace(
'#^(['.$char_class.
']+).*#s',
'\\1', substr($this->data, $start));
◆ closeTagOpenState()
HTML5::closeTagOpenState |
( |
| ) |
|
|
private |
Definition at line 367 of file PH5P.php.
References EOF.
368 $next_node = strtolower($this->
characters(
'A-Za-z', $this->
char + 1));
369 $the_same = count($this->tree->stack) > 0 && $next_node === end($this->tree->stack)->nodeName;
371 if(($this->content_model === self::RCDATA || $this->content_model === self::CDATA) &&
372 (!$the_same || ($the_same && (!preg_match(
'/[\t\n\x0b\x0c >\/]/',
373 $this->
character($this->
char + 1 + strlen($next_node))) || $this->
EOF === $this->
char)))) {
390 'type' => self::CHARACTR,
394 $this->state =
'data';
403 if(preg_match(
'/^[A-Za-z]$/',
$char)) {
409 $this->token = array(
410 'name' => strtolower(
$char),
411 'type' => self::ENDTAG
414 $this->state =
'tagName';
416 } elseif(
$char ===
'>') {
419 $this->state =
'data';
421 } elseif($this->
char === $this->
EOF) {
426 'type' => self::CHARACTR,
431 $this->state =
'data';
435 $this->state =
'bogusComment';
characters($char_class, $start)
◆ commentDashState()
HTML5::commentDashState |
( |
| ) |
|
|
private |
Definition at line 887 of file PH5P.php.
References EOF.
895 $this->state =
'commentEnd';
898 } elseif($this->
char === $this->
EOF) {
903 $this->state =
'data';
909 $this->token[
'data'] .=
'-'.$char;
910 $this->state =
'comment';
◆ commentEndState()
HTML5::commentEndState |
( |
| ) |
|
|
private |
Definition at line 914 of file PH5P.php.
References EOF.
921 $this->state =
'data';
923 } elseif(
$char ===
'-') {
924 $this->token[
'data'] .=
'-';
926 } elseif($this->
char === $this->
EOF) {
929 $this->state =
'data';
932 $this->token[
'data'] .=
'--'.$char;
933 $this->state =
'comment';
◆ commentState()
Definition at line 861 of file PH5P.php.
References EOF.
869 $this->state =
'commentDash';
872 } elseif($this->
char === $this->
EOF) {
877 $this->state =
'data';
883 $this->token[
'data'] .=
$char;
◆ dataState()
Definition at line 166 of file PH5P.php.
References EOF.
171 if(
$char ===
'&' && ($this->content_model === self::PCDATA || $this->content_model === self::RCDATA)) {
176 $this->state =
'entityData';
178 } elseif(
$char ===
'-') {
185 if(($this->content_model === self::RCDATA || $this->content_model ===
186 self::CDATA) && $this->escape ===
false &&
187 $this->
char >= 3 && $this->
character($this->
char - 4, 4) ===
'<!--') {
188 $this->escape =
true;
194 'type' => self::CHARACTR,
199 } elseif(
$char ===
'<' && ($this->content_model === self::PCDATA ||
200 (($this->content_model === self::RCDATA ||
201 $this->content_model === self::CDATA) && $this->escape ===
false))) {
210 $this->state =
'tagOpen';
213 } elseif(
$char ===
'>') {
219 if(($this->content_model === self::RCDATA ||
220 $this->content_model === self::CDATA) && $this->escape ===
true &&
221 $this->
character($this->
char, 3) ===
'-->') {
222 $this->escape =
false;
228 'type' => self::CHARACTR,
232 } elseif($this->
char === $this->
EOF) {
237 } elseif($this->content_model === self::PLAINTEXT) {
242 'type' => self::CHARACTR,
243 'data' => substr($this->data, $this->
char)
253 $len = strcspn($this->data,
'<&', $this->
char);
254 $char = substr($this->data, $this->
char, $len);
255 $this->
char += $len - 1;
258 'type' => self::CHARACTR,
262 $this->state =
'data';
◆ doctypeNameState()
HTML5::doctypeNameState |
( |
| ) |
|
|
private |
Definition at line 998 of file PH5P.php.
References EOF.
1003 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1004 $this->state =
'AfterDoctypeName';
1006 } elseif(
$char ===
'>') {
1008 $this->state =
'data';
1010 } elseif(preg_match(
'/^[a-z]$/',
$char)) {
1011 $this->token[
'name'] .= strtoupper(
$char);
1013 } elseif($this->
char === $this->
EOF) {
1016 $this->state =
'data';
1019 $this->token[
'name'] .=
$char;
1022 $this->token[
'error'] = ($this->token[
'name'] ===
'HTML')
◆ doctypeState()
Definition at line 937 of file PH5P.php.
942 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
943 $this->state =
'beforeDoctypeName';
947 $this->state =
'beforeDoctypeName';
◆ emitToken()
HTML5::emitToken |
( |
|
$token | ) |
|
|
private |
Definition at line 1159 of file PH5P.php.
1160 $emit = $this->tree->emitToken(
$token);
1163 $this->content_model = $emit;
1165 } elseif(
$token[
'type'] === self::ENDTAG) {
1166 $this->content_model = self::PCDATA;
◆ entity()
Definition at line 1069 of file PH5P.php.
1078 switch($this->
character($this->
char + 1)) {
1084 switch($this->
character($this->
char + 1)) {
1096 $char_class =
'0-9A-Fa-f';
1105 $char_class =
'0-9';
1113 $entity = $this->
character($start, $this->
char);
1114 $cond = strlen($e_name) > 0;
1124 $e_name = $this->
characters(
'0-9A-Za-z;', $this->
char + 1);
1125 $len = strlen($e_name);
1127 for($c = 1; $c <= $len; $c++) {
1128 $id = substr($e_name, 0, $c);
1131 if(in_array($id, $this->entities)) {
1132 if ($e_name[$c-1] !==
';') {
1133 if ($c < $len && $e_name[$c] ==
';') {
1142 $cond = isset($entity);
1150 $this->
char = $start;
1156 return html_entity_decode(
'&'.$entity.
';', ENT_QUOTES,
'UTF-8');
characters($char_class, $start)
◆ entityDataState()
HTML5::entityDataState |
( |
| ) |
|
|
private |
Definition at line 266 of file PH5P.php.
268 $entity = $this->
entity();
272 $char = (!$entity) ?
'&' : $entity;
274 'type' => self::CHARACTR,
279 $this->state =
'data';
◆ entityInAttributeValueState()
HTML5::entityInAttributeValueState |
( |
| ) |
|
|
private |
Definition at line 792 of file PH5P.php.
794 $entity = $this->
entity();
803 $last = count($this->token[
'attr']) - 1;
804 $this->token[
'attr'][$last][
'value'] .=
$char;
◆ EOF()
◆ markupDeclarationOpenState()
HTML5::markupDeclarationOpenState |
( |
| ) |
|
|
private |
Definition at line 833 of file PH5P.php.
837 if($this->
character($this->
char + 1, 2) ===
'--') {
839 $this->state =
'comment';
840 $this->token = array(
842 'type' => self::COMMENT
848 } elseif(strtolower($this->
character($this->
char + 1, 7)) ===
'doctype') {
850 $this->state =
'doctype';
857 $this->state =
'bogusComment';
◆ save()
Definition at line 142 of file PH5P.php.
143 return $this->tree->save();
◆ tagNameState()
Definition at line 440 of file PH5P.php.
References EOF.
445 if(preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
452 $this->state =
'beforeAttributeName';
454 } elseif(
$char ===
'>') {
458 $this->state =
'data';
460 } elseif($this->
char === $this->
EOF) {
467 $this->state =
'data';
469 } elseif(
$char ===
'/') {
473 $this->state =
'beforeAttributeName';
479 $this->token[
'name'] .= strtolower(
$char);
480 $this->state =
'tagName';
◆ tagOpenState()
Definition at line 282 of file PH5P.php.
283 switch($this->content_model) {
291 if($this->
character($this->
char + 1) ===
'/') {
293 $this->state =
'closeTagOpen';
297 'type' => self::CHARACTR,
301 $this->state =
'data';
314 $this->state =
'markupDeclarationOpen';
316 } elseif(
$char ===
'/') {
319 $this->state =
'closeTagOpen';
321 } elseif(preg_match(
'/^[A-Za-z]$/',
$char)) {
327 $this->token = array(
328 'name' => strtolower(
$char),
329 'type' => self::STARTTAG,
333 $this->state =
'tagName';
335 } elseif(
$char ===
'>') {
340 'type' => self::CHARACTR,
344 $this->state =
'data';
346 } elseif(
$char ===
'?') {
349 $this->state =
'bogusComment';
356 'type' => self::CHARACTR,
361 $this->state =
'data';
◆ $char
◆ $content_model
◆ $data
◆ $entities
◆ $EOF
◆ $escape
◆ $state
◆ $token
◆ $tree
◆ CDATA
◆ CHARACTR
const HTML5::CHARACTR = 4 |
Definition at line 124 of file PH5P.php.
Referenced by HTML5TreeConstructer\afterBody(), HTML5TreeConstructer\afterFrameset(), HTML5TreeConstructer\afterHead(), HTML5TreeConstructer\beforeHead(), HTML5TreeConstructer\inBody(), HTML5TreeConstructer\inColumnGroup(), HTML5TreeConstructer\inFrameset(), HTML5TreeConstructer\inHead(), HTML5TreeConstructer\initPhase(), HTML5TreeConstructer\inSelect(), HTML5TreeConstructer\inTable(), HTML5TreeConstructer\rootElementPhase(), and HTML5TreeConstructer\trailingEndPhase().
◆ COMMENT
Definition at line 123 of file PH5P.php.
Referenced by HTML5TreeConstructer\afterBody(), HTML5TreeConstructer\afterFrameset(), HTML5TreeConstructer\afterHead(), HTML5TreeConstructer\beforeHead(), HTML5TreeConstructer\inBody(), HTML5TreeConstructer\inColumnGroup(), HTML5TreeConstructer\inFrameset(), HTML5TreeConstructer\inHead(), HTML5TreeConstructer\initPhase(), HTML5TreeConstructer\inSelect(), HTML5TreeConstructer\inTable(), HTML5TreeConstructer\rootElementPhase(), and HTML5TreeConstructer\trailingEndPhase().
◆ DOCTYPE
◆ ENDTAG
Definition at line 122 of file PH5P.php.
Referenced by HTML5TreeConstructer\afterBody(), HTML5TreeConstructer\afterFrameset(), HTML5TreeConstructer\beforeHead(), HTML5TreeConstructer\closeCell(), HTML5TreeConstructer\inBody(), HTML5TreeConstructer\inCaption(), HTML5TreeConstructer\inCell(), HTML5TreeConstructer\inColumnGroup(), HTML5TreeConstructer\inFrameset(), HTML5TreeConstructer\inHead(), HTML5TreeConstructer\initPhase(), HTML5TreeConstructer\inRow(), HTML5TreeConstructer\inSelect(), HTML5TreeConstructer\inTable(), HTML5TreeConstructer\inTableBody(), HTML5TreeConstructer\rootElementPhase(), and HTML5TreeConstructer\trailingEndPhase().
◆ EOF
◆ PCDATA
◆ PLAINTEXT
const HTML5::PLAINTEXT = 3 |
◆ RCDATA
◆ STARTTAG
const HTML5::STARTTAG = 1 |
Definition at line 121 of file PH5P.php.
Referenced by HTML5TreeConstructer\afterFrameset(), HTML5TreeConstructer\afterHead(), HTML5TreeConstructer\beforeHead(), HTML5TreeConstructer\inBody(), HTML5TreeConstructer\inCaption(), HTML5TreeConstructer\inCell(), HTML5TreeConstructer\inColumnGroup(), HTML5TreeConstructer\inFrameset(), HTML5TreeConstructer\inHead(), HTML5TreeConstructer\initPhase(), HTML5TreeConstructer\inRow(), HTML5TreeConstructer\inSelect(), HTML5TreeConstructer\inTable(), HTML5TreeConstructer\inTableBody(), HTML5TreeConstructer\mainPhase(), HTML5TreeConstructer\rootElementPhase(), and HTML5TreeConstructer\trailingEndPhase().
The documentation for this class was generated from the following file:
- Services/Html/HtmlPurifier/library/HTMLPurifier/Lexer/PH5P.php