Add support for pixel as a pseudo-English unit.
[htmlpurifier.git] / smoketests / printDefinition.php
blob86fd949487256f28bcaebe814d2bc285c84fddc1
1 <?php
3 require_once 'common.php'; // load library
5 require_once 'HTMLPurifier/Printer/HTMLDefinition.php';
6 require_once 'HTMLPurifier/Printer/CSSDefinition.php';
7 require_once 'HTMLPurifier/Printer/ConfigForm.php';
9 $config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config', 'HTML');
11 // you can do custom configuration!
12 if (file_exists('printDefinition.settings.php')) {
13 include 'printDefinition.settings.php';
16 $printer_html_definition = new HTMLPurifier_Printer_HTMLDefinition();
17 $printer_css_definition = new HTMLPurifier_Printer_CSSDefinition();
19 $printer_config_form = new HTMLPurifier_Printer_ConfigForm(
20 'config',
21 'http://htmlpurifier.org/live/configdoc/plain.html#%s'
24 echo '<?xml version="1.0" encoding="UTF-8" ?>';
27 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
28 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
29 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
30 <head>
31 <title>HTML Purifier Printer Smoketest</title>
32 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
33 <style type="text/css">
34 .hp-config {margin-left:auto; margin-right:auto;}
35 .HTMLPurifier_Printer table {border-collapse:collapse;
36 border:1px solid #000; width:600px;
37 margin:1em auto;font-family:sans-serif;font-size:75%;}
38 .HTMLPurifier_Printer td, .HTMLPurifier_Printer th {padding:3px;
39 border:1px solid #000;background:#CCC; vertical-align: baseline;}
40 .HTMLPurifier_Printer th {text-align:left;background:#CCF;width:20%;}
41 .HTMLPurifier_Printer caption {font-size:1.5em; font-weight:bold;
42 width:100%;}
43 .HTMLPurifier_Printer .heavy {background:#99C;text-align:center;}
44 .HTMLPurifier_Printer .unsafe {background:#C99;}
45 dt {font-weight:bold;}
46 </style>
47 <link rel="stylesheet" href="../library/HTMLPurifier/Printer/ConfigForm.css" type="text/css" />
48 <script defer="defer" type="text/javascript" src="../library/HTMLPurifier/Printer/ConfigForm.js"></script>
49 </head>
50 <body>
52 <h1>HTML Purifier Printer Smoketest</h1>
54 <p>HTML Purifier claims to have a robust yet permissive whitelist: this
55 page will allow you to see precisely what HTML Purifier's internal
56 whitelist is. You can
57 also twiddle with the configuration settings to see how a directive
58 influences the internal workings of the definition objects.</p>
60 <h2>Modify configuration</h2>
62 <p>You can specify an array by typing in a comma-separated
63 list of items, HTML Purifier will take care of the rest (including
64 transformation into a real array list or a lookup table).</p>
66 <form method="get" action="" name="hp-configform">
67 <?php
68 echo $printer_config_form->render($config, 'HTML');
70 <p>* Some configuration directives make a distinction between an empty
71 variable and a null variable. A whitelist, for example, will take an
72 empty array as meaning <em>no</em> allowed elements, while checking
73 Null/Disabled will mean that user whitelisting functionality is disabled.</p>
74 </form>
76 <h2>Definitions</h2>
78 <dl>
79 <dt>Parent of Fragment</dt>
80 <dd>HTML that HTML Purifier does not live in a void: when it's
81 output, it has to be placed in another element by means of
82 something like <code>&lt;element&gt; &lt;?php echo $html
83 ?&gt; &lt;/element&gt;</code>. The parent in this example
84 is <code>element</code>.</dd>
85 <dt>Strict mode</dt>
86 <dd>Whether or not HTML Purifier's output is Transitional or
87 Strict compliant. Non-strict mode still actually a little strict
88 and converts many deprecated elements.</dd>
89 <dt>#PCDATA</dt>
90 <dd>Literally <strong>Parsed Character Data</strong>, it is regular
91 text. Tags like <code>ul</code> don't allow text in them, so
92 #PCDATA is missing.</dd>
93 <dt>Tag transform</dt>
94 <dd>A tag transform will change one tag to another. Example: <code>font</code>
95 turns into a <code>span</code> tag with appropriate CSS.</dd>
96 <dt>Attr Transform</dt>
97 <dd>An attribute transform changes a group of attributes based on one
98 another. Currently, only <code>lang</code> and <code>xml:lang</code>
99 use this hook, to synchronize each other's values. Pre/Post indicates
100 whether or not the transform is done before/after validation.</dd>
101 <dt>Excludes</dt>
102 <dd>Tags that an element excludes are excluded for all descendants of
103 that element, and not just the children of them.</dd>
104 <dt>Name(Param1, Param2)</dt>
105 <dd>Represents an internal data-structure. You'll have to check out
106 the corresponding classes in HTML Purifier to find out more.</dd>
107 </dl>
109 <h2>HTMLDefinition</h2>
110 <?php echo $printer_html_definition->render($config) ?>
111 <h2>CSSDefinition</h2>
112 <?php echo $printer_css_definition->render($config) ?>
113 </body>
114 </html>