mark
Automatically Clean tags within the html tags
November 26, 2007 08:07AM

Hi,

I installed HTML Purifier on my server, it's working fine, great software.

$dirty_html = &#039;<b>Some Text in Here</s>&#039;;
<?php
require_once &#039;htmlpurifier-2.1.3/library/HTMLPurifier.auto.php&#039;;
$purifier = new HTMLPurifier();
$clean_html = $purifier->purify($dirty_html);
echo $clean_html . "\n<br />";
?>

Is there any way to have HTML Purifier automatically clean the html between the html tags?

<html>all tags to be processed</html>

Thanks

Re: Automatically Clean tags within the html tags
November 26, 2007 01:24PM

Hi, I'm not sure what you're trying to do. Are you embedding HTML in BBCode, or something like that? HTML Purifier will automatically remove HTML tags.

Mark
Re: Automatically Clean tags within the html tags
November 28, 2007 08:38AM

Hi,

I have a simple website that is using php include files to insert repeating regions like the header and footer. The person who is updating the content for the website edits the content with Dreamweaver MX and uploads the files. He doesnt know very much about html and always stays in design view. His code nearly always contains a lot of errors and deprecated tags.

Is there any way that I can set HTML Purifier to automatically scan the content between the tags and purfiy the code before it is rendered in the browser?

Thanks :)

Mark
Re: Automatically Clean tags within the html tags
November 28, 2007 08:40AM

Sorry,

Was meant to read:

Is there any way that I can set HTML Purifier to automatically scan the content between the body tags and purfiy the code before it is rendered in the browser?

Re: Automatically Clean tags within the html tags
November 28, 2007 04:31PM

It's not recommended, because HTML Purifier specifically strips out things like JavaScript and Forms that, while not allowed for user-input, are absolutely necessary for the website itself.

I encourage you to look into HTML Tidy, as well as talking to the developer to get him to learn about semantic markup. :-)

Sorry, you do not have permission to post/reply in this forum.