You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.9KB

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