Definition at line 71 of file PH5P.php.
◆ __construct()
HTML5::__construct |
( |
|
$data | ) |
|
Definition at line 462 of file PH5P.php.
References $data, and EOF.
468 $this->content_model = self::PCDATA;
470 $this->state =
'data';
472 while ($this->state !== null) {
473 $this->{$this->state .
'State'}();
◆ afterAttributeNameState()
HTML5::afterAttributeNameState |
( |
| ) |
|
|
private |
Definition at line 956 of file PH5P.php.
References EOF.
962 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
969 $this->state =
'afterAttributeName';
971 } elseif (
$char ===
'=') {
974 $this->state =
'beforeAttributeValue';
976 } elseif (
$char ===
'>') {
980 $this->state =
'data';
982 } elseif (
$char ===
'/' && $this->
character($this->
char + 1) !==
'>') {
986 $this->state =
'beforeAttributeName';
988 } elseif ($this->
char === $this->
EOF) {
995 $this->state =
'data';
1002 $this->token[
'attr'][] = array(
1003 'name' => strtolower(
$char),
1007 $this->state =
'attributeName';
◆ afterDoctypeNameState()
HTML5::afterDoctypeNameState |
( |
| ) |
|
|
private |
Definition at line 1419 of file PH5P.php.
References EOF.
1425 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1428 } elseif (
$char ===
'>') {
1430 $this->state =
'data';
1432 } elseif ($this->
char === $this->
EOF) {
1435 $this->state =
'data';
1438 $this->token[
'error'] =
true;
1439 $this->state =
'bogusDoctype';
◆ attributeNameState()
HTML5::attributeNameState |
( |
| ) |
|
|
private |
Definition at line 904 of file PH5P.php.
References EOF.
910 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
917 $this->state =
'afterAttributeName';
919 } elseif (
$char ===
'=') {
922 $this->state =
'beforeAttributeValue';
924 } elseif (
$char ===
'>') {
928 $this->state =
'data';
930 } elseif (
$char ===
'/' && $this->
character($this->
char + 1) !==
'>') {
934 $this->state =
'beforeAttributeName';
936 } elseif ($this->
char === $this->
EOF) {
943 $this->state =
'data';
949 $last = count($this->token[
'attr']) - 1;
950 $this->token[
'attr'][$last][
'name'] .= strtolower(
$char);
952 $this->state =
'attributeName';
◆ attributeValueDoubleQuotedState()
HTML5::attributeValueDoubleQuotedState |
( |
| ) |
|
|
private |
Definition at line 1060 of file PH5P.php.
References EOF.
1066 if (
$char ===
'"') {
1069 $this->state =
'beforeAttributeName';
1071 } elseif (
$char ===
'&') {
1076 } elseif ($this->
char === $this->
EOF) {
1083 $this->state =
'data';
1089 $last = count($this->token[
'attr']) - 1;
1090 $this->token[
'attr'][$last][
'value'] .=
$char;
1092 $this->state =
'attributeValueDoubleQuoted';
entityInAttributeValueState()
◆ attributeValueSingleQuotedState()
HTML5::attributeValueSingleQuotedState |
( |
| ) |
|
|
private |
Definition at line 1096 of file PH5P.php.
References EOF.
1102 if (
$char ===
'\'') {
1105 $this->state =
'beforeAttributeName';
1107 } elseif (
$char ===
'&') {
1112 } elseif ($this->
char === $this->
EOF) {
1119 $this->state =
'data';
1125 $last = count($this->token[
'attr']) - 1;
1126 $this->token[
'attr'][$last][
'value'] .=
$char;
1128 $this->state =
'attributeValueSingleQuoted';
entityInAttributeValueState()
◆ attributeValueUnquotedState()
HTML5::attributeValueUnquotedState |
( |
| ) |
|
|
private |
Definition at line 1132 of file PH5P.php.
1138 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1145 $this->state =
'beforeAttributeName';
1147 } elseif (
$char ===
'&') {
1152 } elseif (
$char ===
'>') {
1156 $this->state =
'data';
1162 $last = count($this->token[
'attr']) - 1;
1163 $this->token[
'attr'][$last][
'value'] .=
$char;
1165 $this->state =
'attributeValueUnquoted';
entityInAttributeValueState()
◆ beforeAttributeNameState()
HTML5::beforeAttributeNameState |
( |
| ) |
|
|
private |
Definition at line 854 of file PH5P.php.
References EOF.
860 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
867 $this->state =
'beforeAttributeName';
869 } elseif (
$char ===
'>') {
873 $this->state =
'data';
875 } elseif (
$char ===
'/') {
879 $this->state =
'beforeAttributeName';
881 } elseif ($this->
char === $this->
EOF) {
888 $this->state =
'data';
895 $this->token[
'attr'][] = array(
896 'name' => strtolower(
$char),
900 $this->state =
'attributeName';
◆ beforeAttributeValueState()
HTML5::beforeAttributeValueState |
( |
| ) |
|
|
private |
Definition at line 1011 of file PH5P.php.
1017 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1024 $this->state =
'beforeAttributeValue';
1026 } elseif (
$char ===
'"') {
1029 $this->state =
'attributeValueDoubleQuoted';
1031 } elseif (
$char ===
'&') {
1036 $this->state =
'attributeValueUnquoted';
1038 } elseif (
$char ===
'\'') {
1041 $this->state =
'attributeValueSingleQuoted';
1043 } elseif (
$char ===
'>') {
1047 $this->state =
'data';
1053 $last = count($this->token[
'attr']) - 1;
1054 $this->token[
'attr'][$last][
'value'] .=
$char;
1056 $this->state =
'attributeValueUnquoted';
◆ beforeDoctypeNameState()
HTML5::beforeDoctypeNameState |
( |
| ) |
|
|
private |
Definition at line 1337 of file PH5P.php.
References EOF.
1343 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1346 } elseif (preg_match(
'/^[a-z]$/',
$char)) {
1347 $this->token = array(
1348 'name' => strtoupper(
$char),
1349 'type' => self::DOCTYPE,
1353 $this->state =
'doctypeName';
1355 } elseif (
$char ===
'>') {
1359 'type' => self::DOCTYPE,
1364 $this->state =
'data';
1366 } elseif ($this->
char === $this->
EOF) {
1370 'type' => self::DOCTYPE,
1376 $this->state =
'data';
1379 $this->token = array(
1381 'type' => self::DOCTYPE,
1385 $this->state =
'doctypeName';
◆ bogusCommentState()
HTML5::bogusCommentState |
( |
| ) |
|
|
private |
Definition at line 1185 of file PH5P.php.
References $data, and EOF.
1199 'type' => self::COMMENT
1203 $this->
char += strlen(
$data);
1206 $this->state =
'data';
1209 if ($this->
char === $this->
EOF) {
1210 $this->
char = $this->
EOF - 1;
characters($char_class, $start)
◆ bogusDoctypeState()
HTML5::bogusDoctypeState |
( |
| ) |
|
|
private |
Definition at line 1443 of file PH5P.php.
References EOF.
1449 if (
$char ===
'>') {
1451 $this->state =
'data';
1453 } elseif ($this->
char === $this->
EOF) {
1456 $this->state =
'data';
◆ char()
Definition at line 482 of file PH5P.php.
References EOF.
484 return ($this->char < $this->
EOF)
◆ character()
HTML5::character |
( |
|
$s, |
|
|
|
$l = 0 |
|
) |
| |
|
private |
Definition at line 489 of file PH5P.php.
References EOF.
491 if ($s + $l < $this->
EOF) {
493 return $this->data[$s];
495 return substr($this->data, $s, $l);
◆ characters()
HTML5::characters |
( |
|
$char_class, |
|
|
|
$start |
|
) |
| |
|
private |
Definition at line 500 of file PH5P.php.
502 return preg_replace(
'#^([' . $char_class .
']+).*#s',
'\\1', substr($this->data, $start));
◆ closeTagOpenState()
HTML5::closeTagOpenState |
( |
| ) |
|
|
private |
Definition at line 728 of file PH5P.php.
References EOF.
730 $next_node = strtolower($this->
characters(
'A-Za-z', $this->
char + 1));
731 $the_same = count($this->tree->stack) > 0 && $next_node === end($this->tree->stack)->nodeName;
733 if (($this->content_model === self::RCDATA || $this->content_model === self::CDATA) &&
734 (!$the_same || ($the_same && (!preg_match(
735 '/[\t\n\x0b\x0c >\/]/',
736 $this->
character($this->
char + 1 + strlen($next_node))
737 ) || $this->
EOF === $this->
char)))
756 'type' => self::CHARACTR,
761 $this->state =
'data';
770 if (preg_match(
'/^[A-Za-z]$/',
$char)) {
776 $this->token = array(
777 'name' => strtolower(
$char),
778 'type' => self::ENDTAG
781 $this->state =
'tagName';
783 } elseif (
$char ===
'>') {
786 $this->state =
'data';
788 } elseif ($this->
char === $this->
EOF) {
794 'type' => self::CHARACTR,
800 $this->state =
'data';
804 $this->state =
'bogusComment';
characters($char_class, $start)
◆ commentDashState()
HTML5::commentDashState |
( |
| ) |
|
|
private |
Definition at line 1270 of file PH5P.php.
References EOF.
1277 if (
$char ===
'-') {
1279 $this->state =
'commentEnd';
1282 } elseif ($this->
char === $this->
EOF) {
1287 $this->state =
'data';
1293 $this->token[
'data'] .=
'-' .
$char;
1294 $this->state =
'comment';
◆ commentEndState()
HTML5::commentEndState |
( |
| ) |
|
|
private |
Definition at line 1298 of file PH5P.php.
References EOF.
1304 if (
$char ===
'>') {
1306 $this->state =
'data';
1308 } elseif (
$char ===
'-') {
1309 $this->token[
'data'] .=
'-';
1311 } elseif ($this->
char === $this->
EOF) {
1314 $this->state =
'data';
1317 $this->token[
'data'] .=
'--' .
$char;
1318 $this->state =
'comment';
◆ commentState()
Definition at line 1243 of file PH5P.php.
References EOF.
1250 if (
$char ===
'-') {
1252 $this->state =
'commentDash';
1255 } elseif ($this->
char === $this->
EOF) {
1260 $this->state =
'data';
1266 $this->token[
'data'] .=
$char;
◆ dataState()
Definition at line 505 of file PH5P.php.
References EOF.
511 if (
$char ===
'&' && ($this->content_model === self::PCDATA || $this->content_model === self::RCDATA)) {
516 $this->state =
'entityData';
518 } elseif (
$char ===
'-') {
525 if (($this->content_model === self::RCDATA || $this->content_model ===
526 self::CDATA) && $this->escape ===
false &&
527 $this->
char >= 3 && $this->
character($this->
char - 4, 4) ===
'<!--' 529 $this->escape =
true;
536 'type' => self::CHARACTR,
542 } elseif (
$char ===
'<' && ($this->content_model === self::PCDATA ||
543 (($this->content_model === self::RCDATA ||
544 $this->content_model === self::CDATA) && $this->escape ===
false))
554 $this->state =
'tagOpen';
557 } elseif (
$char ===
'>') {
563 if (($this->content_model === self::RCDATA ||
564 $this->content_model === self::CDATA) && $this->escape ===
true &&
565 $this->
character($this->
char, 3) ===
'-->' 567 $this->escape =
false;
574 'type' => self::CHARACTR,
579 } elseif ($this->
char === $this->
EOF) {
584 } elseif ($this->content_model === self::PLAINTEXT) {
590 'type' => self::CHARACTR,
591 'data' => substr($this->data, $this->
char)
602 $len = strcspn($this->data,
'<&', $this->
char);
603 $char = substr($this->data, $this->
char, $len);
604 $this->
char += $len - 1;
608 'type' => self::CHARACTR,
613 $this->state =
'data';
◆ doctypeNameState()
HTML5::doctypeNameState |
( |
| ) |
|
|
private |
Definition at line 1389 of file PH5P.php.
References EOF.
1395 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1396 $this->state =
'AfterDoctypeName';
1398 } elseif (
$char ===
'>') {
1400 $this->state =
'data';
1402 } elseif (preg_match(
'/^[a-z]$/',
$char)) {
1403 $this->token[
'name'] .= strtoupper(
$char);
1405 } elseif ($this->
char === $this->
EOF) {
1408 $this->state =
'data';
1411 $this->token[
'name'] .=
$char;
1414 $this->token[
'error'] = ($this->token[
'name'] ===
'HTML')
◆ doctypeState()
Definition at line 1322 of file PH5P.php.
1328 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
1329 $this->state =
'beforeDoctypeName';
1333 $this->state =
'beforeDoctypeName';
◆ emitToken()
HTML5::emitToken |
( |
|
$token | ) |
|
|
private |
Definition at line 1554 of file PH5P.php.
1556 $emit = $this->tree->emitToken(
$token);
1558 if (is_int($emit)) {
1559 $this->content_model = $emit;
1561 } elseif (
$token[
'type'] === self::ENDTAG) {
1562 $this->content_model = self::PCDATA;
◆ entity()
Definition at line 1463 of file PH5P.php.
1473 switch ($this->
character($this->
char + 1)) {
1479 switch ($this->
character($this->
char + 1)) {
1491 $char_class =
'0-9A-Fa-f';
1500 $char_class =
'0-9';
1508 $entity = $this->
character($start, $this->
char);
1509 $cond = strlen($e_name) > 0;
1519 $e_name = $this->
characters(
'0-9A-Za-z;', $this->
char + 1);
1520 $len = strlen($e_name);
1522 for ($c = 1; $c <= $len; $c++) {
1523 $id = substr($e_name, 0, $c);
1526 if (in_array($id, $this->entities)) {
1527 if ($e_name[$c - 1] !==
';') {
1528 if ($c < $len && $e_name[$c] ==
';') {
1537 $cond = isset($entity);
1545 $this->
char = $start;
1551 return html_entity_decode(
'&' . $entity .
';', ENT_QUOTES,
'UTF-8');
characters($char_class, $start)
◆ entityDataState()
HTML5::entityDataState |
( |
| ) |
|
|
private |
Definition at line 617 of file PH5P.php.
620 $entity = $this->
entity();
624 $char = (!$entity) ?
'&' : $entity;
627 'type' => self::CHARACTR,
633 $this->state =
'data';
◆ entityInAttributeValueState()
HTML5::entityInAttributeValueState |
( |
| ) |
|
|
private |
Definition at line 1169 of file PH5P.php.
1172 $entity = $this->
entity();
1181 $last = count($this->token[
'attr']) - 1;
1182 $this->token[
'attr'][$last][
'value'] .=
$char;
◆ EOF()
◆ markupDeclarationOpenState()
HTML5::markupDeclarationOpenState |
( |
| ) |
|
|
private |
Definition at line 1214 of file PH5P.php.
1219 if ($this->
character($this->
char + 1, 2) ===
'--') {
1221 $this->state =
'comment';
1222 $this->token = array(
1224 'type' => self::COMMENT
1230 } elseif (strtolower($this->
character($this->
char + 1, 7)) ===
'doctype') {
1232 $this->state =
'doctype';
1239 $this->state =
'bogusComment';
◆ save()
Definition at line 477 of file PH5P.php.
479 return $this->tree->save();
◆ tagNameState()
Definition at line 809 of file PH5P.php.
References EOF.
815 if (preg_match(
'/^[\t\n\x0b\x0c ]$/',
$char)) {
822 $this->state =
'beforeAttributeName';
824 } elseif (
$char ===
'>') {
828 $this->state =
'data';
830 } elseif ($this->
char === $this->
EOF) {
837 $this->state =
'data';
839 } elseif (
$char ===
'/') {
843 $this->state =
'beforeAttributeName';
849 $this->token[
'name'] .= strtolower(
$char);
850 $this->state =
'tagName';
◆ tagOpenState()
Definition at line 636 of file PH5P.php.
638 switch ($this->content_model) {
646 if ($this->
character($this->
char + 1) ===
'/') {
648 $this->state =
'closeTagOpen';
653 'type' => self::CHARACTR,
658 $this->state =
'data';
671 $this->state =
'markupDeclarationOpen';
673 } elseif (
$char ===
'/') {
676 $this->state =
'closeTagOpen';
678 } elseif (preg_match(
'/^[A-Za-z]$/',
$char)) {
684 $this->token = array(
685 'name' => strtolower(
$char),
686 'type' => self::STARTTAG,
690 $this->state =
'tagName';
692 } elseif (
$char ===
'>') {
698 'type' => self::CHARACTR,
703 $this->state =
'data';
705 } elseif (
$char ===
'?') {
708 $this->state =
'bogusComment';
716 'type' => self::CHARACTR,
722 $this->state =
'data';
◆ $char
◆ $content_model
◆ $data
◆ $entities
◆ $EOF
◆ $escape
◆ $state
◆ $token
◆ $tree
◆ CDATA
◆ CHARACTR
const HTML5::CHARACTR = 4 |
Definition at line 459 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 458 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 457 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 456 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