Version Description
- CHANGE Delay 'message_send' replace variables until used (fix conflict with Rank Math).
- CHANGE Optimized variable replacement, runs only when needed.
Download this release
Release Info
Developer | pacotole |
Plugin | WhatsApp me |
Version | 4.5.14 |
Comparing to | |
See all releases |
Code changes from version 4.5.13 to 4.5.14
- README.txt +5 -1
- includes/class-joinchat-util.php +14 -15
- joinchat.php +2 -2
- public/class-joinchat-public.php +5 -2
README.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: Chat, Click to Chat, Facebook Messenger, WhatsApp, Telegram, Whatsapp Busi
|
|
5 |
Requires at least: 4.4.0
|
6 |
Tested up to: 6.1
|
7 |
Requires PHP: 5.5
|
8 |
-
Stable tag: 4.5.
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -356,6 +356,10 @@ Joinchat save two localStorage variables for proper operation:
|
|
356 |
|
357 |
== Changelog ==
|
358 |
|
|
|
|
|
|
|
|
|
359 |
= 4.5.13 =
|
360 |
* FIX Tooltip text is cut off when there is an image emoji.
|
361 |
* FIX PHP notice undefined 'title' introduced in v4.5.12.
|
5 |
Requires at least: 4.4.0
|
6 |
Tested up to: 6.1
|
7 |
Requires PHP: 5.5
|
8 |
+
Stable tag: 4.5.14
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
356 |
|
357 |
== Changelog ==
|
358 |
|
359 |
+
= 4.5.14 =
|
360 |
+
* CHANGE Delay 'message_send' replace variables until used (fix conflict with Rank Math).
|
361 |
+
* CHANGE Optimized variable replacement, runs only when needed.
|
362 |
+
|
363 |
= 4.5.13 =
|
364 |
* FIX Tooltip text is cut off when there is an image emoji.
|
365 |
* FIX PHP notice undefined 'title' introduced in v4.5.12.
|
includes/class-joinchat-util.php
CHANGED
@@ -224,6 +224,12 @@ class JoinChatUtil {
|
|
224 |
* @return string string with replaced variables
|
225 |
*/
|
226 |
public static function replace_variables( $string ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
227 |
global $wp;
|
228 |
|
229 |
$replacements = apply_filters(
|
@@ -259,29 +265,22 @@ class JoinChatUtil {
|
|
259 |
*/
|
260 |
public static function get_title() {
|
261 |
|
262 |
-
|
|
|
|
|
|
|
|
|
|
|
263 |
|
264 |
$title = wp_get_document_title();
|
265 |
|
266 |
-
remove_filter( '
|
|
|
267 |
|
268 |
return apply_filters( 'joinchat_get_title', $title );
|
269 |
|
270 |
}
|
271 |
|
272 |
-
/**
|
273 |
-
* Get only 'title' of title parts
|
274 |
-
*
|
275 |
-
* @since 4.5.12
|
276 |
-
* @param array $parts title parts.
|
277 |
-
* @return array
|
278 |
-
*/
|
279 |
-
public static function only_title_part( $parts ) {
|
280 |
-
|
281 |
-
return empty( $parts['title'] ) ? $parts : array( 'title' => $parts['title'] );
|
282 |
-
|
283 |
-
}
|
284 |
-
|
285 |
/**
|
286 |
* Encode JSON with filtered options
|
287 |
*
|
224 |
* @return string string with replaced variables
|
225 |
*/
|
226 |
public static function replace_variables( $string ) {
|
227 |
+
|
228 |
+
// If empty or don't has vars return early.
|
229 |
+
if ( empty( $string ) || false === strpos( $string, '{' ) ) {
|
230 |
+
return $string;
|
231 |
+
}
|
232 |
+
|
233 |
global $wp;
|
234 |
|
235 |
$replacements = apply_filters(
|
265 |
*/
|
266 |
public static function get_title() {
|
267 |
|
268 |
+
$filter = function ( $parts ) {
|
269 |
+
return empty( $parts['title'] ) ? $parts : array( 'title' => $parts['title'] );
|
270 |
+
};
|
271 |
+
|
272 |
+
add_filter( 'pre_get_document_title', '__return_empty_string', 100 ); // "Disable" third party bypass.
|
273 |
+
add_filter( 'document_title_parts', $filter, 100 ); // Filter only 'title' part.
|
274 |
|
275 |
$title = wp_get_document_title();
|
276 |
|
277 |
+
remove_filter( 'pre_get_document_title', '__return_empty_string', 100 ); // "Re-enable" third party bypass.
|
278 |
+
remove_filter( 'document_title_parts', $filter, 100 ); // Remove our filter.
|
279 |
|
280 |
return apply_filters( 'joinchat_get_title', $title );
|
281 |
|
282 |
}
|
283 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
/**
|
285 |
* Encode JSON with filtered options
|
286 |
*
|
joinchat.php
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
* Plugin Name: Joinchat
|
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.5.
|
13 |
* Author: Creame
|
14 |
* Author URI: https://crea.me
|
15 |
* License: GPL-2.0+
|
@@ -26,7 +26,7 @@ if ( ! defined( 'WPINC' ) ) {
|
|
26 |
/**
|
27 |
* Define constants.
|
28 |
*/
|
29 |
-
define( 'JOINCHAT_VERSION', '4.5.
|
30 |
define( 'JOINCHAT_FILE', __FILE__ );
|
31 |
define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
|
32 |
define( 'JOINCHAT_BASENAME', plugin_basename( JOINCHAT_FILE ) );
|
9 |
* Plugin Name: Joinchat
|
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.5.14
|
13 |
* Author: Creame
|
14 |
* Author URI: https://crea.me
|
15 |
* License: GPL-2.0+
|
26 |
/**
|
27 |
* Define constants.
|
28 |
*/
|
29 |
+
define( 'JOINCHAT_VERSION', '4.5.14' );
|
30 |
define( 'JOINCHAT_FILE', __FILE__ );
|
31 |
define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
|
32 |
define( 'JOINCHAT_BASENAME', plugin_basename( JOINCHAT_FILE ) );
|
public/class-joinchat-public.php
CHANGED
@@ -109,9 +109,8 @@ class JoinChatPublic {
|
|
109 |
$settings['message_text'] = preg_replace( '/^\{\s*\}$/', '', $settings['message_text'] );
|
110 |
$settings['message_send'] = preg_replace( '/^\{\s*\}$/', '', $settings['message_send'] );
|
111 |
|
112 |
-
// Prepare settings.
|
113 |
$settings['telephone'] = JoinChatUtil::clean_whatsapp( $settings['telephone'] );
|
114 |
-
$settings['message_send'] = JoinChatUtil::replace_variables( $settings['message_send'] );
|
115 |
$settings['mobile_only'] = 'yes' === $settings['mobile_only'];
|
116 |
$settings['whatsapp_web'] = 'yes' === $settings['whatsapp_web'];
|
117 |
$settings['qr'] = 'yes' === $settings['qr'];
|
@@ -212,6 +211,8 @@ class JoinChatPublic {
|
|
212 |
|
213 |
$data = array_intersect_key( $this->common->settings, array_flip( array( 'telephone', 'whatsapp_web', 'message_send', 'gads', 'ga_tracker', 'data_layer' ) ) );
|
214 |
|
|
|
|
|
215 |
// Enqueue lite script.
|
216 |
wp_enqueue_script( 'joinchat-lite', plugins_url( "js/joinchat-lite{$min}.js", __FILE__ ), $deps, $this->version, true );
|
217 |
wp_localize_script( 'joinchat-lite', 'joinchat_obj', array( 'settings' => $data ) );
|
@@ -282,6 +283,8 @@ class JoinChatPublic {
|
|
282 |
|
283 |
$data = array_diff_key( $settings, array_flip( $excluded_fields ) );
|
284 |
|
|
|
|
|
285 |
if ( '__jc__' === $settings['header'] ) {
|
286 |
$powered_args = array(
|
287 |
'site' => rawurlencode( get_bloginfo( 'name' ) ),
|
109 |
$settings['message_text'] = preg_replace( '/^\{\s*\}$/', '', $settings['message_text'] );
|
110 |
$settings['message_send'] = preg_replace( '/^\{\s*\}$/', '', $settings['message_send'] );
|
111 |
|
112 |
+
// Prepare settings ('message_send' delay replace variables until they are used).
|
113 |
$settings['telephone'] = JoinChatUtil::clean_whatsapp( $settings['telephone'] );
|
|
|
114 |
$settings['mobile_only'] = 'yes' === $settings['mobile_only'];
|
115 |
$settings['whatsapp_web'] = 'yes' === $settings['whatsapp_web'];
|
116 |
$settings['qr'] = 'yes' === $settings['qr'];
|
211 |
|
212 |
$data = array_intersect_key( $this->common->settings, array_flip( array( 'telephone', 'whatsapp_web', 'message_send', 'gads', 'ga_tracker', 'data_layer' ) ) );
|
213 |
|
214 |
+
$data['message_send'] = JoinChatUtil::replace_variables( $data['message_send'] );
|
215 |
+
|
216 |
// Enqueue lite script.
|
217 |
wp_enqueue_script( 'joinchat-lite', plugins_url( "js/joinchat-lite{$min}.js", __FILE__ ), $deps, $this->version, true );
|
218 |
wp_localize_script( 'joinchat-lite', 'joinchat_obj', array( 'settings' => $data ) );
|
283 |
|
284 |
$data = array_diff_key( $settings, array_flip( $excluded_fields ) );
|
285 |
|
286 |
+
$data['message_send'] = JoinChatUtil::replace_variables( $data['message_send'] );
|
287 |
+
|
288 |
if ( '__jc__' === $settings['header'] ) {
|
289 |
$powered_args = array(
|
290 |
'site' => rawurlencode( get_bloginfo( 'name' ) ),
|