3 require_once 'common.php';
4 require_once 'HTMLPurifier/Filter/ExtractStyleBlocks.php';
6 // need CSSTidy location
7 $csstidy_location = false;
8 if (file_exists('../conf/test-settings.php')) include '../conf/test-settings.php';
9 if (file_exists('../test-settings.php')) include '../test-settings.php';
11 if (!$csstidy_location) {
13 Error
: <a href
="http://csstidy.sourceforge.net/">CSSTidy
</a
> library not
14 found
, please install
and configure
<code
>test
-settings
.php
</code
>
20 require_once $csstidy_location . 'class.csstidy.php';
21 require_once $csstidy_location . 'class.csstidy_print.php';
23 $purifier = new HTMLPurifier(array(
24 'Filter.ExtractStyleBlocks' => true,
27 $html = isset($_POST['html']) ?
$_POST['html'] : '';
28 $purified_html = $purifier->purify($html);
31 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
32 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
35 <title
>Extract Style Blocks
- HTML Purifier Smoketest
</title
>
36 <meta http
-equiv
="Content-Type" content
="text/html; charset=UTF-8" />
39 // generate style blocks
40 foreach ($purifier->context
->get('StyleBlocks') as $style) {
41 ?
><style type
="text/css">
42 <!--/*--><![CDATA[/*><!--*/
53 <h1
>Extract Style Blocks
</h1
>
55 This smoketest allows users to specify
global style sheets
for the
56 document
, allowing
for interesting techniques
and compact markup
57 that wouldn
't normally be possible, using the ExtractStyleBlocks filter.
60 User submitted content:
62 <div style="border: 1px solid #CCC; margin: 1em; padding: 1em;">
63 <?php echo $purified_html ?>
65 <form action="" method="post">
66 <textarea cols="100" rows="20" name="html"><?php echo escapeHTML($html) ?></textarea>
67 <input type="submit" value="Submit" />