WordPress.Arrays.ArrayKeySpacingRestrictions.SpacesAroundArrayKeys
This commit is contained in:
parent
ff852038c9
commit
6c30f84fa2
|
@ -501,11 +501,11 @@ class WC_Admin_Settings {
|
|||
// Image width settings
|
||||
case 'image_width' :
|
||||
|
||||
$image_size = str_replace( '_image_size', '', $value[ 'id' ] );
|
||||
$image_size = str_replace( '_image_size', '', $value['id'] );
|
||||
$size = wc_get_image_size( $image_size );
|
||||
$width = isset( $size[ 'width' ] ) ? $size[ 'width' ] : $value[ 'default' ][ 'width' ];
|
||||
$height = isset( $size[ 'height' ] ) ? $size[ 'height' ] : $value[ 'default' ][ 'height' ];
|
||||
$crop = isset( $size[ 'crop' ] ) ? $size[ 'crop' ] : $value[ 'default' ][ 'crop' ];
|
||||
$width = isset( $size['width'] ) ? $size['width'] : $value['default']['width'];
|
||||
$height = isset( $size['height'] ) ? $size['height'] : $value['default']['height'];
|
||||
$crop = isset( $size['crop'] ) ? $size['crop'] : $value['default']['crop'];
|
||||
$disabled_attr = '';
|
||||
$disabled_message = '';
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ class WC_Admin_Status {
|
|||
|
||||
$handle = ! empty( $viewed_log ) ? self::get_log_file_handle( $viewed_log ) : '';
|
||||
|
||||
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) {
|
||||
self::remove_log();
|
||||
}
|
||||
|
||||
|
@ -244,13 +244,13 @@ class WC_Admin_Status {
|
|||
* Remove/delete the chosen file.
|
||||
*/
|
||||
public static function remove_log() {
|
||||
if ( empty( $_REQUEST[ '_wpnonce' ] ) || ! wp_verify_nonce( $_REQUEST[ '_wpnonce' ], 'remove_log' ) ) {
|
||||
if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'remove_log' ) ) {
|
||||
wp_die( __( 'Action failed. Please refresh the page and retry.', 'woocommerce' ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $_REQUEST[ 'handle' ] ) ) {
|
||||
if ( ! empty( $_REQUEST['handle'] ) ) {
|
||||
$logger = wc_get_logger();
|
||||
$logger->remove( $_REQUEST[ 'handle' ] );
|
||||
$logger->remove( $_REQUEST['handle'] );
|
||||
}
|
||||
|
||||
wp_safe_redirect( esc_url_raw( admin_url( 'admin.php?page=wc-status&tab=logs' ) ) );
|
||||
|
|
|
@ -454,7 +454,7 @@ class WC_Meta_Box_Order_Data {
|
|||
}
|
||||
|
||||
if ( isset( $_POST['_transaction_id'] ) ) {
|
||||
update_post_meta( $post_id, '_transaction_id', wc_clean( $_POST[ '_transaction_id' ] ) );
|
||||
update_post_meta( $post_id, '_transaction_id', wc_clean( $_POST['_transaction_id'] ) );
|
||||
}
|
||||
|
||||
// Payment method handling
|
||||
|
|
|
@ -112,7 +112,7 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
|||
|
||||
$legend[] = array(
|
||||
'title' => sprintf( __( '%s coupons used in total', 'woocommerce' ), '<strong>' . $total_coupons . '</strong>' ),
|
||||
'color' => $this->chart_colours['coupon_count' ],
|
||||
'color' => $this->chart_colours['coupon_count'],
|
||||
'highlight_series' => 0,
|
||||
);
|
||||
|
||||
|
@ -458,8 +458,8 @@ class WC_Report_Coupon_Usage extends WC_Admin_Report {
|
|||
{
|
||||
label: "<?php echo esc_js( __( 'Number of coupons used', 'woocommerce' ) ) ?>",
|
||||
data: order_data.order_coupon_counts,
|
||||
color: '<?php echo $this->chart_colours['coupon_count' ]; ?>',
|
||||
bars: { fillColor: '<?php echo $this->chart_colours['coupon_count' ]; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
|
||||
color: '<?php echo $this->chart_colours['coupon_count']; ?>',
|
||||
bars: { fillColor: '<?php echo $this->chart_colours['coupon_count']; ?>', fill: true, show: true, lineWidth: 0, barWidth: <?php echo $this->barwidth; ?> * 0.5, align: 'center' },
|
||||
shadowSize: 0,
|
||||
hoverable: false
|
||||
},
|
||||
|
|
|
@ -94,7 +94,7 @@ class WC_Report_Sales_By_Category extends WC_Admin_Report {
|
|||
|
||||
$legend[] = array(
|
||||
'title' => sprintf( __( '%s sales in %s', 'woocommerce' ), '<strong>' . wc_price( $total ) . '</strong>', $category->name ),
|
||||
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[ 0 ],
|
||||
'color' => isset( $this->chart_colours[ $index ] ) ? $this->chart_colours[ $index ] : $this->chart_colours[0],
|
||||
'highlight_series' => $index,
|
||||
);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
if ( $current_tab == $key ) {
|
||||
echo 'nav-tab-active';
|
||||
}
|
||||
echo '">' . esc_html( $report_group[ 'title' ] ) . '</a>';
|
||||
echo '">' . esc_html( $report_group['title'] ) . '</a>';
|
||||
}
|
||||
|
||||
do_action( 'wc_reports_tabs' );
|
||||
|
@ -51,9 +51,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php
|
||||
}
|
||||
|
||||
if ( isset( $reports[ $current_tab ][ 'reports' ][ $current_report ] ) ) {
|
||||
if ( isset( $reports[ $current_tab ]['reports'][ $current_report ] ) ) {
|
||||
|
||||
$report = $reports[ $current_tab ][ 'reports' ][ $current_report ];
|
||||
$report = $reports[ $current_tab ]['reports'][ $current_report ];
|
||||
|
||||
if ( ! isset( $report['hide_title'] ) || $report['hide_title'] != true ) {
|
||||
echo '<h1>' . esc_html( $report['title'] ) . '</h1>';
|
||||
|
|
|
@ -154,7 +154,7 @@ class WC_REST_Authentication {
|
|||
// From OAuth PHP library, used under MIT license.
|
||||
$params = array();
|
||||
if ( preg_match_all( '/(oauth_[a-z_-]*)=(:?"([^"]*)"|([^,]*))/', $header, $matches ) ) {
|
||||
foreach ( $matches[ 1 ] as $i => $h ) {
|
||||
foreach ( $matches[1] as $i => $h ) {
|
||||
$params[ $h ] = urldecode( empty( $matches[3][ $i ] ) ? $matches[4][ $i ] : $matches[3][ $i ] );
|
||||
}
|
||||
if ( isset( $params['realm'] ) ) {
|
||||
|
|
|
@ -458,7 +458,7 @@ class WC_REST_Orders_Controller extends WC_REST_Posts_Controller {
|
|||
}
|
||||
|
||||
// If items have changed, recalculate order totals.
|
||||
if ( isset( $request[ 'billing' ], $request[ 'shipping' ], $request[ 'line_items' ], $request[ 'shipping' ], $request[ 'fee' ], $request[ 'coupon' ] ) ) {
|
||||
if ( isset( $request['billing'], $request['shipping'], $request['line_items'], $request['shipping'], $request['fee'], $request['coupon'] ) ) {
|
||||
$order->calculate_totals();
|
||||
}
|
||||
|
||||
|
|
|
@ -156,11 +156,11 @@ class WC_Form_Handler {
|
|||
*/
|
||||
public static function save_account_details() {
|
||||
|
||||
if ( 'POST' !== strtoupper( $_SERVER[ 'REQUEST_METHOD' ] ) ) {
|
||||
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( empty( $_POST[ 'action' ] ) || 'save_account_details' !== $_POST[ 'action' ] || empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'save_account_details' ) ) {
|
||||
if ( empty( $_POST['action'] ) || 'save_account_details' !== $_POST['action'] || empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'save_account_details' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,12 +174,12 @@ class WC_Form_Handler {
|
|||
return;
|
||||
}
|
||||
|
||||
$account_first_name = ! empty( $_POST[ 'account_first_name' ] ) ? wc_clean( $_POST[ 'account_first_name' ] ) : '';
|
||||
$account_last_name = ! empty( $_POST[ 'account_last_name' ] ) ? wc_clean( $_POST[ 'account_last_name' ] ) : '';
|
||||
$account_email = ! empty( $_POST[ 'account_email' ] ) ? sanitize_email( $_POST[ 'account_email' ] ) : '';
|
||||
$pass_cur = ! empty( $_POST[ 'password_current' ] ) ? $_POST[ 'password_current' ] : '';
|
||||
$pass1 = ! empty( $_POST[ 'password_1' ] ) ? $_POST[ 'password_1' ] : '';
|
||||
$pass2 = ! empty( $_POST[ 'password_2' ] ) ? $_POST[ 'password_2' ] : '';
|
||||
$account_first_name = ! empty( $_POST['account_first_name'] ) ? wc_clean( $_POST['account_first_name'] ) : '';
|
||||
$account_last_name = ! empty( $_POST['account_last_name'] ) ? wc_clean( $_POST['account_last_name'] ) : '';
|
||||
$account_email = ! empty( $_POST['account_email'] ) ? sanitize_email( $_POST['account_email'] ) : '';
|
||||
$pass_cur = ! empty( $_POST['password_current'] ) ? $_POST['password_current'] : '';
|
||||
$pass1 = ! empty( $_POST['password_1'] ) ? $_POST['password_1'] : '';
|
||||
$pass2 = ! empty( $_POST['password_2'] ) ? $_POST['password_2'] : '';
|
||||
$save_pass = true;
|
||||
|
||||
$user->first_name = $account_first_name;
|
||||
|
@ -983,7 +983,7 @@ class WC_Form_Handler {
|
|||
wc_add_notice( __( 'Please enter your password.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
|
||||
if ( $posted_fields[ 'password_1' ] !== $posted_fields[ 'password_2' ] ) {
|
||||
if ( $posted_fields['password_1'] !== $posted_fields['password_2'] ) {
|
||||
wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' );
|
||||
}
|
||||
|
||||
|
|
|
@ -635,18 +635,18 @@ class WC_Product_Variation extends WC_Product {
|
|||
foreach ( $attributes as $attribute ) {
|
||||
|
||||
// Only deal with attributes that are variations
|
||||
if ( ! $attribute[ 'is_variation' ] ) {
|
||||
if ( ! $attribute['is_variation'] ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$variation_selected_value = isset( $variation_data[ 'attribute_' . sanitize_title( $attribute[ 'name' ] ) ] ) ? $variation_data[ 'attribute_' . sanitize_title( $attribute[ 'name' ] ) ] : '';
|
||||
$description_name = esc_html( wc_attribute_label( $attribute[ 'name' ] ) );
|
||||
$variation_selected_value = isset( $variation_data[ 'attribute_' . sanitize_title( $attribute['name'] ) ] ) ? $variation_data[ 'attribute_' . sanitize_title( $attribute['name'] ) ] : '';
|
||||
$description_name = esc_html( wc_attribute_label( $attribute['name'] ) );
|
||||
$description_value = __( 'Any', 'woocommerce' );
|
||||
|
||||
// Get terms for attribute taxonomy or value if its a custom attribute
|
||||
if ( $attribute[ 'is_taxonomy' ] ) {
|
||||
if ( $attribute['is_taxonomy'] ) {
|
||||
|
||||
$post_terms = get_the_terms( $this->id, $attribute[ 'name' ] );
|
||||
$post_terms = get_the_terms( $this->id, $attribute['name'] );
|
||||
|
||||
foreach ( $post_terms as $term ) {
|
||||
if ( $variation_selected_value === $term->slug ) {
|
||||
|
@ -656,7 +656,7 @@ class WC_Product_Variation extends WC_Product {
|
|||
|
||||
} else {
|
||||
|
||||
$options = wc_get_text_attributes( $attribute[ 'value' ] );
|
||||
$options = wc_get_text_attributes( $attribute['value'] );
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
|
||||
|
|
|
@ -666,7 +666,7 @@ class WC_Query {
|
|||
}
|
||||
|
||||
if ( ! empty( $args['product_cat'] ) ) {
|
||||
$tax_query[ 'product_cat' ] = array(
|
||||
$tax_query['product_cat'] = array(
|
||||
'taxonomy' => 'product_cat',
|
||||
'terms' => array( $args['product_cat'] ),
|
||||
'field' => 'slug',
|
||||
|
@ -674,7 +674,7 @@ class WC_Query {
|
|||
}
|
||||
|
||||
if ( ! empty( $args['product_tag'] ) ) {
|
||||
$tax_query[ 'product_tag' ] = array(
|
||||
$tax_query['product_tag'] = array(
|
||||
'taxonomy' => 'product_tag',
|
||||
'terms' => array( $args['product_tag'] ),
|
||||
'field' => 'slug',
|
||||
|
|
|
@ -211,7 +211,7 @@ class WC_Shipping_Zone extends WC_Data {
|
|||
|
||||
foreach ( $states as $location ) {
|
||||
$location_codes = explode( ':', $location->code );
|
||||
$location_parts[] = $all_states[ $location_codes[ 0 ] ][ $location_codes[ 1 ] ];
|
||||
$location_parts[] = $all_states[ $location_codes[0] ][ $location_codes[1] ];
|
||||
}
|
||||
|
||||
foreach ( $postcodes as $location ) {
|
||||
|
|
|
@ -40,7 +40,7 @@ $settings = array(
|
|||
$shipping_classes = WC()->shipping->get_shipping_classes();
|
||||
|
||||
if ( ! empty( $shipping_classes ) ) {
|
||||
$settings[ 'class_costs' ] = array(
|
||||
$settings['class_costs'] = array(
|
||||
'title' => __( 'Shipping Class Costs', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'default' => '',
|
||||
|
@ -59,7 +59,7 @@ if ( ! empty( $shipping_classes ) ) {
|
|||
'desc_tip' => true,
|
||||
);
|
||||
}
|
||||
$settings[ 'no_class_cost' ] = array(
|
||||
$settings['no_class_cost'] = array(
|
||||
'title' => __( 'No Shipping Class Cost', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
|
@ -67,7 +67,7 @@ if ( ! empty( $shipping_classes ) ) {
|
|||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
);
|
||||
$settings[ 'type' ] = array(
|
||||
$settings['type'] = array(
|
||||
'title' => __( 'Calculation Type', 'woocommerce' ),
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
|
|
|
@ -37,7 +37,7 @@ class WC_Shipping_Legacy_Flat_Rate extends WC_Shipping_Method {
|
|||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
if ( 'no' === $this->settings['enabled'] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ $settings = array(
|
|||
$shipping_classes = WC()->shipping->get_shipping_classes();
|
||||
|
||||
if ( ! empty( $shipping_classes ) ) {
|
||||
$settings[ 'class_costs' ] = array(
|
||||
$settings['class_costs'] = array(
|
||||
'title' => __( 'Shipping Class Costs', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'default' => '',
|
||||
|
@ -86,7 +86,7 @@ if ( ! empty( $shipping_classes ) ) {
|
|||
'desc_tip' => true,
|
||||
);
|
||||
}
|
||||
$settings[ 'no_class_cost' ] = array(
|
||||
$settings['no_class_cost'] = array(
|
||||
'title' => __( 'No Shipping Class Cost', 'woocommerce' ),
|
||||
'type' => 'text',
|
||||
'placeholder' => __( 'N/A', 'woocommerce' ),
|
||||
|
@ -94,7 +94,7 @@ if ( ! empty( $shipping_classes ) ) {
|
|||
'default' => '',
|
||||
'desc_tip' => true,
|
||||
);
|
||||
$settings[ 'type' ] = array(
|
||||
$settings['type'] = array(
|
||||
'title' => __( 'Calculation Type', 'woocommerce' ),
|
||||
'type' => 'select',
|
||||
'class' => 'wc-enhanced-select',
|
||||
|
@ -107,7 +107,7 @@ if ( ! empty( $shipping_classes ) ) {
|
|||
}
|
||||
|
||||
if ( apply_filters( 'woocommerce_enable_deprecated_additional_flat_rates', $this->get_option( 'options', false ) ) ) {
|
||||
$settings[ 'additional_rates' ] = array(
|
||||
$settings['additional_rates'] = array(
|
||||
'title' => __( 'Additional Rates', 'woocommerce' ),
|
||||
'type' => 'title',
|
||||
'default' => '',
|
||||
|
|
|
@ -38,7 +38,7 @@ class WC_Shipping_Legacy_Free_Shipping extends WC_Shipping_Method {
|
|||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
if ( 'no' === $this->settings['enabled'] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class WC_Shipping_Legacy_Local_Delivery extends WC_Shipping_Local_Pickup {
|
|||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
if ( 'no' === $this->settings['enabled'] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class WC_Shipping_Legacy_Local_Pickup extends WC_Shipping_Method {
|
|||
public function process_admin_options() {
|
||||
parent::process_admin_options();
|
||||
|
||||
if ( 'no' === $this->settings[ 'enabled' ] ) {
|
||||
if ( 'no' === $this->settings['enabled'] ) {
|
||||
wp_redirect( admin_url( 'admin.php?page=wc-settings&tab=shipping§ion=options' ) );
|
||||
exit;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class WC_Shortcode_Checkout {
|
|||
if ( isset( $_GET['pay_for_order'] ) && isset( $_GET['key'] ) && $order_id ) {
|
||||
|
||||
// Pay for existing order
|
||||
$order_key = $_GET[ 'key' ];
|
||||
$order_key = $_GET['key'];
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( ! current_user_can( 'pay_for_order', $order_id ) ) {
|
||||
|
|
|
@ -113,7 +113,7 @@ function wc_get_orders( $args ) {
|
|||
$wp_query_args['post__not_in'] = array_map( 'absint', $args['exclude'] );
|
||||
}
|
||||
|
||||
if ( ! $args['paginate' ] ) {
|
||||
if ( ! $args['paginate'] ) {
|
||||
$wp_query_args['no_found_rows'] = true;
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ function wc_get_orders( $args ) {
|
|||
$return = $orders->posts;
|
||||
}
|
||||
|
||||
if ( $args['paginate' ] ) {
|
||||
if ( $args['paginate'] ) {
|
||||
return (object) array(
|
||||
'orders' => $return,
|
||||
'total' => $orders->found_posts,
|
||||
|
|
|
@ -634,7 +634,7 @@ function wc_update_240_shipping_methods() {
|
|||
|
||||
foreach ( WC()->shipping->get_shipping_classes() as $shipping_class ) {
|
||||
$rate_key = 'class_cost_' . $shipping_class->slug;
|
||||
$math_cost_strings[ $rate_key ] = $math_cost_strings[ 'no_class_cost' ];
|
||||
$math_cost_strings[ $rate_key ] = $math_cost_strings['no_class_cost'];
|
||||
}
|
||||
|
||||
if ( $flat_rates = array_filter( (array) get_option( $flat_rate_option_key, array() ) ) ) {
|
||||
|
@ -658,7 +658,7 @@ function wc_update_240_shipping_methods() {
|
|||
}
|
||||
}
|
||||
|
||||
$math_cost_strings[ 'cost' ][] = $shipping_method->get_option( 'cost_per_order' );
|
||||
$math_cost_strings['cost'][] = $shipping_method->get_option( 'cost_per_order' );
|
||||
|
||||
// Save settings
|
||||
foreach ( $math_cost_strings as $option_id => $math_cost_string ) {
|
||||
|
|
|
@ -316,7 +316,7 @@ add_filter( 'user_has_cap', 'wc_customer_has_capability', 10, 3 );
|
|||
*/
|
||||
function wc_modify_editable_roles( $roles ){
|
||||
if ( ! current_user_can( 'administrator' ) ) {
|
||||
unset( $roles[ 'administrator' ] );
|
||||
unset( $roles['administrator'] );
|
||||
}
|
||||
return $roles;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue