The Elgg Community: Kses (link to source code)

https://code.elgg.org/elgg/releases/full/elgg1.5rc2/vendors/kses/
Kses is an HTML/XHTML filter written in PHP. It removes all unwanted
HTML elements and attributes, no matter how malformed HTML input you give it.
It also does several checks on attribute values. kses can be used to avoid
Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks,
among other things.


kses AUTHORS
============

* Ulf Harnhammar (main coder, project leader)
metaur at users dot sourceforge dot net
http://www.advogato.org/person/metaur/

* Richard R. V�squez, Jr. (coder of object-oriented kses)
contact him at http://chaos.org/contact/


The program is released under the terms of the GNU General Public License. You
should look into what that means, before using kses in your programs. You can
find the full text of the license in the file COPYING.