Fix Internet Explorer innerHTML bug.
[htmlpurifier.git] / smoketests / basic.php
blob1c361727c9151ebed65402f894d872e9bd59f7b7
1 <?php
3 require_once 'common.php';
5 // todo : modularize the HTML in to separate files
7 $allowed = array(
8 'allElements' => true,
9 'legacy' => true
12 $page = isset($_GET['p']) ? $_GET['p'] : false;
13 if (!isset($allowed[$page])) $page = false;
15 $strict = isset($_GET['d']) ? (bool) $_GET['d'] : false;
17 echo '<?xml version="1.0" encoding="UTF-8" ?>';
19 <?php if ($strict) { ?>
20 <!DOCTYPE html
21 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
22 "http://www.w3.org/TR/xhtml1/DTD/xhtml1- Strict.dtd">
23 <?php } else { ?>
24 <!DOCTYPE html
25 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
26 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
27 <?php } ?>
28 <html>
29 <head>
30 <title>HTML Purifier Basic Smoketest</title>
31 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
32 <?php
33 if ($page) {
34 if (file_exists("basic/$page.css")) {
35 ?><link rel="stylesheet" href="basic/<?php echo $page ?>.css" type="text/css" /><?php
39 </head>
40 <body>
41 <?php
43 if ($page) {
45 <div style="float:right;"><div><?php echo $strict ? 'Strict' : 'Loose'; ?>:
46 <a href="?d=<?php echo (int) !$strict; ?>&amp;p=<?php echo $page ?>">Swap</a></div>
47 <a href="http://validator.w3.org/check?uri=referer"><img
48 src="http://www.w3.org/Icons/valid-xhtml10"
49 alt="Valid XHTML 1.0 Transitional" height="31" width="88" style="border:0;" /></a>
50 </div>
51 <?php
52 $config = HTMLPurifier_Config::createDefault();
53 $config->set('Attr.EnableID', true);
54 $config->set('HTML.Strict', $strict);
55 $purifier = new HTMLPurifier($config);
56 echo $purifier->purify(file_get_contents("basic/$page.html"));
57 } else {
59 <h1>HTML Purifier Basic Smoketest Index</h1>
60 <ul>
61 <?php
62 foreach ($allowed as $val => $b) {
63 ?><li><a href="?p=<?php echo $val ?>"><?php echo $val ?></a></li><?php
65 ?></ul><?php
69 </body>
70 </html>
71 <?php
73 // vim: et sw=4 sts=4