[Comoblog-commit] modules/mod_html2text mod_html2text_post_filter.php,NONE,1.1
Status: Inactive
Brought to you by:
markwallis
|
From: iamdecal <iam...@us...> - 2005-11-28 11:33:23
|
Update of /cvsroot/comoblog/modules/mod_html2text In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23710/mod_html2text Added Files: mod_html2text_post_filter.php Log Message: initial add - NOT FOR RELEASE - NEEDS FULL TESTING mod_html2text, i wrote this to help some one out, as i dont suffer from the problem its not been completly tested, howeve they havnt complained so im guess all is okay.. It converts the incoming posts from html to text - that actually a lie as it leaves in the image tags which tend to be on a remote server and so other wise wouldnt be found by easymoblog however it removes the BAD html imposed on some of us by the phone networks If you want to remove any text from the remaining text, - for instance if your phone provider adds some kind of company slogan or copyright message - you might want to look at mod_wordswapper which can be used to remove that.at some point Ill look at building that functionality into this module if people think its worth it --- NEW FILE: mod_html2text_post_filter.php --- <?php require_once(dirname(__FILE__).'/include/mod_html2text.inc.php'); // Include the class definition file. require_once('class.html2text.inc'); // The "source" HTML you want to convert. $html = $post['post_mail_body'] // Instantiate a new instance of the class. Passing the string // variable automatically loads the HTML for you. $h2t =& new html2text($html); $h2t->set_allowed_tags(CFG_HTML2TEXT_ALLOWED_TAGS); // Simply call the get_text() method for the class to convert // the HTML to the plain text. Store it into the variable. $post['post_mail_body'] = $h2t->get_text(); ?> |