phpcs sniff fixes class-wc-admin-list-table-orders.php

This commit is contained in:
Ron Rennick 2018-11-29 16:16:51 -04:00
parent 83cb978c9e
commit 59c1b2f669
1 changed files with 20 additions and 14 deletions

View File

@ -422,7 +422,8 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
*/ */
public static function get_order_preview_item_html( $order ) { public static function get_order_preview_item_html( $order ) {
$hidden_order_itemmeta = apply_filters( $hidden_order_itemmeta = apply_filters(
'woocommerce_hidden_order_itemmeta', array( 'woocommerce_hidden_order_itemmeta',
array(
'_qty', '_qty',
'_tax_class', '_tax_class',
'_product_id', '_product_id',
@ -439,12 +440,14 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
$line_items = apply_filters( 'woocommerce_admin_order_preview_line_items', $order->get_items(), $order ); $line_items = apply_filters( 'woocommerce_admin_order_preview_line_items', $order->get_items(), $order );
$columns = apply_filters( $columns = apply_filters(
'woocommerce_admin_order_preview_line_item_columns', array( 'woocommerce_admin_order_preview_line_item_columns',
array(
'product' => __( 'Product', 'woocommerce' ), 'product' => __( 'Product', 'woocommerce' ),
'quantity' => __( 'Quantity', 'woocommerce' ), 'quantity' => __( 'Quantity', 'woocommerce' ),
'tax' => __( 'Tax', 'woocommerce' ), 'tax' => __( 'Tax', 'woocommerce' ),
'total' => __( 'Total', 'woocommerce' ), 'total' => __( 'Total', 'woocommerce' ),
), $order ),
$order
); );
if ( ! wc_tax_enabled() ) { if ( ! wc_tax_enabled() ) {
@ -602,11 +605,12 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
$shipping_address = $order->get_formatted_shipping_address(); $shipping_address = $order->get_formatted_shipping_address();
return apply_filters( return apply_filters(
'woocommerce_admin_order_preview_get_order_details', array( 'woocommerce_admin_order_preview_get_order_details',
array(
'data' => $order->get_data(), 'data' => $order->get_data(),
'order_number' => $order->get_order_number(), 'order_number' => $order->get_order_number(),
'item_html' => WC_Admin_List_Table_Orders::get_order_preview_item_html( $order ), 'item_html' => self::get_order_preview_item_html( $order ),
'actions_html' => WC_Admin_List_Table_Orders::get_order_preview_actions_html( $order ), 'actions_html' => self::get_order_preview_actions_html( $order ),
'ship_to_billing' => wc_ship_to_billing_address_only(), 'ship_to_billing' => wc_ship_to_billing_address_only(),
'needs_shipping' => $order->needs_shipping_address(), 'needs_shipping' => $order->needs_shipping_address(),
'formatted_billing_address' => $billing_address ? $billing_address : __( 'N/A', 'woocommerce' ), 'formatted_billing_address' => $billing_address ? $billing_address : __( 'N/A', 'woocommerce' ),
@ -616,7 +620,8 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
'shipping_via' => $order->get_shipping_method(), 'shipping_via' => $order->get_shipping_method(),
'status' => $order->get_status(), 'status' => $order->get_status(),
'status_name' => wc_get_order_status_name( $order->get_status() ), 'status_name' => wc_get_order_status_name( $order->get_status() ),
), $order ),
$order
); );
} }
@ -669,7 +674,8 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
'bulk_action' => $report_action, 'bulk_action' => $report_action,
'changed' => $changed, 'changed' => $changed,
'ids' => join( ',', $ids ), 'ids' => join( ',', $ids ),
), $redirect_to ),
$redirect_to
); );
} }
@ -726,7 +732,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
$user_string = ''; $user_string = '';
$user_id = ''; $user_id = '';
if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok. if ( ! empty( $_GET['_customer_user'] ) ) { // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
$user_id = absint( $_GET['_customer_user'] ); // WPCS: input var ok, sanitization ok. $user_id = absint( $_GET['_customer_user'] ); // WPCS: input var ok, sanitization ok.
$user = get_user_by( 'id', $user_id ); $user = get_user_by( 'id', $user_id );
@ -772,11 +778,11 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
// Filter the orders by the posted customer. // Filter the orders by the posted customer.
if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok. if ( ! empty( $_GET['_customer_user'] ) ) { // WPCS: input var ok.
// @codingStandardsIgnoreStart // @codingStandardsIgnoreStart.
$query_vars['meta_query'] = array( $query_vars['meta_query'] = array(
array( array(
'key' => '_customer_user', 'key' => '_customer_user',
'value' => (int) $_GET['_customer_user'], // WPCS: input var ok, sanitization ok. 'value' => (int) $_GET['_customer_user'], // WPCS: input var ok, sanitization ok.
'compare' => '=', 'compare' => '=',
), ),
); );
@ -819,7 +825,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
public function search_label( $query ) { public function search_label( $query ) {
global $pagenow, $typenow; global $pagenow, $typenow;
if ( 'edit.php' !== $pagenow || 'shop_order' !== $typenow || ! get_query_var( 'shop_order_search' ) || ! isset( $_GET['s'] ) ) { // WPCS: input var ok. if ( 'edit.php' !== $pagenow || 'shop_order' !== $typenow || ! get_query_var( 'shop_order_search' ) || ! isset( $_GET['s'] ) ) { // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
return $query; return $query;
} }
@ -845,7 +851,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
public function search_custom_fields( $wp ) { public function search_custom_fields( $wp ) {
global $pagenow; global $pagenow;
if ( 'edit.php' !== $pagenow || empty( $wp->query_vars['s'] ) || 'shop_order' !== $wp->query_vars['post_type'] || ! isset( $_GET['s'] ) ) { // WPCS: input var ok. if ( 'edit.php' !== $pagenow || empty( $wp->query_vars['s'] ) || 'shop_order' !== $wp->query_vars['post_type'] || ! isset( $_GET['s'] ) ) { // phpcs:disable WordPress.Security.NonceVerification.NoNonceVerification
return; return;
} }