Release 3.3.0.
[htmlpurifier/darkodev.git] / plugins / phorum / settings / form.php
bloba47a5fae7d15fa2c68d63de97849a5612b1b53d1
1 <?php
3 function phorum_htmlpurifier_show_form() {
4 if (phorum_htmlpurifier_config_file_exists()) {
5 phorum_htmlpurifier_show_config_info();
6 return;
9 global $PHORUM;
11 $config = phorum_htmlpurifier_get_config();
13 $frm = new PhorumInputForm ("", "post", "Save");
14 $frm->hidden("module", "modsettings");
15 $frm->hidden("mod", "htmlpurifier"); // this is the directory name that the Settings file lives in
17 if (!empty($error)){
18 echo "$error<br />";
21 $frm->addbreak("Edit settings for the HTML Purifier module");
23 $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'wysiwyg\']</code>.
24 When checked, contents sent for edit are now purified and the
25 informative message is disabled. If your WYSIWYG editor is disabled for
26 admin edits, you can safely keep this unchecked.</p>');
27 $frm->addRow('Use WYSIWYG?', $frm->checkbox('wysiwyg', '1', '', $PHORUM['mod_htmlpurifier']['wysiwyg']));
29 $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'suppress_message\']</code>,
30 which removes the big how-to use
31 HTML Purifier message.</p>');
32 $frm->addRow('Suppress information?', $frm->checkbox('suppress_message', '1', '', $PHORUM['mod_htmlpurifier']['suppress_message']));
34 $frm->addMessage('<p>Click on directive links to read what each option does
35 (links do not open in new windows).</p>
36 <p>For more flexibility (for instance, you want to edit the full
37 range of configuration directives), you can create a <tt>config.php</tt>
38 file in your <tt>mods/htmlpurifier/</tt> directory. Doing so will,
39 however, make the web configuration interface unavailable.</p>');
41 require_once 'HTMLPurifier/Printer/ConfigForm.php';
42 $htmlpurifier_form = new HTMLPurifier_Printer_ConfigForm('config', 'http://htmlpurifier.org/live/configdoc/plain.html#%s');
43 $htmlpurifier_form->setTextareaDimensions(23, 7); // widen a little, since we have space
45 $frm->addMessage($htmlpurifier_form->render(
46 $config, $PHORUM['mod_htmlpurifier']['directives'], false));
48 $frm->addMessage("<strong>Warning: Changing HTML Purifier's configuration will invalidate
49 the cache. Expect to see a flurry of database activity after you change
50 any of these settings.</strong>");
52 $frm->addrow('Reset to defaults:', $frm->checkbox("reset", "1", "", false));
54 // hack to include extra styling
55 echo '<style type="text/css">' . $htmlpurifier_form->getCSS() . '
56 .hp-config {margin-left:auto;margin-right:auto;}
57 </style>';
58 $js = $htmlpurifier_form->getJavaScript();
59 echo '<script type="text/javascript">'."<!--\n$js\n//-->".'</script>';
61 $frm->show();
64 function phorum_htmlpurifier_show_config_info() {
65 global $PHORUM;
67 // update mod_htmlpurifier for housekeeping
68 phorum_htmlpurifier_commit_settings();
70 // politely tell user how to edit settings manually
72 <div class="input-form-td-break">How to edit settings for HTML Purifier module</div>
73 <p>
74 A <tt>config.php</tt> file exists in your <tt>mods/htmlpurifier/</tt>
75 directory. This file contains your custom configuration: in order to
76 change it, please navigate to that file and edit it accordingly.
77 You can also set <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg']</code>
78 or <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message']</code>
79 </p>
80 <p>
81 To use the web interface, delete <tt>config.php</tt> (or rename it to
82 <tt>config.php.bak</tt>).
83 </p>
84 <p>
85 <strong>Warning: Changing HTML Purifier's configuration will invalidate
86 the cache. Expect to see a flurry of database activity after you change
87 any of these settings.</strong>
88 </p>
89 <?php
93 // vim: et sw=4 sts=4