PluginProbe
seQura / 4.3.0
seQura v4.3.0
4.3.4 4.3.3 4.3.2 4.3.1 trunk 2.0.0 2.0.10 2.0.11 2.0.12 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 3.0.0 3.0.2 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 4.0.0 All 30 releases
← All changes | templates/front/widget.php +20 -10 3.2.04.3.0 View file →
@@ -29,19 +29,29 @@
29 29 $args['reg_amount']
30 30 ) ) {
31 31 return;
32 32 }
33 +$price = strval( $args['price'] );
34 +$is_price_numeric = preg_match( '/^[0-9]+(?:[.,][0-9]+)?$/', $price );
35 +$in_place_widget_id = str_replace( '.', '', uniqid( 'sequra-widget-', true ) );
36 +$in_place_widget_selector = '#' . $in_place_widget_id;
37 +$dest = empty( $args['dest'] ) ? $in_place_widget_selector : strval( $args['dest'] );
38 +
33 39 //phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
34 -?>
40 +if ( $is_price_numeric || empty( $args['dest'] ) ) : ?>
41 +<div id="<?php echo esc_attr( $in_place_widget_id ); ?>" style="display: none;" aria-hidden="true"><?php echo $is_price_numeric ? esc_html( $price ) : ''; ?></div>
42 +<?php endif; ?>
35 43 <script type='text/javascript'>
36 44 SequraWidgetFacade.widgets && SequraWidgetFacade.widgets.push({
37 - product: "<?php echo esc_js( $args['product'] ); ?>",
38 - dest: "<?php echo wp_strip_all_tags( $args['dest'] ); ?>",
39 - theme: "<?php echo esc_js( $args['theme'] ); ?>",
40 - reverse: "<?php echo esc_js( $args['reverse'] ); ?>",
41 - campaign: "<?php echo esc_js( $args['campaign'] ); ?>",
42 - priceSel: "<?php echo wp_strip_all_tags( $args['price'] ); ?>",
43 - variationPriceSel: "<?php echo wp_strip_all_tags( $args['alt_price'] ); ?>",
44 - isVariableSel: "<?php echo wp_strip_all_tags( $args['is_alt_price'] ); ?>",
45 - registrationAmount: "<?php echo esc_js( $args['reg_amount'] ); ?>",
45 + product: <?php echo wp_json_encode( $args['product'] ); ?>,
46 + dest: <?php echo wp_json_encode( $dest ); ?>,
47 + theme: <?php echo wp_json_encode( $args['theme'] ); ?>,
48 + reverse: <?php echo wp_json_encode( $args['reverse'] ); ?>,
49 + campaign: <?php echo wp_json_encode( $args['campaign'] ); ?>,
50 + priceSel: <?php echo wp_json_encode( $is_price_numeric ? $in_place_widget_selector : $price ); ?>,
51 + variationPriceSel: <?php echo $is_price_numeric ? 'null' : wp_json_encode( $args['alt_price'] ); ?>,
52 + isVariableSel: <?php echo $is_price_numeric ? 'null' : wp_json_encode( $args['is_alt_price'] ); ?>,
53 + registrationAmount: <?php echo wp_json_encode( $args['reg_amount'] ); ?>,
54 + minAmount: <?php echo $args['min_amount'] ? wp_json_encode( $args['min_amount'] ) : '0'; ?>,
55 + maxAmount: <?php echo $args['max_amount'] ? wp_json_encode( $args['max_amount'] ) : 'null'; ?>
46 56 });
47 57 </script>