- Fixes const value declaration for PHP <5.6

This commit is contained in:
Vlad
2016-10-28 10:13:56 -04:00
parent 6ae46b05e5
commit 01af4d3401
2 changed files with 8 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class AmazonSES {
public $reply_to; public $reply_to;
public $date; public $date;
public $date_without_time; public $date_without_time;
const SES_REGIONS = array( private $available_regions = array(
'US East (N. Virginia)' => 'us-east-1', 'US East (N. Virginia)' => 'us-east-1',
'US West (Oregon)' => 'us-west-2', 'US West (Oregon)' => 'us-west-2',
'EU (Ireland)' => 'eu-west-1' 'EU (Ireland)' => 'eu-west-1'
@ -26,7 +26,7 @@ class AmazonSES {
function __construct($region, $access_key, $secret_key, $sender, $reply_to) { function __construct($region, $access_key, $secret_key, $sender, $reply_to) {
$this->aws_access_key = $access_key; $this->aws_access_key = $access_key;
$this->aws_secret_key = $secret_key; $this->aws_secret_key = $secret_key;
$this->aws_region = (in_array($region, self::SES_REGIONS)) ? $region : false; $this->aws_region = (in_array($region, $this->available_regions)) ? $region : false;
if(!$this->aws_region) { if(!$this->aws_region) {
throw new \Exception(__('Unsupported Amazon SES region.', 'mailpoet')); throw new \Exception(__('Unsupported Amazon SES region.', 'mailpoet'));
} }
@ -42,6 +42,7 @@ class AmazonSES {
$this->date_without_time = gmdate('Ymd'); $this->date_without_time = gmdate('Ymd');
} }
function send($newsletter, $subscriber) { function send($newsletter, $subscriber) {
$result = wp_remote_post( $result = wp_remote_post(
$this->url, $this->url,

View File

@ -1,8 +1,6 @@
<?php <?php
namespace MailPoet\Settings; namespace MailPoet\Settings;
use MailPoet\Mailer\Methods\AmazonSES;
class Hosts { class Hosts {
private static $_smtp = array( private static $_smtp = array(
'AmazonSES' => array( 'AmazonSES' => array(
@ -14,7 +12,11 @@ class Hosts {
'access_key', 'access_key',
'secret_key' 'secret_key'
), ),
'regions' => AmazonSES::SES_REGIONS 'regions' => array(
'US East (N. Virginia)' => 'us-east-1',
'US West (Oregon)' => 'us-west-2',
'EU (Ireland)' => 'eu-west-1'
)
), ),
'SendGrid' => array( 'SendGrid' => array(
'name' => 'SendGrid', 'name' => 'SendGrid',