Fixed coding standards
This commit is contained in:
parent
bb8f4f0139
commit
fceca66770
|
@ -2,8 +2,6 @@
|
|||
/**
|
||||
* List tables: products.
|
||||
*
|
||||
* @author WooCommerce
|
||||
* @category Admin
|
||||
* @package WooCommerce/Admin
|
||||
* @version 3.3.0
|
||||
*/
|
||||
|
@ -17,7 +15,7 @@ if ( class_exists( 'WC_Admin_List_Table_Products', false ) ) {
|
|||
}
|
||||
|
||||
if ( ! class_exists( 'WC_Admin_List_Table', false ) ) {
|
||||
include_once( 'abstract-class-wc-admin-list-table.php' );
|
||||
include_once 'abstract-class-wc-admin-list-table.php';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,9 +81,9 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
*/
|
||||
public function define_sortable_columns( $columns ) {
|
||||
$custom = array(
|
||||
'price' => 'price',
|
||||
'sku' => 'sku',
|
||||
'name' => 'title',
|
||||
'price' => 'price',
|
||||
'sku' => 'sku',
|
||||
'name' => 'title',
|
||||
);
|
||||
return wp_parse_args( $custom, $columns );
|
||||
}
|
||||
|
@ -135,7 +133,8 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
global $the_product;
|
||||
|
||||
if ( empty( $this->object ) || $this->object->get_id() !== $post_id ) {
|
||||
$this->object = $the_product = wc_get_product( $post_id );
|
||||
$the_product = wc_get_product( $post_id );
|
||||
$this->object = $the_product;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
* Render columm: thumb.
|
||||
*/
|
||||
protected function render_thumb_column() {
|
||||
echo '<a href="' . esc_url( get_edit_post_link( $this->object->get_id() ) ) . '">' . $this->object->get_image( 'thumbnail' ) . '</a>';
|
||||
echo '<a href="' . esc_url( get_edit_post_link( $this->object->get_id() ) ) . '">' . $this->object->get_image( 'thumbnail' ) . '</a>'; // WPCS: XSS ok.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -236,7 +235,8 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
* Render columm: product_cat.
|
||||
*/
|
||||
protected function render_product_cat_column() {
|
||||
if ( ! $terms = get_the_terms( $this->object->get_id(), 'product_cat' ) ) {
|
||||
$terms = get_the_terms( $this->object->get_id(), 'product_cat' );
|
||||
if ( ! $terms ) {
|
||||
echo '<span class="na">–</span>';
|
||||
} else {
|
||||
$termlist = array();
|
||||
|
@ -252,7 +252,8 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
* Render columm: product_tag.
|
||||
*/
|
||||
protected function render_product_tag_column() {
|
||||
if ( ! $terms = get_the_terms( $this->object->get_id(), 'product_tag' ) ) {
|
||||
$terms = get_the_terms( $this->object->get_id(), 'product_tag' );
|
||||
if ( ! $terms ) {
|
||||
echo '<span class="na">–</span>';
|
||||
} else {
|
||||
$termlist = array();
|
||||
|
@ -315,9 +316,11 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
$categories_count = (int) wp_count_terms( 'product_cat' );
|
||||
|
||||
if ( $categories_count <= apply_filters( 'woocommerce_product_category_filter_threshold', 100 ) ) {
|
||||
wc_product_dropdown_categories( array(
|
||||
'option_select_text' => __( 'Filter by category', 'woocommerce' ),
|
||||
) );
|
||||
wc_product_dropdown_categories(
|
||||
array(
|
||||
'option_select_text' => __( 'Filter by category', 'woocommerce' ),
|
||||
)
|
||||
);
|
||||
} else {
|
||||
$current_category_slug = isset( $_GET['product_cat'] ) ? wc_clean( wp_unslash( $_GET['product_cat'] ) ) : false; // WPCS: input var ok, CSRF ok.
|
||||
$current_category = $current_category_slug ? get_term_by( 'slug', $current_category_slug, 'product_cat' ) : false;
|
||||
|
@ -340,19 +343,19 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
$output .= '>';
|
||||
|
||||
switch ( $term->name ) {
|
||||
case 'grouped' :
|
||||
case 'grouped':
|
||||
$output .= __( 'Grouped product', 'woocommerce' );
|
||||
break;
|
||||
case 'external' :
|
||||
case 'external':
|
||||
$output .= __( 'External/Affiliate product', 'woocommerce' );
|
||||
break;
|
||||
case 'variable' :
|
||||
case 'variable':
|
||||
$output .= __( 'Variable product', 'woocommerce' );
|
||||
break;
|
||||
case 'simple' :
|
||||
case 'simple':
|
||||
$output .= __( 'Simple product', 'woocommerce' );
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
// Assuming that we have other types in future.
|
||||
$output .= ucfirst( $term->name );
|
||||
break;
|
||||
|
@ -380,7 +383,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
|
||||
$output .= '</select>';
|
||||
|
||||
$current_stock_status = isset( $_REQUEST['stock_status'] ) ? wc_clean( wp_unslash( $_REQUEST['stock_status'] ) ): false; // WPCS: input var ok, sanitization ok.
|
||||
$current_stock_status = isset( $_REQUEST['stock_status'] ) ? wc_clean( wp_unslash( $_REQUEST['stock_status'] ) ) : false; // WPCS: input var ok, sanitization ok.
|
||||
$stock_statuses = wc_get_product_stock_status_options();
|
||||
$output .= '<select name="stock_status"><option value="">' . esc_html__( 'Filter by stock status', 'woocommerce' ) . '</option>';
|
||||
|
||||
|
@ -449,7 +452,7 @@ class WC_Admin_List_Table_Products extends WC_Admin_List_Table {
|
|||
}
|
||||
|
||||
$query_vars['meta_query'][] = array(
|
||||
'key' => '_stock_status',
|
||||
'key' => '_stock_status',
|
||||
'value' => wc_clean( wp_unslash( $_GET['stock_status'] ) ),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue