WhatsApp me - Version 4.1.8

Version Description

  • Front script better settings validation
  • FIX error with some prices on variable replacement
  • Bump required minimun WordPress version to 3.5
Download this release

Release Info

Developer pacotole
Plugin Icon 128x128 WhatsApp me
Version 4.1.8
Comparing to
See all releases

Code changes from version 4.1.7 to 4.1.8

README.txt CHANGED
@@ -2,10 +2,10 @@
2
  Contributors: creapuntome, pacotole, davidlillo, monillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
- Requires at least: 3.0.1
6
  Tested up to: 5.6
7
  Requires PHP: 5.3
8
- Stable tag: 4.1.7
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -214,6 +214,11 @@ There is a Javascript event that Join.chat triggers automatically before launch
214
 
215
  == Changelog ==
216
 
 
 
 
 
 
217
  = 4.1.7 =
218
  * FIX jQuery 3 deprecation warnings for event shorthands
219
  * FIX JSON error with """ on variable replacement
2
  Contributors: creapuntome, pacotole, davidlillo, monillo
3
  Donate link: https://www.paypal.me/creapuntome/
4
  Tags: whatsapp business, whatsapp, click to chat, button, whatsapp support chat, support, contact, directly message whatsapp, floating whatsapp, whatsapp chat
5
+ Requires at least: 3.5.0
6
  Tested up to: 5.6
7
  Requires PHP: 5.3
8
+ Stable tag: 4.1.8
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
214
 
215
  == Changelog ==
216
 
217
+ = 4.1.8 =
218
+ * Front script better settings validation
219
+ * FIX error with some prices on variable replacement
220
+ * Bump required minimun WordPress version to 3.5
221
+
222
  = 4.1.7 =
223
  * FIX jQuery 3 deprecation warnings for event shorthands
224
  * FIX JSON error with """ on variable replacement
admin/class-joinchat-admin.php CHANGED
@@ -167,6 +167,7 @@ class JoinChatAdmin {
167
  * Register the JavaScript for the admin area.
168
  *
169
  * @since 3.0.0
 
170
  * @param string $hook The id of the page.
171
  * @return void
172
  */
167
  * Register the JavaScript for the admin area.
168
  *
169
  * @since 3.0.0
170
+ * @since 4.1.4 Added intlTelInput localize.
171
  * @param string $hook The id of the page.
172
  * @return void
173
  */
includes/class-joinchat-util.php CHANGED
@@ -107,7 +107,7 @@ class JoinChatUtil {
107
  return false;
108
  }
109
 
110
- $uploads = wp_get_upload_dir();
111
  $img_info = pathinfo( $img_path );
112
  $new_path = "{$img_info['dirname']}/{$img_info['filename']}-{$width}x{$height}.{$img_info['extension']}";
113
 
@@ -205,7 +205,6 @@ class JoinChatUtil {
205
  * Format message send, replace vars.
206
  *
207
  * @since 3.1.0
208
- * @since 4.1.7 Added replacements fixes
209
  * @param string $string string to apply variable replacements
210
  * @return string string with replaced variables
211
  */
@@ -227,13 +226,9 @@ class JoinChatUtil {
227
  $patterns[] = "/\{$var\}/u";
228
  }
229
 
230
- $fixes = array(
231
- '"' => '"', // Prevent malformed json
232
- '$' => '\$', // Prevent regex reference
233
- );
234
-
235
  foreach ( $replacements as $var => $replacement ) {
236
- $replacements[ $var ] = str_replace( array_keys( $fixes ), $fixes, $replacement );
237
  }
238
 
239
  return preg_replace( $patterns, $replacements, $string );
107
  return false;
108
  }
109
 
110
+ $uploads = wp_upload_dir( null, false );
111
  $img_info = pathinfo( $img_path );
112
  $new_path = "{$img_info['dirname']}/{$img_info['filename']}-{$width}x{$height}.{$img_info['extension']}";
113
 
205
  * Format message send, replace vars.
206
  *
207
  * @since 3.1.0
 
208
  * @param string $string string to apply variable replacements
209
  * @return string string with replaced variables
210
  */
226
  $patterns[] = "/\{$var\}/u";
227
  }
228
 
229
+ // Prevent malformed json
 
 
 
 
230
  foreach ( $replacements as $var => $replacement ) {
231
+ $replacements[ $var ] = str_replace( '"', '"', $replacement );
232
  }
233
 
234
  return preg_replace( $patterns, $replacements, $string );
joinchat.php CHANGED
@@ -9,7 +9,7 @@
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
- * Version: 4.1.7
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
@@ -26,7 +26,7 @@ if ( ! defined( 'WPINC' ) ) {
26
  /**
27
  * Currently plugin version.
28
  */
29
- define( 'JOINCHAT_VERSION', '4.1.7' );
30
 
31
  /**
32
  * The core plugin class that is used to define internationalization,
9
  * Plugin Name: Join.chat
10
  * Plugin URI: https://join.chat
11
  * Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
12
+ * Version: 4.1.8
13
  * Author: Creame
14
  * Author URI: https://crea.me
15
  * License: GPL-2.0+
26
  /**
27
  * Currently plugin version.
28
  */
29
+ define( 'JOINCHAT_VERSION', '4.1.8' );
30
 
31
  /**
32
  * The core plugin class that is used to define internationalization,
public/class-joinchat-woopublic.php CHANGED
@@ -198,6 +198,9 @@ class JoinChatWooPublic {
198
 
199
  $string = strip_tags( wc_price( wc_get_price_to_display( $product, array( 'price' => $price ) ) ) );
200
 
 
 
 
201
  }
202
 
203
  /**
198
 
199
  $string = strip_tags( wc_price( wc_get_price_to_display( $product, array( 'price' => $price ) ) ) );
200
 
201
+ // Escape $ for regex replacement
202
+ return str_replace( '$', '\$', $string );
203
+
204
  }
205
 
206
  /**
public/js/joinchat.js CHANGED
@@ -279,7 +279,7 @@
279
  }
280
 
281
  // In some strange cases data settings are empty
282
- if (typeof joinchat_obj.settings == 'undefined') {
283
  try {
284
  joinchat_obj.settings = JSON.parse(joinchat_obj.$div.attr('data-settings'));
285
  } catch (error) {
@@ -304,4 +304,4 @@
304
  joinchat_obj.store.setItem('joinchat_views', parseInt(joinchat_obj.store.getItem('joinchat_views') || 0) + 1);
305
  });
306
 
307
- }(jQuery, window, document));
279
  }
280
 
281
  // In some strange cases data settings are empty
282
+ if (typeof joinchat_obj.settings != 'object') {
283
  try {
284
  joinchat_obj.settings = JSON.parse(joinchat_obj.$div.attr('data-settings'));
285
  } catch (error) {
304
  joinchat_obj.store.setItem('joinchat_views', parseInt(joinchat_obj.store.getItem('joinchat_views') || 0) + 1);
305
  });
306
 
307
+ }(jQuery, window, document));
public/js/joinchat.min.js CHANGED
@@ -1 +1 @@
1
- !function(p,u,d){"use strict";function t(){p(d).trigger("joinchat:starting");var t,o,e=1e3*joinchat_obj.settings.button_delay,n=1e3*joinchat_obj.settings.message_delay,i=!!joinchat_obj.settings.message_hash,a=!!joinchat_obj.$(".joinchat__box").length,s=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,h=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function c(){clearTimeout(o),joinchat_obj.chatbox_show()}function j(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}var _,r,b,l="joinchat--show";function g(){var t=(d.activeElement.type||"").toLowerCase();0<=["date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week"].indexOf(t)?joinchat_obj.chatbox?(joinchat_obj.chatbox_hide(),setTimeout(function(){joinchat_obj.$div.removeClass("joinchat--show")},400)):joinchat_obj.$div.removeClass("joinchat--show"):joinchat_obj.$div.addClass("joinchat--show")}h||i&&n&&!joinchat_obj.settings.message_badge&&s||(l+=" joinchat--tooltip"),setTimeout(function(){joinchat_obj.$div.addClass(l)},e),i&&!h&&n&&(joinchat_obj.settings.message_badge?o=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},e+n):s&&(o=setTimeout(c,e+n))),a&&!joinchat_obj.is_mobile&&joinchat_obj.$(".joinchat__button").on("mouseenter",function(){t=setTimeout(c,1500)}).on("mouseleave",function(){clearTimeout(t)}),joinchat_obj.$(".joinchat__button").on("click",function(){a&&!joinchat_obj.chatbox?c():(j(),joinchat_obj.open_whatsapp())}),joinchat_obj.$(".joinchat__close").on("click",j),joinchat_obj.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();t=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(t<0?1:-1)}),joinchat_obj.is_mobile&&(p(d).on("focus blur","input, textarea",function(t){p(t.target).closest(joinchat_obj.$div).length||(clearTimeout(_),_=setTimeout(g,200))}),p(u).on("resize",function(){clearTimeout(r),r=setTimeout(function(){joinchat_obj.$div[0].style.setProperty("--vh",window.innerHeight+"px")},200)}).trigger("resize")),p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),!a||p(this).is('.joinchat_app, a[href="#whatsapp"]')?joinchat_obj.open_whatsapp():c()}),p(d).on("click",".joinchat_close",function(t){t.preventDefault(),joinchat_obj.chatbox_hide()}),a&&"IntersectionObserver"in u&&(0<(n=p(".joinchat_show, .joinchat_force_show")).length&&(b=new IntersectionObserver(function(t){p.each(t,function(){if(0<this.intersectionRatio&&(!h||p(this.target).hasClass("joinchat_force_show")))return c(),b.disconnect(),!1})}),n.each(function(){b.observe(this)}))),p(d).trigger("joinchat:start")}u.joinchat_obj=u.joinchat_obj||{},joinchat_obj=p.extend({$div:null,settings:null,store:null,chatbox:!1,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(t){return p(t||this.$div,this.$div)},joinchat_obj.send_event=function(o,e){o=o||"",e=e||"click";var t=u[this.settings.ga_tracker]||u.ga||u.__gaTracker;"function"==typeof t&&"function"==typeof t.getAll?(t("set","transport","beacon"),t.getAll().forEach(function(t){t.send("event","JoinChat",e,o)})):"function"==typeof gtag&&gtag("event",e,{event_category:"JoinChat",event_label:o,transport_type:"beacon"}),"object"==typeof dataLayer&&dataLayer.push({event:"JoinChat",eventAction:e,eventLabel:o}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:o})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),p(d).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),p(d).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(t,o){t={link:this.whatsapp_link(t||this.settings.telephone,o||this.settings.message_send)},o=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");p(d).trigger("joinchat:open",[t,this.settings]),o.test(t.link)?(this.send_event(t.link),u.open(t.link,"joinchat","noopener")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")},p(function(){if(joinchat_obj.$div=p(".joinchat"),joinchat_obj.$div.length){joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if(void 0===joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0,console.error("Join.chat: can't get settings")}joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?t():p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)}})}(jQuery,window,document);
1
+ !function(p,u,d){"use strict";function t(){p(d).trigger("joinchat:starting");var t,o,e=1e3*joinchat_obj.settings.button_delay,n=1e3*joinchat_obj.settings.message_delay,i=!!joinchat_obj.settings.message_hash,a=!!joinchat_obj.$(".joinchat__box").length,s=parseInt(joinchat_obj.store.getItem("joinchat_views")||1)>=joinchat_obj.settings.message_views,h=-1!==(joinchat_obj.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean).indexOf(joinchat_obj.settings.message_hash||"none");function c(){clearTimeout(o),joinchat_obj.chatbox_show()}function j(){joinchat_obj.save_hash(),joinchat_obj.chatbox_hide()}var _,r,b,l="joinchat--show";function g(){var t=(d.activeElement.type||"").toLowerCase();0<=["date","datetime","email","month","number","password","search","tel","text","textarea","time","url","week"].indexOf(t)?joinchat_obj.chatbox?(joinchat_obj.chatbox_hide(),setTimeout(function(){joinchat_obj.$div.removeClass("joinchat--show")},400)):joinchat_obj.$div.removeClass("joinchat--show"):joinchat_obj.$div.addClass("joinchat--show")}h||i&&n&&!joinchat_obj.settings.message_badge&&s||(l+=" joinchat--tooltip"),setTimeout(function(){joinchat_obj.$div.addClass(l)},e),i&&!h&&n&&(joinchat_obj.settings.message_badge?o=setTimeout(function(){joinchat_obj.$(".joinchat__badge").addClass("joinchat__badge--in")},e+n):s&&(o=setTimeout(c,e+n))),a&&!joinchat_obj.is_mobile&&joinchat_obj.$(".joinchat__button").on("mouseenter",function(){t=setTimeout(c,1500)}).on("mouseleave",function(){clearTimeout(t)}),joinchat_obj.$(".joinchat__button").on("click",function(){a&&!joinchat_obj.chatbox?c():(j(),joinchat_obj.open_whatsapp())}),joinchat_obj.$(".joinchat__close").on("click",j),joinchat_obj.$(".joinchat__box__scroll").on("mousewheel DOMMouseScroll",function(t){t.preventDefault();t=t.originalEvent.wheelDelta||-t.originalEvent.detail;this.scrollTop+=30*(t<0?1:-1)}),joinchat_obj.is_mobile&&(p(d).on("focus blur","input, textarea",function(t){p(t.target).closest(joinchat_obj.$div).length||(clearTimeout(_),_=setTimeout(g,200))}),p(u).on("resize",function(){clearTimeout(r),r=setTimeout(function(){joinchat_obj.$div[0].style.setProperty("--vh",window.innerHeight+"px")},200)}).trigger("resize")),p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),!a||p(this).is('.joinchat_app, a[href="#whatsapp"]')?joinchat_obj.open_whatsapp():c()}),p(d).on("click",".joinchat_close",function(t){t.preventDefault(),joinchat_obj.chatbox_hide()}),a&&"IntersectionObserver"in u&&(0<(n=p(".joinchat_show, .joinchat_force_show")).length&&(b=new IntersectionObserver(function(t){p.each(t,function(){if(0<this.intersectionRatio&&(!h||p(this.target).hasClass("joinchat_force_show")))return c(),b.disconnect(),!1})}),n.each(function(){b.observe(this)}))),p(d).trigger("joinchat:start")}u.joinchat_obj=u.joinchat_obj||{},joinchat_obj=p.extend({$div:null,settings:null,store:null,chatbox:!1,is_mobile:!1},joinchat_obj),joinchat_obj.$=function(t){return p(t||this.$div,this.$div)},joinchat_obj.send_event=function(o,e){o=o||"",e=e||"click";var t=u[this.settings.ga_tracker]||u.ga||u.__gaTracker;"function"==typeof t&&"function"==typeof t.getAll?(t("set","transport","beacon"),t.getAll().forEach(function(t){t.send("event","JoinChat",e,o)})):"function"==typeof gtag&&gtag("event",e,{event_category:"JoinChat",event_label:o,transport_type:"beacon"}),"object"==typeof dataLayer&&dataLayer.push({event:"JoinChat",eventAction:e,eventLabel:o}),"function"==typeof fbq&&fbq("trackCustom","JoinChat",{eventAction:e,eventLabel:o})},joinchat_obj.whatsapp_link=function(t,o,e){return((e=void 0!==e?e:this.settings.whatsapp_web&&!this.is_mobile)?"https://web.whatsapp.com/send":"https://api.whatsapp.com/send")+"?phone="+encodeURIComponent(t)+"&text="+encodeURIComponent(o||"")},joinchat_obj.chatbox_show=function(){this.chatbox||(this.chatbox=!0,this.$div.addClass("joinchat--chatbox"),this.settings.message_badge&&this.$(".joinchat__badge").hasClass("joinchat__badge--in")&&this.$(".joinchat__badge").toggleClass("joinchat__badge--in joinchat__badge--out"),p(d).trigger("joinchat:show"))},joinchat_obj.chatbox_hide=function(){this.chatbox&&(this.chatbox=!1,this.$div.removeClass("joinchat--chatbox joinchat--tooltip"),this.settings.message_badge&&this.$(".joinchat__badge").removeClass("joinchat__badge--out"),p(d).trigger("joinchat:hide"))},joinchat_obj.save_hash=function(){var t=this.settings.message_hash||"none",o=(this.store.getItem("joinchat_hashes")||"").split(",").filter(Boolean);-1===o.indexOf(t)&&(o.push(t),this.store.setItem("joinchat_hashes",o.join(",")))},joinchat_obj.open_whatsapp=function(t,o){t={link:this.whatsapp_link(t||this.settings.telephone,o||this.settings.message_send)},o=new RegExp("^https?://(wa.me|(api|web|chat).whatsapp.com|"+location.hostname.replace(".",".")+")/.*","i");p(d).trigger("joinchat:open",[t,this.settings]),o.test(t.link)?(this.send_event(t.link),u.open(t.link,"joinchat","noopener")):console.error("Join.chat: the link doesn't seem safe, it must point to the current domain or whatsapp.com")},p(function(){if(joinchat_obj.$div=p(".joinchat"),joinchat_obj.$div.length){joinchat_obj.settings=joinchat_obj.$div.data("settings"),joinchat_obj.is_mobile=!!navigator.userAgent.match(/Android|iPhone|BlackBerry|IEMobile|Opera Mini/i);try{localStorage.setItem("test",1),localStorage.removeItem("test"),joinchat_obj.store=localStorage}catch(t){joinchat_obj.store={_data:{},setItem:function(t,o){this._data[t]=String(o)},getItem:function(t){return this._data.hasOwnProperty(t)?this._data[t]:null}}}if("object"!=typeof joinchat_obj.settings)try{joinchat_obj.settings=JSON.parse(joinchat_obj.$div.attr("data-settings"))}catch(t){joinchat_obj.settings=void 0,console.error("Join.chat: can't get settings")}joinchat_obj.settings&&joinchat_obj.settings.telephone&&(joinchat_obj.is_mobile||!joinchat_obj.settings.mobile_only?t():p(d).on("click",'.joinchat_open, .joinchat_app, a[href="#joinchat"], a[href="#whatsapp"]',function(t){t.preventDefault(),joinchat_obj.open_whatsapp()})),joinchat_obj.store.setItem("joinchat_views",parseInt(joinchat_obj.store.getItem("joinchat_views")||0)+1)}})}(jQuery,window,document);
public/partials/html.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  defined( 'WPINC' ) || exit;
13
  ?>
 
14
  <div class="joinchat <?php echo apply_filters( 'joinchat_classes', $joinchat_classes ); ?>" data-settings='<?php echo JoinChatUtil::to_json( $data ); ?>'>
15
  <div class="joinchat__button">
16
  <div class="joinchat__button__open"></div>
11
 
12
  defined( 'WPINC' ) || exit;
13
  ?>
14
+
15
  <div class="joinchat <?php echo apply_filters( 'joinchat_classes', $joinchat_classes ); ?>" data-settings='<?php echo JoinChatUtil::to_json( $data ); ?>'>
16
  <div class="joinchat__button">
17
  <div class="joinchat__button__open"></div>
public/partials/script.php CHANGED
@@ -11,6 +11,7 @@
11
 
12
  defined( 'WPINC' ) || exit;
13
  ?>
 
14
  <script>
15
  jQuery(function($){
16
  var arg = <?php echo JoinChatUtil::to_json( $args ); ?>;
11
 
12
  defined( 'WPINC' ) || exit;
13
  ?>
14
+
15
  <script>
16
  jQuery(function($){
17
  var arg = <?php echo JoinChatUtil::to_json( $args ); ?>;