diff -r 07239de796bb -r e756a8c72c3d cms/drupal/sites/all/modules/htmlpurifier/htmlpurifier.admin.inc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cms/drupal/sites/all/modules/htmlpurifier/htmlpurifier.admin.inc Fri Sep 08 12:04:06 2017 +0200 @@ -0,0 +1,43 @@ + t('
This page contains global settings for all HTML Purifier enabled filters. If you are looking for specific filter configuration options, check the format configurations page and select the specific format you would like to configure.
', array('@filter' => url('admin/config/content/formats'))), + ); + $form['htmlpurifier_clear_cache'] = array( + '#type' => 'submit', + '#value' => t('Clear cache (Warning: Can result in performance degradation)'), + '#submit' => array('_htmlpurifier_clear_cache') + ); + + $form = system_settings_form($form); + $form['#submit'][] = 'htmlpurifier_admin_settings_submit'; + return $form; +} + +/** + * Submit handler for the HTML Purifier settings form. + */ +function htmlpurifier_admin_settings_submit($form, &$form_state) { + // Resave all text formats so that the new cache settings for each format are + // recorded. + // TODO: There should be a better way to do this. + foreach (filter_formats() as $format) { + $format->filters = filter_list_format($format->format); + foreach ($format->filters as &$filter) { + $filter = (array) $filter; + } + filter_format_save($format); + } +}