Skip to content
Snippets Groups Projects
Commit 65224786 authored by Jared Hancock's avatar Jared Hancock
Browse files

Use <pre> elements for text emails

This provides better compatibility with mPDF, which doesn't support the CSS
white-space:pre-wrap property
parent 44d3e0e5
Branches
Tags
No related merge requests found
......@@ -168,6 +168,7 @@ class Format {
'safe' => 1, //Exclude applet, embed, iframe, object and script tags.
'balance' => 1, //balance and close unclosed tags.
'comment' => 1, //Remove html comments (OUTLOOK LOVE THEM)
'tidy' => -1,
'deny_attribute' => 'id',
'schemes' => 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; *:file, http, https; src: cid, http, https, data',
'hook_tag' => function ($el, $attributes=0) {
......@@ -196,9 +197,6 @@ class Format {
}
);
if (!preg_match('/style="[^"]*white-space:\s*pre/i', $html) !== false)
$config['tidy'] = -1; // Clean extra whitspace
return Format::html($html, $config);
}
......
......@@ -431,7 +431,7 @@ class MailFetcher {
}
elseif ($body=$this->getPart($mid, 'text/plain', $this->charset)) {
$body = trim($body)
? sprintf('<div style="white-space:pre-wrap">%s</div>',
? sprintf('<pre>%s</pre>',
Format::htmlchars($body))
: '--';
}
......@@ -444,7 +444,7 @@ class MailFetcher {
$body = Format::html2text(Format::safe_html($body), 100, false);
}
$body = trim($body)
? sprintf('<div style="white-space:pre-wrap">%s</div>',
? sprintf('<pre>%s</pre>',
$body)
: '--';
}
......
......@@ -181,7 +181,7 @@ class Mail_Parse {
}
elseif ($body=$this->getPart($this->struct,'text/plain')) {
$body = trim($body)
? sprintf('<div style="white-space:pre-wrap">%s</div>',
? sprintf('<pre>%s</pre>',
Format::htmlchars($body))
: '--';
}
......@@ -194,7 +194,7 @@ class Mail_Parse {
$body = Format::html2text(Format::safe_html($body), 100, false);
}
$body = trim($body)
? sprintf('<div style="white-space:pre-wrap">%s</div>',
? sprintf('<pre>%s</pre>',
$body)
: '--';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment