note 100781 deleted from function.htmlentities by danbrown
| From: | danbrown@php.net | Date: | Fri, 05 Nov 2010 20:06:58 +0000 |
| Subject: | note 100781 deleted from function.htmlentities by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-173804@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I wrote a class with methods to convert stray characters to entities as needed while preserving
existing entities as well as well formed html tags of your choice. It can pull out JavaScript from
the tags you allow (and I may soon enable pulling style attributes also). It can convert all 253 of
your named entities to numeric entities and visa versa. It also applies nl2br intelligently. It
cleans up whitespace and/or control characters to your liking, and can "hardspace" the
whitespace to retain the intended text-based layout format should you choose. It's my answer
to the dilemma of "does the person maintaining the content of the website know HTML?" and
I tried to balance the need for speed with requirement of XHTML validation.
It's become too long to post in these comments, but you can find the free PHP source code here:
http://softmoon-webware.com/PHP_functions-instructions.php#toXHTML
PEACE