Add a button to clear HTML Purifier cache
anrikun - February 3, 2009 - 11:32
| Project: | HTML Purifier |
| Version: | 6.x-1.x-dev |
| Component: | Miscellaneous |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Jump to:
Description
All I want is just to insure that output content is valid XHTML 1.0 Strict.
So I only need to set Tidy and Doctype.
But it doesn't work:
HTML purifier removes the images and the inline styles and I don't know why.
Help me please.
Thanks.

#1
It seems that it's a problem with a cache somewhere. On my site, Drupal cache is not enabled though.
Now HTML Purifier works as expected but I don't understand why now...
How HTML Purifier cache is handled and how to empty it?
#2
HTML Purifier maintains its own cache, because Drupal's caching behavior is not satisfactory. It should automatically clear itself out when you change configuration, I think there's also a button to do that in the admin panel (if there isn't, turn this into a feature request).
#3
I didn't notice such a button.
#4
Fixed in HEAD.
#5
Thanks for adding this button. I just saw in HEAD that the button is in its own fieldset, which looks awkward on the configuration screen if there are other filters enabled on the input format. It looks like the button clears the cache of a filter called Dashboard. Can you move the button down, like so?
<?php$form['htmlpurifier'] = array(
'#type' => 'fieldset',
'#title' => t('HTML Purifier'),
'#collapsible' => TRUE,
);
$form['htmlpurifier']["htmlpurifier_clear_cache"] = array(
'#type' => 'submit',
'#value' => t('Clear cache (Warning: Can result in performance degradation)'),
'#submit' => array('_htmlpurifier_clear_cache')
);
?>
#6
Fantastic, this did it for me also. Purifier just wouldn't take the new settings (kept blocking outside images) no matter what I did. Button works great.
#7
Where is this cache clearing button? I do not see it.
I keep getting message to upgrade to 4.0. Drupal version is 2.0. I ran upgrade from your site and my version in admin/modules says 2.0. Still have upgrade message. Cleared all caches via admin menu (the module-provided top menu), cannot execute /maintenance/flush.php directly from browser. Don't see an option for htmlpurifier under site configurations.
What am I doing wrong?
#8
kirkhings: the "upgrade to 4.0" message is referring to the HTML Purifier API, not the Drupal module. You need to follow the instructions in the module README to upgrade the API.
#9
Now I've really confused myself, I appreciate your prompt help.
The only README I found in the folder is in \library\htmlpurifier-3.3.0 and \library\htmlpurifier-3.2.0 and those READMEs are the same and only offer a couple paragraphs, nothing seems pertinent to this. The referenced INSTALL discusses code and write permissions, not sure if that is what I need.
Someone in another help forum pointed out there is a difference tween the module (http://drupal.org/project/htmlpurifier) and the library (http://htmlpurifier.org/), which I did not realize. However, they seem to be the same folders/files except the module does not have the library folder whereas the 'library' is the same set of files/folders but does have the library folder. Am I misreading that?
In my admin/modules I only see one entry for htmlpurifier, for 2.0, not api module to enable or disable.
In my modules folder structure, I see two folders: htmlpurifier and htmlpurifier-4.0.0.
Did I mess up the install? Is the api and library same thing? What do I need to do here? Sorry for being completely lost, this was installed on the proj b4 I got here and I'm just trying to kill this error message.
Thanks!
#10
The API & the library are the same thing. Sorry if my use of terms was confusing. Look in the sites/all/modules/htmlpurifier directory. I think there should be a README in there. If not, check the INSTALL file. The htmlpurifier 4.0 library directory should go *inside* the htmlpurifier modules directory.
If you have any further questions, please open a new issue, since this issue is focused on a different subject, and I don't want to get it further off-track.
#11
oop I think I kept referencing the same folder before, now I've gotten into the library's folders (htmlpurifier-4.0.0) and see the readme and other things, let's see if i can work this out...
#12
Don't mean to keep going off track but I found the solution for the cache clearing and wanted to post for future searchers.
I finally realized I just had to place the htmlpurifier-4.0.0 folder INSIDE the modules/htmlpurifier/library folder, made a bit more more confusing cuz the htmlpurifier-4.0.0 contained a library folder itself. 4.0 folder was placed alongside other version folders like 3.2, etc.
I still did not see a cache clearing button or any configurable options. I worked on other things for a few hours and checked back and now I don't have the error message so I guess the upgrade worked.
I'm fairly experienced with drupal and modules, but I guess I choked on this. However, I suggest making more clear the diffs between the module and the library/api, whereas they are called the same title but are available from different locations and need such different handling.