diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index ba3f3105a9f..5b49453e542 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -3397,3 +3397,23 @@ if ( ! function_exists( 'woocommerce_product_reviews_tab' ) ) { wc_deprecated_function( 'woocommerce_product_reviews_tab', '2.4' ); } } + +/** + * Filters out the same tags as wp_kses_post, but allows tabindex for element. + * + * @since 3.5.0 + * @param string $message Content to filter through kses. + * @return string + */ +function wc_kses_notice( $message ) { + return wp_kses( $message, + array_replace_recursive( // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound + wp_kses_allowed_html( 'post' ), + array( + 'a' => array( + 'tabindex' => true, + ), + ) + ) + ); +} diff --git a/templates/notices/error.php b/templates/notices/error.php index af0ec12942a..9713af69240 100644 --- a/templates/notices/error.php +++ b/templates/notices/error.php @@ -11,9 +11,8 @@ * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes * @package WooCommerce/Templates - * @version 3.3.0 + * @version 3.5.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -29,16 +28,7 @@ if ( ! $messages ) {
  • array( - 'tabindex' => true, - ), - ) - ) // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound - ); + echo wc_kses_notice( $message ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
  • diff --git a/templates/notices/notice.php b/templates/notices/notice.php index ac6793418a7..db15456a303 100644 --- a/templates/notices/notice.php +++ b/templates/notices/notice.php @@ -11,9 +11,8 @@ * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes * @package WooCommerce/Templates - * @version 1.6.4 + * @version 3.5.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -29,16 +28,7 @@ if ( ! $messages ) {
    array( - 'tabindex' => true, - ), - ) - ) // phpcs:ignore PHPCompatibility.PHP.NewFunctions.array_replace_recursiveFound - ); + echo wc_kses_notice( $message ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
    diff --git a/templates/notices/success.php b/templates/notices/success.php index 44658c2a813..6850b292b64 100644 --- a/templates/notices/success.php +++ b/templates/notices/success.php @@ -11,9 +11,8 @@ * the readme will list any important changes. * * @see https://docs.woocommerce.com/document/template-structure/ - * @author WooThemes * @package WooCommerce/Templates - * @version 3.3.0 + * @version 3.5.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -29,16 +28,7 @@ if ( ! $messages ) {