Fixed class-wc-widget-recently-viewed.php PHPCS violations

This commit is contained in:
Claudio Sanches 2018-03-09 17:48:28 -03:00
parent d3b81b17a8
commit b329d81279
1 changed files with 13 additions and 17 deletions

View File

@ -1,17 +1,15 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Recent Products Widget.
*
* @author WooThemes
* @category Widgets
* @package WooCommerce/Widgets
* @version 3.3.0
* @extends WC_Widget
* @package WooCommerce/Widgets
* @version 3.3.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Widget recently viewed.
*/
class WC_Widget_Recently_Viewed extends WC_Widget {
@ -46,13 +44,11 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
* Output widget.
*
* @see WP_Widget
*
* @param array $args
* @param array $instance
* @param array $args Arguments.
* @param array $instance Widget instance.
*/
public function widget( $args, $instance ) {
$viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', $_COOKIE['woocommerce_recently_viewed'] ) : array();
$viewed_products = ! empty( $_COOKIE['woocommerce_recently_viewed'] ) ? (array) explode( '|', wp_unslash( $_COOKIE['woocommerce_recently_viewed'] ) ) : array(); // @codingStandardsIgnoreLine
$viewed_products = array_reverse( array_filter( array_map( 'absint', $viewed_products ) ) );
if ( empty( $viewed_products ) ) {
@ -80,7 +76,7 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
'terms' => 'outofstock',
'operator' => 'NOT IN',
),
);
); // WPCS: slow query ok.
}
$r = new WP_Query( apply_filters( 'woocommerce_recently_viewed_products_widget_query_args', $query_args ) );
@ -109,6 +105,6 @@ class WC_Widget_Recently_Viewed extends WC_Widget {
$content = ob_get_clean();
echo $content;
echo $content; // WPCS: XSS ok.
}
}