| 1 |
<?php |
| 2 |
/** |
| 3 |
* Mini Widget template |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @var array<string, string> $args The arguments. Must contain: |
| 7 |
* - string 'product' The seQura payment method identifier. |
| 8 |
* - string 'campaign' The seQura campaign identifier. |
| 9 |
* - string 'dest' The CSS selector to place the widget. |
| 10 |
* - string 'price' The CSS selector for the price. |
| 11 |
* - string 'message' The message to show. |
| 12 |
* - string 'message_below_limit' The message to show when the amount is below the limit. |
| 13 |
* - int min_amount The minimum amount to show the widget. |
| 14 |
* - ?int max_amount The maximum amount to show the widget. |
| 15 |
*/ |
| 16 |
|
| 17 |
defined( 'WPINC' ) || die; |
| 18 |
|
| 19 |
// Check if the variables are defined. |
| 20 |
if ( ! isset( |
| 21 |
$args['product'], |
| 22 |
$args['campaign'], |
| 23 |
$args['dest'], |
| 24 |
$args['price'], |
| 25 |
$args['message'], |
| 26 |
$args['message_below_limit'], |
| 27 |
$args['min_amount'] |
| 28 |
) ) { |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
//phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped |
| 33 |
?> |
| 34 |
|
| 35 |
<script type='text/javascript'> |
| 36 |
SequraWidgetFacade.miniWidgets && SequraWidgetFacade.miniWidgets.push({ |
| 37 |
product: "<?php echo esc_js( $args['product'] ); ?>", |
| 38 |
dest: "<?php echo wp_strip_all_tags( $args['dest'] ); ?>", |
| 39 |
priceSel: "<?php echo wp_strip_all_tags( $args['price'] ); ?>", |
| 40 |
campaign: "<?php echo esc_js( $args['campaign'] ); ?>", |
| 41 |
message: "<?php echo esc_js( $args['message'] ); ?>", |
| 42 |
messageBelowLimit: "<?php echo esc_js( $args['message_below_limit'] ); ?>", |
| 43 |
minAmount: <?php echo esc_js( $args['min_amount'] ); ?>, |
| 44 |
maxAmount: <?php echo esc_js( $args['max_amount'] ?? 'null' ); ?> |
| 45 |
}); |
| 46 |
</script> |