THIS PROJECT IS NO LONGER MANTAINED, YOU CAN USE THE SOURCE CODE IN YOUR PROJECT AS YOU WANT
LAST UPDATE: 06/07/2010
STOP bad html inserted by your clients or by the users of your community!
This PHP class lets you clean and repair html code. Here is a quick list of the magic things it can do (it’s really good when you don’t have the possibility to install the Html Tidy module of PHP).
WHAT IT DOES:
- delete closed tags without their opening tag
- fix open tag without close, closing them automatically
- check bad nesting and fix them (if you have a bold inside a bold… or a paragrah that contains a table…)
- fix bad quotes in attributes (open quotes where missing…)
- merge different styles attributes in the same tag
- remove html comments
- remove empty tags and more bad tags
How does it works?
it’s a bit complex to explain, it analyzes char by char the html code, detecting nodes, watching inside each node to fix quotes, attributes, and more and finding their closing tags. Save every node found and it’s inner content in a matrix.
And then it reads the matrix to re-build the fixed html.
The matrix stores open tags, closed tags and content and lets count the errors.
NEW. version 2.05 date 06/07/2010
bug fixed on quotes by emmanuel (at) evobilis.com
added css style filter by Martin Vool
strips php code.
fixed a bug with non closing quotes.