PEAR Mail package updated to 1.3.0

1.3.0 (stable) was released on 2016-01-31
Source: https://pear.php.net/package/Mail
This commit is contained in:
Mikael Nordfeldth
2016-03-05 02:54:13 +01:00
parent 57d57b8d8f
commit 204a8f1fcc
8 changed files with 89 additions and 129 deletions

View File

@@ -1,8 +1,8 @@
<?php
/**
* PEAR's Mail:: interface.
* PEAR's Mail:: interface.
*
* PHP versions 4 and 5
* PHP version 5
*
* LICENSE:
*
@@ -39,7 +39,7 @@
* @author Chuck Hagenbuch <chuck@horde.org>
* @copyright 1997-2010 Chuck Hagenbuch
* @license http://opensource.org/licenses/bsd-license.php New BSD License
* @version CVS: $Id: Mail.php 294747 2010-02-08 08:18:33Z clockwerx $
* @version CVS: $Id$
* @link http://pear.php.net/package/Mail/
*/
@@ -50,8 +50,7 @@ require_once 'PEAR.php';
* mailers under the PEAR hierarchy, and provides supporting functions
* useful in multiple mailer backends.
*
* @access public
* @version $Revision: 294747 $
* @version $Revision$
* @package Mail
*/
class Mail
@@ -60,7 +59,7 @@ class Mail
* Line terminator used for separating header lines.
* @var string
*/
var $sep = "\r\n";
public $sep = "\r\n";
/**
* Provides an interface for generating Mail:: objects of various
@@ -68,10 +67,10 @@ class Mail
*
* @param string $driver The kind of Mail:: object to instantiate.
* @param array $params The parameters to pass to the Mail:: object.
*
* @return object Mail a instance of the driver class or if fails a PEAR Error
* @access public
*/
function &factory($driver, $params = array())
public static function factory($driver, $params = array())
{
$driver = strtolower($driver);
@include_once 'Mail/' . $driver . '.php';
@@ -108,10 +107,9 @@ class Mail
* containing a descriptive error message on
* failure.
*
* @access public
* @deprecated use Mail_mail::send instead
*/
function send($recipients, $headers, $body)
public function send($recipients, $headers, $body)
{
if (!is_array($headers)) {
return PEAR::raiseError('$headers must be an array');
@@ -147,10 +145,8 @@ class Mail
* filter is to prevent mail injection attacks.
*
* @param array $headers The associative array of headers to sanitize.
*
* @access private
*/
function _sanitizeHeaders(&$headers)
protected function _sanitizeHeaders(&$headers)
{
foreach ($headers as $key => $value) {
$headers[$key] =
@@ -173,9 +169,8 @@ class Mail
* otherwise returns an array containing two
* elements: Any From: address found in the headers,
* and the plain text version of the headers.
* @access private
*/
function prepareHeaders($headers)
protected function prepareHeaders($headers)
{
$lines = array();
$from = null;
@@ -235,9 +230,8 @@ class Mail
*
* @return mixed An array of forward paths (bare addresses) or a PEAR_Error
* object if the address list could not be parsed.
* @access private
*/
function parseRecipients($recipients)
protected function parseRecipients($recipients)
{
include_once 'Mail/RFC822.php';
@@ -250,7 +244,8 @@ class Mail
// Parse recipients, leaving out all personal info. This is
// for smtp recipients, etc. All relevant personal information
// should already be in the headers.
$addresses = Mail_RFC822::parseAddressList($recipients, 'localhost', false);
$Mail_RFC822 = new Mail_RFC822();
$addresses = $Mail_RFC822->parseAddressList($recipients, 'localhost', false);
// If parseAddressList() returned a PEAR_Error object, just return it.
if (is_a($addresses, 'PEAR_Error')) {