mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
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
This commit is contained in:
parent
5f0858e1ad
commit
11f0817341
1 changed files with 1 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue