您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

73 行
2.0KB

  1. <?php
  2. require 'common.php';
  3. ?><!DOCTYPE html
  4. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  5. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-loose.dtd">
  6. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  7. <head>
  8. <title>HTML Purifier Attribute Transformation Smoketest</title>
  9. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  10. <style type="text/css">
  11. div.container {position:relative;height:120px;border:1px solid #CCC;
  12. margin-bottom:1em; width:225px; float:left; margin-top:1em;
  13. margin-right:1em;}
  14. h2 {clear:left;margin-bottom:0;}
  15. div.container.legend .test {text-align:center;line-height:100px;}
  16. div.test {width:100px;height:100px;border:1px solid black;
  17. position:absolute;top:10px;overflow:auto;}
  18. div.test.html {left:10px;border-right:none;background:#FCC;}
  19. div.test.css {left:110px;background:#CFC;}
  20. img.marked {border:1px solid #000;background:#FFF;}
  21. table.bright {background-color:#F00;}
  22. hr.short {width:50px;}
  23. </style>
  24. </head>
  25. <body>
  26. <h1>HTML Purifier Attribute Transformation Smoketest</h1>
  27. <div class="container legend">
  28. <div class="test html">
  29. HTML
  30. </div>
  31. <div class="test css">
  32. CSS
  33. </div>
  34. </div>
  35. <?php
  36. if (version_compare(PHP_VERSION, '5', '<')) exit('<p>Requires PHP 5.</p>');
  37. $xml = simplexml_load_file('attrTransform.xml');
  38. // attr transform enabled HTML Purifier
  39. $config = HTMLPurifier_Config::createDefault();
  40. $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
  41. $purifier = new HTMLPurifier($config);
  42. $title = isset($_GET['title']) ? $_GET['title'] : true;
  43. foreach ($xml->group as $group) {
  44. echo '<h2>' . $group['title'] . '</h2>';
  45. foreach ($group->sample as $sample) {
  46. $sample = (string) $sample;
  47. ?>
  48. <div class="container">
  49. <div class="test html">
  50. <?php echo $sample; ?>
  51. </div>
  52. <div class="test css">
  53. <?php echo $purifier->purify($sample); ?>
  54. </div>
  55. </div>
  56. <?php
  57. }
  58. }
  59. ?>
  60. </body>
  61. </html>
  62. <?php
  63. // vim: et sw=4 sts=4