SendinBlue Subscribe Form And WP SMTP - Version 2.9.14

Version Description

  • Form sumission -1 issue and mailin class conflict issue has been fixed
Download this release

Release Info

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

Code changes from version 2.9.13 to 2.9.14

inc/mailin.php CHANGED
@@ -4,7 +4,7 @@
4
  * Sendinblue REST client
5
  */
6
 
7
- class Mailin
8
  {
9
  public $api_key;
10
  public $base_url;
@@ -13,7 +13,7 @@ class Mailin
13
  {
14
  if(!function_exists('curl_init'))
15
  {
16
- throw new Exception('Mailin requires CURL module');
17
  }
18
  $this->base_url = $base_url;
19
  $this->api_key = $api_key;
4
  * Sendinblue REST client
5
  */
6
 
7
+ class SibMailin
8
  {
9
  public $api_key;
10
  public $base_url;
13
  {
14
  if(!function_exists('curl_init'))
15
  {
16
+ throw new Exception('SibMailin requires CURL module');
17
  }
18
  $this->base_url = $base_url;
19
  $this->api_key = $api_key;
inc/sib-api-manager.php CHANGED
@@ -29,7 +29,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
29
  // get account's info.
30
  $account_info = get_transient( 'sib_credit_' . md5( SIB_Manager::$access_key ) );
31
  if ( false === $account_info || false == $account_info ) {
32
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
33
  $response = $mailin->get_account();
34
  if ( (is_array( $response )) && ( 'success' == $response['code'] ) ) {
35
  $account_data = $response['data'];
@@ -59,7 +59,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
59
  public static function get_campaign_stats() {
60
  $campaigns = get_transient( 'sib_campaigns_' . md5( SIB_Manager::$access_key ) );
61
  if ( false === $campaigns || false == $campaigns ) {
62
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
63
  $data = array();
64
  $response = $mailin->get_campaigns_v2( $data );
65
 
@@ -124,7 +124,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
124
  public static function get_smtp_status() {
125
  $status = get_transient( 'sib_smtp_status_' . md5( SIB_Manager::$access_key ) );
126
  if ( false === $status || false == $status ) {
127
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
128
  $response = $mailin->get_smtp_details();
129
  $status = 'disabled';
130
  if ( 'success' == $response['code'] ) {
@@ -151,7 +151,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
151
  $attrs = get_transient( 'sib_attributes_' . md5( SIB_Manager::$access_key ) );
152
 
153
  if ( false === $attrs || false == $attrs ) {
154
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
155
  $response = $mailin->get_attributes();
156
  $attributes = $response['data'];
157
 
@@ -180,7 +180,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
180
  $templates = get_transient( 'sib_template_' . md5( SIB_Manager::$access_key ) );
181
 
182
  if ( false === $templates || false == $templates ) {
183
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
184
  $data = array(
185
  'type' => 'template',
186
  'status' => 'temp_active',
@@ -223,7 +223,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
223
  // get lists.
224
  $lists = get_transient( 'sib_list_' . md5( SIB_Manager::$access_key ) );
225
  if ( false === $lists || false == $lists ) {
226
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
227
  $data = array();
228
  $list_data = $mailin->get_lists( $data );
229
  $lists = array();
@@ -249,7 +249,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
249
  public static function get_totalusers() {
250
  $total_subscribers = get_transient( 'sib_totalusers_' . md5( SIB_Manager::$access_key ) );
251
  if ( false === $total_subscribers || false == $total_subscribers ) {
252
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
253
  $data = array();
254
  $list_response = $mailin->get_lists( $data );
255
  if ( 'success' != $list_response['code'] ) {
@@ -279,7 +279,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
279
  public static function get_sender_lists() {
280
  $senders = get_transient( 'sib_senders_' . md5( SIB_Manager::$access_key ) );
281
  if ( false === $senders || false == $senders ) {
282
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
283
  $data = array(
284
  'option' => '',
285
  );
@@ -333,7 +333,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
333
  * @return array|mixed|object
334
  */
335
  public static function send_email( $data ) {
336
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
337
  $result = $mailin->send_email( $data );
338
  return $result;
339
  }
@@ -347,7 +347,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
347
  * @return array
348
  */
349
  static function validation_email( $type = 'simple', $email, $list_id ) {
350
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
351
 
352
  $isDopted = false;
353
 
@@ -455,7 +455,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
455
  $listid = array_diff( $listid, $list_unlink );
456
  }
457
 
458
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
459
  $data = array(
460
  'email' => $email,
461
  'attributes' => $info,
@@ -483,7 +483,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
483
  * @param string $code - code.
484
  */
485
  public static function send_comfirm_email( $type = 'confirm', $to_email, $template_id = '-1', $attributes = null, $code = '' ) {
486
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
487
 
488
  // set subject info.
489
  if ( 'confirm' == $type ) {
@@ -645,7 +645,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
645
  * @return array|mixed|object
646
  */
647
  public static function sync_users( $users_info, $list_ids ) {
648
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
649
  $data = array(
650
  'body' => $users_info,
651
  'listids' => $list_ids,
@@ -767,7 +767,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
767
  * Unsubscribe process
768
  */
769
  function unsubscribe() {
770
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
771
  $code = isset( $_GET['code'] ) ? esc_attr( sanitize_text_field( $_GET['code'] ) ) : '' ;
772
  $list_id = isset( $_GET['li'] ) ? intval( sanitize_text_field( $_GET['li'] ) ) : '' ;
773
 
@@ -870,7 +870,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
870
  $access_token_settings = get_option( SIB_Manager::ACCESS_TOKEN_OPTION_NAME, array() );
871
  $access_token = isset( $access_token_settings['access_token'] ) ? $access_token_settings['access_token'] : '';
872
 
873
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
874
  $mailin->delete_token( $access_token );
875
 
876
  $access_response = $mailin->get_access_tokens();
@@ -889,7 +889,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
889
  /** Create list and attribute for double optin */
890
  public static function create_default_dopt() {
891
 
892
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
893
 
894
  // add list.
895
  $isEmpty = false;
29
  // get account's info.
30
  $account_info = get_transient( 'sib_credit_' . md5( SIB_Manager::$access_key ) );
31
  if ( false === $account_info || false == $account_info ) {
32
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
33
  $response = $mailin->get_account();
34
  if ( (is_array( $response )) && ( 'success' == $response['code'] ) ) {
35
  $account_data = $response['data'];
59
  public static function get_campaign_stats() {
60
  $campaigns = get_transient( 'sib_campaigns_' . md5( SIB_Manager::$access_key ) );
61
  if ( false === $campaigns || false == $campaigns ) {
62
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
63
  $data = array();
64
  $response = $mailin->get_campaigns_v2( $data );
65
 
124
  public static function get_smtp_status() {
125
  $status = get_transient( 'sib_smtp_status_' . md5( SIB_Manager::$access_key ) );
126
  if ( false === $status || false == $status ) {
127
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
128
  $response = $mailin->get_smtp_details();
129
  $status = 'disabled';
130
  if ( 'success' == $response['code'] ) {
151
  $attrs = get_transient( 'sib_attributes_' . md5( SIB_Manager::$access_key ) );
152
 
153
  if ( false === $attrs || false == $attrs ) {
154
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
155
  $response = $mailin->get_attributes();
156
  $attributes = $response['data'];
157
 
180
  $templates = get_transient( 'sib_template_' . md5( SIB_Manager::$access_key ) );
181
 
182
  if ( false === $templates || false == $templates ) {
183
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
184
  $data = array(
185
  'type' => 'template',
186
  'status' => 'temp_active',
223
  // get lists.
224
  $lists = get_transient( 'sib_list_' . md5( SIB_Manager::$access_key ) );
225
  if ( false === $lists || false == $lists ) {
226
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
227
  $data = array();
228
  $list_data = $mailin->get_lists( $data );
229
  $lists = array();
249
  public static function get_totalusers() {
250
  $total_subscribers = get_transient( 'sib_totalusers_' . md5( SIB_Manager::$access_key ) );
251
  if ( false === $total_subscribers || false == $total_subscribers ) {
252
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
253
  $data = array();
254
  $list_response = $mailin->get_lists( $data );
255
  if ( 'success' != $list_response['code'] ) {
279
  public static function get_sender_lists() {
280
  $senders = get_transient( 'sib_senders_' . md5( SIB_Manager::$access_key ) );
281
  if ( false === $senders || false == $senders ) {
282
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
283
  $data = array(
284
  'option' => '',
285
  );
333
  * @return array|mixed|object
334
  */
335
  public static function send_email( $data ) {
336
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
337
  $result = $mailin->send_email( $data );
338
  return $result;
339
  }
347
  * @return array
348
  */
349
  static function validation_email( $type = 'simple', $email, $list_id ) {
350
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
351
 
352
  $isDopted = false;
353
 
455
  $listid = array_diff( $listid, $list_unlink );
456
  }
457
 
458
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
459
  $data = array(
460
  'email' => $email,
461
  'attributes' => $info,
483
  * @param string $code - code.
484
  */
485
  public static function send_comfirm_email( $type = 'confirm', $to_email, $template_id = '-1', $attributes = null, $code = '' ) {
486
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
487
 
488
  // set subject info.
489
  if ( 'confirm' == $type ) {
645
  * @return array|mixed|object
646
  */
647
  public static function sync_users( $users_info, $list_ids ) {
648
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
649
  $data = array(
650
  'body' => $users_info,
651
  'listids' => $list_ids,
767
  * Unsubscribe process
768
  */
769
  function unsubscribe() {
770
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
771
  $code = isset( $_GET['code'] ) ? esc_attr( sanitize_text_field( $_GET['code'] ) ) : '' ;
772
  $list_id = isset( $_GET['li'] ) ? intval( sanitize_text_field( $_GET['li'] ) ) : '' ;
773
 
870
  $access_token_settings = get_option( SIB_Manager::ACCESS_TOKEN_OPTION_NAME, array() );
871
  $access_token = isset( $access_token_settings['access_token'] ) ? $access_token_settings['access_token'] : '';
872
 
873
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
874
  $mailin->delete_token( $access_token );
875
 
876
  $access_response = $mailin->get_access_tokens();
889
  /** Create list and attribute for double optin */
890
  public static function create_default_dopt() {
891
 
892
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
893
 
894
  // add list.
895
  $isEmpty = false;
page/page-form.php CHANGED
@@ -97,7 +97,7 @@ if ( ! class_exists( 'SIB_Page_Form' ) ) {
97
 
98
  /** Generate page script */
99
  function generate() {
100
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
101
  $config = $mailin->getPluginConfig();
102
  ?>
103
  <div id="wrap" class="wrap box-border-box container-fluid">
@@ -990,7 +990,7 @@ For your information, you cannot select a template with the tag [DOUBLEOPTIN].',
990
  * Get template lists of sendinblue
991
  */
992
  public static function get_template_lists() {
993
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
994
  $data = array(
995
  'type' => 'template',
996
  'status' => 'temp_active',
@@ -1007,7 +1007,7 @@ For your information, you cannot select a template with the tag [DOUBLEOPTIN].',
1007
  public static function ajax_change_template() {
1008
  check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1009
  $template_id = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '';
1010
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
1011
  $data = array(
1012
  'id' => $template_id,
1013
  );
97
 
98
  /** Generate page script */
99
  function generate() {
100
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
101
  $config = $mailin->getPluginConfig();
102
  ?>
103
  <div id="wrap" class="wrap box-border-box container-fluid">
990
  * Get template lists of sendinblue
991
  */
992
  public static function get_template_lists() {
993
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
994
  $data = array(
995
  'type' => 'template',
996
  'status' => 'temp_active',
1007
  public static function ajax_change_template() {
1008
  check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
1009
  $template_id = isset( $_POST['template_id'] ) ? sanitize_text_field( $_POST['template_id'] ) : '';
1010
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
1011
  $data = array(
1012
  'id' => $template_id,
1013
  );
page/page-home.php CHANGED
@@ -682,9 +682,9 @@ if ( ! class_exists( 'SIB_Page_Home' ) ) {
682
  check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
683
  $access_key = isset( $_POST['access_key'] ) ? sanitize_text_field( wp_unslash( $_POST['access_key'] ) ) : '';
684
  try {
685
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, $access_key );
686
  } catch ( Exception $e ) {
687
- if ( $e->getMessage() == 'Mailin requires CURL module' ) {
688
  wp_send_json( 'curl_no_installed' );
689
  } else {
690
  wp_send_json( 'curl_error' );
@@ -797,7 +797,7 @@ if ( ! class_exists( 'SIB_Page_Home' ) ) {
797
 
798
  $html = str_replace( '{title}', $subject, $html );
799
 
800
- $mailin = new Mailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
801
 
802
  $headers = array(
803
  'Content-Type' => 'text/html;charset=iso-8859-1',
682
  check_ajax_referer( 'ajax_sib_admin_nonce', 'security' );
683
  $access_key = isset( $_POST['access_key'] ) ? sanitize_text_field( wp_unslash( $_POST['access_key'] ) ) : '';
684
  try {
685
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, $access_key );
686
  } catch ( Exception $e ) {
687
+ if ( $e->getMessage() == 'SibMailin requires CURL module' ) {
688
  wp_send_json( 'curl_no_installed' );
689
  } else {
690
  wp_send_json( 'curl_error' );
797
 
798
  $html = str_replace( '{title}', $subject, $html );
799
 
800
+ $mailin = new SibMailin( SIB_Manager::SENDINBLUE_API_URL, SIB_Manager::$access_key );
801
 
802
  $headers = array(
803
  'Content-Type' => 'text/html;charset=iso-8859-1',
readme.txt CHANGED
@@ -138,6 +138,9 @@ In order to create a signup form, you need to:
138
  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.
139
 
140
  == Changelog ==
 
 
 
141
  = 2.9.13 =
142
  * Added feature that allows to map WP boolean attributes to Sendinblue contacts
143
 
138
  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.
139
 
140
  == Changelog ==
141
+ = 2.9.14 =
142
+ * Form sumission -1 issue and mailin class conflict issue has been fixed
143
+
144
  = 2.9.13 =
145
  * Added feature that allows to map WP boolean attributes to Sendinblue contacts
146
 
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: Easily send emails from your WordPress blog using Sendinblue SMTP and easily add a subscribe form to your site
6
- * Version: 2.9.13
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
28
  /**
29
  * Application entry point. Contains plugin startup class that loads on <i> sendinblue_init </i> action.
30
  */
31
- if ( ! class_exists( 'Mailin' ) ) {
32
  require_once( 'inc/mailin.php' );
33
  }
34
  // For marketing automation.
@@ -527,6 +527,7 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
527
  <input type="hidden" name="sib_form_action" value="subscribe_form_submit">
528
  <input type="hidden" name="sib_form_id" value="<?php echo esc_attr( $frmID ); ?>">
529
  <input type="hidden" name="sib_form_alert_notice" value="<?php echo esc_attr($formData['requiredMsg']); ?>">
 
530
  <div class="sib_signup_box_inside_<?php echo esc_attr( $frmID ); ?>">
531
  <div style="/*display:none*/" class="sib_msg_disp">
532
  </div>
@@ -577,7 +578,15 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
577
  * Sign up process
578
  */
579
  function signup_process() {
580
- check_ajax_referer( 'sib_front_ajax_nonce', 'security' );
 
 
 
 
 
 
 
 
581
  $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : 1;
582
  if ( 'oldForm' == $formID ) {
583
  $formID = get_option( 'sib_old_form_id' );
3
  * Plugin Name: Newsletter, SMTP, Email marketing and Subscribe forms by Sendinblue
4
  * Plugin URI: https://www.sendinblue.com/?r=wporg
5
  * Description: Easily send emails from your WordPress blog using Sendinblue SMTP and easily add a subscribe form to your site
6
+ * Version: 2.9.14
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
28
  /**
29
  * Application entry point. Contains plugin startup class that loads on <i> sendinblue_init </i> action.
30
  */
31
+ if ( ! class_exists( 'SibMailin' ) ) {
32
  require_once( 'inc/mailin.php' );
33
  }
34
  // For marketing automation.
527
  <input type="hidden" name="sib_form_action" value="subscribe_form_submit">
528
  <input type="hidden" name="sib_form_id" value="<?php echo esc_attr( $frmID ); ?>">
529
  <input type="hidden" name="sib_form_alert_notice" value="<?php echo esc_attr($formData['requiredMsg']); ?>">
530
+ <input type="hidden" name="sib_security" value="<?php echo esc_attr( wp_create_nonce( ‘sib_front_ajax_nonce’ ) ); ?>">
531
  <div class="sib_signup_box_inside_<?php echo esc_attr( $frmID ); ?>">
532
  <div style="/*display:none*/" class="sib_msg_disp">
533
  </div>
578
  * Sign up process
579
  */
580
  function signup_process() {
581
+ //check_ajax_referer( 'sib_front_ajax_nonce', 'security' );
582
+ if ( empty( $_POST['sib_security'] ) ) {
583
+ wp_send_json(
584
+ array(
585
+ 'status' => 'sib_security',
586
+ 'msg' => 'Token not found.',
587
+ )
588
+ );
589
+ }
590
  $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : 1;
591
  if ( 'oldForm' == $formID ) {
592
  $formID = get_option( 'sib_old_form_id' );