HTML Purified
| Download: | html-purified.zip |
|---|---|
| Version: | 0.2.9 |
| Updated: | March 5, 2008 |
| Size: | 258.14 KB |
Support This Plugin!While this software is being provided free to use, it takes considerable time to develop and support. If you do find it particularly useful or want to request a feature then consider donating money as an incentive for me to carry on developing it. Thanks! |
|
| I have other plugins too! | |
HTML Purified replaces the default WordPress comments filters with HTML Purifier, a super HTML filtering library.
HTML Purifier is a standards-compliant HTML filter library written in PHP. HTML Purifier will not only remove all malicious code (better known as XSS) with a thoroughly audited, secure yet permissive whitelist, it will also make sure your documents are standards compliant, something only achievable with a comprehensive knowledge of W3C's specifications. HTML Purifier
Why would you want to do this? There is nothing fundamentally wrong with the way WordPress filters comments, and in fact there has been no security alert related to this. However, this doesn't detract from the desire to make things better, and the fact that HTML Purifier is much more thorough and exhaustive.
A comparison of HTML Purifier and KSES (the default WordPress filtering library) is shown below and taken from a fuller description at the HTML Purifier site.
| Library | Whitelist | Removal | Well-formed | Nesting | Attributes | XSS safe | Standards safe |
|---|---|---|---|---|---|---|---|
| kses | Yes | Yes | No | No | Partial | Probably | No |
| HTML Purifier | Yes | Yes | Yes | Yes | Yes | Yes | Yes |
An additional feature of HTML Purifier is that it will produce valid well-formed XHTML code, something which KSES does not do.
Features:
- Configurable KSES or HTML Purifier
- Configurable list of HTML elements and attributes for both KSES and HTML purifier
- Additionally process comments with HTML Tidy
- URL blacklist
- Works in bbPress!
The plugin is available in the following languages:
- English
- Español - translated by José Cuesta
Version History
- 0.2.9 - Update plugin library. Now works in bbPress
- 0.2.7 - Add option for bbcode-style tags, update to HTML Purifier 2.1.3
- 0.2.5 - Add Spanish localization
- 0.2.4 - Fix cache directory write error
- 0.2.2 - Update HTML purifier to 2.1.1
Installation
The plugin is simple to install:
- Download html-purified.zip
- Unzip
- Upload
html-purifieddirectory to your/wp-content/pluginsdirectory - Go to the plugin management page and enable the plugin
- Configure the options from the Options/HTML Purified page
You can find full details of installing a plugin on the plugin installation page.
General Options
General options apply to both the default KSES filter, as well as HTML Purifier:
Allowed Tags
The allowed tags is a list of HTML tags and attributes that are allowed in comments. The list will be populated with defaults, and you can modify it as you see fit. One feature of the HTML Purified plugin is that any changes to this list will affect both KSES and HTML Purifier, and will be visible on your site (if displaying allowed tags is enabled in your comments form).
Filter admin users
WordPress does not normally filter comments by an administrator, and you can change this by enabling the 'filter admin users' option.
Footer display
Finally there is an option to display the number of purified comments in the footer of your site. Use of this is entirely optional, and provides some nice statistics and an incoming link for both myself and the author of HTML Purifier.
HTML Purifier Options
These options are specific to HTML Purifier:
Caching
HTML Purifier performs a deeper analysis of HTML than KSES, and this results in increased processing time. However, as this increase only happens when a comment is submitted it is not a problem. Should you want to, you can enable the HTML Purifier cache, which attempts to reduce the processing time by caching internal data structures. The purifier cache is stored in a subdirectory of the standard WordPress cache directory wp-content/cache/html-purified/. If you enable the cache you must make sure the web server has write-permissions to this directory. Caching is advised in most situations.
Document type
The document type should match the document type of your chosen theme. Most themes will be 'XHTML transitional', but you can verify this by viewing the HTML source of your site and looking at the first line:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Tidy
As well as validating comments, HTML Purifier can also Tidy them. If you are unfamiliar, HTML Tidy is a popular tool that attempts to correct invalid, poorly formatted, and deprecated HTML. There are three levels of tidying that can be applied, and this reflects the amount of manipulation of the incoming comment. Select a level that suits the complexity of your comments, bearing in mind that the heavier the level the more likely a comment will be modified.
Note that this option does not require Tidy to be installed on your server, although the pretty-printing of HTML does. If you do not have Tidy installed on your server then pretty-printing will be silently ignored.
Blacklist
Finally, a URL blacklist is available. Any text entered into this blacklist will be used to filter the URLs contained within comments. For example, if you enter 'viagra', then any URL containing 'viagra' will be removed.
Support
Please direct all support questions to the HTML Purified support forum. Any support questions left on this page may not be answered.
Bugs & New Features
A full list of all bugs can be found in the HTML Purified issue tracker.
| Date | Current requested features |
|---|---|
| 05 Mar 2008 | Add htmlLawed |
| 05 Mar 2008 | Make HTML Purified work with WP-IDS |
A full list of all requested features can be found in the HTML Purified feature tracker.
Help me to save time by reading these instructions!
Please report bugs in the HTML Purified issue tracker.
Please make feature suggestions in the HTML Purified feature tracker.
Please direct all support questions to the HTML Purified support forum.







Comments (page 4 of 6)
Dec 11, 2007 2:04 pm
oh shit, some of the original code above has converted to the right html output. i'll send you the original code/tag via email.
Dec 11, 2007 1:47 pm
There's conflict between HTML Purified with Quoter plugin. Two of replacement tags of Quoter plugin that i using are %name% (quoted commenter's name) and %id% (quoted commenter' ID).
And %name% tag output will be replaced by HTML Purified plugin with the quoter's name (name of someone who quotes a comment), and the %id% tag output will be removed (disapear).
To make this clear, i give the working and non working example. First, before activating HTML Purified plugin the Quoter plugin output look like : [quote comment="10"]..blah blah blah...[/quote], its a working quote. And after activated HTML Purified plugin, the Quoter plugin output look like : [quote comment="13"]..blah blah blah...[/quote].
So, i believe the problem is on "13" (it should be "13") words, and its mean HTML Purified disallowed the double quotation marks since i'm using Quoter header look like: %name% wrote: on the Quote header of Quoter plugin. I've tried to adding some tags into Allowed tags column of HTML Purified, but still can't resolve this problem.
So, please tell me which's the right tags that i must put into Allowed tags column of HTML Purified so that output of Quoter plugin becoming normal.
Nov 14, 2007 12:07 am
I traced my last bug (see previous comment) to a particular behavior of HTML-Purifier, which requires block-level child elements inside of a blockquote. For some reason, my list of allowed tags for comments didn't have the paragraph tag included (I don't remember changing this--is it enabled by default?), so the plugin couldn't automatically put the inner content into a paragraph, so it simply dropped it.
Nov 13, 2007 11:25 pm
Bug with the latest version: when using the HTML Purifier library, even with blockquotes as accepted input, this plugin will strip the content of a blockquote in the comments, but not the blockquote tags themselves.
Sep 20, 2007 9:14 pm
i see, thank you
But very useful and secure plugin thanks again
Sep 20, 2007 7:14 pm
Tommy, that isn't the purpose of this plugin.
Sep 20, 2007 10:13 am
i wanna block these codes from users browser for my site. when attacker trying xss codes on my site a popup apearing and it shows his cookie. he is trying like that and his cookie appearing his cookie.
http://www.site.com/?p="><script>alert(document.cookie)</script>
Sep 20, 2007 10:11 am
no i mean that.
Attacker trying the xss codes on his toolbar. For example my site is that. http://www.site.com and attacker trying the xss codes on my searchbox ?s= or ?p=
or he is trying xss codes on my site like that: http://www.site.com/?p="><script>alert(document.cookie)</script> from his browser and a pop up appearing. it is showing his cookie. i want to block these codes on users browsers for my site
Sep 20, 2007 2:44 am
Still not sure what you mean Tommy. Are you referring to URLs inside a comment?
Sep 20, 2007 1:36 am
yes this is filter the comments but this is not filter the attacks on url like that:
http://www.site.com/?p="><script>alert(/XSS/)</script>
how can we block these attacks which made on url
Leave a comment