outputhtml : Catch the HTML errors and display them
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4831 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -112,7 +112,23 @@ EOT;
|
|||||||
// Manage the timestamp/md5sum for the external files managed by this
|
// Manage the timestamp/md5sum for the external files managed by this
|
||||||
// server.
|
// server.
|
||||||
$dom = new \DOMDocument ();
|
$dom = new \DOMDocument ();
|
||||||
@$dom->loadHTML ($layoutPage);
|
libxml_use_internal_errors (true);
|
||||||
|
$dom->loadHTML ($layoutPage);
|
||||||
|
$errors = libxml_get_errors ();
|
||||||
|
foreach ($errors as $key => $err)
|
||||||
|
{
|
||||||
|
// Tag YYY invalid : code 801
|
||||||
|
// Like in <nav> <section>
|
||||||
|
if ($err->code === 801)
|
||||||
|
unset ($errors[$key]);
|
||||||
|
}
|
||||||
|
libxml_clear_errors();
|
||||||
|
if (! empty ($errors))
|
||||||
|
{
|
||||||
|
echo "ERROR: Invalid HTML provided\n";
|
||||||
|
echo "<pre>";var_dump ($errors);echo "</pre>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
foreach (array ("script" => "src", "link" => "href", "img" => "src")
|
foreach (array ("script" => "src", "link" => "href", "img" => "src")
|
||||||
as $key=>$val)
|
as $key=>$val)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user