1 mail.inc | _backdrop_html_to_text_pad($text, $pad, $prefix = '') |
Pads the last line with the given character.
See also
File
- core/
includes/ mail.inc, line 618 - API functions for processing and sending email.
Code
function _backdrop_html_to_text_pad($text, $pad, $prefix = '') {
// Remove last line break.
$text = substr($text, 0, -1);
// Calculate needed padding space and add it.
if (($p = strrpos($text, "\n")) === FALSE) {
$p = -1;
}
$n = max(0, 79 - (strlen($text) - $p) - strlen($prefix));
// Add prefix and padding, and restore line break.
return $text . $prefix . str_repeat($pad, $n) . "\n";
}