diff options
author | GDmac <grdalenoort@gmail.com> | 2012-10-30 06:14:19 +0100 |
---|---|---|
committer | GDmac <grdalenoort@gmail.com> | 2012-10-30 06:14:19 +0100 |
commit | 9bea4be2efa74b963d3cd0bbaa4635deffc2f109 (patch) | |
tree | 2b4636f63ee802bc76be24cffb04411d2466332a /system/libraries/Email.php | |
parent | 51b7acda68a144d4e6d917f467a53d0299b326dd (diff) |
Fix #1938
Where the email library removed multiple spaces inside a plain text message.
Signed-off-by: GDmac <grdalenoort@gmail.com>
Diffstat (limited to 'system/libraries/Email.php')
-rw-r--r-- | system/libraries/Email.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php index edca303ff..7280466a5 100644 --- a/system/libraries/Email.php +++ b/system/libraries/Email.php @@ -770,6 +770,9 @@ class CI_Email { $body = str_replace(str_repeat("\n", $i), "\n\n", $body); } + // Reduce multiple spaces + $str = preg_replace('| +|', ' ', $str); + return ($this->wordwrap) ? $this->word_wrap($body, 76) : $body; @@ -792,15 +795,15 @@ class CI_Email { $charlim = empty($this->wrapchars) ? 76 : $this->wrapchars; } - // Reduce multiple spaces - $str = preg_replace('| +|', ' ', $str); - // Standardize newlines if (strpos($str, "\r") !== FALSE) { $str = str_replace(array("\r\n", "\r"), "\n", $str); } + // Reduce multiple spaces at end of line + $str = preg_replace('| +\n|', "\n", $str); + // If the current word is surrounded by {unwrap} tags we'll // strip the entire chunk and replace it with a marker. $unwrap = array(); |