From 71b163d3eebee598846e15b07e946c09de0db90e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 21 Jan 2006 23:22:07 +0000 Subject: [PATCH] Moving Mail::_convert_line_breaks() to Functions::convert_line_breaks() --- functions.php | 19 +++++++++++++++++++ mail.php | 25 +++---------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/functions.php b/functions.php index fd2c40f..714dfe4 100644 --- a/functions.php +++ b/functions.php @@ -615,6 +615,25 @@ class Functions } return $filelist; } + + // ################################################################### + /** + * Changes line breaks into one format + * + * @access public + * + * @param string Text + * @param string New line break (default is UNIX format) + * + * @return string Text with one type of line break + */ + function convert_line_breaks($text, $convert_to = "\n") + { + $text = trim($text); + $text = str_replace(array("\r\n", "\r", "\n"), "\n", $text); + $text = str_replace("\n", $convert_to, $text); + return $text; + } } /*=====================================================================*\ diff --git a/mail.php b/mail.php index 41257c0..84c5de5 100644 --- a/mail.php +++ b/mail.php @@ -218,11 +218,11 @@ class Mail } else { - $this->body = $this->_convert_line_breaks($this->body); + $this->body = $this->registry->modules['functions']->convert_line_breaks($this->body); $this->body = trim($this->registry->unsanitize($this->body, true)); } - $this->headers = $this->_convert_line_breaks($this->headers); + $this->headers = $this->registry->modules['functions']->convert_line_breaks($this->headers); $this->headers .= "From: \"{$this->fromname}\" <{$this->from}>\n"; $this->headers .= "Return-Path: {$this->from}\n"; $this->headers .= "X-Mailer: ISSO Mail Framework \$Revision$\n"; @@ -253,29 +253,10 @@ class Mail */ function _fetch_first_line($string) { - $string = $this->_convert_line_breaks($string); + $string = $this->registry->modules['functions']->convert_line_breaks($string); $broken = explode("\n", $string); return $broken[0]; } - - // ################################################################### - /** - * Changes line breaks into one format - * - * @access private - * - * @param string Text - * @param string New line break (default is UNIX format) - * - * @return string Text with one type of line break - */ - function _convert_line_breaks($text, $convert_to = "\n") - { - $text = trim($text); - $text = str_replace(array("\r\n", "\r", "\n"), "\n", $text); - $text = str_replace("\n", $convert_to, $text); - return $text; - } } /*=====================================================================*\ -- 2.22.5