Skip to content

Commit

Permalink
fix: allow svg in storefront messages, such as notices
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhtungdu committed Jan 15, 2024
1 parent 5185bec commit d306d1e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion inc/woocommerce/storefront-woocommerce-template-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,33 @@ function storefront_product_columns_wrapper_close() {
*/
function storefront_shop_messages() {
if ( ! is_checkout() ) {
echo wp_kses_post( storefront_do_shortcode( 'woocommerce_messages' ) );
$kses_defaults = wp_kses_allowed_html( 'post' );

$svg_args = array(
'svg' => array(
'class' => true,
'aria-hidden' => true,
'aria-labelledby' => true,
'role' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
),
'g' => array( 'fill' => true ),
'title' => array( 'title' => true ),
'path' => array(
'd' => true,
'fill' => true

Check failure on line 255 in inc/woocommerce/storefront-woocommerce-template-functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Each array item in a multi-line array declaration must end in a comma
)

Check failure on line 256 in inc/woocommerce/storefront-woocommerce-template-functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Each array item in a multi-line array declaration must end in a comma
);

$allowed_tags = array_merge( $kses_defaults, $svg_args );

echo wp_kses( storefront_do_shortcode( 'woocommerce_messages' ), $allowed_tags );
}
}

Check failure on line 263 in inc/woocommerce/storefront-woocommerce-template-functions.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Blank line found after control structure

}

if ( ! function_exists( 'storefront_woocommerce_pagination' ) ) {
Expand Down

0 comments on commit d306d1e

Please sign in to comment.