From 66afd70b756a0637da3537e96f6bf6ce0a2c46e9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 26 Dec 2012 12:14:34 +0100 Subject: Framework'ize html2text class --- program/steps/mail/compose.inc | 4 ++-- program/steps/mail/func.inc | 2 +- program/steps/mail/sendmail.inc | 2 +- program/steps/utils/html2text.inc | 4 +--- 4 files changed, 5 insertions(+), 7 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index d07cf587f..379e920e5 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -470,7 +470,7 @@ function rcmail_compose_header_from($attrib) $text = $html = $sql_arr['signature']; if ($sql_arr['html_signature']) { - $h2t = new html2text($sql_arr['signature'], false, false); + $h2t = new rcube_html2text($sql_arr['signature'], false, false); $text = trim($h2t->get_text()); } else { @@ -667,7 +667,7 @@ function rcmail_compose_part_body($part, $isHtml = false) // use html part if it has been used for message (pre)viewing // decrease line length for quoting $len = $compose_mode == RCUBE_COMPOSE_REPLY ? $LINE_LENGTH-2 : $LINE_LENGTH; - $txt = new html2text($body, false, true, $len); + $txt = new rcube_html2text($body, false, true, $len); $body = $txt->get_text(); } else if ($part->ctype_secondary == 'enriched') { diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 90f54cf1b..814adb64d 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -704,7 +704,7 @@ function rcmail_print_body($part, $p = array()) // convert html to text/plain if ($data['type'] == 'html' && $data['plain']) { - $txt = new html2text($data['body'], false, true); + $txt = new rcube_html2text($data['body'], false, true); $body = $txt->get_text(); $part->ctype_secondary = 'plain'; } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 36d850f8f..eb0ba89c6 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -559,7 +559,7 @@ if ($isHtml) { $plugin['body'] = rcmail_replace_emoticons($plugin['body']); // add a plain text version of the e-mail as an alternative part. - $h2t = new html2text($plugin['body'], false, true, 0, $message_charset); + $h2t = new rcube_html2text($plugin['body'], false, true, 0, $message_charset); $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n", false, $message_charset); $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); diff --git a/program/steps/utils/html2text.inc b/program/steps/utils/html2text.inc index e17665fec..c6481b197 100644 --- a/program/steps/utils/html2text.inc +++ b/program/steps/utils/html2text.inc @@ -24,10 +24,8 @@ $html = $HTTP_RAW_POST_DATA; // Replace emoticon images with its text representation $html = rcmail_replace_emoticons($html); -$converter = new html2text($html, false, true, 0); +$converter = new rcube_html2text($html, false, true, 0); header('Content-Type: text/plain; charset=UTF-8'); print rtrim($converter->get_text()); exit; - - -- cgit v1.2.3