Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/customer-reviews-woocommerce/class-ivole.php
+++ b/customer-reviews-woocommerce/class-ivole.php
@@ -88,7 +88,7 @@
require_once( __DIR__ . '/includes/analytics/class-cr-reviews-top-charts.php' );
class Ivole {
- const CR_VERSION = '5.129.0';
+ const CR_VERSION = '5.130.0';
public function __construct() {
if( function_exists( 'wc' ) ) {
--- a/customer-reviews-woocommerce/includes/blocks/class-cr-all-reviews.php
+++ b/customer-reviews-woocommerce/includes/blocks/class-cr-all-reviews.php
@@ -532,7 +532,7 @@
add_filter( 'get_avatar', array( 'CR_Reviews', 'change_avatar_class' ), 10, 6 );
}
CR_Reviews::$custom_ratings_enabled = $this->shortcode_atts['custom_ratings'];
- $return .= wp_list_comments( apply_filters('ivole_product_review_list_args', array(
+ $comments_html = wp_list_comments( apply_filters('ivole_product_review_list_args', array(
'callback' => array( 'CR_Reviews', 'callback_comments' ),
'max_depth' => 5,
'page' => 1,
@@ -542,6 +542,7 @@
'cr_show_products' => $this->shortcode_atts['show_products'],
'cr_hide_avatars' => $hide_avatars
)), $comments );
+ $return .= CR_Utils::cr_encode_shortcode_brackets( $comments_html );
CR_Reviews::$custom_ratings_enabled = true;
if ( 'initials' === $this->shortcode_atts['avatars'] ) {
remove_filter( 'get_avatar', array( 'CR_Reviews_Grid', 'cr_get_avatar' ) );
--- a/customer-reviews-woocommerce/includes/blocks/class-cr-reviews-slider.php
+++ b/customer-reviews-woocommerce/includes/blocks/class-cr-reviews-slider.php
@@ -445,12 +445,13 @@
$attributes = shortcode_atts( $defaults, $attributes, 'cusrev_reviews_slider' );
$attributes = CR_Reviews::sanitize_review_display_attributes( $attributes, $defaults );
- $attributes['slides_to_show'] = absint( $attributes['slides_to_show'] ) >= absint( $attributes['count'] ) ? absint( $attributes['count'] ) : absint( $attributes['slides_to_show'] );
$attributes['count'] = absint( $attributes['count'] );
$attributes['show_products'] = ( $attributes['show_products'] !== 'false' && boolval( $attributes['count'] ) );
$attributes['product_links'] = ( $attributes['product_links'] !== 'false' );
$attributes['shop_reviews'] = ( $attributes['shop_reviews'] !== 'false' && boolval( $attributes['count_shop_reviews'] ) );
$attributes['count_shop_reviews'] = absint( $attributes['count_shop_reviews'] );
+ $max_slides = $attributes['count'] + ( $attributes['shop_reviews'] ? $attributes['count_shop_reviews'] : 0 );
+ $attributes['slides_to_show'] = min( absint( $attributes['slides_to_show'] ), $max_slides );
$attributes['inactive_products'] = ( $attributes['inactive_products'] === 'true' );
$attributes['autoplay'] = ( $attributes['autoplay'] === 'true' );
$attributes['max_chars'] = absint( $attributes['max_chars'] );
@@ -641,7 +642,7 @@
$output = '<div class="cr-sldr-custom-questions">';
$output .= $questions;
$output .= '</div>';
- echo $output;
+ echo CR_Utils::cr_encode_shortcode_brackets( $output );
}
}
}
--- a/customer-reviews-woocommerce/includes/misc/class-cr-captcha.php
+++ b/customer-reviews-woocommerce/includes/misc/class-cr-captcha.php
@@ -18,6 +18,7 @@
const HANDLE_HCAPTCHA = 'cr-hcaptcha';
const HANDLE_TURNSTILE = 'cr-turnstile';
const HANDLE_SCRIPT = 'cr-captcha';
+ const CONTEXT_QNA = 'qna';
private static $settings = null;
@@ -31,7 +32,18 @@
);
}
- public static function get_settings() {
+ public static function get_settings( $context = 'reviews' ) {
+ if ( self::CONTEXT_QNA === $context ) {
+ $type = get_option( 'ivole_qna_captcha_type', false );
+ if ( false === $type ) {
+ $type = 'yes' === get_option( 'ivole_qna_enable_captcha', 'no' ) ? self::TYPE_RECAPTCHA3 : self::TYPE_NONE;
+ }
+ return array(
+ 'type' => is_string( $type ) ? $type : 'invalid',
+ 'site_key' => trim( get_option( 'ivole_qna_captcha_site_key', '' ) ),
+ 'secret_key' => trim( get_option( 'ivole_qna_captcha_secret_key', '' ) )
+ );
+ }
if ( null === self::$settings ) {
$type = self::TYPE_NONE;
$site_key = '';
@@ -82,8 +94,11 @@
return $settings['secret_key'];
}
- public static function is_enabled() {
- $settings = self::get_settings();
+ public static function is_enabled( $context = 'reviews' ) {
+ $settings = self::get_settings( $context );
+ if ( self::CONTEXT_QNA === $context ) {
+ return self::TYPE_NONE !== $settings['type'];
+ }
return (
self::TYPE_NONE !== $settings['type'] &&
'' !== $settings['site_key'] &&
@@ -140,7 +155,7 @@
}
}
- private static function get_api_url( $type, $site_key, $lang ) {
+ private static function get_api_url( $type, $site_key, $lang, $recaptcha_compat = true ) {
switch ( $type ) {
// the widgets are rendered explicitly by 'js/cr-captcha.js', but the
// scripts below are loaded without 'render=explicit' so that automatic
@@ -150,8 +165,14 @@
case self::TYPE_TURNSTILE:
return 'https://challenges.cloudflare.com/turnstile/v0/api.js';
case self::TYPE_HCAPTCHA:
- return 'https://js.hcaptcha.com/1/api.js' .
- ( $lang ? '?hl=' . rawurlencode( $lang ) : '' );
+ $params = array();
+ if ( $lang ) {
+ $params[] = 'hl=' . rawurlencode( $lang );
+ }
+ if ( ! $recaptcha_compat ) {
+ $params[] = 'recaptchacompat=off';
+ }
+ return 'https://js.hcaptcha.com/1/api.js' . ( $params ? '?' . implode( '&', $params ) : '' );
case self::TYPE_RECAPTCHA2:
return 'https://www.google.com/recaptcha/api.js' .
( $lang ? '?hl=' . rawurlencode( $lang ) : '' );
@@ -164,22 +185,32 @@
}
public static function register_scripts( $lang = '' ) {
- if ( ! self::is_enabled() ) {
+ $review_settings = self::get_settings();
+ $qna_settings = self::get_settings( self::CONTEXT_QNA );
+ $configurations = array();
+ if ( self::is_enabled() && ! is_user_logged_in() ) {
+ $configurations[] = $review_settings;
+ }
+ if ( 'yes' === get_option( 'ivole_questions_answers', 'no' ) && self::is_enabled( self::CONTEXT_QNA ) && $qna_settings['site_key'] && self::get_api_handle( $qna_settings['type'] ) ) {
+ $configurations[] = $qna_settings;
+ }
+ if ( ! $configurations ) {
return;
}
- $settings = self::get_settings();
- $api_handle = self::get_api_handle( $settings['type'] );
- wp_register_script(
- $api_handle,
- self::get_api_url( $settings['type'], $settings['site_key'], $lang ),
- array(),
- null,
- true
- );
+ $providers = array();
+ foreach ( $configurations as $settings ) {
+ $handle = self::get_api_handle( $settings['type'] );
+ if ( ! isset( $providers[ $handle ] ) || self::TYPE_RECAPTCHA3 === $settings['type'] ) {
+ $providers[ $handle ] = $settings;
+ }
+ }
+ foreach ( $providers as $handle => $settings ) {
+ wp_register_script( $handle, self::get_api_url( $settings['type'], $settings['site_key'], $lang, ! isset( $providers[ self::HANDLE_RECAPTCHA ] ) ), array(), null, true );
+ }
wp_register_script(
self::HANDLE_SCRIPT,
plugins_url( 'js/cr-captcha.js', dirname( dirname( __FILE__ ) ) ),
- array( 'jquery', $api_handle ),
+ array( 'jquery' ),
Ivole::CR_VERSION,
true
);
@@ -187,29 +218,35 @@
self::HANDLE_SCRIPT,
'crCaptchaConfig',
array(
- 'type' => $settings['type'],
- 'siteKey' => $settings['site_key'],
+ 'type' => self::is_enabled() && ! is_user_logged_in() ? $review_settings['type'] : '',
+ 'siteKey' => $review_settings['site_key'],
'language' => $lang,
'theme' => 'light',
- 'responseField' => self::get_response_field( $settings['type'] ),
+ 'responseField' => self::get_response_field( $review_settings['type'] ),
'errorText' => __( 'Please confirm that you are not a robot', 'customer-reviews-woocommerce' )
)
);
}
- public static function enqueue_scripts() {
- if ( ! self::is_enabled() ) {
+ public static function enqueue_scripts( $context = 'reviews' ) {
+ if ( ! self::is_enabled( $context ) ) {
return;
}
+ $settings = self::get_settings( $context );
+ $api_handle = self::get_api_handle( $settings['type'] );
+ if ( $api_handle && $settings['site_key'] ) {
+ wp_enqueue_script( $api_handle );
+ }
wp_enqueue_script( self::HANDLE_SCRIPT );
}
- public static function get_widget_html() {
- if ( ! self::is_enabled() ) {
+ public static function get_widget_html( $context = 'reviews' ) {
+ if ( ! self::is_enabled( $context ) ) {
return '';
}
- $settings = self::get_settings();
+ $settings = self::get_settings( $context );
$attributes = ' data-crcaptcha-type="' . esc_attr( $settings['type'] ) . '"' .
+ ' data-crcaptcha-context="' . esc_attr( $context ) . '"' .
' data-sitekey="' . esc_attr( $settings['site_key'] ) . '"' .
' data-crcaptchaid="' . esc_attr( substr( str_shuffle( md5( microtime() ) ), 0, 5 ) ) . '"';
if ( self::is_invisible( $settings['type'] ) ) {
@@ -221,11 +258,14 @@
return '<div class="cr-recaptcha cr-captcha cr-captcha-widget"' . $attributes . '></div>';
}
- public static function verify( $token = null ) {
- if ( ! self::is_enabled() ) {
+ public static function verify( $token = null, $context = 'reviews' ) {
+ if ( ! self::is_enabled( $context ) ) {
return true;
}
- $settings = self::get_settings();
+ $settings = self::get_settings( $context );
+ if ( ! $settings['site_key'] || ! $settings['secret_key'] || ! self::get_verify_url( $settings['type'] ) ) {
+ return false;
+ }
if ( null === $token || '' === $token ) {
$token = '';
$fields = array( 'cr_captcha_response', self::get_response_field( $settings['type'] ) );
@@ -254,9 +294,9 @@
if ( ! is_array( $result ) || empty( $result['success'] ) ) {
return false;
}
- if ( self::TYPE_RECAPTCHA3 === $settings['type'] && isset( $result['score'] ) ) {
- $threshold = floatval( apply_filters( 'cr_captcha_score_threshold', 0.5 ) );
- if ( floatval( $result['score'] ) < $threshold ) {
+ if ( self::TYPE_RECAPTCHA3 === $settings['type'] && ( self::CONTEXT_QNA === $context || isset( $result['score'] ) ) ) {
+ $threshold = self::CONTEXT_QNA === $context ? 0.5 : floatval( apply_filters( 'cr_captcha_score_threshold', 0.5 ) );
+ if ( ! isset( $result['score'] ) || ! is_numeric( $result['score'] ) || floatval( $result['score'] ) < $threshold ) {
return false;
}
}
--- a/customer-reviews-woocommerce/includes/misc/class-cr-utils.php
+++ b/customer-reviews-woocommerce/includes/misc/class-cr-utils.php
@@ -50,6 +50,13 @@
}
/**
+ * Prevent literal text from being parsed by a later do_shortcode() pass.
+ */
+ public static function cr_encode_shortcode_brackets( $text ) {
+ return str_replace( array( '[', ']' ), array( '[', ']' ), (string) $text );
+ }
+
+ /**
* Base URL of the CusRev API. Define CR_API_URL in wp-config.php to point it
* at a local/dev environment
*/
--- a/customer-reviews-woocommerce/includes/qna/class-cr-admin-menu-qna.php
+++ b/customer-reviews-woocommerce/includes/qna/class-cr-admin-menu-qna.php
@@ -376,6 +376,7 @@
wp_die( __( 'ERROR: please type a comment.' ) );
$comment_parent = 0;
+ $comment_tmp = null;
if ( isset( $_POST['comment_ID'] ) ) {
$comment_tmp = get_comment( absint( $_POST['comment_ID'] ) );
if( $comment_tmp && 0 < $comment_tmp->comment_parent ) {
@@ -387,9 +388,9 @@
$comment_auto_approved = false;
$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
- // Automatically approve parent comment.
+ // Approve the selected comment, which may be an answer rather than the reply's parent.
if ( !empty($_POST['approve_parent']) ) {
- $parent = get_comment( $comment_parent );
+ $parent = $comment_tmp;
if ( $parent && $parent->comment_approved === '0' && $parent->comment_post_ID == $comment_post_ID ) {
if ( ! current_user_can( 'edit_comment', $parent->comment_ID ) ) {
--- a/customer-reviews-woocommerce/includes/qna/class-cr-qna-list-table.php
+++ b/customer-reviews-woocommerce/includes/qna/class-cr-qna-list-table.php
@@ -671,7 +671,7 @@
$parent = get_comment( $comment->comment_parent );
if ( $parent ) {
$parent_link = esc_url( get_comment_link( $parent ) );
- $name = get_comment_author( $parent );
+ $name = esc_html( get_comment_author( $parent ) );
echo '<p class="cr-qna-admin-reply">';
printf(
__( 'In reply to %s', 'customer-reviews-woocommerce' ),
--- a/customer-reviews-woocommerce/includes/qna/class-cr-qna-shortcode.php
+++ b/customer-reviews-woocommerce/includes/qna/class-cr-qna-shortcode.php
@@ -60,7 +60,7 @@
ob_start();
$this->qna->display_qna_tab( $attributes );
$output = ob_get_clean();
- return $output;
+ return CR_Utils::cr_encode_shortcode_brackets( $output );
}
}
--- a/customer-reviews-woocommerce/includes/qna/class-cr-qna.php
+++ b/customer-reviews-woocommerce/includes/qna/class-cr-qna.php
@@ -9,8 +9,6 @@
class CR_Qna {
private $per_page = 5;
- private $recaptcha = '';
- private $recaptcha_score = 0.5;
private $search = '';
private $duplicate_answer;
@@ -87,7 +85,12 @@
}
}
$cr_qna_checkbox_text = wp_specialchars_decode( $cr_qna_checkbox_text, ENT_QUOTES );
- $cr_recaptcha = $this->recaptcha;
+ $captcha_settings = CR_Captcha::get_settings( CR_Captcha::CONTEXT_QNA );
+ $cr_recaptcha = self::is_captcha_enabled() && CR_Captcha::TYPE_RECAPTCHA3 === $captcha_settings['type'] ? $captcha_settings['site_key'] : '';
+ if ( self::is_captcha_enabled() ) {
+ CR_Captcha::register_scripts( CR_Trust_Badge::get_badge_language() );
+ CR_Captcha::enqueue_scripts( CR_Captcha::CONTEXT_QNA );
+ }
$template = wc_locate_template(
'qna-tab.php',
'customer-reviews-woocommerce',
@@ -204,25 +207,12 @@
}
if( 0 < $product_id ) {
$captcha_correct = true;
- if( self::is_captcha_enabled() ) {
- $secret_key = get_option( 'ivole_qna_captcha_secret_key', '' );
- if( isset( $_POST['cptcha'] ) && 0 < strlen( $_POST['cptcha'] ) ) {
- $captch_response = json_decode( wp_remote_retrieve_body( wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array( 'body' => array( 'secret' => $secret_key, 'response' => $_POST['cptcha'], 'remoteip' => $_SERVER['REMOTE_ADDR'] ) ) ) ), true );
- if( $captch_response['success'] ) {
- if( $captch_response['score'] && $this->recaptcha_score > $captch_response['score'] ) {
- $captcha_correct = false;
- $return['description'] = __( 'reCAPTCHA score is below the threshold.', 'customer-reviews-woocommerce' );
- }
- } else {
- $captcha_correct = false;
- $return['code'] = 3;
- $return['description'] = sprintf( __( 'reCAPTCHA validation error (%s).', 'customer-reviews-woocommerce' ), implode(', ', $captch_response["error-codes"] ) );
- $return['button'] = $error_button;
- }
- } else {
+ if ( self::is_captcha_enabled() ) {
+ $token = isset( $_POST['cptcha'] ) ? sanitize_text_field( wp_unslash( $_POST['cptcha'] ) ) : '';
+ if ( ! $token || ! CR_Captcha::verify( $token, CR_Captcha::CONTEXT_QNA ) ) {
$captcha_correct = false;
- $return['code'] = 4;
- $return['description'] = __( 'reCAPTCHA response is missing.', 'customer-reviews-woocommerce' );
+ $return['code'] = $token ? 3 : 4;
+ $return['description'] = __( 'Captcha verification failed. Please try again.', 'customer-reviews-woocommerce' );
$return['button'] = $error_button;
}
}
@@ -326,14 +316,8 @@
}
public function recaptcha_script() {
- if( is_product() ) {
- if( self::is_captcha_enabled() ) {
- $lang = CR_Trust_Badge::get_badge_language();
- $site_key = get_option( 'ivole_qna_captcha_site_key', '' );
- $this->recaptcha = $site_key;
- wp_register_script( 'cr-recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . $lang . '&render=' . $site_key , array(), null, true );
- wp_enqueue_script( 'cr-recaptcha' );
- }
+ if ( self::is_captcha_enabled() ) {
+ CR_Captcha::register_scripts( CR_Trust_Badge::get_badge_language() );
}
}
@@ -739,8 +723,15 @@
}
}
//
- if ( ! $cr_recaptcha ) {
- $cr_recaptcha = get_option( 'ivole_qna_captcha_site_key', '' );
+ if ( self::is_captcha_enabled() ) {
+ $captcha_settings = CR_Captcha::get_settings( CR_Captcha::CONTEXT_QNA );
+ if ( CR_Captcha::TYPE_RECAPTCHA3 === $captcha_settings['type'] ) {
+ $cr_recaptcha = $captcha_settings['site_key'];
+ } else {
+ $cr_recaptcha = '';
+ }
+ } else {
+ $cr_recaptcha = '';
}
if ( ! $cr_qna_permissions || ! $cr_qna_login || ! $cr_qna_checkbox ) {
$cr_qna_settings = CR_Qna_Settings::get_qna_settings();
@@ -855,7 +846,7 @@
}
public static function is_captcha_enabled() {
- return 'yes' === get_option( 'ivole_qna_enable_captcha', 'no' );
+ return CR_Captcha::is_enabled( CR_Captcha::CONTEXT_QNA );
}
public function is_comment_approved( $approved, $commentdata ) {
--- a/customer-reviews-woocommerce/includes/qna/class-cr-settings-qna.php
+++ b/customer-reviews-woocommerce/includes/qna/class-cr-settings-qna.php
@@ -42,6 +42,21 @@
public function save() {
$this->init_settings();
+ if ( isset( $_POST['ivole_qna_captcha_type'] ) ) {
+ $type = sanitize_text_field( wp_unslash( $_POST['ivole_qna_captcha_type'] ) );
+ if ( ! array_key_exists( $type, CR_Captcha::get_types() ) ) {
+ WC_Admin_Settings::add_error( __( 'Error: Invalid captcha service.', 'customer-reviews-woocommerce' ) );
+ $type = CR_Captcha::get_settings( CR_Captcha::CONTEXT_QNA )['type'];
+ }
+ $_POST['ivole_qna_captcha_type'] = $type;
+ if (
+ CR_Captcha::TYPE_NONE !== $type &&
+ ( empty( trim( wp_unslash( $_POST['ivole_qna_captcha_site_key'] ?? '' ) ) ) ||
+ empty( trim( wp_unslash( $_POST['ivole_qna_captcha_secret_key'] ?? '' ) ) ) )
+ ) {
+ WC_Admin_Settings::add_error( __( 'Error: Both the Site Key and the Secret Key are required for a captcha to function properly', 'customer-reviews-woocommerce' ) );
+ }
+ }
//
$qna_settings = array(
'qna_perm' => '',
@@ -127,24 +142,26 @@
'is_option' => false
),
60 => array(
- 'title' => __( 'reCAPTCHA v3 for Q & A', 'customer-reviews-woocommerce' ),
- 'desc' => __( 'Enable reCAPTCHA v3 to eliminate SPAM questions and answers. You must enter a Site Key and a Secret Key in the fields below, if you want to use reCAPTCHA. You will receive these keys after registration at reCAPTCHA website.', 'customer-reviews-woocommerce' ),
- 'id' => 'ivole_qna_enable_captcha',
- 'default' => 'no',
- 'type' => 'checkbox'
+ 'title' => __( 'Captcha for Q & A', 'customer-reviews-woocommerce' ),
+ 'desc' => __( 'Select a captcha service to prevent spam questions and answers. Enter the Site Key and Secret Key provided by the selected service.', 'customer-reviews-woocommerce' ),
+ 'id' => 'ivole_qna_captcha_type',
+ 'default' => CR_Captcha::TYPE_NONE,
+ 'type' => 'select',
+ 'options' => CR_Captcha::get_types(),
+ 'desc_tip' => true
),
70 => array(
- 'title' => __( 'reCAPTCHA v3 Site Key', 'customer-reviews-woocommerce' ),
+ 'title' => __( 'Captcha site key', 'customer-reviews-woocommerce' ),
'type' => 'text',
- 'desc' => __( 'If you would like to use reCAPTCHA v3, insert here the Site Key that you will receive after registration at the reCAPTCHA website.', 'customer-reviews-woocommerce' ),
+ 'desc' => __( 'Insert here the Site Key that you will receive after registration at the website of the selected captcha service.', 'customer-reviews-woocommerce' ),
'default' => '',
'id' => 'ivole_qna_captcha_site_key',
'desc_tip' => true
),
80 => array(
- 'title' => __( 'reCAPTCHA v3 Secret Key', 'customer-reviews-woocommerce' ),
+ 'title' => __( 'Captcha secret key', 'customer-reviews-woocommerce' ),
'type' => 'text',
- 'desc' => __( 'If you would like to use reCAPTCHA v3, insert here the Secret Key that you will receive after registration at the reCAPTCHA website.', 'customer-reviews-woocommerce' ),
+ 'desc' => __( 'Insert here the Secret Key that you will receive after registration at the website of the selected captcha service.', 'customer-reviews-woocommerce' ),
'default' => '',
'id' => 'ivole_qna_captcha_secret_key',
'desc_tip' => true,
@@ -188,6 +205,8 @@
)
);
$qna_settings = self::get_qna_settings();
+ $captcha_settings = CR_Captcha::get_settings( CR_Captcha::CONTEXT_QNA );
+ $this->settings[60]['value'] = $captcha_settings['type'];
if ( $qna_settings ) {
$this->settings[50]['value'] = self::get_qna_login( $qna_settings );
$this->settings[90]['value'] = self::get_qna_checkbox( $qna_settings );
--- a/customer-reviews-woocommerce/includes/reviews/class-cr-admin-menu-reviews.php
+++ b/customer-reviews-woocommerce/includes/reviews/class-cr-admin-menu-reviews.php
@@ -15,6 +15,7 @@
private $ivole_verified_page = '';
private $customer_avatars = 'standard';
+ private $list_table;
public static $screen_id_bubble = '';
public function __construct() {
@@ -81,9 +82,7 @@
add_filter( 'get_avatar', array( 'CR_Reviews_Grid', 'cr_get_avatar' ), 10, 5 );
}
- $list_table = new CR_Reviews_List_Table(
- [ 'screen' => get_current_screen(), 'avatars' => $this->customer_avatars ]
- );
+ $list_table = $this->list_table;
$pagenum = $list_table->get_pagenum();
$doaction = $list_table->current_action();
@@ -284,9 +283,12 @@
global $wp_list_table;
if ( ! $wp_list_table ) {
- $wp_list_table = new CR_Reviews_List_Table(
- [ 'screen' => 'cr-reviews', 'avatars' => $this->customer_avatars ]
- );
+ $wp_list_table = $this->list_table;
+ if ( ! $wp_list_table ) {
+ $wp_list_table = new CR_Reviews_List_Table(
+ [ 'screen' => 'toplevel_page_cr-reviews', 'avatars' => $this->customer_avatars ]
+ );
+ }
}
?>
@@ -462,7 +464,7 @@
ob_start();
$wp_list_table = new CR_Reviews_List_Table(
- [ 'screen' => 'cr-reviews', 'avatars' => $this->customer_avatars ]
+ [ 'screen' => 'toplevel_page_cr-reviews', 'avatars' => $this->customer_avatars ]
);
$wp_list_table->single_row( $comment );
$comment_list_item = ob_get_clean();
@@ -918,6 +920,10 @@
}
public function display_screen_options() {
+ $this->list_table = new CR_Reviews_List_Table(
+ [ 'screen' => get_current_screen(), 'avatars' => $this->customer_avatars ]
+ );
+
$args = array(
'label' => __( 'Reviews per page', 'customer-reviews-woocommerce' ),
'default' => 10,
--- a/customer-reviews-woocommerce/includes/reviews/class-cr-endpoint.php
+++ b/customer-reviews-woocommerce/includes/reviews/class-cr-endpoint.php
@@ -96,6 +96,7 @@
if( !empty( $body2->order->display_name ) ) {
$customer_name = strval( $body2->order->display_name );
}
+ $customer_name = sanitize_text_field( $customer_name );
//settings for moderation of reviews
$comment_approved = 1;
--- a/customer-reviews-woocommerce/includes/reviews/class-cr-reviews-list-table.php
+++ b/customer-reviews-woocommerce/includes/reviews/class-cr-reviews-list-table.php
@@ -55,10 +55,7 @@
public function prepare_items() {
global $post_id, $comment_status, $comment_type, $search, $cr_rating_type;
- $columns = $this->get_columns();
- $hidden = [];
- $sortable = $this->get_sortable_columns();
- $this->_column_headers = [ $columns, $hidden, $sortable, 'comment' ];
+ $this->_column_headers = $this->get_column_info();
$comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all';
if ( ! in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) {
@@ -853,7 +850,7 @@
$parent = get_comment( $comment->comment_parent );
if ( $parent ) {
$parent_link = esc_url( get_comment_link( $parent ) );
- $name = get_comment_author( $parent );
+ $name = esc_html( get_comment_author( $parent ) );
echo '<p>';
printf(
__( 'In reply to %s', 'customer-reviews-woocommerce' ),
--- a/customer-reviews-woocommerce/includes/reviews/class-cr-reviews.php
+++ b/customer-reviews-woocommerce/includes/reviews/class-cr-reviews.php
@@ -72,10 +72,11 @@
// enhanced CusRev review template
add_action( 'cr_review_after_comment_text', array( $this, 'display_review_image' ), 10 );
//
- add_action( 'comment_form_after_fields', array( $this, 'custom_fields_terms' ) );
+ add_filter( 'comment_form_submit_field', array( $this, 'custom_fields_terms' ) );
+ add_filter( 'preprocess_comment', array( $this, 'validate_review_terms' ) );
if ( CR_Captcha::is_enabled() ) {
if ( ! is_user_logged_in() ) {
- add_action( 'comment_form_after_fields', array( $this, 'custom_fields_captcha2' ) );
+ add_filter( 'comment_form_submit_field', array( $this, 'custom_fields_captcha2' ), 5 );
add_action( 'cr_review_form_before_btns', array( $this, 'display_captcha_cr' ) );
add_filter( 'preprocess_comment', array( $this, 'validate_captcha' ) );
add_action( 'wp_enqueue_scripts', array( $this, 'cr_style_2' ), 11 );
@@ -146,13 +147,12 @@
$comment_form = apply_filters( 'ivole_custom_fields_attachment', $comment_form );
return $comment_form;
}
- public function custom_fields_captcha2() {
+ public function custom_fields_captcha2( $submit_field ) {
if ( 'product' !== get_post_type() ) {
- return;
+ return $submit_field;
}
CR_Captcha::enqueue_scripts();
- echo '<div style="clear:both;"></div>';
- echo CR_Captcha::get_widget_html();
+ return '<div style="clear:both;"></div>' . CR_Captcha::get_widget_html() . $submit_field;
}
public function display_captcha_cr() {
CR_Captcha::enqueue_scripts();
@@ -162,9 +162,9 @@
echo '<div class="cr-review-form-field-error">' . __( '* Please confirm that you are not a robot', 'customer-reviews-woocommerce' ) . '</div>';
echo '</div>';
}
- public function custom_fields_terms() {
+ public function custom_fields_terms( $submit_field ) {
if ( 'product' !== get_post_type() ) {
- return;
+ return $submit_field;
}
$form_settings = CR_Forms_Settings::get_default_form_settings();
$cr_form_checkbox = ( 'yes' === CR_Forms_Settings::get_onsite_form_checkbox( $form_settings ) ) ? true : false;
@@ -173,16 +173,44 @@
$cr_form_checkbox_text = CR_Forms_Settings::get_default_form_onsite_checkbox_text();
}
$cr_form_checkbox_text = wp_specialchars_decode( $cr_form_checkbox_text, ENT_QUOTES );
- if ( $cr_form_checkbox ) :
+ if ( $cr_form_checkbox ) {
+ ob_start();
?>
<div class="cr-review-form-terms">
<label>
- <input type="checkbox" class="cr-review-form-checkbox" name="cr_review_form_checkbox" />
+ <input type="checkbox" class="cr-review-form-checkbox" name="cr_review_form_checkbox" value="1" required />
<span><?php echo $cr_form_checkbox_text; ?></span>
</label>
</div>
<?php
- endif;
+ return ob_get_clean() . $submit_field;
+ }
+ return $submit_field;
+ }
+ public function validate_review_terms( $commentdata ) {
+ if (
+ is_admin() ||
+ wp_doing_ajax() ||
+ ! isset( $_POST['comment_post_ID'], $commentdata['comment_post_ID'], $commentdata['comment_type'] ) ||
+ ! is_scalar( $_POST['comment_post_ID'] ) ||
+ absint( $_POST['comment_post_ID'] ) !== (int) $commentdata['comment_post_ID'] ||
+ 'product' !== get_post_type( $commentdata['comment_post_ID'] ) ||
+ ! in_array( $commentdata['comment_type'], array( '', 'comment', 'review' ), true )
+ ) {
+ return $commentdata;
+ }
+ $form_settings = CR_Forms_Settings::get_default_form_settings();
+ if (
+ 'yes' === CR_Forms_Settings::get_onsite_form_checkbox( $form_settings ) &&
+ ( ! isset( $_POST['cr_review_form_checkbox'] ) || '1' !== $_POST['cr_review_form_checkbox'] )
+ ) {
+ wp_die(
+ __( 'Please tick the checkbox to proceed', 'customer-reviews-woocommerce' ),
+ __( 'Add Review Error', 'customer-reviews-woocommerce' ),
+ array( 'response' => 400, 'back_link' => true )
+ );
+ }
+ return $commentdata;
}
public function save_review_image( $comment_id ) {
if( isset( $_POST['cr-upload-images-ids'] ) && is_array( $_POST['cr-upload-images-ids'] ) ) {
--- a/customer-reviews-woocommerce/includes/settings/class-cr-admin-menu-settings.php
+++ b/customer-reviews-woocommerce/includes/settings/class-cr-admin-menu-settings.php
@@ -823,6 +823,38 @@
</div>
<?php
}
+ } elseif ( 'review_extensions' === $current_tab ) {
+ if ( ! $this->is_pro_addon_activated() ) {
+ if ( $this->is_banner_hidden( 'review_extensions' ) ) {
+ return;
+ }
+ ?>
+ <div class="cr-features-banner">
+ <div class="cr-features-bnr-col1">
+ <img src="<?php echo plugins_url( 'img/reminders-banner.svg', dirname( dirname( __FILE__ ) ) ) ; ?>">
+ </div>
+ <div class="cr-features-bnr-col2">
+ <div class="cr-features-bnr-title">Get more with a Pro version</div>
+ <div class="cr-features-bnr-subtitle">Install a Pro add-on to extend product reviews and customize review forms</div>
+ <div class="cr-features-bnr-uls">
+ <ul class="cr-features-bnr-ul">
+ <li>Share reviews across similar products</li>
+ <li>Add titles to on-site reviews</li>
+ </ul>
+ <ul class="cr-features-bnr-ul">
+ <li>Enable reviewer geolocation on on-site review forms</li>
+ <li>Customize locally hosted aggregated review forms</li>
+ </ul>
+ </div>
+ <div class="cr-features-bnr-other">And other powerful features...</div>
+ <div class="cr-features-bnr-buttons">
+ <a class="button cr-features-bnr-pricing" href="https://www.cusrev.com/business/pricing.html?utm_source=wp_plugin&utm_medium=review_extensions" target="_blank" rel="noopener noreferrer">See pricing<img src="<?php esc_attr_e( untrailingslashit( plugin_dir_url( dirname( dirname( __FILE__ ) ) ) ) . '/img/external-link-2.svg' ); ?>"></a>
+ <a class="cr-features-bnr-hide" href="#" data-banner="review_extensions">Hide this message</a>
+ </div>
+ </div>
+ </div>
+ <?php
+ }
} elseif ( 'forms' === $current_tab ) {
if ( ! $this->is_pro_addon_activated() ) {
if ( $this->is_banner_hidden( 'forms' ) ) {
--- a/customer-reviews-woocommerce/ivole.php
+++ b/customer-reviews-woocommerce/ivole.php
@@ -3,7 +3,7 @@
Plugin Name: Customer Reviews for WooCommerce
Description: Customer Reviews for WooCommerce plugin helps you get more customer reviews for your shop by sending automated reminders and coupons.
Plugin URI: https://wordpress.org/plugins/customer-reviews-woocommerce/
-Version: 5.129.0
+Version: 5.130.0
Author: CusRev
Author URI: https://www.cusrev.com/business/
Text Domain: customer-reviews-woocommerce
--- a/customer-reviews-woocommerce/templates/qna-list.php
+++ b/customer-reviews-woocommerce/templates/qna-list.php
@@ -183,6 +183,11 @@
</div>
</div>
<?php endif; ?>
+ <?php if ( CR_Qna::is_captcha_enabled() ) : ?>
+ <div class="cr-qna-captcha">
+ <?php echo CR_Captcha::get_widget_html( CR_Captcha::CONTEXT_QNA ); ?>
+ </div>
+ <?php endif; ?>
<?php if ( 0 < strlen( $cr_recaptcha ) ) : ?>
<div class="cr-captcha-terms">
<?php echo sprintf( esc_html( __( 'This site is protected by reCAPTCHA and the Google %1$sPrivacy Policy%2$s and %3$sTerms of Service%4$s apply.', 'customer-reviews-woocommerce' ) ), '<a href="https://policies.google.com/privacy" rel="noopener noreferrer nofollow" target="_blank">', '</a>', '<a href="https://policies.google.com/terms" rel="noopener noreferrer nofollow" target="_blank">', '</a>' ); ?>
--- a/customer-reviews-woocommerce/templates/qna-tab.php
+++ b/customer-reviews-woocommerce/templates/qna-tab.php
@@ -19,7 +19,7 @@
$json_attributes = '';
}
?>
-<div id="cr_qna" class="cr-qna-block" data-attributes="<?php echo $json_attributes; ?>" data-nonce="<?php echo $cr_nonce; ?>">
+<div id="cr_qna" class="cr-qna-block" data-attributes="<?php echo $json_attributes; ?>" data-nonce="<?php echo $cr_nonce; ?>" data-request-error="<?php echo esc_attr__( 'Unable to submit. Please try again.', 'customer-reviews-woocommerce' ); ?>" data-retry="<?php echo esc_attr__( 'Try again', 'customer-reviews-woocommerce' ); ?>">
<h2><?php _e( 'Q & A', 'customer-reviews-woocommerce' ); ?></h2>
<div class="cr-qna-new-q-form">
<div class="cr-review-form-nav">
@@ -97,6 +97,11 @@
</div>
</div>
<?php endif; ?>
+ <?php if ( CR_Qna::is_captcha_enabled() ) : ?>
+ <div class="cr-qna-captcha">
+ <?php echo CR_Captcha::get_widget_html( CR_Captcha::CONTEXT_QNA ); ?>
+ </div>
+ <?php endif; ?>
<?php if ( 0 < strlen( $cr_recaptcha ) ) : ?>
<div class="cr-captcha-terms">
<?php echo sprintf( esc_html( __( 'This site is protected by reCAPTCHA and the Google %1$sPrivacy Policy%2$s and %3$sTerms of Service%4$s apply.', 'customer-reviews-woocommerce' ) ), '<a href="https://policies.google.com/privacy" rel="noopener noreferrer nofollow" target="_blank">', '</a>', '<a href="https://policies.google.com/terms" rel="noopener noreferrer nofollow" target="_blank">', '</a>' ); ?>
--- a/customer-reviews-woocommerce/templates/review-media.php
+++ b/customer-reviews-woocommerce/templates/review-media.php
@@ -36,7 +36,7 @@
?>
<div class="image-row cr-media-thumbnails">
<?php foreach ( $customer_videos as $index => $url ) :
- $title = sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author );
+ $title = CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author ) );
?>
<a class="cr-media-thumbnail" href="<?php echo esc_url( $url ); ?>" aria-label="<?php echo esc_attr( $title ); ?>">
<video preload="metadata" muted playsinline class="image-row-vid" src="<?php echo esc_url( $url . '#t=0.1' ); ?>" data-crmedia="vid" data-crtitle="<?php echo esc_attr( $title ); ?>"></video>
@@ -44,7 +44,7 @@
</a>
<?php endforeach; ?>
<?php foreach ( $customer_images as $index => $url ) :
- $title = sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author );
+ $title = CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author ) );
?>
<a class="cr-media-thumbnail" href="<?php echo esc_url( $url ); ?>" aria-label="<?php echo esc_attr( $title ); ?>">
<img class="image-row-img" src="<?php echo esc_url( $url ); ?>" alt="<?php echo esc_attr( $title ); ?>" loading="lazy" data-crmedia="pic">
@@ -57,7 +57,7 @@
?>
<div class="image-row">
<?php foreach ( $customer_videos as $index => $url ) :
- $title = sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author );
+ $title = CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author ) );
?>
<video preload="metadata" class="image-row-vid<?php echo $index ? ' image-row-vid-none' : ''; ?>" src="<?php echo esc_url( $url . '#t=0.1' ); ?>" data-crmedia="vid" data-crtitle="<?php echo esc_attr( $title ); ?>"></video>
<?php if ( ! $index ) : ?>
@@ -65,7 +65,7 @@
<?php endif; ?>
<?php endforeach; ?>
<?php foreach ( $customer_images as $index => $url ) : ?>
- <img class="image-row-img<?php echo $count_customer_videos || $index ? ' image-row-img-none' : ''; ?>" src="<?php echo esc_url( $url ); ?>" alt="<?php echo esc_attr( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author ) ); ?>"<?php echo ! $count_customer_videos && ! $index ? ' loading="lazy"' : ''; ?> data-crmedia="pic">
+ <img class="image-row-img<?php echo $count_customer_videos || $index ? ' image-row-img-none' : ''; ?>" src="<?php echo esc_url( $url ); ?>" alt="<?php echo esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $index + 1, $review->comment_author ) ) ); ?>"<?php echo ! $count_customer_videos && ! $index ? ' loading="lazy"' : ''; ?> data-crmedia="pic">
<?php endforeach; ?>
<div class="media-row-count">
<?php if ( $count_customer_videos ) : ?>
--- a/customer-reviews-woocommerce/templates/reviews-grid.php
+++ b/customer-reviews-woocommerce/templates/reviews-grid.php
@@ -77,9 +77,9 @@
$counter_icons_html = '';
if ( 0 < $count_customer_videos ) {
// if there are videos, use the 1st one as a cover
- $customer_images_html .= '<video preload="metadata" class="image-row-vid" src="' . esc_url( $customer_videos[$vid_idx] ) . '#t=0.1" data-crmedia="vid" data-crtitle="' . esc_attr( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) . '"></video>';
+ $customer_images_html .= '<video preload="metadata" class="image-row-vid" src="' . esc_url( $customer_videos[$vid_idx] ) . '#t=0.1" data-crmedia="vid" data-crtitle="' . esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) ) . '"></video>';
$customer_images_html .= '<img class="cr-comment-videoicon" src="' . CR_Utils::cr_get_plugin_dir_url() . 'img/video.svg" ';
- $customer_images_html .= 'alt="' . esc_attr( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) . '">';
+ $customer_images_html .= 'alt="' . esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) ) . '">';
$vid_idx++;
// add a video counter icon
$counter_icons_html .= '<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="cr-grid-icon-counter-video"><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path d="M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4z" /><path d="M3 6m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z" /></svg>';
@@ -87,14 +87,14 @@
} else {
// otherwise, use the 1st picture as a cover
$customer_images_html .= '<img class="image-row-img" src="' . esc_url( $customer_images[$pic_idx] ) . '" alt="' .
- esc_attr( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $pic_idx + 1, $review->comment_author ) ) . '" loading="lazy" data-crmedia="pic">';
+ esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $pic_idx + 1, $review->comment_author ) ) ) . '" loading="lazy" data-crmedia="pic">';
$pic_idx++;
}
for( $j=$vid_idx; $j < $count_customer_videos; $j++ ) {
- $customer_images_html .= '<video preload="metadata" class="image-row-vid image-row-vid-none" src="' . esc_url( $customer_videos[$j] ) . '#t=0.1" data-crmedia="vid" data-crtitle="' . esc_attr( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) . '"></video>';
+ $customer_images_html .= '<video preload="metadata" class="image-row-vid image-row-vid-none" src="' . esc_url( $customer_videos[$j] ) . '#t=0.1" data-crmedia="vid" data-crtitle="' . esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Video #%1$d from %2$s', 'customer-reviews-woocommerce' ), $vid_idx + 1, $review->comment_author ) ) ) . '"></video>';
}
for( $j=$pic_idx; $j < $count_customer_images; $j++ ) {
- $customer_images_html .= '<img class="image-row-img image-row-img-none" src="' . esc_url( $customer_images[$j] ) . '" alt="' . esc_attr( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $j+1, $review->comment_author ) ) . '" data-crmedia="pic">';
+ $customer_images_html .= '<img class="image-row-img image-row-img-none" src="' . esc_url( $customer_images[$j] ) . '" alt="' . esc_attr( CR_Utils::cr_encode_shortcode_brackets( sprintf( __( 'Image #%1$d from %2$s', 'customer-reviews-woocommerce' ), $j+1, $review->comment_author ) ) ) . '" data-crmedia="pic">';
}
$customer_images_html .= '<div class="media-row-count">';
$customer_images_html .= $counter_icons_html;
@@ -104,7 +104,7 @@
}
$customer_images_html .= '</div></div>';
}
- $author = get_comment_author( $review );
+ $author = CR_Utils::cr_encode_shortcode_brackets( get_comment_author( $review ) );
?>
<div class="<?php echo esc_attr( $card_class ); ?>" style="<?php echo esc_attr( $card_style ); ?>" data-reviewid="<?php echo esc_attr( $review->comment_ID ); ?>">
<div class="cr-review-card-content">
@@ -157,7 +157,7 @@
if ( 0 === intval( $review->comment_parent ) ) {
$rev_title = get_comment_meta( $review->comment_ID, 'cr_rev_title', true );
if ( $rev_title ) {
- echo '<div class="cr-comment-head-text">' . esc_html( $rev_title ) . '</div>';
+ echo '<div class="cr-comment-head-text">' . esc_html( CR_Utils::cr_encode_shortcode_brackets( $rev_title ) ) . '</div>';
}
}
?>
@@ -175,14 +175,14 @@
}
$clear_content = wp_strip_all_tags( $review->comment_content );
if( $max_chars && mb_strlen( $clear_content ) > $max_chars ) {
- $less_content = wp_kses_post( mb_substr( $clear_content, 0, $max_chars ) );
- $more_content = wp_kses_post( mb_substr( $clear_content, $max_chars ) );
+ $less_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $clear_content, 0, $max_chars ) ) );
+ $more_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $clear_content, $max_chars ) ) );
$read_more = '<span class="cr-grid-read-more">...<br><a href="#">' . esc_html__( 'Show More', 'customer-reviews-woocommerce' ) . '</a></span>';
$more_content = '<div class="cr-grid-details" style="display:none;">' . $more_content . '<br><span class="cr-grid-read-less"><a href="#">' . esc_html__( 'Show Less', 'customer-reviews-woocommerce' ) . '</a></span></div>';
$comment_content = $less_content . $read_more . $more_content;
echo $comment_content;
} else {
- echo wpautop( wp_kses_post( $review->comment_content ) );
+ echo CR_Utils::cr_encode_shortcode_brackets( wpautop( wp_kses_post( $review->comment_content ) ) );
}
?>
</div>
@@ -239,7 +239,7 @@
<div class="cr-grid-first-reply">
<div class="cr-grid-reply-top-row">
<?php
- $cr_reply_author = get_comment_author( $cr_replies[$review->comment_ID][0] );
+ $cr_reply_author = CR_Utils::cr_encode_shortcode_brackets( get_comment_author( $cr_replies[$review->comment_ID][0] ) );
$cr_reply_avtr = get_avatar( $cr_replies[$review->comment_ID][0], 40, '', esc_attr( $cr_reply_author ) );
if ( $avatars && $cr_reply_avtr ): ?>
<div class="cr-grid-reply-thumbnail">
@@ -284,14 +284,14 @@
}
$cr_reply_clear_content = wp_strip_all_tags( $cr_replies[$review->comment_ID][0]->comment_content );
if ( $max_chars && strlen( $cr_reply_clear_content ) > $max_chars ) {
- $cr_reply_less_content = wp_kses_post( mb_substr( $cr_reply_clear_content, 0, $max_chars ) );
- $cr_reply_more_content = wp_kses_post( mb_substr( $cr_reply_clear_content, $max_chars ) );
+ $cr_reply_less_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $cr_reply_clear_content, 0, $max_chars ) ) );
+ $cr_reply_more_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $cr_reply_clear_content, $max_chars ) ) );
$cr_reply_read_more = '<span class="cr-grid-read-more">...<br><a href="#">' . esc_html__( 'Show More', 'customer-reviews-woocommerce' ) . '</a></span>';
$cr_reply_more_content = '<div class="cr-grid-details" style="display:none;">' . $cr_reply_more_content . '<br><span class="cr-grid-read-less"><a href="#">' . esc_html__( 'Show Less', 'customer-reviews-woocommerce' ) . '</a></span></div>';
$cr_reply_comment_content = $cr_reply_less_content . $cr_reply_read_more . $cr_reply_more_content;
echo $cr_reply_comment_content;
} else {
- echo wpautop( wp_kses_post( $cr_replies[$review->comment_ID][0]->comment_content ) );
+ echo CR_Utils::cr_encode_shortcode_brackets( wpautop( wp_kses_post( $cr_replies[$review->comment_ID][0]->comment_content ) ) );
}
?>
</div>
--- a/customer-reviews-woocommerce/templates/reviews-slider.php
+++ b/customer-reviews-woocommerce/templates/reviews-slider.php
@@ -16,7 +16,7 @@
if( is_array( $country ) && isset( $country['code'] ) ) {
$country_code = $country['code'];
}
- $author = get_comment_author( $review );
+ $author = CR_Utils::cr_encode_shortcode_brackets( get_comment_author( $review ) );
?>
<div class="cr-review-card">
<div class="cr-review-card-inner" style="<?php echo esc_attr( $card_style ); ?>">
@@ -67,7 +67,7 @@
if ( 0 === intval( $review->comment_parent ) ) {
$rev_title = get_comment_meta( $review->comment_ID, 'cr_rev_title', true );
if ( $rev_title ) {
- echo '<div class="cr-comment-head-text">' . esc_html( $rev_title ) . '</div>';
+ echo '<div class="cr-comment-head-text">' . esc_html( CR_Utils::cr_encode_shortcode_brackets( $rev_title ) ) . '</div>';
}
}
?>
@@ -89,14 +89,14 @@
}
$clear_content = wp_strip_all_tags( $review->comment_content );
if( $max_chars && mb_strlen( $clear_content ) > $max_chars ) {
- $less_content = wp_kses_post( mb_substr( $clear_content, 0, $max_chars ) );
- $more_content = wp_kses_post( mb_substr( $clear_content, $max_chars ) );
+ $less_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $clear_content, 0, $max_chars ) ) );
+ $more_content = CR_Utils::cr_encode_shortcode_brackets( wp_kses_post( mb_substr( $clear_content, $max_chars ) ) );
$read_more = '<span class="cr-slider-read-more">...<br><a href="#">' . esc_html__( 'Show More', 'customer-reviews-woocommerce' ) . '</a></span>';
$more_content = '<div class="cr-slider-details" style="display:none;">' . $more_content . '<br><span class="cr-slider-read-less"><a href="#">' . esc_html__( 'Show Less', 'customer-reviews-woocommerce' ) . '</a></span></div>';
$comment_content = $less_content . $read_more . $more_content;
echo $comment_content;
} else {
- echo wpautop( wp_kses_post( $review->comment_content ) );
+ echo CR_Utils::cr_encode_shortcode_brackets( wpautop( wp_kses_post( $review->comment_content ) ) );
}
?>
</div>
--- a/customer-reviews-woocommerce/uninstall.php
+++ b/customer-reviews-woocommerce/uninstall.php
@@ -134,6 +134,7 @@
'ivole_qna_captcha_secret_key',
'ivole_qna_captcha_site_key',
'ivole_qna_enable_captcha',
+ 'ivole_qna_captcha_type',
'ivole_enable_manual',
'ivole_ignore_duplicate_siteurl_notice',
'ivole_siteurl',