PHP Classes

Regulate XHTML Text: Encode characters in text in HTML tags

Recommend this page to a friend!
  Info   View files View files (11)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 432 This week: 1All time: 6,301 This week: 560Up
Version License PHP version Categories
xhtmlencode 1.0GNU General Publi...5.0HTML, PHP 5, Text processing, Security
Description 

Author

This class can encode characters in text in HTML tags.

It can take a text string eventual formatted with HTML tags and encodes all characters as HTML entities, preserving the original HTML markup.

The class can also replace line break characters by line break HTML tags if the line break is within an HTML tag.

It can also remove any JavaScript it finds to prevent cross-site scripting attacks.

Innovation Award
PHP Programming Innovation award nominee
July 2011
Number 6
Cleaning up and encoding text to show it in HTML pages is easy. However, if you need to properly encode text that is already within HTML tags, it is not so easy.

This class provides a solution that parses the HTML and rewrite the tags and data to properly encode all the text it contains.

Manuel Lemos
Picture of Joseph
Name: Joseph <contact>
Classes: 3 packages by
Country: United States United States
Age: ???
All time rank: 2707373 in United States United States
Week rank: 411 Up48 in United States United States Up
Innovation award
Innovation award
Nominee: 2x

  Files folder image Files  
File Role Description
Plain text file PHP_functions.php Class Source code for XHTML encode
Accessible without login HTML file PHP_functions-php_sourcecode.htm Data Source Code (highlighted) for XHTMLencode (and more)
Accessible without login Plain text file test_XHTMLencode.php Example Demo of Regulate Text Class (XHTMLencode)
Accessible without login HTML file test_XHTMLencode-php_sourcecode.htm Data Sourcecode of Demo for Regulate Text Class (XHTMLencode)
Accessible without login Plain text file PHP_functions-instructions.php Aux. How to use the RegulateText Class (XHTMLencode) and others
Accessible without login HTML file test_array_subkey-php_sourcecode.htm Data Sourcecode of Bonus Demo: array_subkey for PHP 5.3
Accessible without login HTML file test_array_subkey.php Example Demo of bonus: array_subkey for PHP 5.3
Accessible without login Image file SoftMoon.gif Icon foreground image
Accessible without login Image file SoftMoon.repeat-x.png Icon backgrournd image
Accessible without login Image file SoftMoon.repeat-y.png Icon background image
Accessible without login Image file SoftMoon.footer.back.png Icon background image

 Version Control Unique User Downloads Download Rankings  
 0%
Total:432
This week:1
All time:6,301
This week:560Up