Plugin Directory

Changeset 1866512


Ignore:
Timestamp:
04/30/2018 02:50:25 PM (8 years ago)
Author:
sparkpost
Message:

Release of v3.2.0

Location:
sparkpost/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • sparkpost/trunk/admin.widget.class.php

    r1819135 r1866512  
    262262        add_settings_field('sending_method', 'Method*', array($this, 'render_sending_method_field'), 'sp-options-basic', 'general');
    263263        add_settings_field('password', 'API Key*', array($this, 'render_password_field'), 'sp-options-basic', 'general');
     264        add_settings_field('location', 'API Location', array($this, 'render_location_field'), 'sp-options-basic', 'general' );
    264265        add_settings_field('template', 'Template', array($this, 'render_template_field'), 'sp-options-basic', 'general');
    265266
     
    288289        } else {
    289290            $new_input['template'] = '';
     291        }
     292
     293        if (isset($input['location'])) {
     294            $new_input['location'] = sanitize_text_field($input['location']);
     295        } else {
     296            $new_input['location'] = '';
    290297        }
    291298
     
    448455    }
    449456
     457    public function render_location_field()
     458    {
     459        $selected = !empty($this->settings['location']) ? esc_attr($this->settings['location']) : '';
     460
     461        echo '<select name="sp_settings_basic[location]">
     462        <option value="" ' . (($selected === '') ? 'selected' : '') . '>Worldwide</option>
     463        <option value="eu" ' . (($selected === 'eu') ? 'selected' : '') . '>EU</option>
     464        </select>';
     465    }
     466
    450467    public function render_enable_tracking_field()
    451468    {
  • sparkpost/trunk/mailer.http.class.php

    r1819135 r1866512  
    1111class SparkPostHTTPMailer extends \PHPMailer
    1212{
    13     public $endpoint = 'https://api.sparkpost.com/api/v1/transmissions';
     13    public $endpoint;
    1414    public $wp_mail_args;
    1515    private $settings;
     
    2323        $this->settings = SparkPost::get_settings();
    2424        $this->template = new SparkPostTemplates($this);
     25        $this->endpoint = apply_filters('sp_hostname', 'api') . '/api/v1/transmissions';
    2526
    2627        parent::__construct($exceptions);
  • sparkpost/trunk/mailer.smtp.class.php

    r1819135 r1866512  
    1111class SparkPostSMTPMailer
    1212{
    13 
    1413    public function __construct()
    1514    {
     
    4039        $phpmailer->SMTPSecure = 'tls';
    4140        $phpmailer->Port = !empty($settings['port']) ? intval($settings['port']) : 587;
    42         $phpmailer->Host = 'smtp.sparkpostmail.com';
     41        $phpmailer->Host = apply_filters('sp_hostname', 'smtp');
    4342        $phpmailer->SMTPAuth = true;
    4443        $phpmailer->Username = 'SMTP_Injection';
  • sparkpost/trunk/readme.txt

    r1827152 r1866512  
    33Tags: sparkpost, smtp, wp_mail, mail, email
    44Requires at least: 4.3
    5 Tested up to: 4.9.4
    6 Stable tag: 3.1.1
     5Tested up to: 4.9.5
     6Stable tag: 3.2.0
    77License: GPLv2 or later
    88
     
    1212The [SparkPost](https://www.sparkpost.com/) email delivery service offers best in class deliverability to ensure your mail hits the inbox, live analytics to review, track and optimize your email activities, as well as highest performance when you need it most: always.
    1313
    14 When the SparkPost plugin is enabled, all outgoing email from your WordPress installation is sent through your SparkPost service.  From within [the SparkPost UI](https://app.sparkpost.com/), you can then watch your campaigns unfold live by tracking your engagement metrics, learn what your audience responds to and even integrate more deeply with your app using the SparkPost API.
     14When the SparkPost plugin is enabled, all outgoing email from your WordPress installation is sent through your SparkPost service.  From within [the SparkPost UI](https://app.sparkpost.com/) or [SparkPost EU UI](https://app.eu.sparkpost.com/), you can then watch your campaigns unfold live by tracking your engagement metrics, learn what your audience responds to and even integrate more deeply with your app using the SparkPost API.
    1515
    1616**Requirements**
     
    4242
    4343= What do I need to start using this plugin? =
    44 You'll need to create an account on SparkPost.com and then generate an API Key with *Send via SMTP* and *Transmission Read/Write* permissions. Creating an account is completely free. Visit [SparkPost](https://app.sparkpost.com/sign-up) to signup.
     44You'll need to create an account on SparkPost.com and then generate an API Key with *Send via SMTP* and *Transmission Read/Write* permissions. Creating an account is completely free. Visit [SparkPost](https://app.sparkpost.com/join) to signup (https://app.eu.sparkpost.com/ for EU).
    4545
    4646= How do I create an API key? =
     
    5252
    5353== Changelog ==
     54= 3.2.0 =
     55- Add support for EU hostnames ([141](https://github.com/SparkPost/wordpress-sparkpost/pull/141))
     56
    5457= 3.1.1 =
    5558- Avoid db checking if email logging is not enabled
  • sparkpost/trunk/sparkpost.class.php

    r1827152 r1866512  
    2222        'template' => '',
    2323        'transactional' => false,
    24         'log_emails' => false
     24        'log_emails' => false,
     25        'location' => 'us'
     26    );
     27
     28    protected $hostnames = array(
     29        'us' => array(
     30            'api' => 'https://api.sparkpost.com',
     31            'smtp' => 'smtp.sparkpostmail.com'
     32        ),
     33        'eu' => array(
     34            'api' => 'https://api.eu.sparkpost.com',
     35            'smtp' => 'smtp.eu.sparkpostmail.com'
     36        )
    2537    );
    2638
     
    4153            add_filter('wp_mail_from', array($this, 'set_from_email'));
    4254            add_filter('wp_mail_from_name', array($this, 'set_from_name'));
     55            add_filter('sp_hostname', array($this, 'get_hostname'));
    4356        }
    4457
     
    154167    }
    155168
     169    public function get_hostname($type = 'api')
     170    {
     171        $location = !empty($this->settings['location']) ? esc_attr($this->settings['location']) : 'us';
     172        return $this->hostnames[$location][$type];
     173    }
     174
    156175    static function obfuscate_api_key($api_key)
    157176    {
  • sparkpost/trunk/templates.class.php

    r1819135 r1866512  
    88class SparkPostTemplates
    99{
    10     public $endpoint = 'https://api.sparkpost.com/api/v1/templates';
     10    public $endpoint;
    1111
    1212    public function __construct($mailer)
    1313    {
    1414        $this->mailer = $mailer;
     15       
     16        $this->endpoint = apply_filters('sp_hostname', 'api') . '/api/v1/templates';
    1517    }
    1618
    1719    public function preview($id, $substitution_data)
    1820    {
    19         $url = "{$this->endpoint}/{$id}/preview?draft=false";
     21        $endpoint = apply_filters('sp_api_location', $this->endpoint);
     22        $url = "{$endpoint}/{$id}/preview?draft=false";
    2023
    2124        $body = array(
  • sparkpost/trunk/tests/specs/test-sparkpost.class.php

    r1626130 r1866512  
    2929        $this->assertFalse(SparkPost::is_sandbox('[email protected]'));
    3030    }
     31
     32    function test_us_hostnames() {
     33        $us_api = 'https://api.sparkpost.com';
     34        $us_smtp = 'smtp.sparkpostmail.com';
     35
     36        $this->assertTrue($this->SparkPost->get_hostname('api') === $us_api);
     37        $this->assertTrue($this->SparkPost->get_hostname() === $us_api);
     38        $this->assertTrue($this->SparkPost->get_hostname('smtp') === 'smtp.sparkpostmail.com');
     39    }
     40
     41    function test_eu_hostnames() {
     42        $eu_api = 'https://api.eu.sparkpost.com';
     43        $eu_smtp = 'smtp.eu.sparkpostmail.com';
     44
     45        $this->SparkPost->settings['location'] = 'eu';
     46
     47        $this->assertTrue($this->SparkPost->get_hostname('api') === 'https://api.eu.sparkpost.com');
     48        $this->assertTrue($this->SparkPost->get_hostname('smtp') === 'smtp.eu.sparkpostmail.com');
     49    }
    3150}
  • sparkpost/trunk/tests/specs/test-wordpress-sparkpost.php

    r1582798 r1866512  
    33 * @package wp-sparkpost
    44 */
    5 
    65namespace WPSparkPost;
    76
    87class TestWordPressSparkPost extends \WP_UnitTestCase {
    98
    10     function test_plugin_dir_constants() {
    11         $this->assertTrue( defined('WPSP_PLUGIN_DIR') );
    12     }
     9    function test_plugin_dir_constants() {
     10        $this->assertTrue( defined('WPSP_PLUGIN_DIR') );
     11    }
    1312
    14   function test_plugin_path_constants() {
    15         $this->assertTrue( defined('WPSP_PLUGIN_PATH') );
    16     $this->assertTrue( strpos(WPSP_PLUGIN_PATH, '/wordpress-sparkpost/wordpress-sparkpost.php') !== false); // full path not available in test mode
    17     }
     13    function test_plugin_path_constants() {
     14        $this->assertTrue( defined('WPSP_PLUGIN_PATH') );
     15        $this->assertTrue( strpos(WPSP_PLUGIN_PATH, '/wordpress-sparkpost/wordpress-sparkpost.php') !== false); // full path not available in test mode
     16    }
    1817
    19   function test_SparkPost_class_loaded() {
    20     $this->assertTrue( class_exists('WPSparkPost\SparkPost'));
    21   }
     18    function test_SparkPost_class_loaded() {
     19        $this->assertTrue( class_exists('WPSparkPost\SparkPost'));
     20    }
    2221}
  • sparkpost/trunk/wordpress-sparkpost.php

    r1827152 r1866512  
    66Plugin URI: http://sparkpost.com/
    77Description: Send all your email from Wordpress through SparkPost, the world's most advanced email delivery service.
    8 Version: 3.1.1
     8Version: 3.2.0
    99Author: SparkPost
    1010Author URI: http://sparkpost.com
     
    1919define('WPSP_PLUGIN_DIR', plugin_dir_path(__FILE__));
    2020define('WPSP_PLUGIN_PATH', WPSP_PLUGIN_DIR . basename(__FILE__));
    21 define('WPSP_PLUGIN_VERSION', '3.1.1');
     21define('WPSP_PLUGIN_VERSION', '3.2.0');
    2222
    2323require_once(WPSP_PLUGIN_DIR . 'sparkpost.class.php');
Note: See TracChangeset for help on using the changeset viewer.