first commit

This commit is contained in:
2026-04-30 14:38:11 +02:00
commit e22bbde336
1994 changed files with 613950 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Before Command Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a CommandEvent, before it is sent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_BeforeCommandListener extends Swift_Events_Listener
{
/**
* Executes just before Swift sends a command
* @param Swift_Events_CommandEvent Information about the being command sent
*/
public function beforeCommandSent(Swift_Events_CommandEvent $e);
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Before Send Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a SendEvent before the message is sent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_BeforeSendListener extends Swift_Events_Listener
{
/**
* Executes just before Swift sends a message
* @param Swift_Events_SendEvent Information about the message being sent
*/
public function beforeSendPerformed(Swift_Events_SendEvent $e);
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Swift Mailer Command Event
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Generated when Swift is sending a command
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_CommandEvent extends Swift_Events
{
/**
* Contains the command being sent
* @var string
*/
protected $string = null;
/**
* Contains the expected response code (or null)
* @var int
*/
protected $code = null;
/**
* Constructor
* @param string The command being sent
* @param int The expected code
*/
public function __construct($string, $code=null)
{
$this->setString($string);
$this->setCode($code);
}
/**
* Set the command being sent (without CRLF)
* @param string The command being sent
*/
public function setString($string)
{
$this->string = (string) $string;
}
/**
* Get the command being sent
* @return string
*/
public function getString()
{
return $this->string;
}
/**
* Set response code which is expected
* @param int The response code
*/
public function setCode($code)
{
if ($code === null) $this->code = null;
else $this->code = (int) $code;
}
/**
* Get the expected response code
* @return int
*/
public function getCode()
{
return $this->code;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Command Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a CommandEvent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_CommandListener extends Swift_Events_Listener
{
/**
* Executes when Swift sends a command
* @param Swift_Events_CommandEvent Information about the command sent
*/
public function commandSent(Swift_Events_CommandEvent $e);
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Swift Mailer Connect Event
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Generated every time Swift connects with a MTA
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_ConnectEvent extends Swift_Events
{
/**
* A reference to the connection object
* @var Swift_Connection
*/
protected $connection = null;
/**
* Constructor
* @param Swift_Connection The new connection
*/
public function __construct(Swift_Connection $connection)
{
$this->connection = $connection;
}
/**
* Get the connection object
* @return Swift_Connection
*/
public function getConnection()
{
return $this->connection;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Connect Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a ConnectEvent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_ConnectListener extends Swift_Events_Listener
{
/**
* Executes when Swift initiates a connection
* @param Swift_Events_ConnectEvent Information about the connection
*/
public function connectPerformed(Swift_Events_ConnectEvent $e);
}

View File

@@ -0,0 +1,42 @@
<?php
/**
* Swift Mailer Disconnect Event
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Generated every time Swift disconnects from a MTA
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_DisconnectEvent extends Swift_Events
{
/**
* A reference to the connection object
* @var Swift_Connection
*/
protected $connection = null;
/**
* Constructor
* @param Swift_Connection The dead connection
*/
public function __construct(Swift_Connection $connection)
{
$this->connection = $connection;
}
/**
* Get the connection object
* @return Swift_Connection
*/
public function getConnection()
{
return $this->connection;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Disconnect Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a DisconnectEvent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_DisconnectListener extends Swift_Events_Listener
{
/**
* Executes when Swift closes a connection
* @param Swift_Events_DisconnectEvent Information about the connection
*/
public function disconnectPerformed(Swift_Events_DisconnectEvent $e);
}

View File

@@ -0,0 +1,17 @@
<?php
/**
* Swift Mailer Event Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Used for identity only
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_Listener {}

View File

@@ -0,0 +1,47 @@
<?php
/**
* Swift Mailer Mapper for Event Listeners
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Maps event listener names to the methods they implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_ListenerMapper
{
/**
* Get the mapped names (Class => Method(s))
* @return array
*/
public static function getMap()
{
$map = array(
"SendListener" => "sendPerformed",
"BeforeSendListener" => "beforeSendPerformed",
"CommandListener" => "commandSent",
"BeforeCommandListener" => "beforeCommandSent",
"ResponseListener" => "responseReceived",
"ConnectListener" => "connectPerformed",
"DisconnectListener" => "disconnectPerformed"
);
return $map;
}
/**
* Get the name of the method which needs running based upon the listener name
* @return string
*/
public static function getNotifyMethod($listener)
{
$map = self::getMap();
if (isset($map[$listener])) return $map[$listener];
else return false;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/**
* Swift Mailer Response Event
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Generated when Swift receives a server response
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_ResponseEvent extends Swift_Events
{
/**
* Contains the response received
* @var string
*/
protected $string = null;
/**
* Contains the response code
* @var int
*/
protected $code = null;
/**
* Constructor
* @param string The received response
*/
public function __construct($string)
{
$this->setString($string);
$this->setCode(substr($string, 0, 3));
}
/**
* Set the response received
* @param string The response
*/
public function setString($string)
{
$this->string = (string) $string;
}
/**
* Get the received response
* @return string
*/
public function getString()
{
return $this->string;
}
/**
* Set response code
* @param int The response code
*/
public function setCode($code)
{
$this->code = (int) $code;
}
/**
* Get the response code
* @return int
*/
public function getCode()
{
return $this->code;
}
}

View File

@@ -0,0 +1,25 @@
<?php
/**
* Swift Mailer Response Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a ResponseEvent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_ResponseListener extends Swift_Events_Listener
{
/**
* Executes when Swift receives a response
* @param Swift_Events_ResponseEvent Information about the response
*/
public function responseReceived(Swift_Events_ResponseEvent $e);
}

View File

@@ -0,0 +1,116 @@
<?php
/**
* Swift Mailer Send Event
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Generated every time a message is sent with Swift
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
class Swift_Events_SendEvent extends Swift_Events
{
/**
* A reference to the message being sent
* @var Swift_Message
*/
protected $message = null;
/**
* A reference to the sender address object
* @var Swift_Address
*/
protected $sender = null;
/**
* A reference to the recipients being sent to
* @var Swift_RecipientList
*/
protected $recipients = null;
/**
* The number of recipients sent to so
* @var int
*/
protected $sent = null;
/**
* Recipients we couldn't send to
* @var array
*/
protected $failed = array();
/**
* Constructor
* @param Swift_Message The message being sent
* @param Swift_RecipientList The recipients
* @param Swift_Address The sender address
* @param int The number of addresses sent to
*/
public function __construct(Swift_Message $message, Swift_RecipientList $list, Swift_Address $from, $sent=0)
{
$this->message = $message;
$this->recipients = $list;
$this->sender = $from;
$this->sent = $sent;
}
/**
* Get the message being sent
* @return Swift_Message
*/
public function getMessage()
{
return $this->message;
}
/**
* Get the list of recipients
* @return Swift_RecipientList
*/
public function getRecipients()
{
return $this->recipients;
}
/**
* Get the sender's address
* @return Swift_Address
*/
public function getSender()
{
return $this->sender;
}
/**
* Set the number of recipients to how many were sent
* @param int
*/
public function setNumSent($sent)
{
$this->sent = (int) $sent;
}
/**
* Get the total number of addresses to which the email sent successfully
* @return int
*/
public function getNumSent()
{
return $this->sent;
}
/**
* Add an email address to the failed recipient list for this send
* @var string The email address
*/
public function addFailedRecipient($address)
{
$this->failed[] = $address;
}
/**
* Get an array of failed recipients for this send
* @return array
*/
public function getFailedRecipients()
{
return $this->failed;
}
}

View File

@@ -0,0 +1,24 @@
<?php
/**
* Swift Mailer Send Event Listener Interface
* Please read the LICENSE file
* @copyright Chris Corbyn <chris@w3style.co.uk>
* @author Chris Corbyn <chris@w3style.co.uk>
* @package Swift_Events
* @license GNU Lesser General Public License
*/
/**
* Contains the list of methods a plugin requiring the use of a SendEvent must implement
* @package Swift_Events
* @author Chris Corbyn <chris@w3style.co.uk>
*/
interface Swift_Events_SendListener extends Swift_Events_Listener
{
/**
* Executes when Swift sends a message
* @param Swift_Events_SendEvent Information about the message being sent
*/
public function sendPerformed(Swift_Events_SendEvent $e);
}