PluginProbe
seQura / 4.1.0
seQura v4.1.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 +15 -6 3.0.64.1.0 View file →
@@ -29,20 +29,29 @@
29 29 $args['reg_amount']
30 30 ) ) {
31 31 return;
32 32 }
33 +$price = wp_strip_all_tags( 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 : wp_strip_all_tags( $args['dest'] );
38 +
33 39 //phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
34 -?>
35 -
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; ?>
36 43 <script type='text/javascript'>
37 44 SequraWidgetFacade.widgets && SequraWidgetFacade.widgets.push({
38 45 product: "<?php echo esc_js( $args['product'] ); ?>",
39 - dest: "<?php echo wp_strip_all_tags( $args['dest'] ); ?>",
46 + dest: "<?php echo $dest; ?>",
40 47 theme: "<?php echo esc_js( $args['theme'] ); ?>",
41 48 reverse: "<?php echo esc_js( $args['reverse'] ); ?>",
42 49 campaign: "<?php echo esc_js( $args['campaign'] ); ?>",
43 - priceSel: "<?php echo wp_strip_all_tags( $args['price'] ); ?>",
44 - variationPriceSel: "<?php echo wp_strip_all_tags( $args['alt_price'] ); ?>",
45 - isVariableSel: "<?php echo wp_strip_all_tags( $args['is_alt_price'] ); ?>",
50 + priceSel: "<?php echo $is_price_numeric ? $in_place_widget_selector : $price; ?>",
51 + variationPriceSel: "<?php echo $is_price_numeric ? 'null' : wp_strip_all_tags( $args['alt_price'] ); ?>",
52 + isVariableSel: "<?php echo $is_price_numeric ? 'null' : wp_strip_all_tags( $args['is_alt_price'] ); ?>",
46 53 registrationAmount: "<?php echo esc_js( $args['reg_amount'] ); ?>",
54 + minAmount: <?php echo esc_js( $args['min_amount'] ?? '0' ); ?>,
55 + maxAmount: <?php echo esc_js( $args['max_amount'] ?? 'null' ); ?>
47 56 });
48 57 </script>