mirror of
https://github.com/php/php-src.git
synced 2025-01-09 20:44:33 +08:00
249 lines
4.3 KiB
PHP
249 lines
4.3 KiB
PHP
--TEST--
|
|
Accessing root, body, html, and head nodes..
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded("tidy") || !class_exists("tidy_doc")) print "skip"; ?>
|
|
--POST--
|
|
--GET--
|
|
--INI--
|
|
--FILE--
|
|
<?php
|
|
$a = tidy_parse_string("<HTML><BODY BGCOLOR=#FFFFFF ALINK=#000000></BODY></HTML>");
|
|
var_dump($a->root());
|
|
var_dump($a->body());
|
|
var_dump($a->html());
|
|
var_dump($a->head());
|
|
|
|
?>
|
|
--EXPECT--
|
|
object(tidy_node)#2 (5) {
|
|
["value"]=>
|
|
string(94) "<html>
|
|
<head>
|
|
<title></title>
|
|
</head>
|
|
<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
</html>"
|
|
["name"]=>
|
|
string(0) ""
|
|
["type"]=>
|
|
int(0)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(1) {
|
|
[0]=>
|
|
&object(tidy_node)#3 (6) {
|
|
["value"]=>
|
|
string(94) "<html>
|
|
<head>
|
|
<title></title>
|
|
</head>
|
|
<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
</html>"
|
|
["name"]=>
|
|
string(4) "html"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(48)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(2) {
|
|
[0]=>
|
|
&object(tidy_node)#4 (6) {
|
|
["value"]=>
|
|
string(31) "<head>
|
|
<title></title>
|
|
</head>
|
|
"
|
|
["name"]=>
|
|
string(4) "head"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(46)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(1) {
|
|
[0]=>
|
|
&object(tidy_node)#5 (6) {
|
|
["value"]=>
|
|
string(16) "<title></title>
|
|
"
|
|
["name"]=>
|
|
string(5) "title"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(111)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
}
|
|
}
|
|
[1]=>
|
|
&object(tidy_node)#6 (6) {
|
|
["value"]=>
|
|
string(49) "<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
"
|
|
["name"]=>
|
|
string(4) "body"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(16)
|
|
["attribute"]=>
|
|
array(2) {
|
|
["bgcolor"]=>
|
|
string(7) "#FFFFFF"
|
|
["alink"]=>
|
|
string(7) "#000000"
|
|
}
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
object(tidy_node)#2 (6) {
|
|
["value"]=>
|
|
string(49) "<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
"
|
|
["name"]=>
|
|
string(4) "body"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(16)
|
|
["attribute"]=>
|
|
array(2) {
|
|
["bgcolor"]=>
|
|
string(7) "#FFFFFF"
|
|
["alink"]=>
|
|
string(7) "#000000"
|
|
}
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
object(tidy_node)#2 (6) {
|
|
["value"]=>
|
|
string(94) "<html>
|
|
<head>
|
|
<title></title>
|
|
</head>
|
|
<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
</html>"
|
|
["name"]=>
|
|
string(4) "html"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(48)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(2) {
|
|
[0]=>
|
|
&object(tidy_node)#3 (6) {
|
|
["value"]=>
|
|
string(31) "<head>
|
|
<title></title>
|
|
</head>
|
|
"
|
|
["name"]=>
|
|
string(4) "head"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(46)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(1) {
|
|
[0]=>
|
|
&object(tidy_node)#6 (6) {
|
|
["value"]=>
|
|
string(16) "<title></title>
|
|
"
|
|
["name"]=>
|
|
string(5) "title"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(111)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
}
|
|
}
|
|
[1]=>
|
|
&object(tidy_node)#4 (6) {
|
|
["value"]=>
|
|
string(49) "<body bgcolor="#FFFFFF" alink="#000000">
|
|
</body>
|
|
"
|
|
["name"]=>
|
|
string(4) "body"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(16)
|
|
["attribute"]=>
|
|
array(2) {
|
|
["bgcolor"]=>
|
|
string(7) "#FFFFFF"
|
|
["alink"]=>
|
|
string(7) "#000000"
|
|
}
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
}
|
|
}
|
|
object(tidy_node)#2 (6) {
|
|
["value"]=>
|
|
string(31) "<head>
|
|
<title></title>
|
|
</head>
|
|
"
|
|
["name"]=>
|
|
string(4) "head"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(46)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
array(1) {
|
|
[0]=>
|
|
&object(tidy_node)#4 (6) {
|
|
["value"]=>
|
|
string(16) "<title></title>
|
|
"
|
|
["name"]=>
|
|
string(5) "title"
|
|
["type"]=>
|
|
int(5)
|
|
["id"]=>
|
|
int(111)
|
|
["attribute"]=>
|
|
NULL
|
|
["child"]=>
|
|
NULL
|
|
}
|
|
}
|
|
}
|