rebase on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:23:21 -04:00
parent d37566ffb6
commit d096058d7d
4789 changed files with 254611 additions and 307223 deletions

View File

@@ -927,7 +927,7 @@ function wc_get_theme_support( $prop = '', $default = null ) {
*/
function wc_get_image_size( $image_size ) {
$cache_key = 'size-' . ( is_array( $image_size ) ? implode( '-', $image_size ) : $image_size );
$size = wp_cache_get( $cache_key, 'woocommerce' );
$size = ! is_customize_preview() ? wp_cache_get( $cache_key, 'woocommerce' ) : false;
if ( $size ) {
return $size;
@@ -983,8 +983,11 @@ function wc_get_image_size( $image_size ) {
$size = apply_filters( 'woocommerce_get_image_size_' . $image_size, $size );
wp_cache_set( $cache_key, $size, 'woocommerce' );
if ( is_customize_preview() ) {
wp_cache_delete( $cache_key, 'woocommerce' );
} else {
wp_cache_set( $cache_key, $size, 'woocommerce' );
}
return $size;
}
@@ -1560,12 +1563,12 @@ function wc_get_credit_card_type_label( $type ) {
$labels = apply_filters(
'woocommerce_credit_card_type_labels',
array(
'mastercard' => __( 'MasterCard', 'woocommerce' ),
'visa' => __( 'Visa', 'woocommerce' ),
'discover' => __( 'Discover', 'woocommerce' ),
'american express' => __( 'American Express', 'woocommerce' ),
'diners' => __( 'Diners', 'woocommerce' ),
'jcb' => __( 'JCB', 'woocommerce' ),
'mastercard' => _x( 'MasterCard', 'Name of credit card', 'woocommerce' ),
'visa' => _x( 'Visa', 'Name of credit card', 'woocommerce' ),
'discover' => _x( 'Discover', 'Name of credit card', 'woocommerce' ),
'american express' => _x( 'American Express', 'Name of credit card', 'woocommerce' ),
'diners' => _x( 'Diners', 'Name of credit card', 'woocommerce' ),
'jcb' => _x( 'JCB', 'Name of credit card', 'woocommerce' ),
)
);
@@ -1610,7 +1613,7 @@ function wc_help_tip( $tip, $allow_html = false ) {
*
* @return string
*/
return apply_filters( 'wc_help_tip', '<span class="woocommerce-help-tip" data-tip="' . $sanitized_tip . '"></span>', $sanitized_tip, $tip, $allow_html );
return apply_filters( 'wc_help_tip', '<span class="woocommerce-help-tip" tabindex="0" aria-label="' . $sanitized_tip . '" data-tip="' . $sanitized_tip . '"></span>', $sanitized_tip, $tip, $allow_html );
}
/**
@@ -2211,7 +2214,9 @@ function wc_get_permalink_structure() {
* @since 3.1.0
*/
function wc_switch_to_site_locale() {
if ( function_exists( 'switch_to_locale' ) ) {
global $wp_locale_switcher;
if ( function_exists( 'switch_to_locale' ) && isset( $wp_locale_switcher ) ) {
switch_to_locale( get_locale() );
// Filter on plugin_locale so load_plugin_textdomain loads the correct locale.
@@ -2228,7 +2233,9 @@ function wc_switch_to_site_locale() {
* @since 3.1.0
*/
function wc_restore_locale() {
if ( function_exists( 'restore_previous_locale' ) ) {
global $wp_locale_switcher;
if ( function_exists( 'restore_previous_locale' ) && isset( $wp_locale_switcher ) ) {
restore_previous_locale();
// Remove filter.