[3.0.0] Upgraded test scripts and other goodies. Also removed some PHP4 cruft.
[htmlpurifier/darkodev.git] / smoketests / configForm.php
blobf84bb48d88b30d3a30cbbddacd80766e3c80e0f2
1 <?php
3 require_once 'common.php';
5 if (isset($_GET['doc'])) {
7 if (
8 file_exists('testSchema.html') &&
9 filemtime('testSchema.php') < filemtime('testSchema.html') &&
10 !isset($_GET['purge'])
11 ) {
12 echo file_get_contents('testSchema.html');
13 exit;
16 if (version_compare('5', PHP_VERSION, '>')) exit('Requires PHP 5 or higher.');
18 // setup schema for parsing
19 require_once 'testSchema.php';
20 $new_schema = $custom_schema; // dereference the reference
21 HTMLPurifier_ConfigSchema::instance($old); // restore old version
23 // setup ConfigDoc environment
24 require_once '../configdoc/library/ConfigDoc.auto.php';
26 // perform the ConfigDoc generation
27 $configdoc = new ConfigDoc();
28 $html = $configdoc->generate($new_schema, 'plain', array(
29 'css' => '../configdoc/styles/plain.css',
30 'title' => 'Sample Configuration Documentation'
31 ));
32 $configdoc->cleanup();
34 file_put_contents('testSchema.html', $html);
35 echo $html;
37 exit;
40 ?><!DOCTYPE html
41 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
42 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
43 <html>
44 <head>
45 <title>HTML Purifier Config Form Smoketest</title>
46 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
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>
51 <h1>HTML Purifier Config Form Smoketest</h1>
52 <p>This file outputs the configuration form for every single type
53 of directive possible.</p>
54 <form id="htmlpurifier-config" name="htmlpurifier-config" method="get" action=""
55 style="float:right;">
56 <?php
58 require_once 'HTMLPurifier/Printer/ConfigForm.php';
60 // fictional set, attempts to cover every possible data-type
61 // see source at ConfigTest.php
62 require_once 'testSchema.php';
64 // cleanup ( this should be rolled into Config )
65 $config = HTMLPurifier_Config::loadArrayFromForm($_GET, 'config');
66 $printer = new HTMLPurifier_Printer_ConfigForm('config', '?doc#%s');
67 echo $printer->render($config);
70 </form>
71 <pre>
72 <?php
73 echo htmlspecialchars(print_r($config->getAll(), true));
75 </pre>
76 </body>
77 </html>