SendinBlue Subscribe Form And WP SMTP - Version 3.1.2

Version Description

Bug fixes

  • Improved plugin stability and performance.
Download this release

Release Info

Developer neeraj_slit
Plugin Icon 128x128 SendinBlue Subscribe Form And WP SMTP
Version 3.1.2
Comparing to
See all releases

Code changes from version 3.1.1 to 3.1.2

inc/SendinblueApiClient.php CHANGED
@@ -13,6 +13,7 @@ class SendinblueApiClient
13
  const RESPONSE_CODE_OK = 200;
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
 
16
 
17
  private $apiKey;
18
  private $lastResponseCode;
@@ -321,4 +322,4 @@ class SendinblueApiClient
321
  {
322
  return $this->lastResponseCode;
323
  }
324
- }
13
  const RESPONSE_CODE_OK = 200;
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
+ const RESPONSE_CODE_UNAUTHORIZED = 401;
17
 
18
  private $apiKey;
19
  private $lastResponseCode;
322
  {
323
  return $this->lastResponseCode;
324
  }
325
+ }
inc/mailin.php CHANGED
@@ -47,13 +47,5 @@ class Mailin
47
  {
48
  return $this->do_request($resource,"POST",json_encode($input));
49
  }
50
-
51
- /**
52
- * @return mixed
53
- */
54
- public function generateApiV3Key()
55
- {
56
- return $this->post("/account/generateapiv3key", ['name' => 'wordpress']);
57
- }
58
  }
59
  ?>
47
  {
48
  return $this->do_request($resource,"POST",json_encode($input));
49
  }
 
 
 
 
 
 
 
 
50
  }
51
  ?>
inc/sib-api-manager.php CHANGED
@@ -39,10 +39,10 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
39
  'account_user_name' => $account['firstName'] . ' ' . $account['lastName'],
40
  'account_data' => $account['plan'],
41
  );
42
- } else {
 
43
  delete_option(SIB_Manager::API_KEY_V3_OPTION_NAME);
44
  }
45
- set_transient( 'sib_credit_' . md5( SIB_Manager::$access_key ), $account_info, self::DELAYTIME );
46
  }
47
  return $account_info;
48
  }
39
  'account_user_name' => $account['firstName'] . ' ' . $account['lastName'],
40
  'account_data' => $account['plan'],
41
  );
42
+ set_transient( 'sib_credit_' . md5( SIB_Manager::$access_key ), $account_info, self::DELAYTIME );
43
+ } elseif ($client->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_UNAUTHORIZED) {
44
  delete_option(SIB_Manager::API_KEY_V3_OPTION_NAME);
45
  }
 
46
  }
47
  return $account_info;
48
  }
page/page-home.php CHANGED
@@ -568,8 +568,8 @@ if ( ! class_exists( 'SIB_Page_Home' ) ) {
568
  $apiClient = new SendinblueApiClient();
569
  $response = $apiClient->getAccount();
570
  if ( $apiClient->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_OK ) {
571
- $data["partnerName"] = "WORDPRESS";
572
- $apiClient->setPartner($data);
573
  // create tables for users and forms.
574
  SIB_Model_Users::createTable();
575
  SIB_Forms::createTable(); // create default form also
568
  $apiClient = new SendinblueApiClient();
569
  $response = $apiClient->getAccount();
570
  if ( $apiClient->getLastResponseCode() === SendinblueApiClient::RESPONSE_CODE_OK ) {
571
+ $data["partnerName"] = "WORDPRESS";
572
+ $apiClient->setPartner($data);
573
  // create tables for users and forms.
574
  SIB_Model_Users::createTable();
575
  SIB_Forms::createTable(); // create default form also
readme.txt CHANGED
@@ -114,7 +114,12 @@ In order to create a signup form, you need to:
114
  2. Integrate the form in a sidebar using a widget from WP panel > Appearance > Widgets. The Sendinblue widget form should appear in your widgets list, you just to have to drag and drop the widget into the sidebar of your choice.
115
 
116
  == Changelog ==
117
-
 
 
 
 
 
118
  = 3.1.1 =
119
  **Improvements**
120
 
114
  2. Integrate the form in a sidebar using a widget from WP panel > Appearance > Widgets. The Sendinblue widget form should appear in your widgets list, you just to have to drag and drop the widget into the sidebar of your choice.
115
 
116
  == Changelog ==
117
+
118
+ = 3.1.2 =
119
+ **Bug fixes**
120
+
121
+ * Improved plugin stability and performance.
122
+
123
  = 3.1.1 =
124
  **Improvements**
125
 
sendinblue.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
- * Version: 3.1.1
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
@@ -81,8 +81,6 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
81
 
82
  const API_KEY_V3_OPTION_NAME = 'sib_api_key_v3';
83
 
84
- /** Request url of sendinblue api */
85
- const SENDINBLUE_API_URL = 'https://api.sendinblue.com/v2.0';
86
  const RECAPTCHA_API_TEMPLATE = 'https://www.google.com/recaptcha/api/siteverify?%s';
87
 
88
  /**
@@ -293,18 +291,6 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
293
  exit();
294
  }
295
 
296
- $api_key_v3 = get_option(SIB_Manager::API_KEY_V3_OPTION_NAME);
297
- if (empty($api_key_v3)) {
298
- $general_settings = get_option( self::MAIN_OPTION_NAME, array() );
299
- if (isset($general_settings['access_key'])) {
300
- $client = new Mailin(SIB_Manager::SENDINBLUE_API_URL, $general_settings['access_key']);
301
- $response = $client->generateApiV3Key();
302
- if (!empty($response['data']['value'])) {
303
- update_option(SIB_Manager::API_KEY_V3_OPTION_NAME, $response['data']['value']);
304
- }
305
- }
306
- }
307
-
308
  add_action( 'wp_head', array( &$this, 'install_ma_script' ) );
309
  }
310
 
@@ -453,8 +439,9 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
453
  $apiClient->getAccount();
454
  if ( SendinblueApiClient::RESPONSE_CODE_OK === $apiClient->getLastResponseCode() ) {
455
  return true;
 
 
456
  }
457
- delete_option(SIB_Manager::API_KEY_V3_OPTION_NAME);
458
  }
459
 
460
  if ($redirect) {
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Manage your contact lists, subscription forms and all email and marketing-related topics from your wp panel, within one single plugin
6
+ * Version: 3.1.2
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
81
 
82
  const API_KEY_V3_OPTION_NAME = 'sib_api_key_v3';
83
 
 
 
84
  const RECAPTCHA_API_TEMPLATE = 'https://www.google.com/recaptcha/api/siteverify?%s';
85
 
86
  /**
291
  exit();
292
  }
293
 
 
 
 
 
 
 
 
 
 
 
 
 
294
  add_action( 'wp_head', array( &$this, 'install_ma_script' ) );
295
  }
296
 
439
  $apiClient->getAccount();
440
  if ( SendinblueApiClient::RESPONSE_CODE_OK === $apiClient->getLastResponseCode() ) {
441
  return true;
442
+ } elseif (SendinblueApiClient::RESPONSE_CODE_UNAUTHORIZED === $apiClient->getLastResponseCode()) {
443
+ delete_option(SIB_Manager::API_KEY_V3_OPTION_NAME);
444
  }
 
445
  }
446
 
447
  if ($redirect) {