SendinBlue Subscribe Form And WP SMTP - Version 3.1.52

Version Description

  • Improvement in the form preview for a better user experience.
  • Handling exception on blank attribute
Download this release

Release Info

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

Code changes from version 3.1.51 to 3.1.52

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.51';
18
  const USER_AGENT = 'sendinblue_plugins/wordpress';
19
 
20
  private $apiKey;
14
  const RESPONSE_CODE_CREATED = 201;
15
  const RESPONSE_CODE_ACCEPTED = 202;
16
  const RESPONSE_CODE_UNAUTHORIZED = 401;
17
+ const PLUGIN_VERSION = '3.1.52';
18
  const USER_AGENT = 'sendinblue_plugins/wordpress';
19
 
20
  private $apiKey;
inc/sib-api-manager.php CHANGED
@@ -90,7 +90,7 @@ if ( ! class_exists( 'SIB_API_Manager' ) ) {
90
  )
91
  );
92
 
93
- if ( count( $attributes ) > 0 ) {
94
  foreach ($attributes as $key => $value) {
95
  if ($value["category"] == "normal") {
96
  $attrs['attributes']['normal_attributes'][] = $value;
90
  )
91
  );
92
 
93
+ if (!empty($attributes) && count( $attributes ) > 0 ) {
94
  foreach ($attributes as $key => $value) {
95
  if ($value["category"] == "normal") {
96
  $attrs['attributes']['normal_attributes'][] = $value;
inc/sib-sms-code.php CHANGED
@@ -118,5 +118,22 @@ if ( !class_exists( 'SIB_SMS_Code' ) ) {
118
  public function get_sms_code_list(){
119
  return $this->smsCode;
120
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
- }
118
  public function get_sms_code_list(){
119
  return $this->smsCode;
120
  }
121
+
122
+ /**
123
+ * Get country code by dial code.
124
+ * @return string
125
+ */
126
+ public function get_country_code_from_dial_code($dialCode) {
127
+ if(empty($dialCode)) {
128
+ return false;
129
+ }
130
+
131
+ foreach ($this->smsCode as $countryCode => $array) {
132
+ if ($array['code'] == $dialCode) {
133
+ return $countryCode;
134
+ }
135
+ }
136
+ return false;
137
+ }
138
  }
139
+ }
js/admin.js CHANGED
@@ -1250,6 +1250,12 @@ $jQ(document).ready(function(){
1250
  $jQ('.sib-spinner').addClass('is-active');
1251
  return true;
1252
  });
 
 
 
 
 
 
1253
  });
1254
 
1255
  // get serialized data form sync users form
@@ -1269,3 +1275,24 @@ $jQ.fn.serializeObject = function()
1269
  });
1270
  return o;
1271
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1250
  $jQ('.sib-spinner').addClass('is-active');
1251
  return true;
1252
  });
1253
+
1254
+ $jQ('#sibformmarkup').on('change', function ($data) {
1255
+ var formHtml = $jQ('#sibformmarkup').val();
1256
+ formHtml = updateHtmlWithFlag(formHtml);
1257
+ $jQ('#sibformmarkup').val(formHtml);
1258
+ });
1259
  });
1260
 
1261
  // get serialized data form sync users form
1275
  });
1276
  return o;
1277
  };
1278
+
1279
+ function updateHtmlWithFlag(htmlString) {
1280
+ var customEle = document.createElement( 'section' );
1281
+ customEle.innerHTML = htmlString;
1282
+ var codeEle = customEle.querySelector("[name='sib_SMS_prefix']");
1283
+ if(codeEle === null) {
1284
+ return htmlString;
1285
+ }
1286
+ let dialCode = codeEle.value;
1287
+ dialCode = dialCode.replace('+','');
1288
+ var flagInicial = CountryList[dialCode];
1289
+ if (typeof flagInicial !== "undefined") {
1290
+ let flagICo = jQuery('#getDomain').val()+flagInicial.toLowerCase()+".png";
1291
+ customEle.querySelector("[class='sib-cflags']").removeAttribute("style");
1292
+ customEle.querySelector("[class='sib-cflags']").setAttribute("style","background-image:url("+flagICo+")");
1293
+ }
1294
+ var HtString = customEle.innerHTML;
1295
+ HtString = HtString.replace('</p><div class="sib-sms-field','<div class="sib-sms-field');
1296
+ HtString = HtString.replace('<p></p>','</p>');
1297
+ return HtString;
1298
+ }
model/model-forms.php CHANGED
@@ -157,28 +157,6 @@ if ( ! class_exists( 'SIB_Forms' ) ) {
157
  $results = $wpdb->get_row( $query, ARRAY_A ); // db call ok; no-cache ok.
158
  }
159
 
160
- if (str_contains($results['html'], 'class="sib-sms-field"')) {
161
- $sms_manager = new SIB_SMS_Code();
162
- $country_list = $sms_manager->get_sms_code_list();
163
- $stripStartPoint = strpos($results['html'], '"sib-sms"');
164
- $startPoint = $stripStartPoint + 18;
165
- $endPoint = $startPoint + 1;
166
- $stripData = substr($results['html'], $startPoint, $endPoint);
167
- $countryCodeString = explode('"', $stripData);
168
- $countryCode = $countryCodeString[0];
169
- foreach ($country_list as $item => $value) {
170
- $checkCountryCode = $value['code'];
171
- if ($checkCountryCode == $countryCode) {
172
- $flg_url = plugins_url('mailin/img/flags/') . strtolower($item) . '.png';
173
- $results['html'] = str_replace(
174
- 'class="sib-cflags"',
175
- 'class="sib-cflags" id="' . $frmID . '" style="background-image: url(' . $flg_url . ');"',
176
- $results['html']
177
- );
178
- }
179
- }
180
- }
181
-
182
  if ( is_array( $results ) && count( $results ) > 0 ) {
183
  $listIDs = maybe_unserialize( $results['listID'] );
184
  $results['listID'] = $listIDs;
157
  $results = $wpdb->get_row( $query, ARRAY_A ); // db call ok; no-cache ok.
158
  }
159
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  if ( is_array( $results ) && count( $results ) > 0 ) {
161
  $listIDs = maybe_unserialize( $results['listID'] );
162
  $results['listID'] = $listIDs;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: Email Marketing, Newsletter, Sendinblue, Forms, smtp, marketing automation
4
  Requires at least: 4.4
5
  Tested up to: 6.0.2
6
  Requires PHP: 5.6
7
- Stable tag: 3.1.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -116,6 +116,10 @@ In order to create a signup form, you need to:
116
 
117
  == Changelog ==
118
 
 
 
 
 
119
  = 3.1.51 =
120
  * We have fixed the syntax error at different form files.
121
 
4
  Requires at least: 4.4
5
  Tested up to: 6.0.2
6
  Requires PHP: 5.6
7
+ Stable tag: 3.1.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
116
 
117
  == Changelog ==
118
 
119
+ = 3.1.52 =
120
+ * Improvement in the form preview for a better user experience.
121
+ * Handling exception on blank attribute
122
+
123
  = 3.1.51 =
124
  * We have fixed the syntax error at different form files.
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.51
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later
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.52
7
  * Author: Sendinblue
8
  * Author URI: https://www.sendinblue.com/?r=wporg
9
  * License: GPLv2 or later