SendinBlue Subscribe Form And WP SMTP - Version 3.1.5

Version Description

Bug fixes

  • Fixed the unwanted backslash issue when adding apostrophe in text field at forms or at forms settings.
  • Fixed the Missing/Invalid Parameter errors in response from API when sending transactional.
Download this release

Release Info

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

Code changes from version 3.1.4 to 3.1.5

inc/SendinblueApiClient.php CHANGED
@@ -14,7 +14,7 @@ class SendinblueApiClient
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
- const PLUGIN_VERSION = '3.1.4';
18
 
19
  private $apiKey;
20
  private $lastResponseCode;
@@ -324,6 +324,13 @@ class SendinblueApiClient
324
  if (isset($body['unlinkListIds'])) {
325
  $body['unlinkListIds'] = $this->getListsIds($body['unlinkListIds']);
326
  }
 
 
 
 
 
 
 
327
  $args['body'] = wp_json_encode($body);
328
  }
329
 
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
+ const PLUGIN_VERSION = '3.1.5';
18
 
19
  private $apiKey;
20
  private $lastResponseCode;
324
  if (isset($body['unlinkListIds'])) {
325
  $body['unlinkListIds'] = $this->getListsIds($body['unlinkListIds']);
326
  }
327
+ if(is_array($body)) {
328
+ foreach($body as $key => $val) {
329
+ if(empty($val)) {
330
+ unset($body[$key]);
331
+ }
332
+ }
333
+ }
334
  $args['body'] = wp_json_encode($body);
335
  }
336
 
inc/sib-api-manager.php CHANGED
@@ -548,7 +548,16 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
548
  $attachment = array();
549
 
550
  // get info from SIB template.
551
- if ( intval( $template_id ) > 0 ) {
 
 
 
 
 
 
 
 
 
552
  $data = array(
553
  'id' => $template_id,
554
  );
@@ -604,27 +613,15 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
604
  ), $html_content
605
  );
606
 
607
- $home_settings = get_option( SIB_Manager::HOME_OPTION_NAME );
608
  if ( 'yes' == $home_settings['activate_email'] ) {
609
 
610
- $data = [
611
- 'replyTo' => [
612
- 'email' => $from[0],
613
- ],
614
- 'to' => [
615
- [
616
- 'email' => $to_email
617
- ]
618
- ]
619
- ];
620
-
621
- if ( intval( $template_id ) > 0 && ( 'confirm' == $type ) ) {
622
- $data["templateId"] = intval( $template_id );
623
- } else {
624
- $data['sender'] = [ 'email' => $from[0], 'name' => $from[1] ];
625
- $data['htmlContent'] = $html_content;
626
- $data['subject'] = $subject;
627
- }
628
 
629
  $res = $mailin->sendEmail( $data );
630
 
548
  $attachment = array();
549
 
550
  // get info from SIB template.
551
+ if ( 'yes' == $home_settings['activate_email'] && intval( $template_id ) > 0 && ( 'confirm' == $type ) ) {
552
+ $data = array(
553
+ 'replyTo' => array('email' => $sender_email),
554
+ 'to' => array(array('email' => $to_email)),
555
+ );
556
+ $data["templateId"] = intval( $template_id );
557
+ $mailin->sendEmail( $data );
558
+ return;
559
+ }
560
+ else if ( intval( $template_id ) > 0 ) {
561
  $data = array(
562
  'id' => $template_id,
563
  );
613
  ), $html_content
614
  );
615
 
 
616
  if ( 'yes' == $home_settings['activate_email'] ) {
617
 
618
+ $data = array(
619
+ 'replyTo' => array('email' => $from[0]),
620
+ 'to' => array(array('email' => $to_email)),
621
+ );
622
+ $data['sender'] = [ 'email' => $from[0], 'name' => $from[1] ];
623
+ $data['htmlContent'] = $html_content;
624
+ $data['subject'] = $subject;
 
 
 
 
 
 
 
 
 
 
 
625
 
626
  $res = $mailin->sendEmail( $data );
627
 
page/page-form.php CHANGED
@@ -863,10 +863,15 @@ For your information, you cannot select a template with the tag [DOUBLEOPTIN].',
863
  // Check secret through hidden referrer field.
864
  check_admin_referer( 'sib_setting_subscription' );
865
 
 
 
 
 
 
866
  // Subscription form.
867
  $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : '';
868
  $form_name = isset( $_POST['sib_form_name'] ) ? sanitize_text_field( $_POST['sib_form_name'] ) : '';
869
- $form_html = isset( $_POST['sib_form_html'] ) ? stripslashes( $_POST['sib_form_html'] ): '';
870
  $list_ids = isset( $_POST['list_id'] ) ? maybe_serialize( $_POST['list_id'] ) : '';
871
  $dependTheme = isset( $_POST['sib_css_type'] ) ? sanitize_text_field( $_POST['sib_css_type'] ) : '';
872
  $customCss = isset( $_POST['sib_form_css'] ) ? $_POST['sib_form_css'] : '';
863
  // Check secret through hidden referrer field.
864
  check_admin_referer( 'sib_setting_subscription' );
865
 
866
+ //Handling of backslash added by WP because magic quotes are enabled by default
867
+ foreach($_POST as $k => $v) {
868
+ $_POST[$k] = stripslashes($v);
869
+ }
870
+
871
  // Subscription form.
872
  $formID = isset( $_POST['sib_form_id'] ) ? sanitize_text_field( $_POST['sib_form_id'] ) : '';
873
  $form_name = isset( $_POST['sib_form_name'] ) ? sanitize_text_field( $_POST['sib_form_name'] ) : '';
874
+ $form_html = isset( $_POST['sib_form_html'] ) ? $_POST['sib_form_html'] : '';
875
  $list_ids = isset( $_POST['list_id'] ) ? maybe_serialize( $_POST['list_id'] ) : '';
876
  $dependTheme = isset( $_POST['sib_css_type'] ) ? sanitize_text_field( $_POST['sib_css_type'] ) : '';
877
  $customCss = isset( $_POST['sib_form_css'] ) ? $_POST['sib_form_css'] : '';
readme.txt CHANGED
@@ -115,6 +115,12 @@ In order to create a signup form, you need to:
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
118
  = 3.1.4 =
119
  **Bug fixes**
120
 
115
 
116
  == Changelog ==
117
 
118
+ = 3.1.5 =
119
+ **Bug fixes**
120
+
121
+ * Fixed the unwanted backslash issue when adding apostrophe in text field at forms or at forms settings.
122
+ * Fixed the Missing/Invalid Parameter errors in response from API when sending transactional.
123
+
124
  = 3.1.4 =
125
  **Bug fixes**
126
 
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.4
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
@@ -611,6 +611,11 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
611
  * Sign up process
612
  */
613
  function signup_process() {
 
 
 
 
 
614
  if ( empty( $_POST['sib_security'] ) ) {
615
  wp_send_json(
616
  array(
@@ -836,8 +841,23 @@ if ( ! class_exists( 'SIB_Manager' ) ) {
836
  $from_name = apply_filters( 'wp_mail_from_name', $from_name );
837
 
838
  if ( !empty( $headers ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
839
  $headers = str_replace("Content-Type: text/html", "", $headers);
840
- $data['headers'] = $headers;
 
 
 
841
  if ( ! is_array( $headers ) ) {
842
  // Explode the headers out, so this function can take both.
843
  // string headers and an array of headers.
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.5
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
611
  * Sign up process
612
  */
613
  function signup_process() {
614
+ //Handling of backslash added by WP because magic quotes are enabled by default
615
+ foreach($_POST as $k => $v) {
616
+ $_POST[$k] = stripslashes($v);
617
+ }
618
+
619
  if ( empty( $_POST['sib_security'] ) ) {
620
  wp_send_json(
621
  array(
841
  $from_name = apply_filters( 'wp_mail_from_name', $from_name );
842
 
843
  if ( !empty( $headers ) ) {
844
+ if( is_array( $headers ) ){
845
+ foreach ($headers as $key => $val) {
846
+ if( $val == "Content-Type: text/html" ){
847
+ unset( $headers[$key] );
848
+ }
849
+ }
850
+ $headers = array_values( $headers );
851
+ if( count( $headers ) == 1 && $headers[0] == '' ) {
852
+ unset( $headers[0] );
853
+ }
854
+ }
855
+ if( is_string( $headers ) ){
856
  $headers = str_replace("Content-Type: text/html", "", $headers);
857
+ }
858
+ if( !empty( $headers ) ){
859
+ $data['headers'] = $headers;
860
+ }
861
  if ( ! is_array( $headers ) ) {
862
  // Explode the headers out, so this function can take both.
863
  // string headers and an array of headers.