HTMLPurifier 4.4.0
|
00001 <?php 00002 00003 function phorum_htmlpurifier_show_form() { 00004 if (phorum_htmlpurifier_config_file_exists()) { 00005 phorum_htmlpurifier_show_config_info(); 00006 return; 00007 } 00008 00009 global $PHORUM; 00010 00011 $config = phorum_htmlpurifier_get_config(); 00012 00013 $frm = new PhorumInputForm ("", "post", "Save"); 00014 $frm->hidden("module", "modsettings"); 00015 $frm->hidden("mod", "htmlpurifier"); // this is the directory name that the Settings file lives in 00016 00017 if (!empty($error)){ 00018 echo "$error<br />"; 00019 } 00020 00021 $frm->addbreak("Edit settings for the HTML Purifier module"); 00022 00023 $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'wysiwyg\']</code>. 00024 When checked, contents sent for edit are now purified and the 00025 informative message is disabled. If your WYSIWYG editor is disabled for 00026 admin edits, you can safely keep this unchecked.</p>'); 00027 $frm->addRow('Use WYSIWYG?', $frm->checkbox('wysiwyg', '1', '', $PHORUM['mod_htmlpurifier']['wysiwyg'])); 00028 00029 $frm->addMessage('<p>The box below sets <code>$PHORUM[\'mod_htmlpurifier\'][\'suppress_message\']</code>, 00030 which removes the big how-to use 00031 HTML Purifier message.</p>'); 00032 $frm->addRow('Suppress information?', $frm->checkbox('suppress_message', '1', '', $PHORUM['mod_htmlpurifier']['suppress_message'])); 00033 00034 $frm->addMessage('<p>Click on directive links to read what each option does 00035 (links do not open in new windows).</p> 00036 <p>For more flexibility (for instance, you want to edit the full 00037 range of configuration directives), you can create a <tt>config.php</tt> 00038 file in your <tt>mods/htmlpurifier/</tt> directory. Doing so will, 00039 however, make the web configuration interface unavailable.</p>'); 00040 00041 require_once 'HTMLPurifier/Printer/ConfigForm.php'; 00042 $htmlpurifier_form = new HTMLPurifier_Printer_ConfigForm('config', 'http://htmlpurifier.org/live/configdoc/plain.html#%s'); 00043 $htmlpurifier_form->setTextareaDimensions(23, 7); // widen a little, since we have space 00044 00045 $frm->addMessage($htmlpurifier_form->render( 00046 $config, $PHORUM['mod_htmlpurifier']['directives'], false)); 00047 00048 $frm->addMessage("<strong>Warning: Changing HTML Purifier's configuration will invalidate 00049 the cache. Expect to see a flurry of database activity after you change 00050 any of these settings.</strong>"); 00051 00052 $frm->addrow('Reset to defaults:', $frm->checkbox("reset", "1", "", false)); 00053 00054 // hack to include extra styling 00055 echo '<style type="text/css">' . $htmlpurifier_form->getCSS() . ' 00056 .hp-config {margin-left:auto;margin-right:auto;} 00057 </style>'; 00058 $js = $htmlpurifier_form->getJavaScript(); 00059 echo '<script type="text/javascript">'."<!--\n$js\n//-->".'</script>'; 00060 00061 $frm->show(); 00062 } 00063 00064 function phorum_htmlpurifier_show_config_info() { 00065 global $PHORUM; 00066 00067 // update mod_htmlpurifier for housekeeping 00068 phorum_htmlpurifier_commit_settings(); 00069 00070 // politely tell user how to edit settings manually 00071 ?> 00072 <div class="input-form-td-break">How to edit settings for HTML Purifier module</div> 00073 <p> 00074 A <tt>config.php</tt> file exists in your <tt>mods/htmlpurifier/</tt> 00075 directory. This file contains your custom configuration: in order to 00076 change it, please navigate to that file and edit it accordingly. 00077 You can also set <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['wysiwyg']</code> 00078 or <code>$GLOBALS['PHORUM']['mod_htmlpurifier']['suppress_message']</code> 00079 </p> 00080 <p> 00081 To use the web interface, delete <tt>config.php</tt> (or rename it to 00082 <tt>config.php.bak</tt>). 00083 </p> 00084 <p> 00085 <strong>Warning: Changing HTML Purifier's configuration will invalidate 00086 the cache. Expect to see a flurry of database activity after you change 00087 any of these settings.</strong> 00088 </p> 00089 <?php 00090 00091 } 00092 00093 // vim: et sw=4 sts=4