PHPCS fixes

This commit is contained in:
Gerhard 2019-01-17 08:32:42 +02:00
parent f3d9eeeef3
commit 98948a2faf
7 changed files with 36 additions and 19 deletions

View File

@ -225,7 +225,7 @@ abstract class WC_Widget extends WP_Widget {
case 'text':
?>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; ?></label><?php // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped ?>
<label for="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>"><?php echo $setting['label']; /* phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped */ ?></label>
<input class="widefat <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $this->get_field_id( $key ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( $key ) ); ?>" type="text" value="<?php echo esc_attr( $value ); ?>" />
</p>
<?php

View File

@ -240,7 +240,8 @@ class WC_Comments {
FROM {$wpdb->comments}
WHERE comment_type NOT IN ('order_note', 'webhook_delivery')
GROUP BY comment_approved
", ARRAY_A
",
ARRAY_A
);
$approved = array(
@ -327,7 +328,8 @@ class WC_Comments {
AND comment_post_ID = %d
AND comment_approved = '1'
AND meta_value > 0
", $product->get_id()
",
$product->get_id()
)
);
$average = number_format( $ratings / $count, 2, '.', '' );
@ -360,7 +362,8 @@ class WC_Comments {
WHERE comment_parent = 0
AND comment_post_ID = %d
AND comment_approved = '1'
", $product->get_id()
",
$product->get_id()
)
);
@ -393,7 +396,8 @@ class WC_Comments {
AND comment_approved = '1'
AND meta_value > 0
GROUP BY meta_value
", $product->get_id()
",
$product->get_id()
)
);

View File

@ -137,7 +137,8 @@ class WC_Customer extends WC_Legacy_Customer {
public function delete_and_reassign( $reassign = null ) {
if ( $this->data_store ) {
$this->data_store->delete(
$this, array(
$this,
array(
'force_delete' => true,
'reassign' => $reassign,
)

View File

@ -52,7 +52,8 @@ class WC_Frontend_Scripts {
*/
public static function get_styles() {
return apply_filters(
'woocommerce_enqueue_styles', array(
'woocommerce_enqueue_styles',
array(
'woocommerce-layout' => array(
'src' => self::get_asset_url( 'assets/css/woocommerce-layout.css' ),
'deps' => '',
@ -414,7 +415,7 @@ class WC_Frontend_Scripts {
}
// Placeholder style.
wp_register_style( 'woocommerce-inline', false );
wp_register_style( 'woocommerce-inline', false ); // phpcs:ignore
wp_enqueue_style( 'woocommerce-inline' );
if ( true === wc_string_to_bool( get_option( 'woocommerce_checkout_highlight_required_fields', 'yes' ) ) ) {
@ -473,7 +474,8 @@ class WC_Frontend_Scripts {
'i18n_required_rating_text' => esc_attr__( 'Please select a rating', 'woocommerce' ),
'review_rating_required' => wc_review_ratings_required() ? 'yes' : 'no',
'flexslider' => apply_filters(
'woocommerce_single_product_carousel_options', array(
'woocommerce_single_product_carousel_options',
array(
'rtl' => is_rtl(),
'animation' => 'slide',
'smoothHeight' => true,
@ -489,7 +491,8 @@ class WC_Frontend_Scripts {
'zoom_options' => apply_filters( 'woocommerce_single_product_zoom_options', array() ),
'photoswipe_enabled' => apply_filters( 'woocommerce_single_product_photoswipe_enabled', get_theme_support( 'wc-product-gallery-lightbox' ) ),
'photoswipe_options' => apply_filters(
'woocommerce_single_product_photoswipe_options', array(
'woocommerce_single_product_photoswipe_options',
array(
'shareEl' => false,
'closeOnScroll' => false,
'history' => false,

View File

@ -51,7 +51,8 @@ class WC_Post_Types {
'product_type',
apply_filters( 'woocommerce_taxonomy_objects_product_type', array( 'product' ) ),
apply_filters(
'woocommerce_taxonomy_args_product_type', array(
'woocommerce_taxonomy_args_product_type',
array(
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => false,
@ -66,7 +67,8 @@ class WC_Post_Types {
'product_visibility',
apply_filters( 'woocommerce_taxonomy_objects_product_visibility', array( 'product', 'product_variation' ) ),
apply_filters(
'woocommerce_taxonomy_args_product_visibility', array(
'woocommerce_taxonomy_args_product_visibility',
array(
'hierarchical' => false,
'show_ui' => false,
'show_in_nav_menus' => false,
@ -81,7 +83,8 @@ class WC_Post_Types {
'product_cat',
apply_filters( 'woocommerce_taxonomy_objects_product_cat', array( 'product' ) ),
apply_filters(
'woocommerce_taxonomy_args_product_cat', array(
'woocommerce_taxonomy_args_product_cat',
array(
'hierarchical' => true,
'update_count_callback' => '_wc_term_recount',
'label' => __( 'Categories', 'woocommerce' ),
@ -120,7 +123,8 @@ class WC_Post_Types {
'product_tag',
apply_filters( 'woocommerce_taxonomy_objects_product_tag', array( 'product' ) ),
apply_filters(
'woocommerce_taxonomy_args_product_tag', array(
'woocommerce_taxonomy_args_product_tag',
array(
'hierarchical' => false,
'update_count_callback' => '_wc_term_recount',
'label' => __( 'Product tags', 'woocommerce' ),
@ -160,7 +164,8 @@ class WC_Post_Types {
'product_shipping_class',
apply_filters( 'woocommerce_taxonomy_objects_product_shipping_class', array( 'product', 'product_variation' ) ),
apply_filters(
'woocommerce_taxonomy_args_product_shipping_class', array(
'woocommerce_taxonomy_args_product_shipping_class',
array(
'hierarchical' => false,
'update_count_callback' => '_update_post_term_count',
'label' => __( 'Shipping classes', 'woocommerce' ),

View File

@ -32,8 +32,12 @@ $average = $product->get_average_rating();
if ( $rating_count > 0 ) : ?>
<div class="woocommerce-product-rating">
<?php echo wc_get_rating_html( $average, $rating_count ); // ?>
<?php if ( comments_open() ) : ?><a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a><?php endif ?>
<?php echo wc_get_rating_html( $average, $rating_count ); // WPCS: XSS ok. ?>
<?php if ( comments_open() ) : ?>
<?php //phpcs:disable ?>
<a href="#reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a>
<?php // phpcs:enable ?>
<?php endif ?>
</div>
<?php endif; ?>

View File

@ -16,12 +16,12 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
global $comment;
$rating = intval( get_comment_meta( $comment->comment_ID, 'rating', true ) );
if ( $rating && wc_review_ratings_enabled() ) {
echo wc_get_rating_html( $rating );
echo wc_get_rating_html( $rating ); // WPCS: XSS ok.
}