Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/creame-whatsapp-me/gutenberg/class-joinchat-gutenberg.php
+++ b/creame-whatsapp-me/gutenberg/class-joinchat-gutenberg.php
@@ -107,7 +107,7 @@
// Replace dynamic vars.
if ( ! empty( $attributes['message'] ) ) {
- $data .= ' data-message="' . esc_attr( Joinchat_Util::replace_variables( $attributes['message'] ) ) . '"';
+ $data .= ' data-message="' . Joinchat_Util::replace_variables( $attributes['message'], 'attr' ) . '"';
}
// Links to '#whatsapp' with data attributes.
--- a/creame-whatsapp-me/includes/class-joinchat-formatter.php
+++ b/creame-whatsapp-me/includes/class-joinchat-formatter.php
@@ -20,40 +20,110 @@
class Joinchat_Formatter {
/**
- * Singleton instance.
+ * Whether the formatter hooks have already been initialized.
*
- * @since 6.0.0
- * @var self|null
+ * @since 6.3.2
+ * @var bool
*/
- private static $instance = null;
+ private static $initialized = false;
/**
- * Instantiates Manager.
+ * Initialize the formatter hooks.
*
- * @since 6.0.0
- * @return Joinchat_Formatter
+ * @since 6.3.2
+ * @return void
*/
- public static function instance() {
+ public static function init() {
- if ( is_null( self::$instance ) ) {
- self::$instance = new self();
+ if ( self::$initialized ) {
+ return;
}
- return self::$instance;
+ add_filter( 'joinchat_format_replacements', array( __CLASS__, 'formatter' ) );
+ add_filter( 'joinchat_format_replacements', array( __CLASS__, 'save_variables' ), 100 );
+ self::$initialized = true;
}
/**
- * Initialize the class.
+ * Format CTA message text for HTML output.
*
- * @since 6.0.0
+ * Legacy wrapper remains in Joinchat_Util::formatted_message() for
+ * backwards compatibility.
+ *
+ * @since 6.3.2
+ * @param string $string string to apply format replacements.
+ * @param bool $as_array return array of messages.
+ * @return string|array
*/
- private function __construct() {
+ public static function formatted_message( $string, $as_array = false ) {
+
+ self::init();
+
+ if ( empty( $string ) ) {
+ return $as_array ? array() : '';
+ }
+
+ // Format replacements.
+ $replacements = apply_filters( 'joinchat_format_replacements', array() );
+
+ // Split text into lines.
+ $lines = explode( "n", Joinchat_Util::clean_nl( $string ) );
+
+ // Apply replacements line by line.
+ if ( count( $replacements ) ) {
+ foreach ( $lines as $key => $line ) {
+ $escaped_line = esc_html( $line );
+
+ foreach ( $replacements as $pattern => $replacement ) {
+ if ( is_callable( $replacement ) ) {
+ $escaped_line = preg_replace_callback( $pattern, $replacement, $escaped_line );
+ } else {
+ $escaped_line = preg_replace( $pattern, $replacement, $escaped_line );
+ }
+ }
+
+ $lines[ $key ] = $escaped_line;
+ }
+ }
+
+ // Join lines and replace remaining text variables after formatter callbacks
+ // have already handled their own URL/attribute contexts.
+ $context = $as_array ? 'raw' : 'html';
+ $formatted = Joinchat_Util::replace_variables( implode( '<br>', $lines ), $context );
+
+ // Out of bubble messages (notes).
+ $formatted = preg_replace( '/(^(?:>){3,}<br>)/u', '>>>', $formatted );
+ $formatted = preg_replace( '/(<br>(?:>){3,}<br>)/u', '<br>===<br>>>>', $formatted );
+ $formatted = preg_replace( '/(^(?:=){3,}<br>)/u', '', $formatted );
+
+ // Split message in bubbles.
+ $messages = preg_split( '/<br>={3,}<br>/u', $formatted );
+
+ // Return array of messages.
+ if ( $as_array ) {
+ return $messages;
+ }
- add_filter( 'joinchat_format_replacements', array( $this, 'formatter' ) );
- add_filter( 'joinchat_format_replacements', array( $this, 'save_variables' ), 100 );
+ // Wrap messages in divs & add classes.
+ foreach ( $messages as $key => $msg ) {
+ $class = '';
+
+ if ( substr( $msg, 0, 3 ) === '>>>' ) {
+ $class = ' joinchat__bubble--note';
+ $msg = substr( $msg, 3 );
+ } elseif ( wp_strip_all_tags( $msg ) === '' ) {
+ $class = ' joinchat__bubble--media';
+ }
+
+ $messages[ $key ] = sprintf( '<div class="joinchat__bubble%s">%s</div>', $class, $msg );
+ }
+
+ $messages = join( "n", $messages );
+ $messages = str_replace( ' src="', ' data-src="', $messages ); // For delayed loading.
+
+ return $messages;
- // add_action( 'joinchat_preview_header', $this, 'preview_styles' );
}
/**
@@ -63,7 +133,7 @@
* @param array $replacements current replacements.
* @return array
*/
- public function formatter( $replacements ) {
+ public static function formatter( $replacements ) {
// MarkDown bold to WhatsApp bold.
$before = array(
@@ -107,37 +177,49 @@
* Markdown image
*  => <img src="image.jpg" alt="alt text" width="width">
*/
- $formats['/ ]*)(?: (?<w>d+))?)/u'] = array( $this, 'image' );
+ $formats['/ ]*)(?: (?<w>d+))?)/u'] = function( $groups ) {
+ return self::image( $groups );
+ };
/**
* Markdown link
* [title](https://www.example.com) => <a href="https://www.example.com">title</a>
*/
- $formats['/[(?<text>[^[]]+)?]((?<href>[^)]+))/u'] = array( $this, 'link' );
+ $formats['/[(?<text>[^[]]+)?]((?<href>[^)]+))/u'] = function( $groups ) {
+ return self::link( $groups );
+ };
/**
* Joinchat image
* {IMG image.jpg width alt_text} => <img src="image.jpg" alt="alt_text" width="width">
*/
- $formats['/{IMG (?<src>[^ }]+)(?: (?<w>d+))?(?: (?<alt>[^}]+))?}/u'] = array( $this, 'image' );
+ $formats['/{IMG (?<src>[^ }]+)(?: (?<w>d+))?(?: (?<alt>[^}]+))?}/u'] = function( $groups ) {
+ return self::image( $groups );
+ };
/**
* Joinchat link
* {LINK https://www.example.com title} => <a href="https://www.example.com">title</a>
*/
- $formats['/{LINK (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = array( $this, 'link' );
+ $formats['/{LINK (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = function( $groups ) {
+ return self::link( $groups );
+ };
/**
* Joinchat link button
* {BTN https://www.example.com title} => <a class="joinchat__btn" href="https://www.example.com">title</a>
*/
- $formats['/{BTN (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = array( $this, 'button' );
+ $formats['/{BTN (?<href>[^ }]+)(?: (?<text>[^}]+))?}/u'] = function( $groups ) {
+ return self::button( $groups );
+ };
/**
* Joinchat random text
* {RAND texto 1||texto 2||texto n} => "texto 1" or "texto 2" or "texto n"
*/
- $formats['/{RAND (?<text>[^}]+)}/u'] = array( $this, 'random' );
+ $formats['/{RAND (?<text>[^}]+)}/u'] = function( $groups ) {
+ return self::random( $groups );
+ };
return array_merge( $before, $replacements, $formats );
@@ -150,7 +232,7 @@
* @param array $replacements current replacements.
* @return array
*/
- public function save_variables( $replacements ) {
+ public static function save_variables( $replacements ) {
$transform = array( '/{([A-Z]+)}/' => '{$1}' );
$restore = array( '/{([A-Z]+)}/' => '{$1}' );
@@ -170,22 +252,21 @@
* @param array $groups regex groups of link.
* @return string html <a>
*/
- public function link( $groups ) {
+ private static function link( $groups ) {
- $href = $groups['href'];
- $text = ! empty( $groups['text'] ) ? $groups['text'] : preg_replace( '/^https?:///u', '', $href );
- $class = ! empty( $groups['class'] ) ? 'class="' . esc_attr( $groups['class'] ) . '"' : '';
+ $href = self::restore_and_replace( $groups['href'], 'raw' );
+ $text = ! empty( $groups['text'] ) ? self::restore_and_replace( $groups['text'], 'html' ) : preg_replace( '/^https?:///u', '', $href );
+ $class = ! empty( $groups['class'] ) ? ' class="' . esc_attr( $groups['class'] ) . '"' : '';
$rel = '';
$blank = '';
// Check if is an external link and add rel attribute for better SEO & Security.
if ( wp_parse_url( $href, PHP_URL_HOST ) !== wp_parse_url( get_home_url(), PHP_URL_HOST ) ) {
- $rel = 'rel="external nofollow noopener noreferrer"';
- $blank = 'target="_blank"';
+ $rel = ' rel="external nofollow noopener noreferrer"';
+ $blank = ' target="_blank"';
}
- $output = sprintf( '<a href="%s" %s %s %s>%s</a>', esc_url_raw( $href ), $class, $rel, $blank, $text );
- $output = preg_replace( '/s+/', ' ', $output );
+ $output = sprintf( '<a href="%s"%s%s%s>%s</a>', esc_url( $href ), $class, $rel, $blank, $text );
return $output;
@@ -201,11 +282,11 @@
* @param array $groups regex groups of link.
* @return string html <a>
*/
- public function button( $groups ) {
+ private static function button( $groups ) {
$groups['class'] = 'joinchat__btn';
- return $this->link( $groups );
+ return self::link( $groups );
}
@@ -218,11 +299,11 @@
* @param array $groups regex groups of random.
* @return string html <jc-rand><jc-opt>texto 1</jc-opt><jc-opt>texto 2</jc-opt></jc-rand>
*/
- public function random( $groups ) {
+ private static function random( $groups ) {
- $texts = explode( '||', $groups['text'] );
+ $texts = explode( '||', self::restore_variables( $groups['text'] ) );
foreach ( $texts as $key => $text ) {
- $texts[ $key ] = '<jc-opt>' . trim( $text ) . '</jc-opt>';
+ $texts[ $key ] = '<jc-opt>' . Joinchat_Util::replace_variables( trim( $text ), 'html' ) . '</jc-opt>';
}
return '<jc-rand>' . join( '', $texts ) . '</jc-rand>';
@@ -246,17 +327,14 @@
* @param array $groups regex groups of image.
* @return string html <img>
*/
- public function image( $groups ) {
+ private static function image( $groups ) {
$chat_max = 340; // Chat window max width.
- $src = $groups['src'];
+ $src = self::restore_and_replace( $groups['src'], 'raw' );
$w = isset( $groups['w'] ) && is_numeric( $groups['w'] ) ? $groups['w'] : $chat_max;
-
- if ( isset( $groups['alt'] ) && strpos( $groups['alt'], '{' ) !== false ) {
- $groups['alt'] = Joinchat_Util::replace_variables( str_replace( array( '{', '}' ), array( '{', '}' ), $groups['alt'] ) );
- }
- $alt = 'alt="' . ( isset( $groups['alt'] ) ? esc_attr( $groups['alt'] ) : '' ) . '"';
+ $alt = isset( $groups['alt'] ) ? self::restore_and_replace( $groups['alt'], 'attr' ) : '';
+ $alt = 'alt="' . $alt . '"';
// If is post featured image.
if ( in_array( strtoupper( $src ), array( 'THUMB', 'FEATURED' ), true ) ) {
@@ -319,4 +397,27 @@
return $output;
}
+
+ /**
+ * Restore placeholder braces after save_variables() temporary encoding.
+ *
+ * @since 6.3.2
+ * @param string $string string to restore.
+ * @return string
+ */
+ private static function restore_variables( $string ) {
+ return str_replace( array( '{', '}' ), array( '{', '}' ), $string );
+ }
+
+ /**
+ * Restore placeholder braces and apply variable replacements.
+ *
+ * @since 6.3.2
+ * @param string $string string to restore and replace.
+ * @param string $context context for variable replacements.
+ * @return string
+ */
+ private static function restore_and_replace( $string, $context = 'html' ) {
+ return Joinchat_Util::replace_variables( self::restore_variables( $string ), $context );
+ }
}
--- a/creame-whatsapp-me/includes/class-joinchat-integrations.php
+++ b/creame-whatsapp-me/includes/class-joinchat-integrations.php
@@ -93,7 +93,7 @@
*
* Don't load HivePress assets on Joinchat settings page (fix conflixt with intlTelInput).
*/
- if ( defined( 'HP_FILE' ) && is_admin() && isset( $_GET['page'] ) && JOINCHAT_SLUG === $_GET['page'] ) {
+ if ( defined( 'HP_FILE' ) && is_admin() && isset( $_GET['page'] ) && JOINCHAT_SLUG === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification
add_filter( 'hivepress/v1/scripts', '__return_empty_array' );
add_filter( 'hivepress/v1/styles', '__return_empty_array' );
}
--- a/creame-whatsapp-me/includes/class-joinchat-util.php
+++ b/creame-whatsapp-me/includes/class-joinchat-util.php
@@ -235,74 +235,13 @@
* Also apply styles transformations like WhatsApp app.
*
* @since 6.0.0
+ * @since 6.3.2 Delegated to Joinchat_Formatter::formatted_message().
* @param string $string string to apply format replacements.
* @param bool $as_array return array of messages.
* @return string|array string formated
*/
public static function formatted_message( $string, $as_array = false ) {
-
- if ( empty( $string ) ) {
- return $as_array ? array() : '';
- }
-
- // Format replacements .
- $replacements = apply_filters( 'joinchat_format_replacements', array() );
-
- // Split text into lines.
- $lines = explode( "n", self::clean_nl( $string ) );
-
- // Apply replacements line by line.
- if ( count( $replacements ) ) {
- foreach ( $lines as $key => $line ) {
- $escaped_line = esc_html( $line );
-
- foreach ( $replacements as $pattern => $replacement ) {
- if ( is_callable( $replacement ) ) {
- $escaped_line = preg_replace_callback( $pattern, $replacement, $escaped_line );
- } else {
- $escaped_line = preg_replace( $pattern, $replacement, $escaped_line );
- }
- }
-
- $lines[ $key ] = $escaped_line;
- }
- }
-
- // Join lines and replace variables.
- $formatted = self::replace_variables( implode( '<br>', $lines ) );
-
- // Out of bubble messages (notes).
- $formatted = preg_replace( '/(^(?:>){3,}<br>)/u', '>>>', $formatted );
- $formatted = preg_replace( '/(<br>(?:>){3,}<br>)/u', '<br>===<br>>>>', $formatted );
- $formatted = preg_replace( '/(^(?:=){3,}<br>)/u', '', $formatted );
-
- // Split message in bubbles.
- $messages = preg_split( '/<br>={3,}<br>/u', $formatted );
-
- // Return array of messages.
- if ( $as_array ) {
- return $messages;
- }
-
- // Wrap messages in divs & add classes.
- foreach ( $messages as $key => $msg ) {
- $class = '';
-
- if ( substr( $msg, 0, 3 ) === '>>>' ) {
- $class = ' joinchat__bubble--note';
- $msg = substr( $msg, 3 );
- } elseif ( wp_strip_all_tags( $msg ) === '' ) {
- $class = ' joinchat__bubble--media';
- }
-
- $messages[ $key ] = sprintf( '<div class="joinchat__bubble%s">%s</div>', $class, $msg );
- }
-
- $messages = join( "n", $messages );
- $messages = str_replace( ' src="', ' data-src="', $messages ); // For delayed loading.
-
- return $messages;
-
+ return Joinchat_Formatter::formatted_message( $string, $as_array );
}
/**
@@ -316,52 +255,116 @@
* @return string string formated
*/
public static function formated_message( $string ) {
- return self::formatted_message( $string );
+ return Joinchat_Formatter::formatted_message( $string );
}
/**
* Format message send, replace vars.
*
* @since 3.1.0
+ * @since 6.3.2 Add $context param.
* @param string $string string to apply variable replacements.
+ * @param string $context output context: display (legacy), raw, html or attr.
* @return string string with replaced variables
*/
- public static function replace_variables( $string ) {
+ public static function replace_variables( $string, $context = 'display' ) {
// If empty or don't has vars return early.
if ( empty( $string ) || false === strpos( $string, '{' ) ) {
return $string;
}
+ $replacements = self::get_variable_replacements( $context );
+
+ // Patterns as regex {VAR}.
+ $patterns = array();
+ foreach ( $replacements as $var => $replacement ) {
+ $patterns[] = "/{$var}/u";
+ }
+
+ return preg_replace( $patterns, $replacements, $string );
+
+ }
+
+ /**
+ * Build variable replacements for a given output context.
+ *
+ * @since 6.3.2
+ * @param string $context output context.
+ * @return array<string, string>
+ */
+ private static function get_variable_replacements( $context ) {
+
global $wp;
$replacements = apply_filters(
'joinchat_variable_replacements',
array(
'SITE' => get_bloginfo( 'name' ),
- 'HOME' => home_url(),
- 'URL' => user_trailingslashit( home_url( $wp->request ) ),
- 'HREF' => home_url( add_query_arg( null, null ) ),
+ 'HOME' => esc_url_raw( home_url() ),
+ 'URL' => esc_url_raw( user_trailingslashit( home_url( $wp->request ) ) ),
+ 'HREF' => esc_url_raw( home_url( add_query_arg( null, null ) ) ),
'TITLE' => self::get_title(),
- )
+ ),
+ $context
);
- // Patterns as regex {VAR}.
- $patterns = array();
foreach ( $replacements as $var => $replacement ) {
- $patterns[] = "/{$var}/u";
+ $replacements[ $var ] = self::escape_variable_replacement( $var, (string) $replacement, $context );
}
- // Prevent malformed json.
- foreach ( $replacements as $var => $replacement ) {
- $replacements[ $var ] = str_replace( '"', '"', $replacement );
+ return $replacements;
+
+ }
+
+ /**
+ * Escape a replacement according to the output context.
+ *
+ * @since 6.3.2
+ * @param string $var variable name.
+ * @param string $replacement replacement value.
+ * @param string $context output context.
+ * @return string
+ */
+ private static function escape_variable_replacement( $var, $replacement, $context ) {
+
+ $replacement = str_replace( '"', '"', $replacement );
+
+ if ( 'raw' === $context ) {
+ return $replacement;
}
- return preg_replace( $patterns, $replacements, $string );
+ if ( 'attr' === $context ) {
+ return esc_attr( wp_strip_all_tags( $replacement ) );
+ }
+
+ if ( 'html' === $context ) {
+ if ( false !== strpos( $replacement, '<' ) ) {
+ return wp_kses( $replacement, self::variable_allowed_html() );
+ }
+
+ return esc_html( $replacement );
+ }
+
+ if ( in_array( $var, array( 'HOME', 'URL', 'HREF' ), true ) ) {
+ return esc_url( $replacement );
+ }
+
+ return $replacement;
}
/**
+ * Allowed HTML tags for variable replacements in formatted messages.
+ *
+ * @since 6.3.2
+ * @return array<string, array<string, bool>>
+ */
+ private static function variable_allowed_html() {
+ return (array) apply_filters( 'joinchat_variable_allowed_html', array() );
+ }
+
+ /**
* Get current page title
*
* @since 3.1.0
@@ -558,12 +561,14 @@
$client_ip = '';
foreach ( $headers as $header ) {
- if ( empty( $_SERVER[ $header ] ) ) {
+ $server_header = isset( $_SERVER[ $header ] ) ? sanitize_text_field( wp_unslash( (string) $_SERVER[ $header ] ) ) : '';
+
+ if ( '' === $server_header ) {
continue;
}
// Headers like X-Forwarded-For can contain multiple IPs (comma-separated).
- $ips = array_map( 'trim', explode( ',', wp_unslash( (string) $_SERVER[ $header ] ) ) );
+ $ips = array_map( 'trim', explode( ',', $server_header ) );
foreach ( $ips as $ip ) {
if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
@@ -573,9 +578,10 @@
}
}
- if ( empty( $client_ip ) && ! empty( $_SERVER['REMOTE_ADDR'] ) ) {
- $ip = trim( wp_unslash( (string) $_SERVER['REMOTE_ADDR'] ) );
- if ( filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
+ if ( empty( $client_ip ) ) {
+ $remote_addr = isset( $_SERVER['REMOTE_ADDR'] ) ? sanitize_text_field( wp_unslash( (string) $_SERVER['REMOTE_ADDR'] ) ) : '';
+ $ip = trim( $remote_addr );
+ if ( '' !== $ip && filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
$client_ip = $ip;
}
}
--- a/creame-whatsapp-me/includes/class-joinchat.php
+++ b/creame-whatsapp-me/includes/class-joinchat.php
@@ -253,7 +253,7 @@
}
require_once JOINCHAT_DIR . 'includes/class-joinchat-formatter.php';
- Joinchat_Formatter::instance();
+ Joinchat_Formatter::init();
require_once JOINCHAT_DIR . 'public/class-joinchat-public.php';
@@ -373,6 +373,10 @@
* @return bool True if is login page, false otherwise.
*/
private function is_login() {
- return function_exists( 'is_login' ) ? is_login() : false !== stripos( wp_login_url(), $_SERVER['SCRIPT_NAME'] ?? '' );
+ if ( function_exists( 'is_login' ) ) {
+ return is_login();
+ }
+
+ return false !== stripos( wp_login_url(), sanitize_text_field( wp_unslash( $_SERVER['SCRIPT_NAME'] ?? '' ) ) );
}
}
--- a/creame-whatsapp-me/joinchat.php
+++ b/creame-whatsapp-me/joinchat.php
@@ -7,10 +7,10 @@
* @package Joinchat
*
* @wordpress-plugin
- * Plugin Name: Joinchat
+ * Plugin Name: Joinchat - Enhanced "click to chat"
* Plugin URI: https://join.chat
* Description: Connects a WordPress chat with WhatsApp. The best solution for marketing and support. Stop losing customers and increase your sales.
- * Version: 6.3.1
+ * Version: 6.3.2
* Author: Creame
* Author URI: https://crea.me
* License: GPL-2.0+
@@ -27,7 +27,7 @@
/**
* Define constants.
*/
-define( 'JOINCHAT_VERSION', '6.3.1' );
+define( 'JOINCHAT_VERSION', '6.3.2' );
define( 'JOINCHAT_SLUG', 'joinchat' );
define( 'JOINCHAT_FILE', __FILE__ );
define( 'JOINCHAT_DIR', plugin_dir_path( JOINCHAT_FILE ) );
@@ -49,7 +49,7 @@
* @since 1.0.0
* @since 3.0.0 Replaced direct run() to launch via 'init' hook
*/
-function run_joinchat() {
+function joinchat_run() {
$plugin = new Joinchat();
@@ -57,4 +57,4 @@
}
-run_joinchat();
+joinchat_run();
--- a/creame-whatsapp-me/public/class-joinchat-public.php
+++ b/creame-whatsapp-me/public/class-joinchat-public.php
@@ -329,7 +329,7 @@
$data = array_intersect_key( jc_common()->settings, array_flip( apply_filters( 'joinchat_script_lite_fields', $fields ) ) );
- $data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'] );
+ $data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'], 'raw' );
// Enqueue lite script.
wp_enqueue_script( 'joinchat-lite', plugins_url( "js/joinchat-lite{$min}.js", __FILE__ ), $deps, JOINCHAT_VERSION, $args );
@@ -444,7 +444,7 @@
$data = array_diff_key( $settings, array_flip( $excluded_fields ) );
- $data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'] );
+ $data['message_send'] = Joinchat_Util::replace_variables( $data['message_send'], 'raw' );
if ( $settings['show_brand'] || $is_preview ) {
$powered_args = array(
--- a/creame-whatsapp-me/public/class-joinchat-woo-public.php
+++ b/creame-whatsapp-me/public/class-joinchat-woo-public.php
@@ -43,6 +43,7 @@
$loader->add_filter( 'joinchat_get_settings', $this, 'product_settings' );
$loader->add_filter( 'joinchat_visibility', $this, 'visibility', 10, 2 );
$loader->add_filter( 'joinchat_variable_replacements', $this, 'replacements' );
+ $loader->add_filter( 'joinchat_variable_allowed_html', $this, 'allowed_html' );
$loader->add_filter( 'joinchat_excluded_fields', $this, 'excluded_fields' );
$loader->add_filter( 'joinchat_script_lite_fields', $this, 'lite_fields' );
@@ -236,6 +237,21 @@
}
/**
+ * Add allowed HTML for variable replacements
+ *
+ * @since 6.3.2
+ * @param array $allowed current allowed HTML.
+ * @return array
+ */
+ public function allowed_html( $allowed ) {
+
+ $allowed['jc-sku'] = array();
+
+ return $allowed;
+
+ }
+
+ /**
* Exclude unnecessary Woocommerce settings in front
*
* @since 3.0.0
--- a/creame-whatsapp-me/uninstall.php
+++ b/creame-whatsapp-me/uninstall.php
@@ -12,12 +12,12 @@
exit;
}
-$option = get_option( 'joinchat' );
+$joinchat_option = get_option( 'joinchat' );
/**
* Delete all plugin data if 'clear' is true.
*/
-if ( isset( $option['clear'] ) && 'yes' === $option['clear'] ) {
+if ( isset( $joinchat_option['clear'] ) && 'yes' === $joinchat_option['clear'] ) {
global $wpdb;