forked from Wavyzz/dolibarr
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -99,8 +99,6 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -108,8 +106,6 @@ class Swift_Plugins_AntiFloodPlugin implements Swift_Events_SendListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
private $in = 0;
|
||||
|
||||
/** Bound byte streams */
|
||||
private $mirrors = array();
|
||||
private $mirrors = [];
|
||||
|
||||
/**
|
||||
* Not used.
|
||||
@@ -41,8 +41,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -52,24 +50,20 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
|
||||
/**
|
||||
* Invoked immediately following a command being sent.
|
||||
*
|
||||
* @param Swift_Events_CommandEvent $evt
|
||||
*/
|
||||
public function commandSent(Swift_Events_CommandEvent $evt)
|
||||
{
|
||||
$command = $evt->getCommand();
|
||||
$this->out += strlen($command);
|
||||
$this->out += \strlen($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately following a response coming back.
|
||||
*
|
||||
* @param Swift_Events_ResponseEvent $evt
|
||||
*/
|
||||
public function responseReceived(Swift_Events_ResponseEvent $evt)
|
||||
{
|
||||
$response = $evt->getResponse();
|
||||
$this->in += strlen($response);
|
||||
$this->in += \strlen($response);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +73,7 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
*/
|
||||
public function write($bytes)
|
||||
{
|
||||
$this->out += strlen($bytes);
|
||||
$this->out += \strlen($bytes);
|
||||
foreach ($this->mirrors as $stream) {
|
||||
$stream->write($bytes);
|
||||
}
|
||||
@@ -97,8 +91,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
*
|
||||
* The stream acts as an observer, receiving all data that is written.
|
||||
* All {@link write()} and {@link flushBuffers()} operations will be mirrored.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function bind(Swift_InputByteStream $is)
|
||||
{
|
||||
@@ -111,8 +103,6 @@ class Swift_Plugins_BandwidthMonitorPlugin implements Swift_Events_SendListener,
|
||||
* If $is is not bound, no errors will be raised.
|
||||
* If the stream currently has any buffered data it will be written to $is
|
||||
* before unbinding occurs.
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function unbind(Swift_InputByteStream $is)
|
||||
{
|
||||
|
||||
@@ -23,10 +23,10 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
private $originalBody;
|
||||
|
||||
/** The original headers of the message, before replacements */
|
||||
private $originalHeaders = array();
|
||||
private $originalHeaders = [];
|
||||
|
||||
/** Bodies of children before they are replaced */
|
||||
private $originalChildBodies = array();
|
||||
private $originalChildBodies = [];
|
||||
|
||||
/** The Message that was last replaced */
|
||||
private $lastMessage;
|
||||
@@ -74,8 +74,6 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -98,20 +96,20 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
foreach ($message->getHeaders()->getAll() as $header) {
|
||||
$body = $header->getFieldBodyModel();
|
||||
$count = 0;
|
||||
if (is_array($body)) {
|
||||
$bodyReplaced = array();
|
||||
if (\is_array($body)) {
|
||||
$bodyReplaced = [];
|
||||
foreach ($body as $key => $value) {
|
||||
$count1 = 0;
|
||||
$count2 = 0;
|
||||
$key = is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
|
||||
$value = is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
|
||||
$key = \is_string($key) ? str_replace($search, $replace, $key, $count1) : $key;
|
||||
$value = \is_string($value) ? str_replace($search, $replace, $value, $count2) : $value;
|
||||
$bodyReplaced[$key] = $value;
|
||||
|
||||
if (!$count && ($count1 || $count2)) {
|
||||
$count = 1;
|
||||
}
|
||||
}
|
||||
} elseif (is_string($body)) {
|
||||
} elseif (\is_string($body)) {
|
||||
$bodyReplaced = str_replace($search, $replace, $body, $count);
|
||||
}
|
||||
|
||||
@@ -159,13 +157,11 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
return $this->replacements->getReplacementsFor($address);
|
||||
}
|
||||
|
||||
return isset($this->replacements[$address]) ? $this->replacements[$address] : null;
|
||||
return $this->replacements[$address] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -182,21 +178,21 @@ class Swift_Plugins_DecoratorPlugin implements Swift_Events_SendListener, Swift_
|
||||
}
|
||||
if (!empty($this->originalHeaders)) {
|
||||
foreach ($message->getHeaders()->getAll() as $header) {
|
||||
if (array_key_exists($header->getFieldName(), $this->originalHeaders)) {
|
||||
if (\array_key_exists($header->getFieldName(), $this->originalHeaders)) {
|
||||
$header->setFieldBodyModel($this->originalHeaders[$header->getFieldName()]);
|
||||
}
|
||||
}
|
||||
$this->originalHeaders = array();
|
||||
$this->originalHeaders = [];
|
||||
}
|
||||
if (!empty($this->originalChildBodies)) {
|
||||
$children = (array) $message->getChildren();
|
||||
foreach ($children as $child) {
|
||||
$id = $child->getId();
|
||||
if (array_key_exists($id, $this->originalChildBodies)) {
|
||||
if (\array_key_exists($id, $this->originalChildBodies)) {
|
||||
$child->setBody($this->originalChildBodies[$id]);
|
||||
}
|
||||
}
|
||||
$this->originalChildBodies = array();
|
||||
$this->originalChildBodies = [];
|
||||
}
|
||||
$this->lastMessage = null;
|
||||
}
|
||||
|
||||
@@ -34,8 +34,6 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -51,8 +49,6 @@ class Swift_Plugins_ImpersonatePlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
|
||||
@@ -20,8 +20,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
|
||||
|
||||
/**
|
||||
* Create a new LoggerPlugin using $logger.
|
||||
*
|
||||
* @param Swift_Plugins_Logger $logger
|
||||
*/
|
||||
public function __construct(Swift_Plugins_Logger $logger)
|
||||
{
|
||||
@@ -58,8 +56,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked immediately following a command being sent.
|
||||
*
|
||||
* @param Swift_Events_CommandEvent $evt
|
||||
*/
|
||||
public function commandSent(Swift_Events_CommandEvent $evt)
|
||||
{
|
||||
@@ -69,8 +65,6 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked immediately following a response coming back.
|
||||
*
|
||||
* @param Swift_Events_ResponseEvent $evt
|
||||
*/
|
||||
public function responseReceived(Swift_Events_ResponseEvent $evt)
|
||||
{
|
||||
@@ -80,52 +74,42 @@ class Swift_Plugins_LoggerPlugin implements Swift_Events_CommandListener, Swift_
|
||||
|
||||
/**
|
||||
* Invoked just before a Transport is started.
|
||||
*
|
||||
* @param Swift_Events_TransportChangeEvent $evt
|
||||
*/
|
||||
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
|
||||
{
|
||||
$transportName = get_class($evt->getSource());
|
||||
$transportName = \get_class($evt->getSource());
|
||||
$this->logger->add(sprintf('++ Starting %s', $transportName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Transport is started.
|
||||
*
|
||||
* @param Swift_Events_TransportChangeEvent $evt
|
||||
*/
|
||||
public function transportStarted(Swift_Events_TransportChangeEvent $evt)
|
||||
{
|
||||
$transportName = get_class($evt->getSource());
|
||||
$transportName = \get_class($evt->getSource());
|
||||
$this->logger->add(sprintf('++ %s started', $transportName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked just before a Transport is stopped.
|
||||
*
|
||||
* @param Swift_Events_TransportChangeEvent $evt
|
||||
*/
|
||||
public function beforeTransportStopped(Swift_Events_TransportChangeEvent $evt)
|
||||
{
|
||||
$transportName = get_class($evt->getSource());
|
||||
$transportName = \get_class($evt->getSource());
|
||||
$this->logger->add(sprintf('++ Stopping %s', $transportName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Transport is stopped.
|
||||
*
|
||||
* @param Swift_Events_TransportChangeEvent $evt
|
||||
*/
|
||||
public function transportStopped(Swift_Events_TransportChangeEvent $evt)
|
||||
{
|
||||
$transportName = get_class($evt->getSource());
|
||||
$transportName = \get_class($evt->getSource());
|
||||
$this->logger->add(sprintf('++ %s stopped', $transportName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked as a TransportException is thrown in the Transport system.
|
||||
*
|
||||
* @param Swift_Events_TransportExceptionEvent $evt
|
||||
*/
|
||||
public function exceptionThrown(Swift_Events_TransportExceptionEvent $evt)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $log = array();
|
||||
private $log = [];
|
||||
|
||||
/**
|
||||
* Max size of the log.
|
||||
@@ -47,7 +47,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
|
||||
public function add($entry)
|
||||
{
|
||||
$this->log[] = $entry;
|
||||
while (count($this->log) > $this->size) {
|
||||
while (\count($this->log) > $this->size) {
|
||||
array_shift($this->log);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ class Swift_Plugins_Loggers_ArrayLogger implements Swift_Plugins_Logger
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->log = array();
|
||||
$this->log = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
||||
{
|
||||
/**
|
||||
* @var Swift_Mime_Message[]
|
||||
* @var Swift_Mime_SimpleMessage[]
|
||||
*/
|
||||
private $messages;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->messages = array();
|
||||
$this->messages = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the message list.
|
||||
*
|
||||
* @return Swift_Mime_Message[]
|
||||
* @return Swift_Mime_SimpleMessage[]
|
||||
*/
|
||||
public function getMessages()
|
||||
{
|
||||
@@ -42,7 +42,7 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
||||
*/
|
||||
public function countMessages()
|
||||
{
|
||||
return count($this->messages);
|
||||
return \count($this->messages);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,13 +50,11 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->messages = array();
|
||||
$this->messages = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -65,8 +63,6 @@ class Swift_Plugins_MessageLogger implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
|
||||
@@ -45,7 +45,8 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
/**
|
||||
* Create a new PopBeforeSmtpPlugin for $host and $port.
|
||||
*
|
||||
* @param string $host
|
||||
* @param string $host Hostname or IP. Literal IPv6 addresses should be
|
||||
* wrapped in square brackets.
|
||||
* @param int $port
|
||||
* @param string $crypto as "tls" or "ssl"
|
||||
*/
|
||||
@@ -59,8 +60,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
/**
|
||||
* Set a Pop3Connection to delegate to instead of connecting directly.
|
||||
*
|
||||
* @param Swift_Plugins_Pop_Pop3Connection $connection
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConnection(Swift_Plugins_Pop_Pop3Connection $connection)
|
||||
@@ -72,8 +71,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
|
||||
/**
|
||||
* Bind this plugin to a specific SMTP transport instance.
|
||||
*
|
||||
* @param Swift_Transport
|
||||
*/
|
||||
public function bindSmtp(Swift_Transport $smtp)
|
||||
{
|
||||
@@ -135,16 +132,12 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
if (!isset($this->socket)) {
|
||||
if (!$socket = fsockopen(
|
||||
$this->getHostString(), $this->port, $errno, $errstr, $this->timeout)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr)
|
||||
);
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]: %s', $this->host, $errstr));
|
||||
}
|
||||
$this->socket = $socket;
|
||||
|
||||
if (false === $greeting = fgets($this->socket)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('Failed to connect to POP3 host [%s]', trim($greeting))
|
||||
);
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to connect to POP3 host [%s]', trim($greeting ?? '')));
|
||||
}
|
||||
|
||||
$this->assertOk($greeting);
|
||||
@@ -167,9 +160,7 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
} else {
|
||||
$this->command("QUIT\r\n");
|
||||
if (!fclose($this->socket)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('POP3 host [%s] connection could not be stopped', $this->host)
|
||||
);
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 host [%s] connection could not be stopped', $this->host));
|
||||
}
|
||||
$this->socket = null;
|
||||
}
|
||||
@@ -177,8 +168,6 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
|
||||
/**
|
||||
* Invoked just before a Transport is started.
|
||||
*
|
||||
* @param Swift_Events_TransportChangeEvent $evt
|
||||
*/
|
||||
public function beforeTransportStarted(Swift_Events_TransportChangeEvent $evt)
|
||||
{
|
||||
@@ -216,15 +205,11 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
private function command($command)
|
||||
{
|
||||
if (!fwrite($this->socket, $command)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('Failed to write command [%s] to POP3 host', trim($command))
|
||||
);
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to write command [%s] to POP3 host', trim($command ?? '')));
|
||||
}
|
||||
|
||||
if (false === $response = fgets($this->socket)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('Failed to read from POP3 host after command [%s]', trim($command))
|
||||
);
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('Failed to read from POP3 host after command [%s]', trim($command ?? '')));
|
||||
}
|
||||
|
||||
$this->assertOk($response);
|
||||
@@ -234,17 +219,15 @@ class Swift_Plugins_PopBeforeSmtpPlugin implements Swift_Events_TransportChangeL
|
||||
|
||||
private function assertOk($response)
|
||||
{
|
||||
if (substr($response, 0, 3) != '+OK') {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(
|
||||
sprintf('POP3 command failed [%s]', trim($response))
|
||||
);
|
||||
if ('+OK' != substr($response, 0, 3)) {
|
||||
throw new Swift_Plugins_Pop_Pop3Exception(sprintf('POP3 command failed [%s]', trim($response ?? '')));
|
||||
}
|
||||
}
|
||||
|
||||
private function getHostString()
|
||||
{
|
||||
$host = $this->host;
|
||||
switch (strtolower($this->crypto)) {
|
||||
switch (strtolower($this->crypto ?? '')) {
|
||||
case 'ssl':
|
||||
$host = 'ssl://'.$host;
|
||||
break;
|
||||
|
||||
@@ -27,15 +27,14 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $whitelist = array();
|
||||
private $whitelist = [];
|
||||
|
||||
/**
|
||||
* Create a new RedirectingPlugin.
|
||||
*
|
||||
* @param mixed $recipient
|
||||
* @param array $whitelist
|
||||
*/
|
||||
public function __construct($recipient, array $whitelist = array())
|
||||
public function __construct($recipient, array $whitelist = [])
|
||||
{
|
||||
$this->recipient = $recipient;
|
||||
$this->whitelist = $whitelist;
|
||||
@@ -63,8 +62,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Set a list of regular expressions to whitelist certain recipients.
|
||||
*
|
||||
* @param array $whitelist
|
||||
*/
|
||||
public function setWhitelist(array $whitelist)
|
||||
{
|
||||
@@ -83,8 +80,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -113,11 +108,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
// Add each hard coded recipient
|
||||
$to = $message->getTo();
|
||||
if (null === $to) {
|
||||
$to = array();
|
||||
$to = [];
|
||||
}
|
||||
|
||||
foreach ((array) $this->recipient as $recipient) {
|
||||
if (!array_key_exists($recipient, $to)) {
|
||||
if (!\array_key_exists($recipient, $to)) {
|
||||
$message->addTo($recipient);
|
||||
}
|
||||
}
|
||||
@@ -126,8 +121,7 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
/**
|
||||
* Filter header set against a whitelist of regular expressions.
|
||||
*
|
||||
* @param Swift_Mime_SimpleHeaderSet $headerSet
|
||||
* @param string $type
|
||||
* @param string $type
|
||||
*/
|
||||
private function filterHeaderSet(Swift_Mime_SimpleHeaderSet $headerSet, $type)
|
||||
{
|
||||
@@ -139,13 +133,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
/**
|
||||
* Filtered list of addresses => name pairs.
|
||||
*
|
||||
* @param array $recipients
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function filterNameAddresses(array $recipients)
|
||||
{
|
||||
$filtered = array();
|
||||
$filtered = [];
|
||||
|
||||
foreach ($recipients as $address => $name) {
|
||||
if ($this->isWhitelisted($address)) {
|
||||
@@ -159,13 +151,11 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
/**
|
||||
* Matches address against whitelist of regular expressions.
|
||||
*
|
||||
* @param $recipient
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isWhitelisted($recipient)
|
||||
{
|
||||
if (in_array($recipient, (array) $this->recipient)) {
|
||||
if (\in_array($recipient, (array) $this->recipient)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -180,8 +170,6 @@ class Swift_Plugins_RedirectingPlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
|
||||
@@ -24,9 +24,8 @@ interface Swift_Plugins_Reporter
|
||||
/**
|
||||
* Notifies this ReportNotifier that $address failed or succeeded.
|
||||
*
|
||||
* @param Swift_Mime_SimpleMessage $message
|
||||
* @param string $address
|
||||
* @param int $result from {@link RESULT_PASS, RESULT_FAIL}
|
||||
* @param string $address
|
||||
* @param int $result from {@link RESULT_PASS, RESULT_FAIL}
|
||||
*/
|
||||
public function notify(Swift_Mime_SimpleMessage $message, $address, $result);
|
||||
}
|
||||
|
||||
@@ -24,8 +24,6 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Create a new ReporterPlugin using $reporter.
|
||||
*
|
||||
* @param Swift_Plugins_Reporter $reporter
|
||||
*/
|
||||
public function __construct(Swift_Plugins_Reporter $reporter)
|
||||
{
|
||||
@@ -41,21 +39,19 @@ class Swift_Plugins_ReporterPlugin implements Swift_Events_SendListener
|
||||
|
||||
/**
|
||||
* Invoked immediately after the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
$message = $evt->getMessage();
|
||||
$failures = array_flip($evt->getFailedRecipients());
|
||||
foreach ((array) $message->getTo() as $address => $null) {
|
||||
$this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
}
|
||||
foreach ((array) $message->getCc() as $address => $null) {
|
||||
$this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
}
|
||||
foreach ((array) $message->getBcc() as $address => $null) {
|
||||
$this->reporter->notify($message, $address, (array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
$this->reporter->notify($message, $address, (\array_key_exists($address, $failures) ? Swift_Plugins_Reporter::RESULT_FAIL : Swift_Plugins_Reporter::RESULT_PASS));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,16 +20,15 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $failures = array();
|
||||
private $failures = [];
|
||||
|
||||
private $failures_cache = array();
|
||||
private $failures_cache = [];
|
||||
|
||||
/**
|
||||
* Notifies this ReportNotifier that $address failed or succeeded.
|
||||
*
|
||||
* @param Swift_Mime_SimpleMessage $message
|
||||
* @param string $address
|
||||
* @param int $result from {@link RESULT_PASS, RESULT_FAIL}
|
||||
* @param string $address
|
||||
* @param int $result from {@link RESULT_PASS, RESULT_FAIL}
|
||||
*/
|
||||
public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
|
||||
{
|
||||
@@ -54,6 +53,6 @@ class Swift_Plugins_Reporters_HitReporter implements Swift_Plugins_Reporter
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->failures = $this->failures_cache = array();
|
||||
$this->failures = $this->failures_cache = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,8 @@ class Swift_Plugins_Reporters_HtmlReporter implements Swift_Plugins_Reporter
|
||||
/**
|
||||
* Notifies this ReportNotifier that $address failed or succeeded.
|
||||
*
|
||||
* @param Swift_Mime_SimpleMessage $message
|
||||
* @param string $address
|
||||
* @param int $result from {@see RESULT_PASS, RESULT_FAIL}
|
||||
* @param string $address
|
||||
* @param int $result from {@see RESULT_PASS, RESULT_FAIL}
|
||||
*/
|
||||
public function notify(Swift_Mime_SimpleMessage $message, $address, $result)
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
|
||||
* Create a new ThrottlerPlugin.
|
||||
*
|
||||
* @param int $rate
|
||||
* @param int $mode, defaults to {@link BYTES_PER_MINUTE}
|
||||
* @param int $mode defaults to {@link BYTES_PER_MINUTE}
|
||||
* @param Swift_Plugins_Sleeper $sleeper (only needed in testing)
|
||||
* @param Swift_Plugins_Timer $timer (only needed in testing)
|
||||
*/
|
||||
@@ -86,8 +86,6 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
|
||||
|
||||
/**
|
||||
* Invoked immediately before the Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function beforeSendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
@@ -119,8 +117,6 @@ class Swift_Plugins_ThrottlerPlugin extends Swift_Plugins_BandwidthMonitorPlugin
|
||||
|
||||
/**
|
||||
* Invoked when a Message is sent.
|
||||
*
|
||||
* @param Swift_Events_SendEvent $evt
|
||||
*/
|
||||
public function sendPerformed(Swift_Events_SendEvent $evt)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user