Changeset 1866512
- Timestamp:
- 04/30/2018 02:50:25 PM (8 years ago)
- Location:
- sparkpost/trunk
- Files:
-
- 9 edited
-
admin.widget.class.php (modified) (3 diffs)
-
mailer.http.class.php (modified) (2 diffs)
-
mailer.smtp.class.php (modified) (2 diffs)
-
readme.txt (modified) (4 diffs)
-
sparkpost.class.php (modified) (3 diffs)
-
templates.class.php (modified) (1 diff)
-
tests/specs/test-sparkpost.class.php (modified) (1 diff)
-
tests/specs/test-wordpress-sparkpost.php (modified) (1 diff)
-
wordpress-sparkpost.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sparkpost/trunk/admin.widget.class.php
r1819135 r1866512 262 262 add_settings_field('sending_method', 'Method*', array($this, 'render_sending_method_field'), 'sp-options-basic', 'general'); 263 263 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' ); 264 265 add_settings_field('template', 'Template', array($this, 'render_template_field'), 'sp-options-basic', 'general'); 265 266 … … 288 289 } else { 289 290 $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'] = ''; 290 297 } 291 298 … … 448 455 } 449 456 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 450 467 public function render_enable_tracking_field() 451 468 { -
sparkpost/trunk/mailer.http.class.php
r1819135 r1866512 11 11 class SparkPostHTTPMailer extends \PHPMailer 12 12 { 13 public $endpoint = 'https://api.sparkpost.com/api/v1/transmissions';13 public $endpoint; 14 14 public $wp_mail_args; 15 15 private $settings; … … 23 23 $this->settings = SparkPost::get_settings(); 24 24 $this->template = new SparkPostTemplates($this); 25 $this->endpoint = apply_filters('sp_hostname', 'api') . '/api/v1/transmissions'; 25 26 26 27 parent::__construct($exceptions); -
sparkpost/trunk/mailer.smtp.class.php
r1819135 r1866512 11 11 class SparkPostSMTPMailer 12 12 { 13 14 13 public function __construct() 15 14 { … … 40 39 $phpmailer->SMTPSecure = 'tls'; 41 40 $phpmailer->Port = !empty($settings['port']) ? intval($settings['port']) : 587; 42 $phpmailer->Host = 'smtp.sparkpostmail.com';41 $phpmailer->Host = apply_filters('sp_hostname', 'smtp'); 43 42 $phpmailer->SMTPAuth = true; 44 43 $phpmailer->Username = 'SMTP_Injection'; -
sparkpost/trunk/readme.txt
r1827152 r1866512 3 3 Tags: sparkpost, smtp, wp_mail, mail, email 4 4 Requires at least: 4.3 5 Tested up to: 4.9. 46 Stable tag: 3. 1.15 Tested up to: 4.9.5 6 Stable tag: 3.2.0 7 7 License: GPLv2 or later 8 8 … … 12 12 The [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. 13 13 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.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/) 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. 15 15 16 16 **Requirements** … … 42 42 43 43 = 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.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/join) to signup (https://app.eu.sparkpost.com/ for EU). 45 45 46 46 = How do I create an API key? = … … 52 52 53 53 == Changelog == 54 = 3.2.0 = 55 - Add support for EU hostnames ([141](https://github.com/SparkPost/wordpress-sparkpost/pull/141)) 56 54 57 = 3.1.1 = 55 58 - Avoid db checking if email logging is not enabled -
sparkpost/trunk/sparkpost.class.php
r1827152 r1866512 22 22 'template' => '', 23 23 '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 ) 25 37 ); 26 38 … … 41 53 add_filter('wp_mail_from', array($this, 'set_from_email')); 42 54 add_filter('wp_mail_from_name', array($this, 'set_from_name')); 55 add_filter('sp_hostname', array($this, 'get_hostname')); 43 56 } 44 57 … … 154 167 } 155 168 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 156 175 static function obfuscate_api_key($api_key) 157 176 { -
sparkpost/trunk/templates.class.php
r1819135 r1866512 8 8 class SparkPostTemplates 9 9 { 10 public $endpoint = 'https://api.sparkpost.com/api/v1/templates';10 public $endpoint; 11 11 12 12 public function __construct($mailer) 13 13 { 14 14 $this->mailer = $mailer; 15 16 $this->endpoint = apply_filters('sp_hostname', 'api') . '/api/v1/templates'; 15 17 } 16 18 17 19 public function preview($id, $substitution_data) 18 20 { 19 $url = "{$this->endpoint}/{$id}/preview?draft=false"; 21 $endpoint = apply_filters('sp_api_location', $this->endpoint); 22 $url = "{$endpoint}/{$id}/preview?draft=false"; 20 23 21 24 $body = array( -
sparkpost/trunk/tests/specs/test-sparkpost.class.php
r1626130 r1866512 29 29 $this->assertFalse(SparkPost::is_sandbox('[email protected]')); 30 30 } 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 } 31 50 } -
sparkpost/trunk/tests/specs/test-wordpress-sparkpost.php
r1582798 r1866512 3 3 * @package wp-sparkpost 4 4 */ 5 6 5 namespace WPSparkPost; 7 6 8 7 class TestWordPressSparkPost extends \WP_UnitTestCase { 9 8 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 } 13 12 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 mode17 }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 } 18 17 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 } 22 21 } -
sparkpost/trunk/wordpress-sparkpost.php
r1827152 r1866512 6 6 Plugin URI: http://sparkpost.com/ 7 7 Description: Send all your email from Wordpress through SparkPost, the world's most advanced email delivery service. 8 Version: 3. 1.18 Version: 3.2.0 9 9 Author: SparkPost 10 10 Author URI: http://sparkpost.com … … 19 19 define('WPSP_PLUGIN_DIR', plugin_dir_path(__FILE__)); 20 20 define('WPSP_PLUGIN_PATH', WPSP_PLUGIN_DIR . basename(__FILE__)); 21 define('WPSP_PLUGIN_VERSION', '3. 1.1');21 define('WPSP_PLUGIN_VERSION', '3.2.0'); 22 22 23 23 require_once(WPSP_PLUGIN_DIR . 'sparkpost.class.php');
Note: See TracChangeset
for help on using the changeset viewer.