Skip to content
Snippets Groups Projects
Commit 98f0fceb authored by Bob Vincent's avatar Bob Vincent
Browse files

Update mailsystem_html_to_text

parent 0546e51f
No related branches found
No related tags found
No related merge requests found
......@@ -304,11 +304,18 @@ function &mailsystem_get_classes() {
* The output will be suitable for use as 'format=flowed; delsp=yes' text
* (RFC 3676) and can be passed directly to drupal_mail() for sending.
*
* We deliberately use LF rather than CRLF, see drupal_mail().
* We deliberately use MAIL_LINE_ENDINGS rather than CRLF.
*
* This function provides suitable alternatives for the following tags:
* <a> <em> <i> <strong> <b> <br> <p> <blockquote> <ul> <ol> <li> <dl> <dt>
* <dd> <h1> <h2> <h3> <h4> <h5> <h6> <hr>
*
* <a> <address> <b> <blockquote> <br /> <dd> <dl> <dt> <em>
* <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <ol> <p> <strong> <ul>
*
* The following tags are also handled:
*
* <del> <div> <ins> <pre> <tr>: Rendered the same as a <p> tag.
*
* <td>: A space is inserted between adjacent table cells.
*
* @param $string
* The string to be transformed.
......@@ -322,7 +329,7 @@ function &mailsystem_get_classes() {
* Note: This is a corrected version of html_to_text() that hopefully will
* get included into core at some point.
*
* @see http://drupal.org/node/299138
* @see drupal_mail()
*/
function mailsystem_html_to_text($string, $allowed_tags = NULL) {
// Cache list of supported tags.
......@@ -520,6 +527,5 @@ function mailsystem_html_to_text($string, $allowed_tags = NULL) {
$tag = !$tag;
}
return $output . $footnotes;
return ltrim(rtrim($output . $footnotes, " \r\n"), "\r\n");
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment