mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removed the format address method.
This commit is contained in:
parent
8f2aeec2f3
commit
84e405db81
2 changed files with 0 additions and 76 deletions
|
@ -514,27 +514,6 @@ class EmailComponent extends Component {
|
|||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a string as an email address
|
||||
*
|
||||
* @param string $string String representing an email address
|
||||
* @return string Email address suitable for email headers or smtp pipe
|
||||
* @access private
|
||||
*/
|
||||
function _formatAddress($string, $smtp = false) {
|
||||
$hasAlias = preg_match('/((.*))?\s?<(.+)>/', $string, $matches);
|
||||
if ($smtp && $hasAlias) {
|
||||
return $this->_strip('<' . $matches[3] . '>');
|
||||
} elseif ($smtp) {
|
||||
return $this->_strip('<' . $string . '>');
|
||||
}
|
||||
|
||||
if ($hasAlias && !empty($matches[2])) {
|
||||
return $this->_encode($matches[2]) . $this->_strip(' <' . $matches[3] . '>');
|
||||
}
|
||||
return $this->_strip($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format addresses to be an array with email as key and alias as value
|
||||
*
|
||||
|
|
|
@ -62,14 +62,6 @@ class EmailTestComponent extends EmailComponent {
|
|||
return parent::_strip($content, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper for testing.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function formatAddress($string, $smtp = false) {
|
||||
return parent::_formatAddress($string, $smtp);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -895,51 +887,4 @@ HTMLBLOC;
|
|||
$this->assertEqual($expected, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that _formatName doesn't jack up email addresses with alias parts.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testFormatAddressAliases() {
|
||||
$result = $this->Controller->EmailTest->formatAddress('email@example.com');
|
||||
$this->assertEqual($result, 'email@example.com');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('alias <email@example.com>');
|
||||
$this->assertEqual($result, 'alias <email@example.com>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('alias<email@example.com>');
|
||||
$this->assertEqual($result, 'alias <email@example.com>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('email@example.com');
|
||||
$this->assertEqual($result, 'email@example.com');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('<email@example.com>');
|
||||
$this->assertEqual($result, '<email@example.com>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('email@example.com', true);
|
||||
$this->assertEqual($result, '<email@example.com>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('<email@example.com>', true);
|
||||
$this->assertEqual($result, '<email@example.com>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('alias name <email@example.com>', true);
|
||||
$this->assertEqual($result, '<email@example.com>');
|
||||
}
|
||||
|
||||
/**
|
||||
* test formatting addresses with multibyte chars
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function testFormatAddressMultibyte() {
|
||||
$this->Controller->EmailTest->charset = 'UTF-8';
|
||||
$result = $this->Controller->EmailTest->formatAddress('ÄÖÜTest <email@domain.de>');
|
||||
$this->assertEqual($result, '=?UTF-8?B?w4TDlsOcVGVzdCA=?= <email@domain.de>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('ÄÖÜTest<email@domain.de>');
|
||||
$this->assertEqual($result, '=?UTF-8?B?w4TDlsOcVGVzdA==?= <email@domain.de>');
|
||||
|
||||
$result = $this->Controller->EmailTest->formatAddress('ÄÖÜTest <email@domain.de>', true);
|
||||
$this->assertEqual($result, '<email@domain.de>');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue