SendGrid - Version 1.11.2

Version Description

  • Relaxed PHP requirement to at least version 5.4.
Download this release

Release Info

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

Code changes from version 1.11.0 to 1.11.2

assets/screenshot-3.png CHANGED
Binary file
assets/screenshot-8.png CHANGED
Binary file
lib/class-sendgrid-statistics.php CHANGED
@@ -79,7 +79,7 @@ class Sendgrid_Statistics
79
  public static function add_statistics_menu()
80
  {
81
  $apikey = Sendgrid_Tools::get_api_key();
82
- if ( ! Sendgrid_Tools::check_api_key( $apikey ) ) {
83
  return;
84
  }
85
 
@@ -94,7 +94,7 @@ class Sendgrid_Statistics
94
  */
95
  public static function add_network_statistics_menu() {
96
  $apikey = Sendgrid_Tools::get_api_key();
97
- if ( ! Sendgrid_Tools::check_api_key( $apikey ) ) {
98
  return;
99
  }
100
 
79
  public static function add_statistics_menu()
80
  {
81
  $apikey = Sendgrid_Tools::get_api_key();
82
+ if ( ! Sendgrid_Tools::check_api_key( $apikey ) or ! Sendgrid_Tools::check_api_key_stats( $apikey ) ) {
83
  return;
84
  }
85
 
94
  */
95
  public static function add_network_statistics_menu() {
96
  $apikey = Sendgrid_Tools::get_api_key();
97
+ if ( ! Sendgrid_Tools::check_api_key( $apikey ) or ! Sendgrid_Tools::check_api_key_stats( $apikey ) ) {
98
  return;
99
  }
100
 
lib/class-sendgrid-tools.php CHANGED
@@ -248,15 +248,7 @@ class Sendgrid_Tools
248
  if ( defined( 'SENDGRID_API_KEY' ) ) {
249
  return SENDGRID_API_KEY;
250
  } else {
251
- $apikey = Sendgrid_Tools::get_sendgrid_option( 'api_key' );
252
- $new_apikey = Sendgrid_Tools::get_sendgrid_option( 'apikey' );
253
- if ( $new_apikey and ! $apikey ) {
254
- Sendgrid_Tools::update_sendgrid_option( 'api_key', self::decrypt( $new_apikey, AUTH_KEY ) );
255
- Sendgrid_Tools::delete_sendgrid_option( 'apikey' );
256
- }
257
-
258
- $apikey = Sendgrid_Tools::get_sendgrid_option( 'api_key' );
259
- return $apikey;
260
  }
261
  }
262
 
@@ -1134,40 +1126,6 @@ class Sendgrid_Tools
1134
  return $padding[$position];
1135
  }
1136
 
1137
- /**
1138
- * Returns decrypted string using the key or empty string in case of error
1139
- *
1140
- * @return string
1141
- */
1142
- private static function decrypt( $encrypted_input_string, $key ) {
1143
- if ( ! extension_loaded( 'mcrypt' ) ) {
1144
- return '';
1145
- }
1146
-
1147
- $iv_size = mcrypt_get_iv_size( MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB );
1148
- if( false === $iv_size ) {
1149
- return '';
1150
- }
1151
-
1152
- $iv = mcrypt_create_iv( $iv_size, MCRYPT_RAND );
1153
- if( false === $iv ) {
1154
- return '';
1155
- }
1156
-
1157
- $h_key = hash( 'sha256', $key, TRUE );
1158
- $decoded = base64_decode( $encrypted_input_string );
1159
- if( false === $decoded ) {
1160
- return '';
1161
- }
1162
-
1163
- $decrypted = mcrypt_decrypt( MCRYPT_RIJNDAEL_256, $h_key, $decoded, MCRYPT_MODE_ECB, $iv );
1164
- if( false === $decrypted ) {
1165
- return '';
1166
- }
1167
-
1168
- return trim( $decrypted );
1169
- }
1170
-
1171
  /**
1172
  * Check apikey stats permissions
1173
  *
248
  if ( defined( 'SENDGRID_API_KEY' ) ) {
249
  return SENDGRID_API_KEY;
250
  } else {
251
+ return Sendgrid_Tools::get_sendgrid_option( 'api_key' );
 
 
 
 
 
 
 
 
252
  }
253
  }
254
 
1126
  return $padding[$position];
1127
  }
1128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1129
  /**
1130
  * Check apikey stats permissions
1131
  *
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.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -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.6.0. PHP 7 is not yet supported. Installing this plugin on PHP versions 5.3 and earlier will cause your website to break.
46
  Installation on PHP versions 5.4 and 5.5 will work but it is not recommended.
47
  2. To send emails through SMTP you need to also install the 'Swift Mailer' plugin. ( https://wordpress.org/plugins/swift-mailer/ )
48
  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
@@ -51,7 +51,7 @@ To upload the SendGrid Plugin .ZIP file:
51
 
52
  1. Upload the WordPress SendGrid Plugin to the /wp-contents/plugins/ folder.
53
  2. Activate the plugin from the "Plugins" menu in WordPress.
54
- 3. Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">http://sendgrid.com/partner/wordpress</a>
55
  4. Navigate to "Settings" -> "SendGrid Settings" and enter your SendGrid credentials
56
 
57
  To auto install the SendGrid Plugin from the WordPress admin:
@@ -246,7 +246,7 @@ You need to enable the use of the First Name and Last Name fields from the setti
246
 
247
  Yes. This plugin has basic Multisite support. You need to Network Activate this plugin.
248
 
249
- The settings for all sites in the network can be configured only by the Network Admin in the Network Admin Dashboard.
250
 
251
  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.
252
 
@@ -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.0 =
270
  * BREAKING CHANGE: DO NOT UPGRADE IF YOU USE PHP <= 5.3. Only PHP 5.4 and later versions are supported.
271
  * BREAKING CHANGE: Username & Password is no longer supported. Change your settings to use an API Key before updating
@@ -426,6 +432,12 @@ Since 1.10.5 the Network Admin can delegate the configuration for each subsite t
426
 
427
  == Upgrade notice ==
428
 
 
 
 
 
 
 
429
  = 1.11.0 =
430
  * BREAKING CHANGE: DO NOT UPGRADE IF YOU USE PHP <= 5.3. Only PHP 5.4 and later versions are supported.
431
  * BREAKING CHANGE: Username & Password is no longer supported. Change your settings to use an API Key before updating
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
 
42
 
43
  Requirements:
44
 
45
+ 1. PHP version >= 5.6 and <= 7.1. Installing this plugin on PHP versions 5.3 and earlier will cause your website to break.
46
  Installation on PHP versions 5.4 and 5.5 will work but it is not recommended.
47
  2. To send emails through SMTP you need to also install the 'Swift Mailer' plugin. ( https://wordpress.org/plugins/swift-mailer/ )
48
  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
51
 
52
  1. Upload the WordPress SendGrid Plugin to the /wp-contents/plugins/ folder.
53
  2. Activate the plugin from the "Plugins" menu in WordPress.
54
+ 3. Create a SendGrid account at <a href="http://sendgrid.com/partner/wordpress" target="_blank">http://sendgrid.com/partner/wordpress</a>
55
  4. Navigate to "Settings" -> "SendGrid Settings" and enter your SendGrid credentials
56
 
57
  To auto install the SendGrid Plugin from the WordPress admin:
246
 
247
  Yes. This plugin has basic Multisite support. You need to Network Activate this plugin.
248
 
249
+ The settings for all sites in the network can be configured only by the Network Admin in the Network Admin Dashboard.
250
 
251
  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.
252
 
266
 
267
  == Changelog ==
268
 
269
+ = 1.11.2 =
270
+ * Relaxed PHP requirement to at least version 5.4.
271
+ = 1.11.1 =
272
+ * Confirmed compatibility with PHP 7 and 7.1
273
+ * Removed some legacy code that caused warnings in PHP 7
274
+ * Fixed issue where the statistics page would show up in menu even if the API key did not have stats permissions
275
  = 1.11.0 =
276
  * BREAKING CHANGE: DO NOT UPGRADE IF YOU USE PHP <= 5.3. Only PHP 5.4 and later versions are supported.
277
  * BREAKING CHANGE: Username & Password is no longer supported. Change your settings to use an API Key before updating
432
 
433
  == Upgrade notice ==
434
 
435
+ = 1.11.2 =
436
+ * Relaxed PHP requirement to at least version 5.4.
437
+ = 1.11.1 =
438
+ * Confirmed compatibility with PHP 7 and 7.1
439
+ * Removed some legacy code that caused warnings in PHP 7
440
+ * Fixed issue where the statistics page would show up in menu even if the API key did not have stats permissions
441
  = 1.11.0 =
442
  * BREAKING CHANGE: DO NOT UPGRADE IF YOU USE PHP <= 5.3. Only PHP 5.4 and later versions are supported.
443
  * BREAKING CHANGE: Username & Password is no longer supported. Change your settings to use an API Key before updating
view/sendgrid_contextual_help.php CHANGED
@@ -1,3 +1,4 @@
 
1
  <p>
2
  Email Delivery. Simplified.
3
  </p>
@@ -99,29 +100,29 @@
99
  <br />
100
  $to = array('address1@sendgrid.com', 'Address2 <address2@sendgrid.com>', 'address3@sendgrid.com');
101
  <br />
102
- <br />
103
  $headers = new SendGrid\Email();
104
  <br />
105
  $headers<br />
106
  ->setFromName("Me Myself")
107
  <br />
108
  ->setFrom("me@example.net")
109
- <br />
110
  ->setCc("address4@sendgrid.com")
111
- <br />
112
  ->setBcc("address5@sendgrid.com")
113
- <br />
114
  ->setUniqueArgs(array('customer' => 'mycustomer', 'location' => 'mylocation'))
115
- <br />
116
  ->addCategory('category1')
117
- <br />
118
  ->addCategory('category2')
119
- <br />
120
  ->setTemplateId('templateID');
121
- <br />
122
- <br />
123
  $attachments = array('/tmp/img1.jpg', '/tmp/img2.jpg');
124
- <br />
125
  add_filter('wp_mail_content_type', 'set_html_content_type');
126
  <br />
127
  $mail = wp_mail($to, $subject, $message, $headers, $attachments);
@@ -144,24 +145,24 @@
144
  $headers
145
  <br />
146
  ->addSmtpapiTo("john@somewhere.com")
147
- <br />
148
  ->addSmtpapiTo("harry@somewhere.com")
149
- <br />
150
  ->addSmtpapiTo("Bob@somewhere.com")
151
- <br />
152
  ->addSubstitution("%name%", array("John", "Harry", "Bob"))
153
- <br />
154
  ->addSubstitution("%place%", array("%office%", "%office%", "%home%"))
155
- <br />
156
  ->addSection("%office%", "an office")
157
- <br />
158
  ->addSection("%home%", "your house");
159
  <br />
160
  <br />
161
  $mail = wp_mail($to, $subject, $message, $headers);`
162
  </div>
163
  <br />
164
- More examples for using SendGrid SMTPAPI header: <a href="https://github.com/sendgrid/sendgrid-php#smtpapi" target="_blank">https://github.com/sendgrid/sendgrid-php#smtpapi</a>
165
  <br />
166
  <br />
167
  <b>Categories used for emails can be set:</b>
@@ -175,10 +176,9 @@
175
  <p><b>Define SendGrid settings as global variables (wp-config.php):</b></p>
176
  <p>
177
  <ol>
178
- <li>Set credentials (both need to be set in order to get credentials from variables and not from the database):
179
  <ul>
180
- <li>Username: <span class="code">define('SENDGRID_USERNAME', 'sendgrid_username');</span></li>
181
- <li>Password: <span class="code">define('SENDGRID_PASSWORD', 'sendgrid_password');</span></li>
182
  </ul>
183
  </li>
184
  <li>Set email related settings:
1
+ <?php ?>
2
  <p>
3
  Email Delivery. Simplified.
4
  </p>
100
  <br />
101
  $to = array('address1@sendgrid.com', 'Address2 <address2@sendgrid.com>', 'address3@sendgrid.com');
102
  <br />
103
+ <br />
104
  $headers = new SendGrid\Email();
105
  <br />
106
  $headers<br />
107
  ->setFromName("Me Myself")
108
  <br />
109
  ->setFrom("me@example.net")
110
+ <br />
111
  ->setCc("address4@sendgrid.com")
112
+ <br />
113
  ->setBcc("address5@sendgrid.com")
114
+ <br />
115
  ->setUniqueArgs(array('customer' => 'mycustomer', 'location' => 'mylocation'))
116
+ <br />
117
  ->addCategory('category1')
118
+ <br />
119
  ->addCategory('category2')
120
+ <br />
121
  ->setTemplateId('templateID');
122
+ <br />
123
+ <br />
124
  $attachments = array('/tmp/img1.jpg', '/tmp/img2.jpg');
125
+ <br />
126
  add_filter('wp_mail_content_type', 'set_html_content_type');
127
  <br />
128
  $mail = wp_mail($to, $subject, $message, $headers, $attachments);
145
  $headers
146
  <br />
147
  ->addSmtpapiTo("john@somewhere.com")
148
+ <br />
149
  ->addSmtpapiTo("harry@somewhere.com")
150
+ <br />
151
  ->addSmtpapiTo("Bob@somewhere.com")
152
+ <br />
153
  ->addSubstitution("%name%", array("John", "Harry", "Bob"))
154
+ <br />
155
  ->addSubstitution("%place%", array("%office%", "%office%", "%home%"))
156
+ <br />
157
  ->addSection("%office%", "an office")
158
+ <br />
159
  ->addSection("%home%", "your house");
160
  <br />
161
  <br />
162
  $mail = wp_mail($to, $subject, $message, $headers);`
163
  </div>
164
  <br />
165
+ More examples for using SendGrid SMTPAPI header: <a href="https://github.com/sendgrid/smtpapi-php/" target="_blank">https://github.com/sendgrid/smtpapi-php/</a>
166
  <br />
167
  <br />
168
  <b>Categories used for emails can be set:</b>
176
  <p><b>Define SendGrid settings as global variables (wp-config.php):</b></p>
177
  <p>
178
  <ol>
179
+ <li>Set the API Key:
180
  <ul>
181
+ <li>API Key: <span class="code">define('SENDGRID_API_KEY', 'sendgrid_api_key');</span></li>
 
182
  </ul>
183
  </li>
184
  <li>Set email related settings:
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.0
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.2
7
  Author: SendGrid
8
  Author URI: http://sendgrid.com
9
  Text Domain: sendgrid-email-delivery-simplified