Remove trailing whitespace

This commit is contained in:
Kijin Sung 2023-01-17 20:57:44 +09:00
parent 3b0030e82b
commit a9f72a5cd2
81 changed files with 2455 additions and 2455 deletions

View file

@ -11,12 +11,12 @@ abstract class Base implements \Rhymix\Framework\Drivers\MailInterface
* The configuration is stored here.
*/
protected $_config = null;
/**
* The mailer instance is stored here.
*/
protected $_mailer = null;
/**
* Direct invocation of the constructor is not permitted.
*/
@ -24,10 +24,10 @@ abstract class Base implements \Rhymix\Framework\Drivers\MailInterface
{
$this->_config = $config;
}
/**
* Create a new instance of the current mail driver, using the given settings.
*
*
* @param array $config
* @return object
*/
@ -35,74 +35,74 @@ abstract class Base implements \Rhymix\Framework\Drivers\MailInterface
{
return new static($config);
}
/**
* Get the human-readable name of this mail driver.
*
*
* @return string
*/
public static function getName()
{
return class_basename(get_called_class());
}
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array();
}
/**
* Get the list of API types supported by this mail driver.
*
*
* @return array
*/
public static function getAPITypes()
{
return array();
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return '';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()
{
return '';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return false;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/

View file

@ -9,21 +9,21 @@ class Dummy extends Base implements \Rhymix\Framework\Drivers\MailInterface
{
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/

View file

@ -15,44 +15,44 @@ class MailFunction extends Base implements \Rhymix\Framework\Drivers\MailInterfa
include_once \RX_BASEDIR . 'common/libraries/swift_mail.php';
$this->mailer = new \Swift_Mailer(new \Swift_MailTransport);
}
/**
* Get the human-readable name of this mail driver.
*
*
* @return string
*/
public static function getName()
{
return 'mail() Function';
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'ip4:$SERVER_ADDR';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -67,7 +67,7 @@ class MailFunction extends Base implements \Rhymix\Framework\Drivers\MailInterfa
$message->errors[] = $e->getMessage();
return false;
}
foreach ($errors as $error)
{
$message->errors[] = $error;

View file

@ -11,54 +11,54 @@ class Mailgun extends Base implements \Rhymix\Framework\Drivers\MailInterface
* The API URL.
*/
protected static $_url = 'https://api.mailgun.net/v3';
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_domain', 'api_token');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:mailgun.org';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()
{
return 'mailo._domainkey';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -87,7 +87,7 @@ class Mailgun extends Base implements \Rhymix\Framework\Drivers\MailInterface
$recipients[] = $address;
}
}
// Prepare data and options for Requests.
$boundary = str_repeat('-', 24) . substr(md5(mt_rand()), 0, 16);
$headers = array(
@ -112,12 +112,12 @@ class Mailgun extends Base implements \Rhymix\Framework\Drivers\MailInterface
'timeout' => 5,
'useragent' => 'PHP',
);
// Send the API request.
$url = self::$_url . '/' . $this->_config['api_domain'] . '/messages.mime';
$request = \Requests::post($url, $headers, $data, $options);
$result = @json_decode($request->body);
// Parse the result.
if (!$result)
{

View file

@ -19,30 +19,30 @@ class Mandrill extends SMTP implements \Rhymix\Framework\Drivers\MailInterface
$config['smtp_pass'] = $config['api_token'];
parent::__construct($config);
}
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_user', 'api_token');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:spf.mandrillapp.com';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()

View file

@ -19,30 +19,30 @@ class Postmark extends SMTP implements \Rhymix\Framework\Drivers\MailInterface
$config['smtp_pass'] = $config['api_token'];
parent::__construct($config);
}
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_token');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:spf.mtasv.net';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()

View file

@ -11,54 +11,54 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
* The API URL.
*/
protected static $_url = 'https://api.sendgrid.com/v3/mail/send';
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_token');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:sendgrid.net';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()
{
return 'smtpapi._domainkey';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -70,11 +70,11 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
$message->errors[] = 'SendGrid: Please use API key (token) instead of username and password.';
return;
}
// Initialize the request data.
$data = [];
$data['personalizations'] = [];
// Assemble the list of recipients.
$to_list = [];
if ($to = $message->message->getTo())
@ -103,7 +103,7 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
}
$data['personalizations'][] = ['bcc' => $bcc_list];
}
// Set the sender information.
$from = $message->message->getFrom();
if ($from)
@ -114,21 +114,21 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
$data['from']['name'] = array_first($from);
}
}
// Set the Reply-To address.
$replyTo = $message->message->getReplyTo();
if ($replyTo)
{
$data['reply_to']['email'] = array_first_key($from);
}
// Set the subject.
$data['subject'] = strval($message->getSubject()) ?: 'Title';
// Set the body.
$data['content'][0]['type'] = $message->getContentType();
$data['content'][0]['value'] = $message->getBody();
// Add attachments.
foreach ($message->getAttachments() as $attachment)
{
@ -142,7 +142,7 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
}
$data['attachments'][] = $file_info;
}
// Prepare data and options for Requests.
$headers = array(
'Authorization' => 'Bearer ' . $this->_config['api_token'],
@ -152,11 +152,11 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
'timeout' => 8,
'useragent' => 'PHP',
);
// Send the API request.
$request = \Requests::post(self::$_url, $headers, json_encode($data), $options);
$response_code = intval($request->status_code);;
// Parse the result.
if (!$response_code)
{
@ -168,7 +168,7 @@ class SendGrid extends Base implements \Rhymix\Framework\Drivers\MailInterface
$message->errors[] = 'SendGrid: Response code ' . $response_code . ': ' . $request->body;
return false;
}
return true;
}
}

View file

@ -11,7 +11,7 @@ class SES extends SMTP implements \Rhymix\Framework\Drivers\MailInterface
* Cache the message here for debug access.
*/
protected $_message;
/**
* Direct invocation of the constructor is not permitted.
*/
@ -22,30 +22,30 @@ class SES extends SMTP implements \Rhymix\Framework\Drivers\MailInterface
$config['smtp_security'] = 'tls';
parent::__construct($config);
}
/**
* Get the human-readable name of this mail driver.
*
*
* @return string
*/
public static function getName()
{
return 'Amazon SES (SMTP)';
}
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('smtp_user', 'smtp_pass', 'api_type');
}
/**
* Get the list of API types supported by this mail driver.
*
*
* @return array
*/
public static function getAPITypes()
@ -57,20 +57,20 @@ class SES extends SMTP implements \Rhymix\Framework\Drivers\MailInterface
'ap-southeast-1', 'ap-southeast-2', 'ap-south-1',
);
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:amazonses.com';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()

View file

@ -23,34 +23,34 @@ class SMTP extends Base implements \Rhymix\Framework\Drivers\MailInterface
}
$this->mailer = new \Swift_Mailer($transport);
}
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('smtp_host', 'smtp_port', 'smtp_security', 'smtp_user', 'smtp_pass');
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return function_exists('proc_open');
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -65,7 +65,7 @@ class SMTP extends Base implements \Rhymix\Framework\Drivers\MailInterface
$message->errors[] = $e->getMessage();
return false;
}
foreach ($errors as $error)
{
$message->errors[] = 'Failed to send to ' . $error;

View file

@ -11,54 +11,54 @@ class SparkPost extends Base implements \Rhymix\Framework\Drivers\MailInterface
* The API URL.
*/
protected static $_url = 'https://api.sparkpost.com/api/v1/transmissions';
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_token');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:sparkpostmail.com';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()
{
return '********._domainkey';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -87,7 +87,7 @@ class SparkPost extends Base implements \Rhymix\Framework\Drivers\MailInterface
$recipients[] = array('address' => array('name' => $name, 'email' => $address));
}
}
// Prepare data and options for Requests.
$headers = array(
'Authorization' => $this->_config['api_token'],
@ -106,11 +106,11 @@ class SparkPost extends Base implements \Rhymix\Framework\Drivers\MailInterface
'timeout' => 5,
'useragent' => 'PHP',
);
// Send the API request.
$request = \Requests::post(self::$_url, $headers, $data, $options);
$result = @json_decode($request->body);
// Parse the result.
if (!$result)
{
@ -124,7 +124,7 @@ class SparkPost extends Base implements \Rhymix\Framework\Drivers\MailInterface
$message->errors[] = 'SparkPost: ' . $error->message . ': ' . $error->description . ' (code ' . $error->code . ')';
}
}
if ($result->results)
{
return $result->results->total_accepted_recipients > 0 ? true : false;

View file

@ -11,7 +11,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
* The API URL.
*/
protected static $_url = 'https://woorimail.com/index.php';
/**
* Error codes and messages.
*/
@ -25,69 +25,69 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
'me_007' => '이메일과 등록일 갯수가 다릅니다.',
'me_008' => '이메일 갯수가 2,000개가 넘습니다.',
'me_009' => 'type이 api가 아닙니다.',
'me_010' => '인증키가 없습니다.',
'me_010' => '인증키가 없습니다.',
'me_011' => '인증키가 부정확합니다.',
'me_012' => '포인트가 부족합니다.',
'me_013' => '전용채널에 도메인이 등록되어 있지 않습니다.',
);
/**
* Get the list of configuration fields required by this mail driver.
*
*
* @return array
*/
public static function getRequiredConfig()
{
return array('api_domain', 'api_token', 'api_type');
}
/**
* Get the list of API types supported by this mail driver.
*
*
* @return array
*/
public static function getAPITypes()
{
return array('free', 'paid');
}
/**
* Get the SPF hint.
*
*
* @return string
*/
public static function getSPFHint()
{
return 'include:woorimail.com';
}
/**
* Get the DKIM hint.
*
*
* @return string
*/
public static function getDKIMHint()
{
return '';
}
/**
* Check if the current mail driver is supported on this server.
*
*
* This method returns true on success and false on failure.
*
*
* @return bool
*/
public static function isSupported()
{
return true;
}
/**
* Send a message.
*
*
* This method returns true on success and false on failure.
*
*
* @param object $message
* @return bool
*/
@ -112,7 +112,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
'callback' => '',
'is_sendok' => 'W',
);
// Fill the sender info.
$from = $message->message->getFrom();
foreach($from as $email => $name)
@ -137,7 +137,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
$data['sender_email'] = $replyTo;
}
}
// Fill the recipient info.
if ($to = $message->message->getTo())
{
@ -166,7 +166,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
$data['member_regdate'] = implode(',', array_fill(0, count($data['receiver_email']), date('YmdHis')));
$data['receiver_email'] = implode(',', $data['receiver_email']);
$data['receiver_nickname'] = implode(',', $data['receiver_nickname']);
// Define connection options.
$headers = array(
'Accept' => 'application/json, text/javascript, */*; q=0.1',
@ -175,7 +175,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
'timeout' => 5,
'useragent' => 'PHP',
);
// Send the API request.
try
{
@ -187,7 +187,7 @@ class Woorimail extends Base implements \Rhymix\Framework\Drivers\MailInterface
$message->errors[] = 'Woorimail: ' . $e->getMessage();
return false;
}
// Parse the result.
if (!$result)
{