SendGrid - Version 1.7.2

Version Description

  • Check your credentials after updating, you might need to reenter your credentials
  • Fixed mcrypt library depencency issue
Download this release

Release Info

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

Code changes from version 1.7.1 to 1.7.2

Files changed (3) hide show
  1. lib/class-sendgrid-tools.php +25 -50
  2. readme.txt +15 -5
  3. wpsendgrid.php +1 -1
lib/class-sendgrid-tools.php CHANGED
@@ -224,13 +224,14 @@ class Sendgrid_Tools
224
  return SENDGRID_PASSWORD;
225
  } else {
226
  $password = get_option('sendgrid_pwd');
227
- if( $password ) {
228
- delete_option('sendgrid_pwd');
229
- update_option('sendgrid_password', self::encrypt( $password, AUTH_KEY ) );
 
230
  }
231
 
232
- $password = get_option('sendgrid_password');
233
- return ( $password == '' ? '' : self::decrypt($password, AUTH_KEY) );
234
  }
235
  }
236
 
@@ -241,10 +242,7 @@ class Sendgrid_Tools
241
  */
242
  public static function set_password($password)
243
  {
244
- if( $password == '' )
245
- return update_option('sendgrid_password', '');
246
-
247
- return update_option('sendgrid_password', self::encrypt( $password, AUTH_KEY ));
248
  }
249
 
250
  /**
@@ -258,13 +256,14 @@ class Sendgrid_Tools
258
  return SENDGRID_API_KEY;
259
  } else {
260
  $apikey = get_option('sendgrid_api_key');
261
- if( $apikey ) {
262
- delete_option('sendgrid_api_key');
263
- update_option('sendgrid_apikey', self::encrypt( $apikey, AUTH_KEY ));
 
264
  }
265
 
266
- $apikey = get_option('sendgrid_apikey');
267
- return ( $apikey == '' ? '' : self::decrypt($apikey, AUTH_KEY) );
268
  }
269
  }
270
 
@@ -275,9 +274,7 @@ class Sendgrid_Tools
275
  */
276
  public static function set_api_key($apikey)
277
  {
278
- if( $apikey == '' )
279
- return update_option('sendgrid_apikey', '');
280
- return update_option('sendgrid_apikey', self::encrypt( $apikey, AUTH_KEY ));
281
  }
282
 
283
  /**
@@ -423,11 +420,15 @@ class Sendgrid_Tools
423
  }
424
 
425
  /**
426
- * Returns encrypted string using the key or empty string in case of error
427
  *
428
  * @return string template
429
  */
430
- private static function encrypt($input_string, $key) {
 
 
 
 
431
  $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
432
  if(false === $iv_size)
433
  return '';
@@ -437,41 +438,15 @@ class Sendgrid_Tools
437
  return '';
438
 
439
  $h_key = hash('sha256', $key, TRUE);
440
- $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $h_key, $input_string, MCRYPT_MODE_ECB, $iv);
441
- if(false === $encrypted)
442
  return '';
443
 
444
- $encoded = base64_encode($encrypted);
445
- if(false === $encoded)
446
  return '';
447
 
448
- return $encoded;
449
- }
450
-
451
- /**
452
- * Returns decrypted string using the key or empty string in case of error
453
- *
454
- * @return string template
455
- */
456
- private static function decrypt($encrypted_input_string, $key) {
457
- $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
458
- if(false === $iv_size)
459
- return '';
460
-
461
- $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
462
- if(false === $iv)
463
- return '';
464
-
465
- $h_key = hash('sha256', $key, TRUE);
466
- $decoded = base64_decode($encrypted_input_string);
467
- if(false === $decoded)
468
- return '';
469
-
470
- $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $h_key, $decoded, MCRYPT_MODE_ECB, $iv);
471
- if(false === $decrypted)
472
- return '';
473
-
474
- return trim($decrypted);
475
  }
476
 
477
  /**
224
  return SENDGRID_PASSWORD;
225
  } else {
226
  $password = get_option('sendgrid_pwd');
227
+ $new_password = get_option('sendgrid_password');
228
+ if( $new_password && ! $password ) {
229
+ update_option('sendgrid_pwd', self::decrypt( $new_password, AUTH_KEY ) );
230
+ delete_option('sendgrid_password');
231
  }
232
 
233
+ $password = get_option('sendgrid_pwd');
234
+ return $password;
235
  }
236
  }
237
 
242
  */
243
  public static function set_password($password)
244
  {
245
+ return update_option('sendgrid_pwd', $password);
 
 
 
246
  }
247
 
248
  /**
256
  return SENDGRID_API_KEY;
257
  } else {
258
  $apikey = get_option('sendgrid_api_key');
259
+ $new_apikey = get_option('sendgrid_apikey');
260
+ if( $new_apikey && ! $apikey ) {
261
+ update_option('sendgrid_api_key', self::decrypt( $new_apikey, AUTH_KEY ));
262
+ delete_option('sendgrid_apikey');
263
  }
264
 
265
+ $apikey = get_option('sendgrid_api_key');
266
+ return $apikey;
267
  }
268
  }
269
 
274
  */
275
  public static function set_api_key($apikey)
276
  {
277
+ return update_option('sendgrid_api_key', $apikey);
 
 
278
  }
279
 
280
  /**
420
  }
421
 
422
  /**
423
+ * Returns decrypted string using the key or empty string in case of error
424
  *
425
  * @return string template
426
  */
427
+ private static function decrypt($encrypted_input_string, $key) {
428
+ if (!extension_loaded('mcrypt')) {
429
+ return '';
430
+ }
431
+
432
  $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
433
  if(false === $iv_size)
434
  return '';
438
  return '';
439
 
440
  $h_key = hash('sha256', $key, TRUE);
441
+ $decoded = base64_decode($encrypted_input_string);
442
+ if(false === $decoded)
443
  return '';
444
 
445
+ $decrypted = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $h_key, $decoded, MCRYPT_MODE_ECB, $iv);
446
+ if(false === $decrypted)
447
  return '';
448
 
449
+ return trim($decrypted);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
450
  }
451
 
452
  /**
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: 3.3
6
  Tested up to: 4.3
7
- Stable tag: 1.7.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -132,10 +132,15 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
132
 
133
  == Changelog ==
134
 
 
 
 
135
  = 1.7.1 =
136
- * Fixed a timeout issue from version 1.7.0.
 
137
  = 1.7.0 =
138
- * 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.
 
139
  * Added the possibility of setting the api key or username/password empty
140
  * Added the possibility of selecting the authentication method
141
  * Removed dependency on cURL, now all API requests are made through Wordpress
@@ -209,10 +214,15 @@ Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" tar
209
 
210
  == Upgrade notice ==
211
 
 
 
 
212
  = 1.7.1 =
213
- * Fixed a timeout issue from version 1.7.0.
 
214
  = 1.7.0 =
215
- * 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.
 
216
  * Added the possibility of setting the api key or username/password empty
217
  * Added the possibility of selecting the authentication method
218
  * Removed dependency on cURL, now all API requests are made through Wordpress
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: 3.3
6
  Tested up to: 4.3
7
+ Stable tag: 1.7.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
132
 
133
  == Changelog ==
134
 
135
+ = 1.7.2 =
136
+ * Check your credentials after updating, you might need to reenter your credentials
137
+ * Fixed mcrypt library depencency issue
138
  = 1.7.1 =
139
+ * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
140
+ * Fixed a timeout issue from version 1.7.0
141
  = 1.7.0 =
142
+ * 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
143
+ * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
144
  * Added the possibility of setting the api key or username/password empty
145
  * Added the possibility of selecting the authentication method
146
  * Removed dependency on cURL, now all API requests are made through Wordpress
214
 
215
  == Upgrade notice ==
216
 
217
+ = 1.7.2 =
218
+ * Check your credentials after updating, you might need to reenter your credentials
219
+ * Fixed mcrypt library depencency issue
220
  = 1.7.1 =
221
+ * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
222
+ * Fixed a timeout issue from version 1.7.0
223
  = 1.7.0 =
224
+ * 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
225
+ * BREAKING CHANGE: Don't make update if you don't have mcrypt php library enabled
226
  * Added the possibility of setting the api key or username/password empty
227
  * Added the possibility of selecting the authentication method
228
  * Removed dependency on cURL, now all API requests are made through Wordpress
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.7.1
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.7.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified