SendGrid - Version 1.11.3

Version Description

  • Fixed an issue where the send test form was displayed when no API key was set
  • Fixed an issue where the subscription test form was not displayed for the default contact list
  • Fixed an issue where the virtual pages for Subscription errors was not displayed
  • Fixed an issue where there was no notification for option update on the Multisite settings page
  • Fixed an issue where there was no notification when an API key was not set on the General tab when there was one on the Subscription Widget tab
Download this release

Release Info

Developer team-rs
Plugin Icon 128x128 SendGrid
Version 1.11.3
Comparing to
See all releases

Code changes from version 1.11.2 to 1.11.3

lib/class-sendgrid-mc-optin.php CHANGED
@@ -43,12 +43,12 @@ class Sendgrid_OptIn_API_Endpoint{
43
  exit;
44
  }
45
  }
46
-
47
- /**
48
  * Handle Requests
49
  * This is where compute the email from the token and subscribe the user_error()
50
  *
51
- * @return void
52
  */
53
  protected function handle_request() {
54
  global $wp;
@@ -59,7 +59,7 @@ class Sendgrid_OptIn_API_Endpoint{
59
  wp_redirect( 'sg-subscription-missing-token' );
60
  exit();
61
  }
62
-
63
  $transient = Sendgrid_Tools::get_transient_sendgrid( $token );
64
 
65
  if ( ! $transient or
43
  exit;
44
  }
45
  }
46
+
47
+ /**
48
  * Handle Requests
49
  * This is where compute the email from the token and subscribe the user_error()
50
  *
51
+ * @return void
52
  */
53
  protected function handle_request() {
54
  global $wp;
59
  wp_redirect( 'sg-subscription-missing-token' );
60
  exit();
61
  }
62
+
63
  $transient = Sendgrid_Tools::get_transient_sendgrid( $token );
64
 
65
  if ( ! $transient or
lib/class-sendgrid-nlvx-widget.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
 
3
  require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-tools.php';
4
  require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-nlvx.php';
@@ -77,29 +77,29 @@ class SendGrid_NLVX_Widget extends WP_Widget {
77
 
78
  // Widget text input
79
  echo '<p>';
80
- echo '<label for="' . $this->get_field_id( 'text' ) . '">' . _e( 'Message to display before subscription form:' ) . '</label>';
81
  echo '<input class="widefat" id="' . $this->get_field_id( 'text' ) . '" name="' . $this->get_field_name( 'text' ). '" type="text" value="' . esc_attr( $text ) . '" />';
82
  echo '</p>';
83
 
84
  // Widget error text input
85
  echo '<p>';
86
- echo '<label for="' . $this->get_field_id( 'error_text' ) . '">' . _e( 'Message to display for errors:' ) . '</label>';
87
  echo '<input class="widefat" id="' . $this->get_field_id( 'error_text' ) . '" name="' . $this->get_field_name( 'error_text' ). '" type="text" value="' . esc_attr( $error_text ) . '" />';
88
  echo '</p>';
89
 
90
  // Widget email error text input
91
  echo '<p>';
92
- echo '<label for="' . $this->get_field_id( 'error_email_text' ) . '">' . _e( 'Message to display for invalid email address:' ) . '</label>';
93
  echo '<input class="widefat" id="' . $this->get_field_id( 'error_email_text' ) . '" name="' . $this->get_field_name( 'error_email_text' ). '" type="text" value="' . esc_attr( $error_email_text ) . '" />';
94
  echo '</p>';
95
 
96
  // Widget success text input
97
  echo '<p>';
98
- echo '<label for="' . $this->get_field_id( 'success_text' ) . '">' . _e( 'Message to display for success:' ) . '</label>';
99
  echo '<input class="widefat" id="' . $this->get_field_id( 'success_text' ) . '" name="' . $this->get_field_name( 'success_text' ). '" type="text" value="' . esc_attr( $success_text ) . '" />';
100
  echo '</p>';
101
  }
102
-
103
  /**
104
  * Method called to update the widget parameters in the back-end
105
  *
1
+ <?php
2
 
3
  require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-tools.php';
4
  require_once plugin_dir_path( __FILE__ ) . 'class-sendgrid-nlvx.php';
77
 
78
  // Widget text input
79
  echo '<p>';
80
+ echo '<label for="' . $this->get_field_id( 'text' ) . '">' . _e( 'Message to display before subscription form:' ) . '</label>';
81
  echo '<input class="widefat" id="' . $this->get_field_id( 'text' ) . '" name="' . $this->get_field_name( 'text' ). '" type="text" value="' . esc_attr( $text ) . '" />';
82
  echo '</p>';
83
 
84
  // Widget error text input
85
  echo '<p>';
86
+ echo '<label for="' . $this->get_field_id( 'error_text' ) . '">' . _e( 'Message to display for errors:' ) . '</label>';
87
  echo '<input class="widefat" id="' . $this->get_field_id( 'error_text' ) . '" name="' . $this->get_field_name( 'error_text' ). '" type="text" value="' . esc_attr( $error_text ) . '" />';
88
  echo '</p>';
89
 
90
  // Widget email error text input
91
  echo '<p>';
92
+ echo '<label for="' . $this->get_field_id( 'error_email_text' ) . '">' . _e( 'Message to display for invalid email address:' ) . '</label>';
93
  echo '<input class="widefat" id="' . $this->get_field_id( 'error_email_text' ) . '" name="' . $this->get_field_name( 'error_email_text' ). '" type="text" value="' . esc_attr( $error_email_text ) . '" />';
94
  echo '</p>';
95
 
96
  // Widget success text input
97
  echo '<p>';
98
+ echo '<label for="' . $this->get_field_id( 'success_text' ) . '">' . _e( 'Message to display for success:' ) . '</label>';
99
  echo '<input class="widefat" id="' . $this->get_field_id( 'success_text' ) . '" name="' . $this->get_field_name( 'success_text' ). '" type="text" value="' . esc_attr( $success_text ) . '" />';
100
  echo '</p>';
101
  }
102
+
103
  /**
104
  * Method called to update the widget parameters in the back-end
105
  *
lib/class-sendgrid-settings.php CHANGED
@@ -209,13 +209,28 @@ class Sendgrid_Settings {
209
  $checked_req_fname_lname = 'checked';
210
  }
211
 
212
- $contact_lists = Sendgrid_NLVX::get_all_lists();
213
  $contact_list_id_is_valid = false;
 
 
 
214
  if ( false != $contact_lists ) {
215
- foreach ( $contact_lists as $key => $list ) {
216
- if ( $mc_list_id == $list['id'] ) {
 
 
 
 
 
 
217
  $contact_list_id_is_valid = true;
218
- break;
 
 
 
 
 
 
 
219
  }
220
  }
221
  }
@@ -236,11 +251,7 @@ class Sendgrid_Settings {
236
  }
237
  }
238
 
239
- if ( $is_mc_api_key_valid ) {
240
- Sendgrid_Tools::set_mc_auth_valid( 'true' );
241
- } else {
242
- Sendgrid_Tools::set_mc_auth_valid( 'false' );
243
- }
244
 
245
  if ( ! $error_from_update ) {
246
  if ( ! in_array( strtoupper( $send_method ), $allowed_send_methods ) ) {
@@ -257,6 +268,7 @@ class Sendgrid_Settings {
257
  $status = 'error';
258
  } elseif ( 'error' != $status ) {
259
  $status = 'valid_auth';
 
260
  }
261
  }
262
 
@@ -357,6 +369,15 @@ class Sendgrid_Settings {
357
  $warning_status = 'notice notice-warning';
358
  }
359
 
 
 
 
 
 
 
 
 
 
360
  require_once dirname( __FILE__ ) . '/../view/sendgrid_settings.php';
361
  }
362
 
@@ -415,6 +436,11 @@ class Sendgrid_Settings {
415
  update_blog_option( $site->blog_id, 'sendgrid_can_manage_subsite', 0 );
416
  }
417
  }
 
 
 
 
 
418
  }
419
 
420
  /**
209
  $checked_req_fname_lname = 'checked';
210
  }
211
 
 
212
  $contact_list_id_is_valid = false;
213
+ $contact_lists = Sendgrid_NLVX::get_all_lists();
214
+
215
+ // If the response to get all contact lists did not fail
216
  if ( false != $contact_lists ) {
217
+ // If there's no list ID in the DB
218
+ if ( empty( $mc_list_id ) ) {
219
+ // The MC API key was just set but no contact list ID is set
220
+ // even though the select shows the first one as selected by default.
221
+ // We set the first list ID in the database in order to enable the contact upload test.
222
+ if ( isset( $contact_lists[0] ) and isset( $contact_lists[0]['id'] ) ) {
223
+ $mc_list_id = $contact_lists[0]['id'];
224
+ Sendgrid_Tools::set_mc_list_id( $mc_list_id );
225
  $contact_list_id_is_valid = true;
226
+ }
227
+ } else {
228
+ // Check the validity of the list ID set in the database
229
+ foreach ( $contact_lists as $key => $list ) {
230
+ if ( $mc_list_id == $list['id'] ) {
231
+ $contact_list_id_is_valid = true;
232
+ break;
233
+ }
234
  }
235
  }
236
  }
251
  }
252
  }
253
 
254
+ $is_api_key_valid = false;
 
 
 
 
255
 
256
  if ( ! $error_from_update ) {
257
  if ( ! in_array( strtoupper( $send_method ), $allowed_send_methods ) ) {
268
  $status = 'error';
269
  } elseif ( 'error' != $status ) {
270
  $status = 'valid_auth';
271
+ $is_api_key_valid = true;
272
  }
273
  }
274
 
369
  $warning_status = 'notice notice-warning';
370
  }
371
 
372
+ if ( $is_mc_api_key_valid and ! $is_api_key_valid ) {
373
+ $warning_message = 'You need to configure an API Key for sending subscription emails on the General tab.';
374
+ $warning_status = 'notice notice-warning';
375
+ $warning_exclude_tab = 'general';
376
+ Sendgrid_Tools::set_mc_auth_valid( 'false' );
377
+ } else if ( $is_mc_api_key_valid and $is_api_key_valid ) {
378
+ Sendgrid_Tools::set_mc_auth_valid( 'true' );
379
+ }
380
+
381
  require_once dirname( __FILE__ ) . '/../view/sendgrid_settings.php';
382
  }
383
 
436
  update_blog_option( $site->blog_id, 'sendgrid_can_manage_subsite', 0 );
437
  }
438
  }
439
+
440
+ return array(
441
+ 'message' => 'Options are saved.',
442
+ 'status' => 'updated'
443
+ );
444
  }
445
 
446
  /**
lib/class-sendgrid-virtual-pages.php CHANGED
@@ -37,47 +37,45 @@ if ( ! class_exists( 'SGVirtualPage' ) )
37
  {
38
  global $wp, $wp_query;
39
 
40
- if ( count( $posts ) == 0 and
41
- ( strcasecmp( $wp->request, $this->slug ) == 0 or $wp->query_vars['page_id'] == $this->slug ) )
42
- {
43
- $post = new stdClass;
44
-
45
- $post->ID = -1;
46
- $post->post_author = $this->author;
47
- $post->post_date = $this->date;
48
- $post->post_date_gmt = $this->dategmt;
49
- $post->post_content = $this->content;
50
- $post->post_title = $this->title;
51
- $post->post_excerpt = '';
52
- $post->post_status = 'publish';
53
- $post->comment_status = 'closed';
54
- $post->ping_status = 'closed';
55
- $post->post_password = '';
56
- $post->post_name = $this->slug;
57
- $post->to_ping = '';
58
- $post->pinged = '';
59
- $post->modified = $post->post_date;
60
- $post->modified_gmt = $post->post_date_gmt;
61
- $post->post_content_filtered = '';
62
- $post->post_parent = 0;
63
- $post->guid = get_home_url('/' . $this->slug);
64
- $post->menu_order = 0;
65
- $post->post_tyle = $this->type;
66
- $post->post_mime_type = '';
67
- $post->comment_count = 0;
68
-
69
- $posts = array( $post );
70
-
71
- $wp_query->is_page = TRUE;
72
- $wp_query->is_singular = TRUE;
73
- $wp_query->is_home = FALSE;
74
- $wp_query->is_archive = FALSE;
75
- $wp_query->is_category = FALSE;
76
-
77
- unset( $wp_query->query['error'] );
78
- $wp_query->query_vars['error'] = '';
79
- $wp_query->is_404 = FALSE;
80
- }
81
 
82
  return $posts;
83
  }
37
  {
38
  global $wp, $wp_query;
39
 
40
+ $post = new stdClass;
41
+
42
+ $post->ID = -1;
43
+ $post->post_author = $this->author;
44
+ $post->post_date = $this->date;
45
+ $post->post_date_gmt = $this->dategmt;
46
+ $post->post_content = $this->content;
47
+ $post->post_title = $this->title;
48
+ $post->post_excerpt = '';
49
+ $post->post_status = 'publish';
50
+ $post->comment_status = 'closed';
51
+ $post->ping_status = 'closed';
52
+ $post->post_password = '';
53
+ $post->post_name = $this->slug;
54
+ $post->to_ping = '';
55
+ $post->pinged = '';
56
+ $post->modified = $post->post_date;
57
+ $post->modified_gmt = $post->post_date_gmt;
58
+ $post->post_content_filtered = '';
59
+ $post->post_parent = 0;
60
+ $post->guid = get_home_url('/' . $this->slug);
61
+ $post->menu_order = 0;
62
+ $post->post_tyle = $this->type;
63
+ $post->post_mime_type = '';
64
+ $post->comment_count = 0;
65
+
66
+ $posts = array( $post );
67
+
68
+ $wp_query->is_page = TRUE;
69
+ $wp_query->is_singular = TRUE;
70
+ $wp_query->is_home = FALSE;
71
+ $wp_query->is_archive = FALSE;
72
+ $wp_query->is_category = FALSE;
73
+
74
+ unset( $wp_query->query['error'] );
75
+ $wp_query->query_vars['error'] = '';
76
+ $wp_query->is_404 = FALSE;
77
+
78
+ remove_filter( 'the_posts', array( &$this, 'virtualPage' ) );
 
 
79
 
80
  return $posts;
81
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://sendgrid.com/
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.6
6
  Tested up to: 4.7
7
- Stable tag: 1.11.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -266,6 +266,12 @@ Since 1.10.5 the Network Admin can delegate the configuration for each subsite t
266
 
267
  == Changelog ==
268
 
 
 
 
 
 
 
269
  = 1.11.2 =
270
  * Relaxed PHP requirement to at least version 5.4.
271
  = 1.11.1 =
@@ -432,6 +438,12 @@ Since 1.10.5 the Network Admin can delegate the configuration for each subsite t
432
 
433
  == Upgrade notice ==
434
 
 
 
 
 
 
 
435
  = 1.11.2 =
436
  * Relaxed PHP requirement to at least version 5.4.
437
  = 1.11.1 =
4
  Tags: email, email reliability, email templates, sendgrid, smtp, transactional email, wp_mail,email infrastructure, email marketing, marketing email, deliverability, email deliverability, email delivery, email server, mail server, email integration, cloud email
5
  Requires at least: 4.6
6
  Tested up to: 4.7
7
+ Stable tag: 1.11.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
266
 
267
  == Changelog ==
268
 
269
+ = 1.11.3 =
270
+ * Fixed an issue where the send test form was displayed when no API key was set
271
+ * Fixed an issue where the subscription test form was not displayed for the default contact list
272
+ * Fixed an issue where the virtual pages for Subscription errors was not displayed
273
+ * Fixed an issue where there was no notification for option update on the Multisite settings page
274
+ * Fixed an issue where there was no notification when an API key was not set on the General tab when there was one on the Subscription Widget tab
275
  = 1.11.2 =
276
  * Relaxed PHP requirement to at least version 5.4.
277
  = 1.11.1 =
438
 
439
  == Upgrade notice ==
440
 
441
+ = 1.11.3 =
442
+ * Fixed an issue where the send test form was displayed when no API key was set
443
+ * Fixed an issue where the subscription test form was not displayed for the default contact list
444
+ * Fixed an issue where the virtual pages for Subscription errors was not displayed
445
+ * Fixed an issue where there was no notification for option update on the Multisite settings page
446
+ * Fixed an issue where there was no notification when an API key was not set on the General tab when there was one on the Subscription Widget tab
447
  = 1.11.2 =
448
  * Relaxed PHP requirement to at least version 5.4.
449
  = 1.11.1 =
view/sendgrid_settings.php CHANGED
@@ -3,22 +3,6 @@
3
  <img src="<?php echo plugins_url( '/images/logo.png', __FILE__ ) ?>" width="100" alt="" />
4
  </a>
5
 
6
- <?php if ( isset( $status ) and ( 'updated' == $status or 'error' == $status or 'notice notice-warning' == $status ) ): ?>
7
- <div id="message" class="<?php echo $status ?>">
8
- <p>
9
- <strong><?php echo $message ?></strong>
10
- </p>
11
- </div>
12
- <?php endif; ?>
13
-
14
- <?php if ( isset( $warning_status ) and isset( $warning_message ) ): ?>
15
- <div id="message" class="<?php echo $warning_status ?>">
16
- <p>
17
- <strong><?php echo $warning_message ?></strong>
18
- </p>
19
- </div>
20
- <?php endif; ?>
21
-
22
  <?php
23
  $tabs = array( 'general' => 'General', 'marketing' => 'Subscription Widget' );
24
 
@@ -36,6 +20,24 @@
36
  }
37
  ?>
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  <?php
40
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_nav.php';
41
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_general.php';
3
  <img src="<?php echo plugins_url( '/images/logo.png', __FILE__ ) ?>" width="100" alt="" />
4
  </a>
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  <?php
7
  $tabs = array( 'general' => 'General', 'marketing' => 'Subscription Widget' );
8
 
20
  }
21
  ?>
22
 
23
+ <?php if ( isset( $status ) and ( 'updated' == $status or 'error' == $status or 'notice notice-warning' == $status ) ): ?>
24
+ <div id="message" class="<?php echo $status ?>">
25
+ <p>
26
+ <strong><?php echo $message ?></strong>
27
+ </p>
28
+ </div>
29
+ <?php endif; ?>
30
+
31
+ <?php if ( isset( $warning_status ) and isset( $warning_message ) ): ?>
32
+ <?php if ( ! isset( $warning_exclude_tab ) or $warning_exclude_tab != $active_tab ): ?>
33
+ <div id="message" class="<?php echo $warning_status ?>">
34
+ <p>
35
+ <strong><?php echo $warning_message ?></strong>
36
+ </p>
37
+ </div>
38
+ <?php endif; ?>
39
+ <?php endif; ?>
40
+
41
  <?php
42
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_nav.php';
43
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_general.php';
view/sendgrid_settings_test_contact.php CHANGED
@@ -1,5 +1,11 @@
1
  <?php if ( $active_tab == 'marketing' ): ?>
2
- <?php if ( ( $is_mc_api_key_valid and $contact_list_id_is_valid ) or ( 'error' == $status and isset( $error_type ) and 'upload' == $error_type ) ): ?>
 
 
 
 
 
 
3
  <form class="form-table" name="sendgrid_form" method="POST" action="<?php echo Sendgrid_Tools::get_form_action(); ?>">
4
  <table class="form-table">
5
  <tbody>
1
  <?php if ( $active_tab == 'marketing' ): ?>
2
+ <?php if (
3
+ // Both api keys are set and the contact list id is set
4
+ ( $is_mc_api_key_valid and $is_api_key_valid and $contact_list_id_is_valid ) or
5
+ // There was an error sending the subscription email for contact upload
6
+ ( 'error' == $status and isset( $error_type ) and 'upload' == $error_type )
7
+ ) :
8
+ ?>
9
  <form class="form-table" name="sendgrid_form" method="POST" action="<?php echo Sendgrid_Tools::get_form_action(); ?>">
10
  <table class="form-table">
11
  <tbody>
view/sendgrid_settings_test_email.php CHANGED
@@ -1,5 +1,13 @@
1
  <?php if ( $active_tab == 'general' ): ?>
2
- <?php if ( ! isset( $status ) or ( 'error' != $status ) or ( 'error' == $status and isset( $error_type ) and 'sending' == $error_type ) ): ?>
 
 
 
 
 
 
 
 
3
  <form name="sendgrid_test" method="POST" action="<?php echo Sendgrid_Tools::get_form_action(); ?>">
4
  <table class="form-table">
5
  <tbody>
1
  <?php if ( $active_tab == 'general' ): ?>
2
+ <?php if (
3
+ // No status is set
4
+ ! isset( $status ) or
5
+ // There is no error status
6
+ ( 'error' != $status and ! empty( $api_key ) ) or
7
+ // There is an error, but the error was from sending with the test form
8
+ ( 'error' == $status and isset( $error_type ) and 'sending' == $error_type )
9
+ ) :
10
+ ?>
11
  <form name="sendgrid_test" method="POST" action="<?php echo Sendgrid_Tools::get_form_action(); ?>">
12
  <table class="form-table">
13
  <tbody>
wpsendgrid.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
- Version: 1.11.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
3
  Plugin Name: SendGrid
4
  Plugin URI: http://wordpress.org/plugins/sendgrid-email-delivery-simplified/
5
  Description: Email Delivery. Simplified. SendGrid's cloud-based email infrastructure relieves businesses of the cost and complexity of maintaining custom email systems. SendGrid provides reliable delivery, scalability and real-time analytics along with flexible APIs that make custom integration a breeze.
6
+ Version: 1.11.3
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified