From 11f0817341840928d6ab393b6a9d2942d9abd8e5 Mon Sep 17 00:00:00 2001 From: TommyO Date: Tue, 11 Nov 2008 19:54:15 +0000 Subject: [PATCH] Improved strip method for performance and clarity. git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7866 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/controller/components/email.php | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index 053a92d76..5e78a9387 100644 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -623,32 +623,15 @@ class EmailComponent extends Object{ * @access private */ function __strip($value, $message = false) { -/* $search = '%0a|%0d|Content-(?:Type|Transfer-Encoding)\:|charset\=|mime-version\:|multipart/mixed|(?:to|b?cc)\:.*'; if ($message !== true) { - $search .= '|\\r|\\n'; + $search .= '|\r|\n'; } $search = '#(?:' . $search . ')#i'; while (preg_match($search, $value)) { $value = preg_replace($search, '', $value); } return $value; -*/ - $search = array( - '/(?:%0a)/i', '/(?:%0d)/i', '/(?:Content-Type\:)/i', '/(?:charset\=)/i', '/(?:mime-version\:)/i', - '/(?:multipart\/mixed)/i', '/(?:bcc\:.*)/i','/(?:to\:.*)/i','/(?:cc\:.*)/i', '/(?:Content-Transfer-Encoding\:)/i', - '/\\r/i', '/\\n/i' - ); - if ($message === true) { - $search = array_slice($search, 0, -2); - } - - foreach ($search as $key) { - while (preg_match($key, $value)) { - $value = preg_replace($key, '', $value); - } - } - return preg_replace($search, '', $value); } /** * Wrapper for PHP mail function used for sending out emails