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