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