TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-02-2008, 02:28 PM   #1 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default HTML tags

I'm about to start writing a class for performing HTML cleanup and perhaps validation. Before doing that, however, I'd like to know if there is already some PHP extension that could do that. It would be easier, as well as faster. If not, could you perhaps give me some advice on the implementation? I mean, replacing ALL tags would be a relatively easy task. But how about removing all tags that are not in a set of allowed tags?

PS: please don't give me the strip_tags function. I know it's there, but I'd rather not use it. It has its flaws, I've experienced some with it and I've seen others have problems with it.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Old 02-02-2008, 04:03 PM   #2 (permalink)
The Addict
 
Join Date: Nov 2007
Posts: 264
Thanks: 2
TlcAndres is on a distinguished road
Default

For validation I believe WC3 has an pear API you could look at, don't exactly know the link to it though.
TlcAndres is offline  
Reply With Quote
Old 02-02-2008, 04:16 PM   #3 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

The biggie in this field would be Tidy for "HTML cleanup". There's also HTML Purifier (fairly new, PHP5) if you're looking more towards filtering, XSS prevention and so on.

For the W3C validation using PEAR that TicAndres mentioned, there's: Servies_W3C_HTMLValidator
Salathe is offline  
Reply With Quote
The Following User Says Thank You to Salathe For This Useful Post:
xenon (02-02-2008)
Old 02-02-2008, 04:30 PM   #4 (permalink)
The Frequenter
Newcomer 
 
xenon's Avatar
 
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 438
Thanks: 3
xenon is on a distinguished road
Default

Thanks Salathe, I'll look into HTML Purifier. I've heard about it some time ago, but forgot about it. Its features sound good. And I wouldn't have to write a library myself.
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
xenon is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:32 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design