Login   Register  
PHP Classes
elePHPant
Icontem

lib_text2html: Parse and process text and HTML to clean up

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2010-11-21 (4 years ago) RSS 2.0 feedNot yet rated by the usersTotal: 1,027 This week: 1All time: 3,338 This week: 1,398Up
Version License PHP version Categories  
lib_text2html 2.0GNU General Public Lice...5.0HTML, Text processing, Templates, Sec...
Description Author  

Process input HTML code.

Features:

- Parses input text, get HTML tags information;
- Removes unwanted HTML tags (configurable whitelist/blacklist);
- Removes unwanted HTML tag attributes depending on their name/value;
- Formats all HTML tags/attributes as lowercase/uppercase;
- Detects URLs in text and convert to HTML links;
- Encodes HTML special characters to entities, similar to PHP's built-in functions but more configurable;
- Decodes HTML entities (named and numeric) to the corresponding unicode characters (to avoid the problem of double entity encoding);
- Uses additional map file to decode unknown HTML entities;
- Support UTF-8 and ASCII/ISO-8859-1 charsets for HTML entities decode;
- Obfuscates properly writen e-mail addresses using HTML entities;
- Converts newline characters to <br />\n;
- Strips the texts in HTML comments out;
- Replaces arbitrary strings in text (array search/replace mapping).

You can pass the input text for every command individually, or once for the constructor to be chain-processed.

Default process settings (tags and their attributes lists) should be acceptable for most sites.

Picture of Mariusz Kaczmarczyk
Name: Mariusz Kaczmarczyk <contact>
Classes: 2 packages by
Country: Poland Poland
Age: 33
All time rank: 134634 in Poland Poland
Week rank: 560 Up12 in Poland Poland Up

  Files folder image Files  
File Role Description
Plain text file lib_text2html Class Class ver. 2.0
Plain text file html_entities.map Data Default HTML entities map, to be placed in the same directory as the class file
Plain text file test.php Example Example usage of the class

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,027All time:3,338
 This week:1This week:1,398Up