phpcs
This commit is contained in:
parent
1d3a642d59
commit
845c667e77
|
@ -4,12 +4,9 @@
|
|||
*
|
||||
* @version 3.3.0
|
||||
* @package WooCommerce
|
||||
* @author WooCommerce
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/**
|
||||
* WC_Shop_Customizer class.
|
||||
|
@ -81,6 +78,11 @@ class WC_Shop_Customizer {
|
|||
$max_rows = wc_get_theme_support( 'product_grid::max_rows', '' );
|
||||
$min_columns = wc_get_theme_support( 'product_grid::min_columns', 1 );
|
||||
$max_columns = wc_get_theme_support( 'product_grid::max_columns', '' );
|
||||
|
||||
/* translators: %d: Setting value */
|
||||
$min_notice = __( 'The minimum allowed setting is %d', 'woocommerce' );
|
||||
/* translators: %d: Setting value */
|
||||
$max_notice = __( 'The maximum allowed setting is %d', 'woocommerce' );
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
jQuery( document ).ready( function( $ ) {
|
||||
|
@ -111,7 +113,7 @@ class WC_Shop_Customizer {
|
|||
'max_columns_error',
|
||||
{
|
||||
type : 'error',
|
||||
message: '<?php echo esc_js( sprintf( __( 'The maximum allowed setting for columns is %d', 'woocommerce' ), $max_columns ) ); ?>'
|
||||
message: '<?php echo esc_js( sprintf( $max_notice, $max_columns ) ); ?>'
|
||||
}
|
||||
) );
|
||||
} else {
|
||||
|
@ -123,7 +125,7 @@ class WC_Shop_Customizer {
|
|||
'min_columns_error',
|
||||
{
|
||||
type : 'error',
|
||||
message: '<?php echo esc_js( sprintf( __( 'The minimum allowed setting for columns is %d', 'woocommerce' ), $min_columns ) ); ?>'
|
||||
message: '<?php echo esc_js( sprintf( $min_notice, $min_columns ) ); ?>'
|
||||
}
|
||||
) );
|
||||
} else {
|
||||
|
@ -142,7 +144,7 @@ class WC_Shop_Customizer {
|
|||
'max_rows_error',
|
||||
{
|
||||
type : 'error',
|
||||
message: '<?php echo esc_js( sprintf( __( 'The maximum allowed setting for rows is %d', 'woocommerce' ), $max_rows ) ); ?>'
|
||||
message: '<?php echo esc_js( sprintf( $min_notice, $max_rows ) ); ?>'
|
||||
}
|
||||
) );
|
||||
} else {
|
||||
|
@ -154,7 +156,7 @@ class WC_Shop_Customizer {
|
|||
'min_rows_error',
|
||||
{
|
||||
type : 'error',
|
||||
message: '<?php echo esc_js( sprintf( __( 'The minimum allowed setting for rows is %d', 'woocommerce' ), $min_rows ) ); ?>'
|
||||
message: '<?php echo esc_js( sprintf( $min_notice, $min_rows ) ); ?>'
|
||||
}
|
||||
) );
|
||||
} else {
|
||||
|
@ -194,7 +196,7 @@ class WC_Shop_Customizer {
|
|||
public function sanitize_archive_display( $value ) {
|
||||
$options = array( '', 'subcategories', 'both' );
|
||||
|
||||
return in_array( $value, $options ) ? $value : '';
|
||||
return in_array( $value, $options, true ) ? $value : '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -266,10 +268,10 @@ class WC_Shop_Customizer {
|
|||
$wp_customize->add_control(
|
||||
'woocommerce_demo_store',
|
||||
array(
|
||||
'label' => __( 'Enable store notice', 'woocommerce' ),
|
||||
'section' => 'woocommerce_store_notice',
|
||||
'settings' => 'woocommerce_demo_store',
|
||||
'type' => 'checkbox',
|
||||
'label' => __( 'Enable store notice', 'woocommerce' ),
|
||||
'section' => 'woocommerce_store_notice',
|
||||
'settings' => 'woocommerce_demo_store',
|
||||
'type' => 'checkbox',
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -293,10 +295,10 @@ class WC_Shop_Customizer {
|
|||
$wp_customize->add_setting(
|
||||
'woocommerce_shop_page_display',
|
||||
array(
|
||||
'default' => '',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_archive_display' ),
|
||||
'default' => '',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_archive_display' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -319,10 +321,10 @@ class WC_Shop_Customizer {
|
|||
$wp_customize->add_setting(
|
||||
'woocommerce_category_archive_display',
|
||||
array(
|
||||
'default' => '',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_archive_display' ),
|
||||
'default' => '',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_archive_display' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -345,10 +347,10 @@ class WC_Shop_Customizer {
|
|||
$wp_customize->add_setting(
|
||||
'woocommerce_default_catalog_orderby',
|
||||
array(
|
||||
'default' => 'menu_order',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_default_catalog_orderby' ),
|
||||
'default' => 'menu_order',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => array( $this, 'sanitize_default_catalog_orderby' ),
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -503,15 +505,15 @@ class WC_Shop_Customizer {
|
|||
);
|
||||
}
|
||||
|
||||
include_once( WC_ABSPATH . 'includes/customizer/class-wc-customizer-control-cropping.php' );
|
||||
include_once WC_ABSPATH . 'includes/customizer/class-wc-customizer-control-cropping.php';
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'woocommerce_thumbnail_cropping',
|
||||
array(
|
||||
'default' => '1:1',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => 'wc_clean',
|
||||
'default' => '1: 1',
|
||||
'type' => 'option',
|
||||
'capability' => 'manage_woocommerce',
|
||||
'sanitize_callback' => 'wc_clean',
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -550,15 +552,15 @@ class WC_Shop_Customizer {
|
|||
),
|
||||
'label' => __( 'Thumbnail cropping', 'woocommerce' ),
|
||||
'choices' => array(
|
||||
'1:1' => array(
|
||||
'1:1' => array(
|
||||
'label' => __( '1:1', 'woocommerce' ),
|
||||
'description' => __( 'Images will be cropped into a square', 'woocommerce' ),
|
||||
),
|
||||
'custom' => array(
|
||||
'custom' => array(
|
||||
'label' => __( 'Custom', 'woocommerce' ),
|
||||
'description' => __( 'Images will be cropped to a custom aspect ratio', 'woocommerce' ),
|
||||
),
|
||||
'uncropped' => array(
|
||||
'uncropped' => array(
|
||||
'label' => __( 'Uncropped', 'woocommerce' ),
|
||||
'description' => __( 'Images will display using the aspect ratio in which they were uploaded', 'woocommerce' ),
|
||||
),
|
||||
|
|
Loading…
Reference in New Issue