From b18106a39aa4e3190cfdb1193483f3f763e2cb37 Mon Sep 17 00:00:00 2001 From: Frank de Jonge Date: Sun, 23 Oct 2011 22:19:16 +0200 Subject: [PATCH] The utf8_char_boundary function was no longer used. --- classes/email/driver.php | 57 +++------------------------------------- 1 file changed, 3 insertions(+), 54 deletions(-) diff --git a/classes/email/driver.php b/classes/email/driver.php index 2e543a7..fd836a1 100644 --- a/classes/email/driver.php +++ b/classes/email/driver.php @@ -952,57 +952,6 @@ protected function build_message() ); } - /** - * Returns the uft8 character boundary - * - * @param string $encoded_text utf-8 encoded text - * @param int $max_length the max boundary position - * @return int the fount char boundary - */ - public static function utf8_char_boundary($encoded_text, $max_length) { - $found_split_pos = false; - $look_back = 3; - while ( ! $found_split_pos) - { - $last_chunk = substr($encoded_text, $max_length - $look_back, $look_back); - $encoded_char_pos = strpos($last_chunk, '='); - if ($encoded_char_pos !== false) - { - // Found start of encoded character byte within $lookBack block. - // Check the encoded byte value (the 2 chars after the '=') - $hex = substr($encoded_text, $max_length - $look_back + $encoded_char_pos + 1, 2); - $dec = hexdec($hex); - if ($dec < 128) - { - // Single byte character. - // If the encoded char was found at pos 0, it will fit - // otherwise reduce maxLength to start of the encoded char - $max_length = ($encoded_char_pos == 0) ? $max_length : - $max_length - ($look_back - $encoded_char_pos); - $found_split_pos = true; - } - elseif ($dec >= 192) - { - // First byte of a multi byte character - // Reduce maxLength to split at start of character - $max_length = $max_length - ($look_back - $encoded_char_pos); - $foundSplitPos = true; - } - elseif ($dec < 192) - { - // Middle byte of a multi byte character, look further back - $lookBack += 3; - } - } - else - { - // No encoded character found - $found_split_pos = true; - } - } - return $max_length; - } - /** * Wraps the body or alt text * @@ -1030,7 +979,7 @@ protected static function wrap_text($message, $length, $newline, $is_html = true */ protected static function prep_newlines($string, $newline = null) { - $newline or $newline = \Config::get('email.defaults.newline'); + $newline or $newline = \Config::get('email.defaults.newline', "\n"); $replace = array( "\r\n" => "\n", @@ -1054,9 +1003,9 @@ protected static function prep_newlines($string, $newline = null) * @param string $encoding the charset * @return string encoded string */ - public static function encode_string($string, $encoding, $newline = null) + protected static function encode_string($string, $encoding, $newline = null) { - $newline or $newline = \Config::get('email.defaults.newline', "\r\n"); + $newline or $newline = \Config::get('email.defaults.newline', "\n"); switch ($encoding) {