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(
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">
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
;
46 .HTMLPurifier_Printer
.heavy
{background
:#99C;text-align:center;}
47 .HTMLPurifier_Printer
.unsafe
{background
:#C99;}
48 dt
{font
-weight
:bold
;}
50 <link rel
="stylesheet" href
="../library/HTMLPurifier/Printer/ConfigForm.css" type
="text/css" />
51 <script defer
="defer" type
="text/javascript" src
="../library/HTMLPurifier/Printer/ConfigForm.js"></script
>
55 <h1
>HTML Purifier Printer Smoketest
</h1
>
57 <p
>HTML Purifier claims to have a robust yet permissive whitelist
: this
58 page will allow you to see precisely what HTML Purifier
's internal
60 also twiddle with the configuration settings to see how a directive
61 influences the internal workings of the definition objects.</p>
63 <h2>Modify configuration</h2>
65 <p>You can specify an array by typing in a comma-separated
66 list of items, HTML Purifier will take care of the rest (including
67 transformation into a real array list or a lookup table).</p>
69 <form method="get" action="" name="hp-configform">
71 echo $printer_config_form->render($config, 'HTML
');
73 <p>* Some configuration directives make a distinction between an empty
74 variable and a null variable. A whitelist, for example, will take an
75 empty array as meaning <em>no</em> allowed elements, while checking
76 Null/Disabled will mean that user whitelisting functionality is disabled.</p>
82 <dt>Parent of Fragment</dt>
83 <dd>HTML that HTML Purifier does not live in a void: when it's
84 output
, it has to be placed in another element by means of
85 something like
<code
><
;element
>
; <
;?php
echo $html
86 ?
>
; <
;/element
>
;</code
>. The parent in this example
87 is
<code
>element
</code
>.</dd
>
89 <dd
>Whether
or not HTML Purifier
's output is Transitional or
90 Strict compliant. Non-strict mode still actually a little strict
91 and converts many deprecated elements.</dd>
93 <dd>Literally <strong>Parsed Character Data</strong>, it is regular
94 text. Tags like <code>ul</code> don't allow text in them
, so
95 #PCDATA is missing.</dd>
96 <dt
>Tag transform
</dt
>
97 <dd
>A tag transform will change one tag to another
. Example
: <code
>font
</code
>
98 turns into a
<code
>span
</code
> tag with appropriate CSS
.</dd
>
99 <dt
>Attr Transform
</dt
>
100 <dd
>An attribute transform changes a group of attributes based on one
101 another
. Currently
, only
<code
>lang
</code
> and <code
>xml
:lang
</code
>
102 use this hook
, to synchronize each other
's values. Pre/Post indicates
103 whether or not the transform is done before/after validation.</dd>
105 <dd>Tags that an element excludes are excluded for all descendants of
106 that element, and not just the children of them.</dd>
107 <dt>Name(Param1, Param2)</dt>
108 <dd>Represents an internal data-structure. You'll have to check out
109 the corresponding classes in HTML Purifier to find out more
.</dd
>
112 <h2
>HTMLDefinition
</h2
>
113 <?php
echo $printer_html_definition->render($config) ?
>
114 <h2
>CSSDefinition
</h2
>
115 <?php
echo $printer_css_definition->render($config) ?
>