Skip to content

Commit f84f929

Browse files
committed
Escape html chars for order items
1 parent d0a4ff6 commit f84f929

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/includes/class-paynow-gateway.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,25 @@ public function payment_request( WC_Order $order, $return_url, $payment_method_i
8181
foreach ( $order->get_items() as $item ) {
8282
$product = $item->get_product();
8383
$order_items[] = [
84-
'name' => $product->get_title(),
84+
'name' => esc_html( $product->get_title() ),
8585
'category' => WC_Pay_By_Paynow_PL_Helper::get_product_categories( $product->get_id() ),
8686
'quantity' => $item->get_quantity(),
8787
'price' => WC_Pay_By_Paynow_PL_Helper::get_amount( WC_Pay_By_Paynow_PL_Helper::is_old_wc_version() ? wc_price( wc_get_price_including_tax( $product ) ) : $product->get_price_including_tax() )
8888
];
8989
}
9090

91-
$order_items = array_filter( $order_items, function ( $item ) {
92-
return ! empty( $item['category'] );
93-
} );
91+
$order_items = array_filter( $order_items, function ( $item ) {
92+
return ! empty( $item['category'] );
93+
} );
9494

9595
if ( ! empty( $order_items ) ) {
9696
$payment_data['orderItems'] = $order_items;
9797
}
9898
}
9999

100-
if ( $this->settings['use_payment_validity_time_flag'] === 'yes' ) {
101-
$payment_data['validityTime'] = $this->settings['payment_validity_time'];
102-
}
100+
if ( $this->settings['use_payment_validity_time_flag'] === 'yes' ) {
101+
$payment_data['validityTime'] = $this->settings['payment_validity_time'];
102+
}
103103

104104
$idempotency_key = substr( uniqid( $order_id, true ), 0, 36 );
105105
$payment = new Payment( $this->client );

src/includes/class-wc-pay-by-paynow-pl-helper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public static function get_product_categories( $product_id ) {
9696

9797
$categories = [];
9898
foreach ( $terms as $term ) {
99-
$categories[] = $term->name;
99+
$categories[] = esc_html($term->name);
100100
}
101101

102102
return implode( ', ', $categories );

0 commit comments

Comments
 (0)