Hi

After I enabled HTML purifier I got this error message into watchdog for each show page. I found it when my db was down because it did watchdog table almost 300 mega big for night.

HTMLPurifier->addFilter() is deprecated, use configuration directives in the Filter namespace or Filter.Custom in /home/users/somvprahe.sk/web/www/sites/all/modules/htmlpurifier/library/HTMLPurifier.php on line 101.

I have Drupal 5.7, PHP: 5.2.3-1ubuntu6.3, MySQL: 5.0.45, HTML Purifier 3.1.0. RC
I have it added into my HTML filtered filter, with this order:

HTML filter
Gallery2 filter
googtube filter
URL filter
Line Breaks
Inline images
HTML Purifier

Igorik
http://www.somvprahe.sk

Comments

ezyang’s picture

This is a bug stemming from backwards-compatibility. You can fix it with this:

Index: htmlpurifier.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/htmlpurifier/htmlpurifier.module,v
retrieving revision 1.2.2.2
diff -u -r1.2.2.2 htmlpurifier.module
--- htmlpurifier.module	25 Apr 2008 03:22:16 -0000	1.2.2.2
+++ htmlpurifier.module	25 Apr 2008 13:17:46 -0000
@@ -118,7 +118,8 @@
 function _htmlpurifier_add_filters($format, &$purifier) {
   if (variable_get("htmlpurifier_preserveyoutube_$format", FALSE) && version_compare($purifier->version, '1.4.1', '>=')) {
     require_once 'HTMLPurifier/Filter/YouTube.php';
-    $purifier->addFilter(new HTMLPurifier_Filter_YouTube());
+    // This is deprecated in recent versions, but we don't care.
+    @$purifier->addFilter(new HTMLPurifier_Filter_YouTube());
   }
 }
 

Well, I guess I ought to do a re-release.

By the way, looking at your filterset, HTML filter is not necessary and can be removed. Also, once you upgrade to 6.x-2.x (not released yet), URL, linebreaks and inline images will not be necessary either. :-)

igorik’s picture

Hi, thanks for quick reply.

HTML filter is used because it specify which html tags can be used.
As far I understand HTML purifier I think that it remove malicious code and html, but I can't find option to set which HTML elements can be allowed.
(E.g. I don't want to allow element <b>, <h1>...)
This is reason why I use HTML filter.

I will be glad when all these standard filters as line break etc. will be inside drupal. Thanks for info.
Igorik

igorik’s picture

Status: Active » Fixed

Hi
I had to comment out this line right after last line from your code

I can confirm, now it works fine without error messages

thanks
Igorik

ezyang’s picture

Igorik, I'm closing this bug as fixed. Would you mind filing another bug for setting allowed elements? I'll add that to 1.2 as well.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.