SendGrid - Version 1.10.9

Version Description

  • Added pagination on multisite settings page
  • Fixed an FAQ link
  • Changed a class method to protected for extensibility (user contribution)
  • Added some CSS classes for subscription widget (user contribution)
  • Added warning when API Key doesn't have statistics permissions
  • The statistics page will not show up in menu or dashboard when API key does not have stats permissions
Download this release

Release Info

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

Code changes from version 1.10.8 to 1.10.9

lib/class-sendgrid-nlvx-widget.php CHANGED
@@ -15,7 +15,7 @@ class SendGrid_NLVX_Widget extends WP_Widget {
15
  const INVALID_EMAIL_ERROR = 'email_invalid';
16
  const SUCCESS_EMAIL_SEND = 'email_sent';
17
  const ERROR_EMAIL_SEND = 'email_error_send';
18
-
19
  /**
20
  * Widget class constructor
21
  *
@@ -23,8 +23,8 @@ class SendGrid_NLVX_Widget extends WP_Widget {
23
  */
24
  function __construct() {
25
  parent::__construct(
26
- 'sendgrid_nlvx_widget',
27
- 'SendGrid Subscription Widget',
28
  array(
29
  'description' => 'SendGrid Marketing Campaigns Subscription Widget'
30
  )
@@ -118,7 +118,7 @@ class SendGrid_NLVX_Widget extends WP_Widget {
118
 
119
  return $instance;
120
  }
121
-
122
  /**
123
  * Method called to render the front-end of the widget
124
  *
@@ -164,12 +164,12 @@ class SendGrid_NLVX_Widget extends WP_Widget {
164
  if ( isset( $_POST['sendgrid_mc_email'] ) ) {
165
  $process_form_reponse = $this->process_subscription();
166
  if ( self::SUCCESS_EMAIL_SEND == $process_form_reponse ) {
167
- echo '<p class="sendgrid_widget_text"> ' . $success_text . ' </p>';
168
  } elseif ( self::INVALID_EMAIL_ERROR == $process_form_reponse ) {
169
- echo '<p class="sendgrid_widget_text"> ' . $error_email_text . ' </p>';
170
  $this->display_form();
171
  } else {
172
- echo '<p class="sendgrid_widget_text"> ' . $error_text . ' </p>';
173
  $this->display_form();
174
  }
175
  } else {
@@ -190,17 +190,17 @@ class SendGrid_NLVX_Widget extends WP_Widget {
190
  *
191
  * @return void
192
  */
193
- private function process_subscription() {
194
  $email_split = explode( "@", htmlspecialchars($_POST['sendgrid_mc_email'], ENT_QUOTES, 'UTF-8') );
195
 
196
  if ( isset( $email_split[1] ) ) {
197
  $email_domain = $email_split[1];
198
-
199
  try {
200
  $Punycode = new Punycode();
201
  $email_domain = $Punycode->decode( $email_split[1] );
202
  }
203
- catch ( Exception $e ) {
204
  }
205
 
206
  $email = $email_split[0] . '@' . $email_domain;
@@ -223,8 +223,8 @@ class SendGrid_NLVX_Widget extends WP_Widget {
223
  }
224
 
225
  if ( isset( $_POST['sendgrid_mc_first_name'] ) and isset( $_POST['sendgrid_mc_last_name'] ) ) {
226
- Sendgrid_OptIn_API_Endpoint::send_confirmation_email(
227
- $email,
228
  htmlspecialchars( $_POST['sendgrid_mc_first_name'], ENT_QUOTES, 'UTF-8' ),
229
  htmlspecialchars( $_POST['sendgrid_mc_last_name'], ENT_QUOTES, 'UTF-8' )
230
  );
@@ -276,7 +276,7 @@ class SendGrid_NLVX_Widget extends WP_Widget {
276
  $require_fname_lname = '';
277
 
278
  echo '<form method="post" id="sendgrid_mc_email_form" class="mc_email_form" action="#sendgrid_mc_email_subscribe" style="padding-top: 10px;">';
279
-
280
  if ( 'true' == Sendgrid_Tools::get_mc_opt_incl_fname_lname() ) {
281
  if ( 'true' == Sendgrid_Tools::get_mc_opt_req_fname_lname() ) {
282
  $require_fname_lname = "required";
@@ -284,7 +284,7 @@ class SendGrid_NLVX_Widget extends WP_Widget {
284
  $last_name_label .= "<sup>*</sup>";
285
  }
286
 
287
- echo '<div class="sendgrid_mc_fields" style="' . $input_padding . '">';
288
  echo ' <div class="sendgrid_mc_label_div">';
289
  echo ' <label for="sendgrid_mc_first_name" class="sendgrid_mc_label sendgrid_mc_label_first_name">' . $first_name_label . ' : </label>';
290
  echo ' </div>';
@@ -311,7 +311,7 @@ class SendGrid_NLVX_Widget extends WP_Widget {
311
  echo ' </div>';
312
  echo '</div>';
313
 
314
- echo '<div class="sendgrid_mc_button_div">';
315
  echo ' <input style="' . $button_padding . '" class="sendgrid_mc_button" type="submit" id="sendgrid_mc_email_submit" value="' . $subscribe_label . '" />';
316
  echo '</div>';
317
  echo '</form>';
15
  const INVALID_EMAIL_ERROR = 'email_invalid';
16
  const SUCCESS_EMAIL_SEND = 'email_sent';
17
  const ERROR_EMAIL_SEND = 'email_error_send';
18
+
19
  /**
20
  * Widget class constructor
21
  *
23
  */
24
  function __construct() {
25
  parent::__construct(
26
+ 'sendgrid_nlvx_widget',
27
+ 'SendGrid Subscription Widget',
28
  array(
29
  'description' => 'SendGrid Marketing Campaigns Subscription Widget'
30
  )
118
 
119
  return $instance;
120
  }
121
+
122
  /**
123
  * Method called to render the front-end of the widget
124
  *
164
  if ( isset( $_POST['sendgrid_mc_email'] ) ) {
165
  $process_form_reponse = $this->process_subscription();
166
  if ( self::SUCCESS_EMAIL_SEND == $process_form_reponse ) {
167
+ echo '<p class="sendgrid_widget_text sendgrid_widget_success"> ' . $success_text . ' </p>';
168
  } elseif ( self::INVALID_EMAIL_ERROR == $process_form_reponse ) {
169
+ echo '<p class="sendgrid_widget_text sendgrid_widget_error"> ' . $error_email_text . ' </p>';
170
  $this->display_form();
171
  } else {
172
+ echo '<p class="sendgrid_widget_text sendgrid_widget_error"> ' . $error_text . ' </p>';
173
  $this->display_form();
174
  }
175
  } else {
190
  *
191
  * @return void
192
  */
193
+ private function process_subscription() {
194
  $email_split = explode( "@", htmlspecialchars($_POST['sendgrid_mc_email'], ENT_QUOTES, 'UTF-8') );
195
 
196
  if ( isset( $email_split[1] ) ) {
197
  $email_domain = $email_split[1];
198
+
199
  try {
200
  $Punycode = new Punycode();
201
  $email_domain = $Punycode->decode( $email_split[1] );
202
  }
203
+ catch ( Exception $e ) {
204
  }
205
 
206
  $email = $email_split[0] . '@' . $email_domain;
223
  }
224
 
225
  if ( isset( $_POST['sendgrid_mc_first_name'] ) and isset( $_POST['sendgrid_mc_last_name'] ) ) {
226
+ Sendgrid_OptIn_API_Endpoint::send_confirmation_email(
227
+ $email,
228
  htmlspecialchars( $_POST['sendgrid_mc_first_name'], ENT_QUOTES, 'UTF-8' ),
229
  htmlspecialchars( $_POST['sendgrid_mc_last_name'], ENT_QUOTES, 'UTF-8' )
230
  );
276
  $require_fname_lname = '';
277
 
278
  echo '<form method="post" id="sendgrid_mc_email_form" class="mc_email_form" action="#sendgrid_mc_email_subscribe" style="padding-top: 10px;">';
279
+
280
  if ( 'true' == Sendgrid_Tools::get_mc_opt_incl_fname_lname() ) {
281
  if ( 'true' == Sendgrid_Tools::get_mc_opt_req_fname_lname() ) {
282
  $require_fname_lname = "required";
284
  $last_name_label .= "<sup>*</sup>";
285
  }
286
 
287
+ echo '<div class="sendgrid_mc_fields" style="' . $input_padding . '">';
288
  echo ' <div class="sendgrid_mc_label_div">';
289
  echo ' <label for="sendgrid_mc_first_name" class="sendgrid_mc_label sendgrid_mc_label_first_name">' . $first_name_label . ' : </label>';
290
  echo ' </div>';
311
  echo ' </div>';
312
  echo '</div>';
313
 
314
+ echo '<div class="sendgrid_mc_button_div">';
315
  echo ' <input style="' . $button_padding . '" class="sendgrid_mc_button" type="submit" id="sendgrid_mc_email_submit" value="' . $subscribe_label . '" />';
316
  echo '</div>';
317
  echo '</form>';
lib/class-sendgrid-nlvx.php CHANGED
@@ -11,7 +11,7 @@ class Sendgrid_NLVX
11
  *
12
  * @return mixed string of the header value if successful, false otherwise.
13
  */
14
- private static function get_auth_header_value()
15
  {
16
  if ( "false" == Sendgrid_Tools::get_mc_opt_use_transactional() ) {
17
  $mc_api_key = Sendgrid_Tools::get_mc_api_key();
@@ -126,7 +126,7 @@ class Sendgrid_NLVX
126
  if ( ! isset( $recipient_response['persisted_recipients'] ) or ! isset( $recipient_response['persisted_recipients'][0] ) ) {
127
  return false;
128
  }
129
-
130
  return $recipient_response['persisted_recipients'][0];
131
  }
132
 
11
  *
12
  * @return mixed string of the header value if successful, false otherwise.
13
  */
14
+ protected static function get_auth_header_value()
15
  {
16
  if ( "false" == Sendgrid_Tools::get_mc_opt_use_transactional() ) {
17
  $mc_api_key = Sendgrid_Tools::get_mc_api_key();
126
  if ( ! isset( $recipient_response['persisted_recipients'] ) or ! isset( $recipient_response['persisted_recipients'][0] ) ) {
127
  return false;
128
  }
129
+
130
  return $recipient_response['persisted_recipients'][0];
131
  }
132
 
lib/class-sendgrid-settings.php CHANGED
@@ -129,7 +129,7 @@ class Sendgrid_Settings {
129
  * @return void
130
  */
131
  public static function show_settings_page()
132
- {
133
  $response = null;
134
  $error_from_update = false;
135
 
@@ -257,7 +257,7 @@ class Sendgrid_Settings {
257
  $status = 'error';
258
  } elseif ( 'true' == $mc_opt_use_transactional and ! $is_mc_api_key_valid ) {
259
  $message = 'The configured API Key for subscription widget is invalid, empty or without permissions.';
260
- $status = 'error';
261
  } elseif ( 'error' != $status ) {
262
  $status = 'valid_auth';
263
  }
@@ -311,7 +311,7 @@ class Sendgrid_Settings {
311
  $unsubscribe_groups = Sendgrid_Tools::get_all_unsubscribe_groups();
312
  $no_permission_on_unsubscribe_groups = false;
313
  if ( ( 'apikey' == $auth_method ) and ( 'true' != Sendgrid_Tools::get_asm_permission() ) ) {
314
- $no_permission_on_unsubscribe_groups = true;
315
  }
316
 
317
  // get form configuration
@@ -369,6 +369,11 @@ class Sendgrid_Settings {
369
  }
370
  }
371
 
 
 
 
 
 
372
  require_once dirname( __FILE__ ) . '/../view/sendgrid_settings.php';
373
  }
374
 
@@ -390,11 +395,11 @@ class Sendgrid_Settings {
390
 
391
  if ( isset( $params['contact_upload_test'] ) and $params['contact_upload_test'] ) {
392
  return self::send_contact_upload_test( $params );
393
- }
394
 
395
  if ( isset( $params['subsite_settings'] ) and $params['subsite_settings'] ) {
396
  return self::save_subsite_settings( $params );
397
- }
398
 
399
  return self::save_general_settings( $params );
400
  }
@@ -407,9 +412,20 @@ class Sendgrid_Settings {
407
  * @return mixed response array with message and status
408
  */
409
  private static function save_subsite_settings( $params ) {
410
- $sites = get_sites();
 
 
 
 
 
 
 
 
 
 
 
411
  foreach( $sites as $site ) {
412
- if ( isset( $params['checked_sites'][$site->blog_id] ) and
413
  'on' == $params['checked_sites'][$site->blog_id] ) {
414
  update_blog_option( $site->blog_id, 'sendgrid_can_manage_subsite', 1 );
415
  } else {
@@ -426,7 +442,7 @@ class Sendgrid_Settings {
426
  * @return mixed response array with message and status
427
  */
428
  private static function save_mc_settings( $params ) {
429
- // Use Transactional Option
430
  $use_transactional_key = false;
431
 
432
  if ( ! defined( 'SENDGRID_MC_OPT_USE_TRANSACTIONAL' ) ) {
@@ -443,7 +459,7 @@ class Sendgrid_Settings {
443
  // If Use Transactional Is Set and auth is not through credentials, check the API key for MC scopes.
444
  if ( $use_transactional_key and 'apikey' == Sendgrid_Tools::get_auth_method() ) {
445
  $apikey = Sendgrid_Tools::get_api_key();
446
- if( false == $apikey or empty( $apikey ) ) {
447
  $response = array(
448
  'message' => 'API Key is empty.',
449
  'status' => 'error'
129
  * @return void
130
  */
131
  public static function show_settings_page()
132
+ {
133
  $response = null;
134
  $error_from_update = false;
135
 
257
  $status = 'error';
258
  } elseif ( 'true' == $mc_opt_use_transactional and ! $is_mc_api_key_valid ) {
259
  $message = 'The configured API Key for subscription widget is invalid, empty or without permissions.';
260
+ $status = 'error';
261
  } elseif ( 'error' != $status ) {
262
  $status = 'valid_auth';
263
  }
311
  $unsubscribe_groups = Sendgrid_Tools::get_all_unsubscribe_groups();
312
  $no_permission_on_unsubscribe_groups = false;
313
  if ( ( 'apikey' == $auth_method ) and ( 'true' != Sendgrid_Tools::get_asm_permission() ) ) {
314
+ $no_permission_on_unsubscribe_groups = true;
315
  }
316
 
317
  // get form configuration
369
  }
370
  }
371
 
372
+ if ( $auth_method == 'apikey' and $api_key != '' and ! Sendgrid_Tools::check_api_key_stats( $api_key ) ) {
373
+ $warning_message = 'The configured API key does not have statistics permissions. You will not be able to see the statistics page.';
374
+ $warning_status = 'notice notice-warning';
375
+ }
376
+
377
  require_once dirname( __FILE__ ) . '/../view/sendgrid_settings.php';
378
  }
379
 
395
 
396
  if ( isset( $params['contact_upload_test'] ) and $params['contact_upload_test'] ) {
397
  return self::send_contact_upload_test( $params );
398
+ }
399
 
400
  if ( isset( $params['subsite_settings'] ) and $params['subsite_settings'] ) {
401
  return self::save_subsite_settings( $params );
402
+ }
403
 
404
  return self::save_general_settings( $params );
405
  }
412
  * @return mixed response array with message and status
413
  */
414
  private static function save_subsite_settings( $params ) {
415
+ $limit = 50;
416
+ $offset = 0;
417
+
418
+ if ( isset( $_GET['limit'] ) ) {
419
+ $limit = intval( $_GET['limit'] );
420
+ }
421
+
422
+ if ( isset( $_GET['offset'] ) ) {
423
+ $offset = intval( $_GET['offset'] );
424
+ }
425
+
426
+ $sites = get_sites( array( 'number' => $limit, 'offset' => $offset ) );
427
  foreach( $sites as $site ) {
428
+ if ( isset( $params['checked_sites'][$site->blog_id] ) and
429
  'on' == $params['checked_sites'][$site->blog_id] ) {
430
  update_blog_option( $site->blog_id, 'sendgrid_can_manage_subsite', 1 );
431
  } else {
442
  * @return mixed response array with message and status
443
  */
444
  private static function save_mc_settings( $params ) {
445
+ // Use Transactional Option
446
  $use_transactional_key = false;
447
 
448
  if ( ! defined( 'SENDGRID_MC_OPT_USE_TRANSACTIONAL' ) ) {
459
  // If Use Transactional Is Set and auth is not through credentials, check the API key for MC scopes.
460
  if ( $use_transactional_key and 'apikey' == Sendgrid_Tools::get_auth_method() ) {
461
  $apikey = Sendgrid_Tools::get_api_key();
462
+ if ( false == $apikey or empty( $apikey ) ) {
463
  $response = array(
464
  'message' => 'API Key is empty.',
465
  'status' => 'error'
lib/class-sendgrid-statistics.php CHANGED
@@ -31,7 +31,7 @@ class Sendgrid_Statistics
31
  } elseif ( is_multisite() and is_main_site() ) {
32
  // Add SendGrid stats page in menu
33
  add_action( 'network_admin_menu', array( __CLASS__, 'add_network_statistics_menu' ) );
34
-
35
  // Add SendGrid javascripts in header
36
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_headers' ) );
37
 
@@ -93,7 +93,7 @@ class Sendgrid_Statistics
93
  {
94
  case "apikey":
95
  $apikey = Sendgrid_Tools::get_api_key();
96
- if ( ! Sendgrid_Tools::check_api_key( $apikey ) ) {
97
  return;
98
  }
99
  break;
@@ -119,7 +119,7 @@ class Sendgrid_Statistics
119
  {
120
  case "apikey":
121
  $apikey = Sendgrid_Tools::get_api_key();
122
- if ( ! Sendgrid_Tools::check_api_key( $apikey ) ) {
123
  return;
124
  }
125
  break;
@@ -211,7 +211,7 @@ class Sendgrid_Statistics
211
  }
212
 
213
  $endpoint = 'v3/stats';
214
-
215
  if ( isset( $_POST['type'] ) && 'general' != $_POST['type'] ) {
216
  if( 'wordpress' == $_POST['type'] ) {
217
  $parameters['categories'] = 'wp_sendgrid_plugin';
31
  } elseif ( is_multisite() and is_main_site() ) {
32
  // Add SendGrid stats page in menu
33
  add_action( 'network_admin_menu', array( __CLASS__, 'add_network_statistics_menu' ) );
34
+
35
  // Add SendGrid javascripts in header
36
  add_action( 'admin_enqueue_scripts', array( __CLASS__, 'add_headers' ) );
37
 
93
  {
94
  case "apikey":
95
  $apikey = Sendgrid_Tools::get_api_key();
96
+ if ( ! Sendgrid_Tools::check_api_key_stats( $apikey ) ) {
97
  return;
98
  }
99
  break;
119
  {
120
  case "apikey":
121
  $apikey = Sendgrid_Tools::get_api_key();
122
+ if ( ! Sendgrid_Tools::check_api_key_stats( $apikey ) ) {
123
  return;
124
  }
125
  break;
211
  }
212
 
213
  $endpoint = 'v3/stats';
214
+
215
  if ( isset( $_POST['type'] ) && 'general' != $_POST['type'] ) {
216
  if( 'wordpress' == $_POST['type'] ) {
217
  $parameters['categories'] = 'wp_sendgrid_plugin';
lib/class-sendgrid-tools.php CHANGED
@@ -80,7 +80,7 @@ class Sendgrid_Tools
80
  $url .= "api_user=" . urlencode( $username ) . "&api_key=" . urlencode( $password );
81
 
82
  $response = wp_remote_get( $url, array( 'decompress' => false ) );
83
-
84
  if ( ! is_array( $response ) or ! isset( $response['body'] ) ) {
85
  return false;
86
  }
@@ -169,7 +169,7 @@ class Sendgrid_Tools
169
  if ( Sendgrid_Tools::check_api_key_scopes( $apikey, array( "asm.groups.read" ) ) ) {
170
  Sendgrid_Tools::set_asm_permission( 'true' );
171
  } else {
172
- Sendgrid_Tools::set_asm_permission( 'false' );
173
  }
174
 
175
  if ( ! Sendgrid_Tools::check_api_key_scopes( $apikey, array( "mail.send" ) ) ) {
@@ -231,7 +231,7 @@ class Sendgrid_Tools
231
 
232
  $args = array(
233
  'headers' => array(
234
- 'Authorization' => 'Basic ' . $creds
235
  ),
236
  'decompress' => false
237
  );
@@ -239,7 +239,7 @@ class Sendgrid_Tools
239
  } else {
240
  $args = array(
241
  'headers' => array(
242
- 'Authorization' => 'Bearer ' . $parameters['apikey']
243
  ),
244
  'decompress' => false
245
  );
@@ -1008,7 +1008,7 @@ class Sendgrid_Tools
1008
  $parameters['apikey'] = Sendgrid_Tools::get_api_key();
1009
 
1010
  if ( ( 'apikey' == $parameters['auth_method'] ) and ( 'true' != self::get_asm_permission() ) ) {
1011
- return false;
1012
  }
1013
 
1014
  $response = Sendgrid_Tools::do_request( $url, $parameters );
@@ -1183,7 +1183,7 @@ class Sendgrid_Tools
1183
  /**
1184
  * Return input padding by position from the database
1185
  *
1186
- * @param string $position position
1187
  * @return integer padding value
1188
  */
1189
  public static function get_mc_input_padding_by_position( $position )
@@ -1247,7 +1247,7 @@ class Sendgrid_Tools
1247
  /**
1248
  * Return button padding by position from the database
1249
  *
1250
- * @param string $position position
1251
  * @return integer padding value
1252
  */
1253
  public static function get_mc_button_padding_by_position( $position )
@@ -1502,7 +1502,7 @@ class Sendgrid_Tools
1502
  public static function get_transient_sendgrid( $transient ) {
1503
  $old_cache_value = wp_using_ext_object_cache();
1504
  wp_using_ext_object_cache( false );
1505
-
1506
  if ( ! is_multisite() || ( is_multisite() and ! is_main_site() and get_option( 'sendgrid_can_manage_subsite' ) ) ) {
1507
  $value = get_transient( $transient );
1508
  } else {
@@ -1552,6 +1552,56 @@ class Sendgrid_Tools
1552
  $request_uri = str_replace( '%7E', '~', $request_uri );
1553
  return $request_uri;
1554
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1555
  }
1556
 
1557
  /**
80
  $url .= "api_user=" . urlencode( $username ) . "&api_key=" . urlencode( $password );
81
 
82
  $response = wp_remote_get( $url, array( 'decompress' => false ) );
83
+
84
  if ( ! is_array( $response ) or ! isset( $response['body'] ) ) {
85
  return false;
86
  }
169
  if ( Sendgrid_Tools::check_api_key_scopes( $apikey, array( "asm.groups.read" ) ) ) {
170
  Sendgrid_Tools::set_asm_permission( 'true' );
171
  } else {
172
+ Sendgrid_Tools::set_asm_permission( 'false' );
173
  }
174
 
175
  if ( ! Sendgrid_Tools::check_api_key_scopes( $apikey, array( "mail.send" ) ) ) {
231
 
232
  $args = array(
233
  'headers' => array(
234
+ 'Authorization' => 'Basic ' . $creds
235
  ),
236
  'decompress' => false
237
  );
239
  } else {
240
  $args = array(
241
  'headers' => array(
242
+ 'Authorization' => 'Bearer ' . $parameters['apikey']
243
  ),
244
  'decompress' => false
245
  );
1008
  $parameters['apikey'] = Sendgrid_Tools::get_api_key();
1009
 
1010
  if ( ( 'apikey' == $parameters['auth_method'] ) and ( 'true' != self::get_asm_permission() ) ) {
1011
+ return false;
1012
  }
1013
 
1014
  $response = Sendgrid_Tools::do_request( $url, $parameters );
1183
  /**
1184
  * Return input padding by position from the database
1185
  *
1186
+ * @param string $position position
1187
  * @return integer padding value
1188
  */
1189
  public static function get_mc_input_padding_by_position( $position )
1247
  /**
1248
  * Return button padding by position from the database
1249
  *
1250
+ * @param string $position position
1251
  * @return integer padding value
1252
  */
1253
  public static function get_mc_button_padding_by_position( $position )
1502
  public static function get_transient_sendgrid( $transient ) {
1503
  $old_cache_value = wp_using_ext_object_cache();
1504
  wp_using_ext_object_cache( false );
1505
+
1506
  if ( ! is_multisite() || ( is_multisite() and ! is_main_site() and get_option( 'sendgrid_can_manage_subsite' ) ) ) {
1507
  $value = get_transient( $transient );
1508
  } else {
1552
  $request_uri = str_replace( '%7E', '~', $request_uri );
1553
  return $request_uri;
1554
  }
1555
+
1556
+ /**
1557
+ * Function that returns an array of data used on the multisite pagination,
1558
+ * The array will contain the total number of pages, the current page and
1559
+ * HTML for the previous and next buttons.
1560
+ *
1561
+ * @param type int $offset
1562
+ * @param type int $limit
1563
+ *
1564
+ * @return array data used by the multisite view
1565
+ */
1566
+ public static function get_multisite_pagination( $offset, $limit ) {
1567
+ $pagination = array();
1568
+
1569
+ // Fetch sites based on pagination
1570
+ $total_site_count = get_blog_count();
1571
+ $sites_remaining = $total_site_count - $offset - $limit;
1572
+
1573
+ $total_page_count = 1;
1574
+ $current_page = 1;
1575
+
1576
+ if ( $limit != 0 ) {
1577
+ $total_page_count = ceil( $total_site_count / $limit );
1578
+ $current_page = ceil( $offset / $limit ) + 1;
1579
+ }
1580
+
1581
+ // Create previous button HTML code
1582
+ $previous_button = '';
1583
+ if ( $offset != 0 and $limit != 0 ) {
1584
+ $previous_offset = ( $offset - $limit < 0 ? 0 : $offset - $limit );
1585
+ $previous_button .= '<a href="?page=sendgrid-settings&tab=multisite&offset=' . $previous_offset;
1586
+ $previous_button .= '&limit=' . $limit . '" class="sendgrid-multisite-button button button-secondary">';
1587
+ $previous_button .= translate( 'Previous' ) . '</a>';
1588
+ }
1589
+
1590
+ $next_button = '';
1591
+ if ( $sites_remaining > 0 and $limit != 0 ) {
1592
+ $next_offset = $offset + $limit;
1593
+ $next_button .= '<a href="?page=sendgrid-settings&tab=multisite&offset=' . $next_offset;
1594
+ $next_button .= '&limit=' . $limit . '" class="sendgrid-multisite-button button button-secondary">';
1595
+ $next_button .= translate( 'Next' ) . '</a>';
1596
+ }
1597
+
1598
+ $pagination['total_pages'] = $total_page_count;
1599
+ $pagination['current_page'] = $current_page;
1600
+ $pagination['previous_button'] = $previous_button;
1601
+ $pagination['next_button'] = $next_button;
1602
+
1603
+ return $pagination;
1604
+ }
1605
  }
1606
 
1607
  /**
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: team-rs
3
  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.2
6
  Tested up to: 4.7
7
- Stable tag: 1.10.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -28,7 +28,7 @@ SendGrid’s WordPress Subscription Widget makes it easy for people visiting you
28
 
29
  For more details, consult the official documentation for the Subscription Widget here : https://sendgrid.com/docs/Integrate/Tutorials/WordPress/subscription_widget.html
30
 
31
- = Multisite (Beta) =
32
 
33
  If you are using the SendGrid plugin in a Multisite environment, you need to Network Activate it. You can then access the settings page on the network dashboard and the configure settings will be used for all sites.
34
 
@@ -42,7 +42,7 @@ If you already had the plugin installed in a Multisite environment and you updat
42
 
43
  Requirements:
44
 
45
- 1. PHP version >= 5.3.0
46
  2. To send emails through SMTP you need to also install the 'Swift Mailer' plugin. ( https://wordpress.org/plugins/swift-mailer/ )
47
  3. If wp_mail() function has been declared by another plugin that you have installed, you won't be able to use the SendGrid plugin
48
 
@@ -108,13 +108,13 @@ Use HTML content type for a single email:
108
 
109
  `add_filter('wp_mail_content_type', 'set_html_content_type');
110
 
111
- // Send the email
112
 
113
  remove_filter('wp_mail_content_type', 'set_html_content_type');`
114
 
115
  Change the email contents for all emails before they are sent:
116
 
117
- `function change_content( $message, $content_type ) {
118
  if ( 'text/plain' == $content_type ) {
119
  $message = $message . ' will be sent as text ' ;
120
  } else {
@@ -162,7 +162,7 @@ Add it into your wp-config.php file. Example: `define('SENDGRID_API_KEY', 'your_
162
 
163
  If you have WP Better Emails plugin installed and you want to use the template defined here instead of the SendGrid template you can add the following code in your functions.php file from your theme:
164
 
165
- `function use_wpbe_template( $message, $content_type ) {
166
  global $wp_better_emails;
167
  if ( 'text/plain' == $content_type ) {
168
  $message = $wp_better_emails->process_email_text( $message );
@@ -178,7 +178,7 @@ Using the default templates from WP Better Emails will cause all emails to be se
178
 
179
  = Why are my emails sent as HTML instead of plain text ? =
180
 
181
- For a detailed explanation see this page: https://support.sendgrid.com/hc/en-us/articles/200181418-Plain-text-emails-converted-to-HTML
182
 
183
  = Will contacts from the widget be uploaded to Marketing Campaigns or Legacy Newsletter ? =
184
 
@@ -186,8 +186,13 @@ The contacts will only be uploaded to Marketing Campaigns.
186
 
187
  = What permissions should my API keys have ? =
188
 
189
- For the API Key used for sending emails, that is entered on the General tab, the key needs to have Full Access to Mail Send and Read Access to Stats.
190
- For the API Key used for contact upload, that is entered on the Subscription Widget tab, the key needs to have Full Access to Marketings Campaigns.
 
 
 
 
 
191
 
192
  = Can I disable the opt-in email ? =
193
 
@@ -235,29 +240,38 @@ You need to enable the use of the First Name and Last Name fields from the setti
235
 
236
  = Does this plugin support Multisite? =
237
 
238
- Yes. This plugin has basic Multisite support. You need to Network Activate this plugin.
239
 
240
  The settings for all sites in the network can be configured only by the Network Admin in the Network Admin Dashboard.
241
 
 
 
242
  == Screenshots ==
243
 
244
- 1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
245
- 2. After activation "Settings" link will appear.
246
- 3. Go to settings page and provide your SendGrid credentials by choosing the authentication method which default is Api Key. On this page you can set also the default "Name", "Sending Address" and "Reply Address".
247
  4. If you want to use your username and password for authentication, switch to Username&Password authentication method.
248
- 5. If you provide valid credentials, a form which can be used to send test emails will appear. Here you can test the plugin sending some emails.
249
- 6. Header provided in the send test email form.
250
- 7. If you click in the right corner from the top of the page on the "Help" button, a popup window with more information will appear.
251
  8. Select the time interval for which you want to see SendGrid statistics and charts.
252
  9. You can configure the port number when using SMTP method.
253
- 10. You can configure categories for which you would like to see your stats.
254
  11. You can use substitutions for emails using X-SMTPAPI headers.
255
  12. You can configure the subscription widget.
256
 
257
  == Changelog ==
258
 
 
 
 
 
 
 
 
259
  = 1.10.8 =
260
- * Fixed an XSS vulnerability in the settings forms that would allow other admins to inject scripts.
261
  = 1.10.7 =
262
  * Add port 2525 for SMTP
263
  * Use cache for stats widget on dashboard
@@ -326,7 +340,7 @@ The settings for all sites in the network can be configured only by the Network
326
  = 1.7.1 =
327
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
328
  * Fixed a timeout issue from version 1.7.0
329
- = 1.7.0 =
330
  * BREAKING CHANGE : wp_mail() now returns only true/false to mirror the return values of the original wp_mail(). If you have written something custom in your function.php that depends on the old behavior of the wp_mail() you should check your code to make sure it will still work right with boolean as return value instead of array
331
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
332
  * Added the possibility of setting the api key or username/password empty
@@ -352,7 +366,7 @@ The settings for all sites in the network can be configured only by the Network
352
  = 1.6.2 =
353
  * Add Api Keys for authentication, use the last version of Sendgrid library: https://github.com/sendgrid/sendgrid-php/releases/tag/v3.2.0
354
  = 1.6.1 =
355
- * Add unique arguments
356
  = 1.6 =
357
  * Fix setTo method in SMTP option, update documentation, add link to SendGrid portal
358
  = 1.5.4 =
@@ -379,9 +393,9 @@ The settings for all sites in the network can be configured only by the Network
379
  * Added support to set additional categories
380
  = 1.4 =
381
  * Fix warnings for static method, add notice for php version < 5.3.0, refactor plugin code
382
- = 1.3.2 =
383
  * Fix URL for loading image
384
- = 1.3.1 =
385
  * Fixed reply-to to accept: "name <email@example.com>"
386
  = 1.3 =
387
  * Added support for WordPress 3.8, fixed visual issues for WordPress 3.7
@@ -396,14 +410,21 @@ The settings for all sites in the network can be configured only by the Network
396
  = 1.1.1 =
397
  * Added default category on sending
398
  = 1.1 =
399
- * Added SendGrid Statistics
400
  = 1.0 =
401
  * Fixed issue: Add error message when PHP-curl extension is not enabled.
402
 
403
  == Upgrade notice ==
404
 
 
 
 
 
 
 
 
405
  = 1.10.8 =
406
- * Fixed an XSS vulnerability in the settings forms that would allow other admins to inject scripts.
407
  = 1.10.7 =
408
  * Add port 2525 for SMTP
409
  * Use cache for stats widget on dashboard
@@ -472,7 +493,7 @@ The settings for all sites in the network can be configured only by the Network
472
  = 1.7.1 =
473
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
474
  * Fixed a timeout issue from version 1.7.0
475
- = 1.7.0 =
476
  * BREAKING CHANGE : wp_mail() now returns only true/false to mirror the return values of the original wp_mail(). If you have written something custom in your function.php that depends on the old behavior of the wp_mail() you should check your code to make sure it will still work right with boolean as return value instead of array
477
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
478
  * Added the possibility of setting the api key or username/password empty
@@ -498,7 +519,7 @@ The settings for all sites in the network can be configured only by the Network
498
  = 1.6.2 =
499
  * Add Api Keys for authentication, use the last version of Sendgrid library: https://github.com/sendgrid/sendgrid-php/releases/tag/v3.2.0
500
  = 1.6.1 =
501
- * Add unique arguments
502
  = 1.6 =
503
  * Fix setTo method in SMTP option, update documentation, add link to SendGrid portal
504
  = 1.5.4 =
2
  Contributors: team-rs
3
  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.10.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
28
 
29
  For more details, consult the official documentation for the Subscription Widget here : https://sendgrid.com/docs/Integrate/Tutorials/WordPress/subscription_widget.html
30
 
31
+ = Multisite =
32
 
33
  If you are using the SendGrid plugin in a Multisite environment, you need to Network Activate it. You can then access the settings page on the network dashboard and the configure settings will be used for all sites.
34
 
42
 
43
  Requirements:
44
 
45
+ 1. PHP version >= 5.3.0. PHP 7 is not yet supported.
46
  2. To send emails through SMTP you need to also install the 'Swift Mailer' plugin. ( https://wordpress.org/plugins/swift-mailer/ )
47
  3. If wp_mail() function has been declared by another plugin that you have installed, you won't be able to use the SendGrid plugin
48
 
108
 
109
  `add_filter('wp_mail_content_type', 'set_html_content_type');
110
 
111
+ // Send the email
112
 
113
  remove_filter('wp_mail_content_type', 'set_html_content_type');`
114
 
115
  Change the email contents for all emails before they are sent:
116
 
117
+ `function change_content( $message, $content_type ) {
118
  if ( 'text/plain' == $content_type ) {
119
  $message = $message . ' will be sent as text ' ;
120
  } else {
162
 
163
  If you have WP Better Emails plugin installed and you want to use the template defined here instead of the SendGrid template you can add the following code in your functions.php file from your theme:
164
 
165
+ `function use_wpbe_template( $message, $content_type ) {
166
  global $wp_better_emails;
167
  if ( 'text/plain' == $content_type ) {
168
  $message = $wp_better_emails->process_email_text( $message );
178
 
179
  = Why are my emails sent as HTML instead of plain text ? =
180
 
181
+ For a detailed explanation see this page: https://sendgrid.com/docs/Classroom/Build/Format_Content/plain_text_emails_converted_to_html.html
182
 
183
  = Will contacts from the widget be uploaded to Marketing Campaigns or Legacy Newsletter ? =
184
 
186
 
187
  = What permissions should my API keys have ? =
188
 
189
+ For the API Key used for sending emails (the General tab):
190
+ - Full Access to Mail Send.
191
+ - Read Access to Stats.
192
+ - Read Access to Supressions > Unsubscribe Groups.
193
+ - Read Access to Template Engine.
194
+ For the API Key used for contact upload (the Subscription Widget tab):
195
+ - Full Access to Marketing Campaigns.
196
 
197
  = Can I disable the opt-in email ? =
198
 
240
 
241
  = Does this plugin support Multisite? =
242
 
243
+ Yes. This plugin has basic Multisite support. You need to Network Activate this plugin.
244
 
245
  The settings for all sites in the network can be configured only by the Network Admin in the Network Admin Dashboard.
246
 
247
+ Since 1.10.5 the Network Admin can delegate the configuration for each subsite to their respective owners. This will allow any subsite to use it's own SendGrid Plugin configuration.
248
+
249
  == Screenshots ==
250
 
251
+ 1. Go to Admin Panel, section Plugins and activate the SendGrid plugin. If you want to send emails through SMTP you need to install also the 'Swift Mailer' plugin.
252
+ 2. After activation "Settings" link will appear.
253
+ 3. Go to settings page and provide your SendGrid credentials by choosing the authentication method which default is Api Key. On this page you can set also the default "Name", "Sending Address" and "Reply Address".
254
  4. If you want to use your username and password for authentication, switch to Username&Password authentication method.
255
+ 5. If you provide valid credentials, a form which can be used to send test emails will appear. Here you can test the plugin sending some emails.
256
+ 6. Header provided in the send test email form.
257
+ 7. If you click in the right corner from the top of the page on the "Help" button, a popup window with more information will appear.
258
  8. Select the time interval for which you want to see SendGrid statistics and charts.
259
  9. You can configure the port number when using SMTP method.
260
+ 10. You can configure categories for which you would like to see your stats.
261
  11. You can use substitutions for emails using X-SMTPAPI headers.
262
  12. You can configure the subscription widget.
263
 
264
  == Changelog ==
265
 
266
+ = 1.10.9 =
267
+ * Added pagination on multisite settings page
268
+ * Fixed an FAQ link
269
+ * Changed a class method to protected for extensibility (user contribution)
270
+ * Added some CSS classes for subscription widget (user contribution)
271
+ * Added warning when API Key doesn't have statistics permissions
272
+ * The statistics page will not show up in menu or dashboard when API key does not have stats permissions
273
  = 1.10.8 =
274
+ * Fixed an XSS vulnerability in the settings forms that would allow other admins to inject scripts
275
  = 1.10.7 =
276
  * Add port 2525 for SMTP
277
  * Use cache for stats widget on dashboard
340
  = 1.7.1 =
341
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
342
  * Fixed a timeout issue from version 1.7.0
343
+ = 1.7.0 =
344
  * BREAKING CHANGE : wp_mail() now returns only true/false to mirror the return values of the original wp_mail(). If you have written something custom in your function.php that depends on the old behavior of the wp_mail() you should check your code to make sure it will still work right with boolean as return value instead of array
345
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
346
  * Added the possibility of setting the api key or username/password empty
366
  = 1.6.2 =
367
  * Add Api Keys for authentication, use the last version of Sendgrid library: https://github.com/sendgrid/sendgrid-php/releases/tag/v3.2.0
368
  = 1.6.1 =
369
+ * Add unique arguments
370
  = 1.6 =
371
  * Fix setTo method in SMTP option, update documentation, add link to SendGrid portal
372
  = 1.5.4 =
393
  * Added support to set additional categories
394
  = 1.4 =
395
  * Fix warnings for static method, add notice for php version < 5.3.0, refactor plugin code
396
+ = 1.3.2 =
397
  * Fix URL for loading image
398
+ = 1.3.1 =
399
  * Fixed reply-to to accept: "name <email@example.com>"
400
  = 1.3 =
401
  * Added support for WordPress 3.8, fixed visual issues for WordPress 3.7
410
  = 1.1.1 =
411
  * Added default category on sending
412
  = 1.1 =
413
+ * Added SendGrid Statistics
414
  = 1.0 =
415
  * Fixed issue: Add error message when PHP-curl extension is not enabled.
416
 
417
  == Upgrade notice ==
418
 
419
+ = 1.10.9 =
420
+ * Added pagination on multisite settings page
421
+ * Fixed an FAQ link
422
+ * Changed a class method to protected for extensibility (user contribution)
423
+ * Added some CSS classes for subscription widget (user contribution)
424
+ * Added warning when API Key doesn't have statistics permissions
425
+ * The statistics page will not show up in menu or dashboard when API key does not have stats permissions
426
  = 1.10.8 =
427
+ * Fixed an XSS vulnerability in the settings forms that would allow other admins to inject scripts
428
  = 1.10.7 =
429
  * Add port 2525 for SMTP
430
  * Use cache for stats widget on dashboard
493
  = 1.7.1 =
494
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
495
  * Fixed a timeout issue from version 1.7.0
496
+ = 1.7.0 =
497
  * BREAKING CHANGE : wp_mail() now returns only true/false to mirror the return values of the original wp_mail(). If you have written something custom in your function.php that depends on the old behavior of the wp_mail() you should check your code to make sure it will still work right with boolean as return value instead of array
498
  * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
499
  * Added the possibility of setting the api key or username/password empty
519
  = 1.6.2 =
520
  * Add Api Keys for authentication, use the last version of Sendgrid library: https://github.com/sendgrid/sendgrid-php/releases/tag/v3.2.0
521
  = 1.6.1 =
522
+ * Add unique arguments
523
  = 1.6 =
524
  * Fix setTo method in SMTP option, update documentation, add link to SendGrid portal
525
  = 1.5.4 =
view/css/sendgrid.css CHANGED
@@ -57,7 +57,7 @@
57
  Filters
58
  */
59
  .sendgrid-filters-container {
60
- float:right;
61
  margin-right: 2.4%;
62
  margin-left: 2.3%;
63
  }
@@ -106,7 +106,7 @@
106
  Statistics
107
  */
108
  .sendgrid-container {
109
- width: 100%;
110
  position: relative;
111
  }
112
 
@@ -115,7 +115,7 @@
115
  width: 48px;
116
  height: 48px;
117
  left: 50%;
118
- top: 50%;
119
  margin-left: -24px;
120
  margin-top: -24px;
121
  }
@@ -127,7 +127,7 @@
127
 
128
  .sendgrid-container .widget {
129
  float: left;
130
- width: 189px;
131
  margin-top: 15px;
132
  cursor: default;
133
  }
@@ -142,7 +142,7 @@
142
  }
143
 
144
  .sendgrid-container .widget .widget-inside {
145
- display: block;
146
  text-align: center;
147
  min-height: 70px;
148
  border-top: none!important;
@@ -215,8 +215,8 @@
215
  }
216
 
217
  .sendgrid-statistics-legend {
218
- width: 100%;
219
- height: 22px;
220
  margin-top: 15px;
221
  }
222
 
@@ -249,12 +249,12 @@
249
  .columns-4 .sendgrid-container .widget.others {
250
  width: 46%;
251
  }
252
-
253
  .wordpress-dashboard-new.sendgrid-container .widget.others {
254
  width: 46.55%;
255
  }
256
-
257
- .columns-4 .sendgrid-container .widget.others:last-of-type,
258
  .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
259
  display: block;
260
  padding: 0px;
@@ -269,7 +269,7 @@
269
  .columns-3 .sendgrid-container .widget.others {
270
  width: 46%;
271
  }
272
-
273
  .columns-3 .sendgrid-container .widget.others:last-of-type {
274
  display: block;
275
  padding: 0px;
@@ -284,7 +284,7 @@
284
  .columns-4 .sendgrid-container .widget.others:first-of-type {
285
  margin-top: 10px;
286
  }
287
-
288
  .columns-4 .sendgrid-container .widget.others {
289
  display: block;
290
  padding: 0px;
@@ -300,13 +300,13 @@
300
  .columns-4 .sendgrid-container .widget.others {
301
  width: 46%;
302
  }
303
-
304
  .wordpress-dashboard-new.sendgrid-container .widget.others {
305
  width: 46.55%;
306
  }
307
-
308
  .columns-2 .sendgrid-container .widget.others:last-of-type,
309
- .columns-4 .sendgrid-container .widget.others:last-of-type,
310
  .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
311
  display: block;
312
  padding: 0px;
@@ -318,16 +318,16 @@
318
  }
319
 
320
  @media (min-width: 800px) and (max-width: 1000px) {
321
- .columns-2 .sendgrid-container .widget.others:first-of-type,
322
- .columns-3 .sendgrid-container .widget.others:first-of-type,
323
- .columns-4 .sendgrid-container .widget.others:first-of-type,
324
  .wordpress-dashboard-new.sendgrid-container .widget.others:first-of-type {
325
  margin-top: 10px;
326
  }
327
-
328
- .columns-2 .sendgrid-container .widget.others,
329
- .columns-3 .sendgrid-container .widget.others,
330
- .columns-4 .sendgrid-container .widget.others,
331
  .wordpress-dashboard-new.sendgrid-container .widget.others {
332
  display: block;
333
  padding: 0px;
@@ -339,19 +339,19 @@
339
  }
340
 
341
  @media (min-width: 560px) and (max-width: 782px) {
342
- .sendgrid-filters #sendgrid-start-date,
343
  .sendgrid-filters #sendgrid-end-date {
344
  width: 110px;
345
  }
346
-
347
  .sendgrid-container .widget.others {
348
  width: 46%;
349
  }
350
-
351
  .wordpress-new.sendgrid-container .widget.others {
352
  width: 46.5%;
353
  }
354
-
355
  .sendgrid-container .widget.others:last-of-type {
356
  display: block;
357
  padding: 0px;
@@ -363,7 +363,7 @@
363
  }
364
 
365
  @media (max-width: 559px) {
366
- .sendgrid-filters #sendgrid-start-date,
367
  .sendgrid-filters #sendgrid-end-date {
368
  width: 110px;
369
  }
@@ -371,7 +371,7 @@
371
  .sendgrid-container .widget.others:first-of-type {
372
  margin-top: 10px;
373
  }
374
-
375
  .sendgrid-container .widget.others {
376
  display: block;
377
  padding: 0px;
@@ -410,4 +410,30 @@
410
  font-size: 0.9em;
411
  padding-bottom: 0px;
412
  margin-bottom: 20px!important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
413
  }
57
  Filters
58
  */
59
  .sendgrid-filters-container {
60
+ float:right;
61
  margin-right: 2.4%;
62
  margin-left: 2.3%;
63
  }
106
  Statistics
107
  */
108
  .sendgrid-container {
109
+ width: 100%;
110
  position: relative;
111
  }
112
 
115
  width: 48px;
116
  height: 48px;
117
  left: 50%;
118
+ top: 50%;
119
  margin-left: -24px;
120
  margin-top: -24px;
121
  }
127
 
128
  .sendgrid-container .widget {
129
  float: left;
130
+ width: 189px;
131
  margin-top: 15px;
132
  cursor: default;
133
  }
142
  }
143
 
144
  .sendgrid-container .widget .widget-inside {
145
+ display: block;
146
  text-align: center;
147
  min-height: 70px;
148
  border-top: none!important;
215
  }
216
 
217
  .sendgrid-statistics-legend {
218
+ width: 100%;
219
+ height: 22px;
220
  margin-top: 15px;
221
  }
222
 
249
  .columns-4 .sendgrid-container .widget.others {
250
  width: 46%;
251
  }
252
+
253
  .wordpress-dashboard-new.sendgrid-container .widget.others {
254
  width: 46.55%;
255
  }
256
+
257
+ .columns-4 .sendgrid-container .widget.others:last-of-type,
258
  .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
259
  display: block;
260
  padding: 0px;
269
  .columns-3 .sendgrid-container .widget.others {
270
  width: 46%;
271
  }
272
+
273
  .columns-3 .sendgrid-container .widget.others:last-of-type {
274
  display: block;
275
  padding: 0px;
284
  .columns-4 .sendgrid-container .widget.others:first-of-type {
285
  margin-top: 10px;
286
  }
287
+
288
  .columns-4 .sendgrid-container .widget.others {
289
  display: block;
290
  padding: 0px;
300
  .columns-4 .sendgrid-container .widget.others {
301
  width: 46%;
302
  }
303
+
304
  .wordpress-dashboard-new.sendgrid-container .widget.others {
305
  width: 46.55%;
306
  }
307
+
308
  .columns-2 .sendgrid-container .widget.others:last-of-type,
309
+ .columns-4 .sendgrid-container .widget.others:last-of-type,
310
  .wordpress-dashboard-new.sendgrid-container .widget.others:last-of-type {
311
  display: block;
312
  padding: 0px;
318
  }
319
 
320
  @media (min-width: 800px) and (max-width: 1000px) {
321
+ .columns-2 .sendgrid-container .widget.others:first-of-type,
322
+ .columns-3 .sendgrid-container .widget.others:first-of-type,
323
+ .columns-4 .sendgrid-container .widget.others:first-of-type,
324
  .wordpress-dashboard-new.sendgrid-container .widget.others:first-of-type {
325
  margin-top: 10px;
326
  }
327
+
328
+ .columns-2 .sendgrid-container .widget.others,
329
+ .columns-3 .sendgrid-container .widget.others,
330
+ .columns-4 .sendgrid-container .widget.others,
331
  .wordpress-dashboard-new.sendgrid-container .widget.others {
332
  display: block;
333
  padding: 0px;
339
  }
340
 
341
  @media (min-width: 560px) and (max-width: 782px) {
342
+ .sendgrid-filters #sendgrid-start-date,
343
  .sendgrid-filters #sendgrid-end-date {
344
  width: 110px;
345
  }
346
+
347
  .sendgrid-container .widget.others {
348
  width: 46%;
349
  }
350
+
351
  .wordpress-new.sendgrid-container .widget.others {
352
  width: 46.5%;
353
  }
354
+
355
  .sendgrid-container .widget.others:last-of-type {
356
  display: block;
357
  padding: 0px;
363
  }
364
 
365
  @media (max-width: 559px) {
366
+ .sendgrid-filters #sendgrid-start-date,
367
  .sendgrid-filters #sendgrid-end-date {
368
  width: 110px;
369
  }
371
  .sendgrid-container .widget.others:first-of-type {
372
  margin-top: 10px;
373
  }
374
+
375
  .sendgrid-container .widget.others {
376
  display: block;
377
  padding: 0px;
410
  font-size: 0.9em;
411
  padding-bottom: 0px;
412
  margin-bottom: 20px!important;
413
+ }
414
+
415
+ .sendgrid-multisite-pagination {
416
+ width: auto;
417
+ position: relative;
418
+ float: right;
419
+ margin: 0px;
420
+ padding: 5px;
421
+ }
422
+
423
+ .sendgrid-multisite-button {
424
+ width: 6em;
425
+ text-align: center;
426
+ }
427
+
428
+ .sendgrid-multisite-submit {
429
+ margin-top: 0px;
430
+ padding-top: 5px;
431
+ }
432
+
433
+ .sendgrid-page-numbers {
434
+ position: relative;
435
+ float: left;
436
+ margin: 0px;
437
+ padding: 5px;
438
+ text-align: center;
439
  }
view/js/sendgrid.settings-v1.7.3.js CHANGED
@@ -87,7 +87,7 @@ jQuery(document).ready(function($) {
87
  $('#signup_select_page').select2( {
88
  placeholder: select_page_placeholder
89
  } );
90
-
91
  $('#signup_select_page').prop( 'disabled', false );
92
  }
93
 
@@ -98,12 +98,12 @@ jQuery(document).ready(function($) {
98
  var selected_value_text = $('#select_contact_list option[selected="selected"]').text();
99
  $('#select2-select_contact_list-container').prop('title', selected_value_text);
100
  $('#select2-select_contact_list-container').html(selected_value_text);
101
- }
102
  }
103
 
104
  if( $('#mc_signup_page_defined_in_env').length != 0 ) {
105
  $('#signup_select_page').prop( 'disabled', true );
106
-
107
  if ( $('select#signup_select_page option').length != 0 ) {
108
  var selected_value_text = $('#signup_select_page option[selected="selected"]').text();
109
  $('#select2-signup_select_page-container').prop('title', selected_value_text);
@@ -132,7 +132,7 @@ jQuery(document).ready(function($) {
132
  $("#sendgrid_general_settings_form").submit();
133
  }
134
  });
135
-
136
 
137
  $('#select_unsubscribe_group').select2({
138
  minimumResultsForSearch: 20
87
  $('#signup_select_page').select2( {
88
  placeholder: select_page_placeholder
89
  } );
90
+
91
  $('#signup_select_page').prop( 'disabled', false );
92
  }
93
 
98
  var selected_value_text = $('#select_contact_list option[selected="selected"]').text();
99
  $('#select2-select_contact_list-container').prop('title', selected_value_text);
100
  $('#select2-select_contact_list-container').html(selected_value_text);
101
+ }
102
  }
103
 
104
  if( $('#mc_signup_page_defined_in_env').length != 0 ) {
105
  $('#signup_select_page').prop( 'disabled', true );
106
+
107
  if ( $('select#signup_select_page option').length != 0 ) {
108
  var selected_value_text = $('#signup_select_page option[selected="selected"]').text();
109
  $('#select2-signup_select_page-container').prop('title', selected_value_text);
132
  $("#sendgrid_general_settings_form").submit();
133
  }
134
  });
135
+
136
 
137
  $('#select_unsubscribe_group').select2({
138
  minimumResultsForSearch: 20
view/partials/sendgrid_stats_compliance.php CHANGED
@@ -6,7 +6,7 @@
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="compliance-container" class="sendgrid-statistics"></div>
8
  </div>
9
- <div id="compliance-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="compliance-container" class="sendgrid-statistics"></div>
8
  </div>
9
+ <div id="compliance-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
view/partials/sendgrid_stats_deliveries.php CHANGED
@@ -6,7 +6,7 @@
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="deliveries-container" class="sendgrid-statistics"></div>
8
  </div>
9
- <div id="deliveries-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="deliveries-container" class="sendgrid-statistics"></div>
8
  </div>
9
+ <div id="deliveries-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
view/partials/sendgrid_stats_engagement.php CHANGED
@@ -6,7 +6,7 @@
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="engagement-container" class="sendgrid-statistics"></div>
8
  </div>
9
- <div id="engagement-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
6
  <img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" class="loading" style="position:absolute;" />
7
  <div id="engagement-container" class="sendgrid-statistics"></div>
8
  </div>
9
+ <div id="engagement-container-legend" class="sendgrid-statistics-legend"></div>
10
 
11
  </div>
12
  </div>
view/partials/sendgrid_stats_widget.php CHANGED
@@ -14,10 +14,10 @@
14
  <div class="loading"><img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" style="width: 15px; height: 15px;" /></div>
15
  </div>
16
  <br class="clearfix-clear"/>
17
- <div class="sendgrid-container
18
  <?php echo ( ( version_compare( get_bloginfo( "version" ), '3.7.10', '>' ) and ! isset( $_GET['page'] ) ) ? "wordpress-dashboard-new" : "" ); ?>
19
  <?php echo ( version_compare( get_bloginfo( "version" ), '3.7.10', '>' ) ? "wordpress-new" : ""); ?>" style="position:relative;">
20
- <div class="widget others" id="deliveries">
21
  <div class="widget-top">
22
  <div class="widget-title"><h4>Deliveries</h4></div>
23
  </div>
@@ -42,8 +42,8 @@
42
  </div>
43
  </div>
44
  </div>
45
-
46
- <div class="widget others" id="compliance">
47
  <div class="widget-top">
48
  <div class="widget-title"><h4>Compliance</h4></div>
49
  </div>
@@ -68,8 +68,8 @@
68
  </div>
69
  </div>
70
  </div>
71
-
72
- <div class="widget others" id="engagement">
73
  <div class="widget-top">
74
  <div class="widget-title"><h4>Engagement</h4></div>
75
  </div>
@@ -101,7 +101,7 @@
101
  </div>
102
  </div>
103
  <br class="clearfix-clear"/>
104
-
105
  <?php if ( ! isset ($_GET['page'] ) or "sendgrid-statistics" != sanitize_text_field( $_GET['page'] ) ) { ?>
106
  <a href="index.php?page=sendgrid-statistics" class="more-statistics">See charts</a>
107
  <br class="clearfix-clear"/>
14
  <div class="loading"><img src="<?php echo plugin_dir_url( __FILE__ ); ?>../images/loader.gif" style="width: 15px; height: 15px;" /></div>
15
  </div>
16
  <br class="clearfix-clear"/>
17
+ <div class="sendgrid-container
18
  <?php echo ( ( version_compare( get_bloginfo( "version" ), '3.7.10', '>' ) and ! isset( $_GET['page'] ) ) ? "wordpress-dashboard-new" : "" ); ?>
19
  <?php echo ( version_compare( get_bloginfo( "version" ), '3.7.10', '>' ) ? "wordpress-new" : ""); ?>" style="position:relative;">
20
+ <div class="widget others" id="deliveries">
21
  <div class="widget-top">
22
  <div class="widget-title"><h4>Deliveries</h4></div>
23
  </div>
42
  </div>
43
  </div>
44
  </div>
45
+
46
+ <div class="widget others" id="compliance">
47
  <div class="widget-top">
48
  <div class="widget-title"><h4>Compliance</h4></div>
49
  </div>
68
  </div>
69
  </div>
70
  </div>
71
+
72
+ <div class="widget others" id="engagement">
73
  <div class="widget-top">
74
  <div class="widget-title"><h4>Engagement</h4></div>
75
  </div>
101
  </div>
102
  </div>
103
  <br class="clearfix-clear"/>
104
+
105
  <?php if ( ! isset ($_GET['page'] ) or "sendgrid-statistics" != sanitize_text_field( $_GET['page'] ) ) { ?>
106
  <a href="index.php?page=sendgrid-statistics" class="more-statistics">See charts</a>
107
  <br class="clearfix-clear"/>
view/sendgrid_settings.php CHANGED
@@ -2,7 +2,8 @@
2
  <a href="http://sendgrid.com" target="_blank">
3
  <img src="<?php echo plugins_url( '/images/logo.png', __FILE__ ) ?>" width="100" alt="" />
4
  </a>
5
- <?php if ( isset( $status ) and ( 'updated' == $status or 'error' == $status ) ): ?>
 
6
  <div id="message" class="<?php echo $status ?>">
7
  <p>
8
  <strong><?php echo $message ?></strong>
@@ -10,7 +11,15 @@
10
  </div>
11
  <?php endif; ?>
12
 
13
- <?php
 
 
 
 
 
 
 
 
14
  $tabs = array( 'general' => 'General', 'marketing' => 'Subscription Widget' );
15
 
16
  // If network settings display settings for subsites
@@ -35,4 +44,4 @@
35
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_test_contact.php';
36
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_multisite.php';
37
  ?>
38
- </div>
2
  <a href="http://sendgrid.com" target="_blank">
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>
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
 
25
  // If network settings display settings for subsites
44
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_test_contact.php';
45
  require_once plugin_dir_path( __FILE__ ) . 'sendgrid_settings_multisite.php';
46
  ?>
47
+ </div>
view/sendgrid_settings_general.php CHANGED
@@ -143,7 +143,7 @@
143
  echo '<option value="' . $group['id'] . '" selected="selected">' . $group['name'] . '</option>';
144
  } else {
145
  echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
146
- }
147
  }
148
  }
149
  ?>
@@ -183,6 +183,6 @@
183
  <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Update Settings') ?>" />
184
  </p>
185
  <input type="hidden" name="general_settings" value="true"/>
186
- </form>
187
  <br />
188
  <?php endif; ?>
143
  echo '<option value="' . $group['id'] . '" selected="selected">' . $group['name'] . '</option>';
144
  } else {
145
  echo '<option value="' . $group['id'] . '">' . $group['name'] . '</option>';
146
+ }
147
  }
148
  }
149
  ?>
183
  <input class="button button-primary" type="submit" name="Submit" value="<?php _e('Update Settings') ?>" />
184
  </p>
185
  <input type="hidden" name="general_settings" value="true"/>
186
+ </form>
187
  <br />
188
  <?php endif; ?>
view/sendgrid_settings_multisite.php CHANGED
@@ -1,43 +1,81 @@
1
  <?php if ( $active_tab == 'multisite' ): ?>
2
- <?php $sites = get_sites(); ?>
3
- <p class="description">
4
- On this page you can grant each subsite the ability to manage SendGrid settings. </br>
5
- If the checkbox is unchecked then that site will not see the SendGrid settings page and will use the settings set on the network.</br>
6
- <strong> Warning! </strong> When you activate the management for a subsite, that site will not be able to send emails until the subsite admin updates his SendGrid settings.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  </p>
8
- <form method="POST" action="<?php echo str_replace( '%7E', '~', $_SERVER['REQUEST_URI'] ); ?>">
 
 
 
 
 
 
 
9
  <table class="widefat fixed" id="subsites-table-sg" cellspacing="0">
10
  <thead>
11
  <tr valign="top">
12
- <th scope="col" class="manage-column column-columnname num">ID</th>
13
- <th scope="col" class="manage-column column-columnname">Name</th>
14
- <th scope="col" class="manage-column column-columnname">Public</th>
15
- <th scope="col" class="manage-column column-columnname">Site Url</th>
16
- <th scope="col" class="manage-column"><input style="margin:0 0 0 0px;" type="checkbox" id="sg-check-all-sites"/> Self-Managed?</th>
 
 
 
 
 
 
 
17
  </tr>
18
- </thead>
19
  <tbody>
20
- <?php foreach ($sites as $index => $site): ?>
21
- <?php if (!is_main_site($site->blog_id)): ?>
22
- <?php $site_info = get_blog_details($site->blog_id); ?>
23
- <tr <?php echo ($index%2 == 1)? 'class="alternate"':''?>>
24
  <td class="column-columnname num" scope="row"><?php echo $site_info->blog_id; ?></td>
25
  <td class="column-columnname" scope="row"><?php echo $site_info->blogname; ?></td>
26
- <td class="column-columnname" scope="row"><?php echo $site_info->public? "true":"false"; ?></td>
27
  <td class="column-columnname" scope="row">
28
  <a href="<?php echo $site_info->siteurl; ?>"><?php echo $site_info->siteurl; ?><a>
29
  </td>
30
  <td class="column-columnname" scope="row" aligh="center">
31
- <input type="checkbox" id="check-can-manage-sg" name="checked_sites[<?php echo $site_info->blog_id ?>]"
32
- <?php echo (get_blog_option( $site_info->blog_id, 'sendgrid_can_manage_subsite', 0 )? "checked":"") ?> />
33
  </td>
34
  </tr>
35
  <?php endif; ?>
36
  <?php endforeach; ?>
37
  </tbody>
38
  </table>
39
- <p class="submit">
40
- <input type="submit" id="doaction" class="button button-primary" value="Save Settings">
 
 
 
 
 
41
  </p>
42
  <input type="hidden" name="subsite_settings" value="true"/>
43
  </form>
1
  <?php if ( $active_tab == 'multisite' ): ?>
2
+ <?php
3
+ // Pagination setup
4
+ $limit = 50;
5
+ $offset = 0;
6
+
7
+ if ( isset( $_GET['offset'] ) ) {
8
+ $offset = intval( $_GET['offset'] );
9
+ }
10
+
11
+ if ( isset( $_GET['limit'] ) ) {
12
+ $limit = intval( $_GET['limit'] );
13
+ }
14
+
15
+ $pagination = Sendgrid_Tools::get_multisite_pagination( $offset, $limit );
16
+ $sites = get_sites( array( 'offset' => $offset, 'number' => $limit ) );
17
+ ?>
18
+
19
+ <p class="description">
20
+ <?php
21
+ echo translate( 'On this page you can grant each subsite the ability to manage SendGrid settings.' ) . '</br>';
22
+ echo translate( 'If the checkbox is unchecked then that site will not see the SendGrid settings page and will use the settings set on the network.' ) . '</br>';
23
+ echo '<strong>' . translate( 'Warning!' ) . '</strong>';
24
+ echo translate( ' When you activate the management for a subsite, that site will not be able to send emails until the subsite admin updates his SendGrid settings.' );
25
+ ?>
26
  </p>
27
+
28
+ <p class="sendgrid-multisite-pagination">
29
+ <?php
30
+ echo $pagination['previous_button'] . ' ' . $pagination['next_button'];
31
+ ?>
32
+ </p>
33
+
34
+ <form method="POST" action="<?php echo Sendgrid_Tools::get_form_action(); ?>">
35
  <table class="widefat fixed" id="subsites-table-sg" cellspacing="0">
36
  <thead>
37
  <tr valign="top">
38
+ <th scope="col" class="manage-column column-columnname num" colspan="5">
39
+ <?php
40
+ echo translate( 'Page ' ) . $pagination['current_page'] . translate( ' of ' ) . $pagination['total_pages'];
41
+ ?>
42
+ </th>
43
+ </tr>
44
+ <tr valign="top">
45
+ <th scope="col" class="manage-column column-columnname num"> <?php _e( 'ID' ); ?></th>
46
+ <th scope="col" class="manage-column column-columnname"> <?php _e( 'Name' ); ?></th>
47
+ <th scope="col" class="manage-column column-columnname"> <?php _e( 'Public' ); ?></th>
48
+ <th scope="col" class="manage-column column-columnname"> <?php _e( 'Site URL' ); ?></th>
49
+ <th scope="col" class="manage-column"><input style="margin:0 0 0 0px;" type="checkbox" id="sg-check-all-sites"/> <?php _e( 'Self-Managed?' ); ?></th>
50
  </tr>
51
+ </thead>
52
  <tbody>
53
+ <?php foreach ( $sites as $index => $site ): ?>
54
+ <?php if ( ! is_main_site( $site->blog_id ) ): ?>
55
+ <?php $site_info = get_blog_details ($site->blog_id ); ?>
56
+ <tr <?php echo ( $index % 2 == 1 ) ? 'class="alternate"' : ''?>>
57
  <td class="column-columnname num" scope="row"><?php echo $site_info->blog_id; ?></td>
58
  <td class="column-columnname" scope="row"><?php echo $site_info->blogname; ?></td>
59
+ <td class="column-columnname" scope="row"><?php echo $site_info->public ? "true" : "false"; ?></td>
60
  <td class="column-columnname" scope="row">
61
  <a href="<?php echo $site_info->siteurl; ?>"><?php echo $site_info->siteurl; ?><a>
62
  </td>
63
  <td class="column-columnname" scope="row" aligh="center">
64
+ <input type="checkbox" id="check-can-manage-sg" name="checked_sites[<?php echo $site_info->blog_id ?>]"
65
+ <?php echo ( get_blog_option( $site_info->blog_id, 'sendgrid_can_manage_subsite', 0 ) ? "checked" : "" ) ?> />
66
  </td>
67
  </tr>
68
  <?php endif; ?>
69
  <?php endforeach; ?>
70
  </tbody>
71
  </table>
72
+ <p class="sendgrid-multisite-pagination">
73
+ <?php
74
+ echo $pagination['previous_button'] . ' ' . $pagination['next_button'];
75
+ ?>
76
+ </p>
77
+ <p class="sendgrid-multisite-submit">
78
+ <input type="submit" id="doaction" class="button button-primary" value="<?php _e( 'Save Settings' ); ?>">
79
  </p>
80
  <input type="hidden" name="subsite_settings" value="true"/>
81
  </form>
view/sendgrid_settings_nav.php CHANGED
@@ -1,5 +1,5 @@
1
  <h2 class="nav-tab-wrapper sengrid-settings-nav-bar">
2
- <?php
3
  foreach ( $tabs as $tab_key => $tab_description ) {
4
  if ( $active_tab == $tab_key ) {
5
  echo '<a href="?page=sendgrid-settings&tab=' . $tab_key . '" class="nav-tab nav-tab-active">' . $tab_description . '</a>';
1
  <h2 class="nav-tab-wrapper sengrid-settings-nav-bar">
2
+ <?php
3
  foreach ( $tabs as $tab_key => $tab_description ) {
4
  if ( $active_tab == $tab_key ) {
5
  echo '<a href="?page=sendgrid-settings&tab=' . $tab_key . '" class="nav-tab nav-tab-active">' . $tab_description . '</a>';
view/sendgrid_settings_nlvx.php CHANGED
@@ -38,7 +38,7 @@
38
  echo '<option value="' . $list['id'] . '" selected="selected">' . $list['name'] . '</option>';
39
  } else {
40
  echo '<option value="' . $list['id'] . '">' . $list['name'] . '</option>';
41
- }
42
  }
43
  }
44
  ?>
@@ -104,7 +104,7 @@
104
  echo '<option value="' . $page->ID . '" selected="selected">' . $page->post_title . '</option>';
105
  } else {
106
  echo '<option value="' . $page->ID . '">' . $page->post_title . '</option>';
107
- }
108
  }
109
  }
110
  ?>
38
  echo '<option value="' . $list['id'] . '" selected="selected">' . $list['name'] . '</option>';
39
  } else {
40
  echo '<option value="' . $list['id'] . '">' . $list['name'] . '</option>';
41
+ }
42
  }
43
  }
44
  ?>
104
  echo '<option value="' . $page->ID . '" selected="selected">' . $page->post_title . '</option>';
105
  } else {
106
  echo '<option value="' . $page->ID . '">' . $page->post_title . '</option>';
107
+ }
108
  }
109
  }
110
  ?>
view/sendgrid_settings_test_email.php CHANGED
@@ -1,5 +1,5 @@
1
  <?php if ( $active_tab == 'general' ): ?>
2
- <?php if ( ! isset($status) or ( 'updated' == $status ) or ( 'valid_auth' == $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 ( ! 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>
view/sendgrid_stats.php CHANGED
@@ -31,7 +31,7 @@
31
  <?php endif; ?>
32
  </select>
33
  </div>
34
-
35
  <div id="dashboard-widgets-wrap" class="full-width">
36
  <div id="dashboard-widgets" class="metabox-holder columns-1">
37
  <div class="postbox-container">
@@ -43,9 +43,9 @@
43
  </div>
44
 
45
  <?php
46
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_deliveries.php';
47
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_compliance.php';
48
- require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_engagement.php';
49
  ?>
50
  </div>
51
  </div>
31
  <?php endif; ?>
32
  </select>
33
  </div>
34
+
35
  <div id="dashboard-widgets-wrap" class="full-width">
36
  <div id="dashboard-widgets" class="metabox-holder columns-1">
37
  <div class="postbox-container">
43
  </div>
44
 
45
  <?php
46
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_deliveries.php';
47
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_compliance.php';
48
+ require plugin_dir_path( __FILE__ ) . '../view/partials/sendgrid_stats_engagement.php';
49
  ?>
50
  </div>
51
  </div>
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.10.8
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
@@ -17,7 +17,7 @@ define( 'SENDGRID_PLUGIN_STATISTICS', 'dashboard_page_sendgrid-statistics' );
17
 
18
  if ( version_compare( phpversion(), '5.3.0', '<' ) ) {
19
  add_action( 'admin_notices', 'php_version_error' );
20
-
21
  /**
22
  * Display the notice if PHP version is lower than plugin need
23
  *
@@ -29,7 +29,7 @@ if ( version_compare( phpversion(), '5.3.0', '<' ) ) {
29
  }
30
 
31
  return;
32
- }
33
 
34
  if ( function_exists('wp_mail') )
35
  {
@@ -37,7 +37,7 @@ if ( function_exists('wp_mail') )
37
  * wp_mail has been declared by another process or plugin, so you won't be able to use SENDGRID until the problem is solved.
38
  */
39
  add_action( 'admin_notices', 'wp_mail_already_declared_notice' );
40
-
41
  /**
42
  * Display the notice that wp_mail function was declared by another plugin
43
  *
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.10.9
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified
17
 
18
  if ( version_compare( phpversion(), '5.3.0', '<' ) ) {
19
  add_action( 'admin_notices', 'php_version_error' );
20
+
21
  /**
22
  * Display the notice if PHP version is lower than plugin need
23
  *
29
  }
30
 
31
  return;
32
+ }
33
 
34
  if ( function_exists('wp_mail') )
35
  {
37
  * wp_mail has been declared by another process or plugin, so you won't be able to use SENDGRID until the problem is solved.
38
  */
39
  add_action( 'admin_notices', 'wp_mail_already_declared_notice' );
40
+
41
  /**
42
  * Display the notice that wp_mail function was declared by another plugin
43
  *