From 8eeb6fc204bb91b306bc98da4f6bc26c0e0f560e Mon Sep 17 00:00:00 2001 From: claudiosmweb Date: Wed, 19 Nov 2014 22:43:09 -0200 Subject: [PATCH] Removed more some unused code --- .../reports/class-wc-report-taxes-by-code.php | 3 - .../reports/class-wc-report-taxes-by-date.php | 3 - .../settings/class-wc-settings-emails.php | 4 - .../settings/class-wc-settings-products.php | 9 - includes/admin/wc-admin-functions.php | 2 - includes/api/class-wc-api-orders.php | 4 +- includes/api/class-wc-api-products.php | 6 - includes/api/class-wc-api-server.php | 13 +- includes/class-wc-countries.php | 9 +- includes/class-wc-install.php | 1 - includes/class-wc-query.php | 2 - includes/class-wc-webhook.php | 4 +- .../class-wc-gateway-paypal-request.php | 5 +- .../class-wc-shipping-free-shipping.php | 161 +++++++++--------- includes/wc-cart-functions.php | 16 +- includes/wc-core-functions.php | 3 +- includes/wc-formatting-functions.php | 1 - includes/wc-page-functions.php | 33 ++-- includes/wc-template-functions.php | 5 +- includes/wc-term-functions.php | 7 +- .../class-wc-widget-layered-nav-filters.php | 3 - .../widgets/class-wc-widget-price-filter.php | 3 - 22 files changed, 136 insertions(+), 161 deletions(-) diff --git a/includes/admin/reports/class-wc-report-taxes-by-code.php b/includes/admin/reports/class-wc-report-taxes-by-code.php index f8299a2c9d5..a9a3e2c72d0 100644 --- a/includes/admin/reports/class-wc-report-taxes-by-code.php +++ b/includes/admin/reports/class-wc-report-taxes-by-code.php @@ -14,9 +14,6 @@ class WC_Report_Taxes_By_Code extends WC_Admin_Report { * @return array */ public function get_chart_legend() { - - $legend = array(); - return array(); } diff --git a/includes/admin/reports/class-wc-report-taxes-by-date.php b/includes/admin/reports/class-wc-report-taxes-by-date.php index 37fb341d239..c168303a828 100644 --- a/includes/admin/reports/class-wc-report-taxes-by-date.php +++ b/includes/admin/reports/class-wc-report-taxes-by-date.php @@ -14,9 +14,6 @@ class WC_Report_Taxes_By_Date extends WC_Admin_Report { * @return array */ public function get_chart_legend() { - - $legend = array(); - return array(); } diff --git a/includes/admin/settings/class-wc-settings-emails.php b/includes/admin/settings/class-wc-settings-emails.php index 38c61e066eb..a86859ba83e 100644 --- a/includes/admin/settings/class-wc-settings-emails.php +++ b/includes/admin/settings/class-wc-settings-emails.php @@ -201,10 +201,6 @@ class WC_Settings_Emails extends WC_Settings_Page { WC_Admin_Settings::save_fields( $settings ); } else { - - // Load mailer - $mailer = WC()->mailer(); - if ( class_exists( $current_section ) ) { $current_section_class = new $current_section(); diff --git a/includes/admin/settings/class-wc-settings-products.php b/includes/admin/settings/class-wc-settings-products.php index 37d9602ffe3..c00a6f21e68 100644 --- a/includes/admin/settings/class-wc-settings-products.php +++ b/includes/admin/settings/class-wc-settings-products.php @@ -79,15 +79,6 @@ class WC_Settings_Products extends WC_Settings_Page { public function get_settings( $current_section = '' ) { if ( 'display' == $current_section ) { - // Get shop page - $shop_page_id = wc_get_page_id( 'shop' ); - $base_slug = ( $shop_page_id > 0 && get_post( $shop_page_id ) ) ? get_page_uri( $shop_page_id ) : 'shop'; - $woocommerce_shop_page_children_warning = ''; - - if ( $shop_page_id > 0 && sizeof( get_pages( "child_of=$shop_page_id" ) ) > 0 ) { - $woocommerce_shop_page_children_warning = ' ' . __( 'Note: The shop page has children - child pages will not work if you enable this option.', 'woocommerce' ) . ''; - } - $settings = apply_filters( 'woocommerce_product_settings', array( array( diff --git a/includes/admin/wc-admin-functions.php b/includes/admin/wc-admin-functions.php index 0c5b0d8df01..ffe96cfce85 100644 --- a/includes/admin/wc-admin-functions.php +++ b/includes/admin/wc-admin-functions.php @@ -62,8 +62,6 @@ function wc_create_page( $slug, $option = '', $page_title = '', $page_content = return -1; } - $page_found = null; - if ( strlen( $page_content ) > 0 ) { // Search for an existing page with the specified page content (typically a shortcode) $page_found = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM " . $wpdb->posts . " WHERE post_type='page' AND post_content LIKE %s LIMIT 1;", "%{$page_content}%" ) ); diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php index 145880eb8d9..f4660eaeec3 100644 --- a/includes/api/class-wc-api-orders.php +++ b/includes/api/class-wc-api-orders.php @@ -150,7 +150,7 @@ class WC_API_Orders extends WC_API_Resource { 'status' => $order->get_status(), 'currency' => $order->get_order_currency(), 'total' => wc_format_decimal( $order->get_total(), 2 ), - 'subtotal' => wc_format_decimal( $order->get_subtotal( $order ), 2 ), + 'subtotal' => wc_format_decimal( $order->get_subtotal(), 2 ), 'total_line_items_quantity' => $order->get_item_count(), 'total_tax' => wc_format_decimal( $order->get_total_tax(), 2 ), 'total_shipping' => wc_format_decimal( $order->get_total_shipping(), 2 ), @@ -529,7 +529,7 @@ class WC_API_Orders extends WC_API_Resource { $this->set_item( $order, $line_type, $item, 'create' ); - } elseif ( $this->item_is_null( $item, $line_type ) ) { + } elseif ( $this->item_is_null( $item ) ) { // delete item wc_delete_order_item( $item['id'] ); diff --git a/includes/api/class-wc-api-products.php b/includes/api/class-wc-api-products.php index 589cb4684f0..3bdda2d85f3 100644 --- a/includes/api/class-wc-api-products.php +++ b/includes/api/class-wc-api-products.php @@ -1196,12 +1196,6 @@ class WC_API_Products extends WC_API_Resource { if ( isset( $variation['in_stock'] ) ) { $stock_status = ( true === $variation['in_stock'] ) ? 'instock' : 'outofstock'; wc_update_product_stock_status( $variation_id, $stock_status ); - } else { - $stock_status = get_post_meta( $variation_id, '_stock_status', true ); - - if ( '' === $stock_status ) { - $stock_status = 'instock'; - } } if ( 'yes' === $manage_stock ) { diff --git a/includes/api/class-wc-api-server.php b/includes/api/class-wc-api-server.php index 1d0ca7ef4cd..fb0bbf75536 100644 --- a/includes/api/class-wc-api-server.php +++ b/includes/api/class-wc-api-server.php @@ -458,18 +458,21 @@ class WC_API_Server { $data = array(); $route = preg_replace( '#\(\?P(<\w+?>).*?\)#', '$1', $route ); - $methods = array(); + foreach ( self::$method_map as $name => $bitmask ) { foreach ( $callbacks as $callback ) { // Skip to the next route if any callback is hidden - if ( $callback[1] & self::HIDDEN_ENDPOINT ) + if ( $callback[1] & self::HIDDEN_ENDPOINT ) { continue 3; + } - if ( $callback[1] & $bitmask ) + if ( $callback[1] & $bitmask ) { $data['supports'][] = $name; + } - if ( $callback[1] & self::ACCEPT_DATA ) + if ( $callback[1] & self::ACCEPT_DATA ) { $data['accepts_data'] = true; + } // For non-variable routes, generate links if ( strpos( $route, '<' ) === false ) { @@ -479,8 +482,10 @@ class WC_API_Server { } } } + $available['store']['routes'][ $route ] = apply_filters( 'woocommerce_api_endpoints_description', $data ); } + return apply_filters( 'woocommerce_api_index', $available ); } diff --git a/includes/class-wc-countries.php b/includes/class-wc-countries.php index e4d5ebc62bb..b956116fb85 100644 --- a/includes/class-wc-countries.php +++ b/includes/class-wc-countries.php @@ -265,9 +265,12 @@ class WC_Countries { * @return string */ public function shipping_to_prefix() { - $return = ''; - if (in_array(WC()->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __( 'to the', 'woocommerce' ); - else $return = __( 'to', 'woocommerce' ); + if ( in_array( WC()->customer->get_shipping_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ) ) ) { + $return = __( 'to the', 'woocommerce' ); + } else { + $return = __( 'to', 'woocommerce' ); + } + return apply_filters('woocommerce_countries_shipping_to_prefix', $return, WC()->customer->get_shipping_country()); } diff --git a/includes/class-wc-install.php b/includes/class-wc-install.php index 94dfbc8bffe..44121b37eeb 100644 --- a/includes/class-wc-install.php +++ b/includes/class-wc-install.php @@ -117,7 +117,6 @@ class WC_Install { $this->create_files(); // Queue upgrades - $current_version = get_option( 'woocommerce_version', null ); $current_db_version = get_option( 'woocommerce_db_version', null ); if ( version_compare( $current_db_version, '2.2.0', '<' ) && null !== $current_db_version ) { diff --git a/includes/class-wc-query.php b/includes/class-wc-query.php index 5ad371a4b16..e072d248b75 100644 --- a/includes/class-wc-query.php +++ b/includes/class-wc-query.php @@ -429,8 +429,6 @@ class WC_Query { public function get_products_in_view() { global $wp_the_query; - $unfiltered_product_ids = array(); - // Get main query $current_wp_query = $wp_the_query->query; diff --git a/includes/class-wc-webhook.php b/includes/class-wc-webhook.php index dbae6e33b18..a01558e6f2e 100644 --- a/includes/class-wc-webhook.php +++ b/includes/class-wc-webhook.php @@ -63,12 +63,10 @@ class WC_Webhook { * * @since 2.2 * @param string $key - * @return mixed|null|void value + * @return mixed value */ public function __get( $key ) { - $value = null; - if ( 'status' === $key ) { $value = $this->get_status(); } else { diff --git a/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php b/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php index 1e0ae0bbc67..669dc87f5d7 100644 --- a/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php +++ b/includes/gateways/paypal/includes/class-wc-gateway-paypal-request.php @@ -210,9 +210,8 @@ class WC_Gateway_Paypal_Request { * @return string */ protected function get_order_item_name( $order, $item ) { - $product = $order->get_product_from_item( $item ); - $item_name = $item['name']; - $item_meta = new WC_Order_Item_Meta( $item['item_meta'] ); + $item_name = $item['name']; + $item_meta = new WC_Order_Item_Meta( $item['item_meta'] ); if ( $meta = $item_meta->display( true, true ) ) { $item_name .= ' ( ' . $meta . ' )'; diff --git a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php index 6dda402374c..ca35ecff11a 100644 --- a/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php +++ b/includes/shipping/free-shipping/class-wc-shipping-free-shipping.php @@ -9,17 +9,16 @@ if ( ! defined( 'ABSPATH' ) ) { * * A simple shipping method for free shipping * - * @class WC_Shipping_Free_Shipping - * @version 2.0.0 - * @package WooCommerce/Classes/Shipping - * @author WooThemes + * @class WC_Shipping_Free_Shipping + * @version 2.3.0 + * @package WooCommerce/Classes/Shipping + * @author WooThemes */ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { /** * __construct function. * - * @access public * @return void */ function __construct() { @@ -31,7 +30,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { /** * init function. * - * @access public * @return void */ function init() { @@ -56,68 +54,66 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { /** * Initialise Gateway Settings Form Fields * - * @access public * @return void */ function init_form_fields() { $this->form_fields = array( 'enabled' => array( - 'title' => __( 'Enable/Disable', 'woocommerce' ), - 'type' => 'checkbox', - 'label' => __( 'Enable Free Shipping', 'woocommerce' ), - 'default' => 'yes' - ), + 'title' => __( 'Enable/Disable', 'woocommerce' ), + 'type' => 'checkbox', + 'label' => __( 'Enable Free Shipping', 'woocommerce' ), + 'default' => 'yes' + ), 'title' => array( - 'title' => __( 'Method Title', 'woocommerce' ), - 'type' => 'text', - 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ), - 'default' => __( 'Free Shipping', 'woocommerce' ), - 'desc_tip' => true, - ), + 'title' => __( 'Method Title', 'woocommerce' ), + 'type' => 'text', + 'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ), + 'default' => __( 'Free Shipping', 'woocommerce' ), + 'desc_tip' => true, + ), 'availability' => array( - 'title' => __( 'Method availability', 'woocommerce' ), - 'type' => 'select', - 'default' => 'all', - 'class' => 'availability', - 'options' => array( - 'all' => __( 'All allowed countries', 'woocommerce' ), - 'specific' => __( 'Specific Countries', 'woocommerce' ) - ) - ), + 'title' => __( 'Method availability', 'woocommerce' ), + 'type' => 'select', + 'default' => 'all', + 'class' => 'availability', + 'options' => array( + 'all' => __( 'All allowed countries', 'woocommerce' ), + 'specific' => __( 'Specific Countries', 'woocommerce' ) + ) + ), 'countries' => array( - 'title' => __( 'Specific Countries', 'woocommerce' ), - 'type' => 'multiselect', - 'class' => 'chosen_select', - 'css' => 'width: 450px;', - 'default' => '', - 'options' => WC()->countries->get_shipping_countries(), - 'custom_attributes' => array( - 'data-placeholder' => __( 'Select some countries', 'woocommerce' ) - ) - ), + 'title' => __( 'Specific Countries', 'woocommerce' ), + 'type' => 'multiselect', + 'class' => 'chosen_select', + 'css' => 'width: 450px;', + 'default' => '', + 'options' => WC()->countries->get_shipping_countries(), + 'custom_attributes' => array( + 'data-placeholder' => __( 'Select some countries', 'woocommerce' ) + ) + ), 'requires' => array( - 'title' => __( 'Free Shipping Requires...', 'woocommerce' ), - 'type' => 'select', - 'default' => '', - 'options' => array( - '' => __( 'N/A', 'woocommerce' ), - 'coupon' => __( 'A valid free shipping coupon', 'woocommerce' ), - 'min_amount' => __( 'A minimum order amount (defined below)', 'woocommerce' ), - 'either' => __( 'A minimum order amount OR a coupon', 'woocommerce' ), - 'both' => __( 'A minimum order amount AND a coupon', 'woocommerce' ), - ) - ), + 'title' => __( 'Free Shipping Requires...', 'woocommerce' ), + 'type' => 'select', + 'default' => '', + 'options' => array( + '' => __( 'N/A', 'woocommerce' ), + 'coupon' => __( 'A valid free shipping coupon', 'woocommerce' ), + 'min_amount' => __( 'A minimum order amount (defined below)', 'woocommerce' ), + 'either' => __( 'A minimum order amount OR a coupon', 'woocommerce' ), + 'both' => __( 'A minimum order amount AND a coupon', 'woocommerce' ), + ) + ), 'min_amount' => array( - 'title' => __( 'Minimum Order Amount', 'woocommerce' ), - 'type' => 'price', - 'placeholder' => wc_format_localized_price( 0 ), - 'description' => __( 'Users will need to spend this amount to get free shipping (if enabled above).', 'woocommerce' ), - 'default' => '0', - 'desc_tip' => true - ) - ); - + 'title' => __( 'Minimum Order Amount', 'woocommerce' ), + 'type' => 'price', + 'placeholder' => wc_format_localized_price( 0 ), + 'description' => __( 'Users will need to spend this amount to get free shipping (if enabled above).', 'woocommerce' ), + 'default' => '0', + 'desc_tip' => true + ) + ); } @@ -126,7 +122,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { * - Options for bits like 'title' and availability on a country-by-country basis * * @since 1.0.0 - * @access public * @return void */ public function admin_options() { @@ -146,63 +141,74 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { /** * is_available function. * - * @access public * @param mixed $package * @return bool */ function is_available( $package ) { - if ( $this->enabled == "no" ) return false; + if ( 'no' == $this->enabled ) { + return false; + } - $ship_to_countries = ''; - - if ( $this->availability == 'specific' ) + if ( 'specific' == $this->availability ) { $ship_to_countries = $this->countries; - else + } else { $ship_to_countries = array_keys( WC()->countries->get_shipping_countries() ); + } - if ( is_array( $ship_to_countries ) ) - if ( ! in_array( $package['destination']['country'], $ship_to_countries ) ) - return false; + if ( is_array( $ship_to_countries ) && ! in_array( $package['destination']['country'], $ship_to_countries ) ) { + return false; + } // Enabled logic - $is_available = false; - $has_coupon = false; + $is_available = false; + $has_coupon = false; $has_met_min_amount = false; if ( in_array( $this->requires, array( 'coupon', 'either', 'both' ) ) ) { if ( $coupons = WC()->cart->get_coupons() ) { foreach ( $coupons as $code => $coupon ) { - if ( $coupon->is_valid() && $coupon->enable_free_shipping() ) + if ( $coupon->is_valid() && $coupon->enable_free_shipping() ) { $has_coupon = true; + } } } } if ( in_array( $this->requires, array( 'min_amount', 'either', 'both' ) ) && isset( WC()->cart->cart_contents_total ) ) { - if ( WC()->cart->prices_include_tax ) + if ( WC()->cart->prices_include_tax ) { $total = WC()->cart->cart_contents_total + array_sum( WC()->cart->taxes ); - else + } else { $total = WC()->cart->cart_contents_total; + } - if ( $total >= $this->min_amount ) + if ( $total >= $this->min_amount ) { $has_met_min_amount = true; + } } switch ( $this->requires ) { case 'min_amount' : - if ( $has_met_min_amount ) $is_available = true; + if ( $has_met_min_amount ) { + $is_available = true; + } break; case 'coupon' : - if ( $has_coupon ) $is_available = true; + if ( $has_coupon ) { + $is_available = true; + } break; case 'both' : - if ( $has_met_min_amount && $has_coupon ) $is_available = true; + if ( $has_met_min_amount && $has_coupon ) { + $is_available = true; + } break; case 'either' : - if ( $has_met_min_amount || $has_coupon ) $is_available = true; + if ( $has_met_min_amount || $has_coupon ) { + $is_available = true; + } break; default : $is_available = true; @@ -216,7 +222,6 @@ class WC_Shipping_Free_Shipping extends WC_Shipping_Method { /** * calculate_shipping function. * - * @access public * @return array */ function calculate_shipping() { diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php index e8840b5a761..308ca8ee987 100644 --- a/includes/wc-cart-functions.php +++ b/includes/wc-cart-functions.php @@ -45,20 +45,22 @@ function wc_empty_cart() { /** * Load the cart upon login * - * @param mixed $user_login - * @param integer $user - * @return void + * @param string $user_login + * @param WP_User $user */ -function wc_load_persistent_cart( $user_login, $user = 0 ) { +function wc_load_persistent_cart( $user_login, $user ) { - if ( ! $user ) + if ( ! $user ) { return; + } $saved_cart = get_user_meta( $user->ID, '_woocommerce_persistent_cart', true ); - if ( $saved_cart ) - if ( empty( WC()->session->cart ) || ! is_array( WC()->session->cart ) || sizeof( WC()->session->cart ) == 0 ) + if ( $saved_cart ) { + if ( empty( WC()->session->cart ) || ! is_array( WC()->session->cart ) || sizeof( WC()->session->cart ) == 0 ) { WC()->session->cart = $saved_cart['cart']; + } + } } add_action( 'wp_login', 'wc_load_persistent_cart', 1, 2 ); diff --git a/includes/wc-core-functions.php b/includes/wc-core-functions.php index 44df9f7e0ba..b7ad9459685 100644 --- a/includes/wc-core-functions.php +++ b/includes/wc-core-functions.php @@ -569,8 +569,7 @@ function wc_get_log_file_path( $handle ) { * Init for our rewrite rule fixes */ function wc_fix_rewrite_rules_init() { - $permalinks = get_option( 'woocommerce_permalinks' ); - $product_permalink = empty( $permalinks['product_base'] ) ? _x( 'product', 'slug', 'woocommerce' ) : $permalinks['product_base']; + $permalinks = get_option( 'woocommerce_permalinks' ); if ( ! empty( $permalinks['use_verbose_page_rules'] ) ) { $GLOBALS['wp_rewrite']->use_verbose_page_rules = true; diff --git a/includes/wc-formatting-functions.php b/includes/wc-formatting-functions.php index 6fbc155a7a3..dbab446d206 100644 --- a/includes/wc-formatting-functions.php +++ b/includes/wc-formatting-functions.php @@ -317,7 +317,6 @@ function wc_price( $price, $args = array() ) { 'ex_tax_label' => '0' ), $args ) ); - $return = ''; $num_decimals = absint( get_option( 'woocommerce_price_num_decimals' ) ); $currency = isset( $args['currency'] ) ? $args['currency'] : ''; $currency_symbol = get_woocommerce_currency_symbol($currency); diff --git a/includes/wc-page-functions.php b/includes/wc-page-functions.php index dfeecfc8f32..cb879dcb4c0 100644 --- a/includes/wc-page-functions.php +++ b/includes/wc-page-functions.php @@ -116,36 +116,35 @@ function wc_customer_edit_account_url() { * Hide menu items conditionally * * @param array $items - * @param mixed $args * @return array */ -function wc_nav_menu_items( $items, $args ) { +function wc_nav_menu_items( $items ) { if ( ! is_user_logged_in() ) { - - $hide_pages = array(); - $hide_pages[] = (int) wc_get_page_id( 'logout' ); - $hide_pages = apply_filters( 'woocommerce_logged_out_hidden_page_ids', $hide_pages ); + $customer_logout = get_option( 'woocommerce_logout_endpoint', 'customer-logout' ); foreach ( $items as $key => $item ) { - if ( strstr( $item->url, 'customer-logout' ) ) + if ( strstr( $item->url, $customer_logout ) ) { unset( $items[ $key ] ); + } } } + return $items; } -add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_items', 10, 2 ); +add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_items', 10 ); /** * Fix active class in nav for shop page. * * @param array $menu_items - * @param array $args * @return array */ -function wc_nav_menu_item_classes( $menu_items, $args ) { +function wc_nav_menu_item_classes( $menu_items ) { - if ( ! is_woocommerce() ) return $menu_items; + if ( ! is_woocommerce() ) { + return $menu_items; + } $shop_page = (int) wc_get_page_id('shop'); $page_for_posts = (int) get_option( 'page_for_posts' ); @@ -158,15 +157,17 @@ function wc_nav_menu_item_classes( $menu_items, $args ) { if ( $page_for_posts == $menu_item->object_id ) { $menu_items[$key]->current = false; - if ( in_array( 'current_page_parent', $classes ) ) + if ( in_array( 'current_page_parent', $classes ) ) { unset( $classes[ array_search('current_page_parent', $classes) ] ); + } - if ( in_array( 'current-menu-item', $classes ) ) + if ( in_array( 'current-menu-item', $classes ) ) { unset( $classes[ array_search('current-menu-item', $classes) ] ); + } // Set active state if this is the shop page link } elseif ( is_shop() && $shop_page == $menu_item->object_id ) { - $menu_items[$key]->current = true; + $menu_items[ $key ]->current = true; $classes[] = 'current-menu-item'; $classes[] = 'current_page_item'; @@ -175,13 +176,13 @@ function wc_nav_menu_item_classes( $menu_items, $args ) { $classes[] = 'current_page_parent'; } - $menu_items[$key]->classes = array_unique( $classes ); + $menu_items[ $key ]->classes = array_unique( $classes ); } return $menu_items; } -add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_item_classes', 2, 20 ); +add_filter( 'wp_nav_menu_objects', 'wc_nav_menu_item_classes', 2 ); /** diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index ca6b2b2c6a3..4eb2dd52e2a 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -614,10 +614,11 @@ if ( ! function_exists( 'woocommerce_get_product_thumbnail' ) ) { function woocommerce_get_product_thumbnail( $size = 'shop_catalog', $placeholder_width = 0, $placeholder_height = 0 ) { global $post; - if ( has_post_thumbnail() ) + if ( has_post_thumbnail() ) { return get_the_post_thumbnail( $post->ID, $size ); - elseif ( wc_placeholder_img_src() ) + } elseif ( wc_placeholder_img_src() ) { return wc_placeholder_img( $size ); + } } } diff --git a/includes/wc-term-functions.php b/includes/wc-term-functions.php index f333e30f583..7a42702362a 100644 --- a/includes/wc-term-functions.php +++ b/includes/wc-term-functions.php @@ -542,11 +542,10 @@ add_action( 'woocommerce_product_set_stock_status', 'wc_recount_after_stock_chan * that takes catalog visibility into account. * * @param array $terms - * @param mixed $taxonomies - * @param mixed $args + * @param string|array $taxonomies * @return array */ -function wc_change_term_counts( $terms, $taxonomies, $args ) { +function wc_change_term_counts( $terms, $taxonomies ) { if ( is_admin() || is_ajax() ) { return $terms; } @@ -574,4 +573,4 @@ function wc_change_term_counts( $terms, $taxonomies, $args ) { return $terms; } -add_filter( 'get_terms', 'wc_change_term_counts', 10, 3 ); +add_filter( 'get_terms', 'wc_change_term_counts', 10, 2 ); diff --git a/includes/widgets/class-wc-widget-layered-nav-filters.php b/includes/widgets/class-wc-widget-layered-nav-filters.php index b2c8bbae22f..521a2e34979 100644 --- a/includes/widgets/class-wc-widget-layered-nav-filters.php +++ b/includes/widgets/class-wc-widget-layered-nav-filters.php @@ -51,9 +51,6 @@ class WC_Widget_Layered_Nav_Filters extends WC_Widget { return; } - $current_term = is_tax() ? get_queried_object()->term_id : ''; - $current_tax = is_tax() ? get_queried_object()->taxonomy : ''; - // Price $min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0; $max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0; diff --git a/includes/widgets/class-wc-widget-price-filter.php b/includes/widgets/class-wc-widget-price-filter.php index 46267b60167..973b00eaa17 100644 --- a/includes/widgets/class-wc-widget-price-filter.php +++ b/includes/widgets/class-wc-widget-price-filter.php @@ -97,9 +97,6 @@ class WC_Widget_Price_Filter extends WC_Widget { } } - $min = $max = 0; - $post_min = $post_max = ''; - if ( 0 === sizeof( WC()->query->layered_nav_product_ids ) ) { $min = floor( $wpdb->get_var( $wpdb->prepare('