Merge pull request #21860 from rellect/wc_case

Rename wc() to WC() for consistency
This commit is contained in:
Mike Jolley 2019-01-08 14:29:59 +00:00 committed by GitHub
commit 868e7841e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 12 additions and 12 deletions

View File

@ -659,7 +659,7 @@ class WC_Admin_List_Table_Orders extends WC_Admin_List_Table {
// Sanity check: bail out if this is actually not a status, or is not a registered status.
if ( isset( $order_statuses[ 'wc-' . $new_status ] ) ) {
// Initialize payment gateways in case order has hooked status transition actions.
wc()->payment_gateways();
WC()->payment_gateways();
foreach ( $ids as $id ) {
$order = wc_get_order( $id );

View File

@ -486,7 +486,7 @@ class WC_AJAX {
if ( wc_is_order_status( 'wc-' . $status ) && $order ) {
// Initialize payment gateways in case order has hooked status transition actions.
wc()->payment_gateways();
WC()->payment_gateways();
$order->update_status( $status, '', true );
do_action( 'woocommerce_order_edit_status', $order->get_id(), $status );

View File

@ -95,10 +95,10 @@ class WC_Shipping {
public function __get( $name ) {
// Grab from cart for backwards compatibility with versions prior to 3.2.
if ( 'shipping_total' === $name ) {
return wc()->cart->get_shipping_total();
return WC()->cart->get_shipping_total();
}
if ( 'shipping_taxes' === $name ) {
return wc()->cart->get_shipping_taxes();
return WC()->cart->get_shipping_taxes();
}
}

View File

@ -443,7 +443,7 @@ class WC_Template_Loader {
$args = self::get_current_shop_view_args();
$shortcode = new WC_Shortcode_Products(
array_merge(
wc()->query->get_catalog_ordering_args(),
WC()->query->get_catalog_ordering_args(),
array(
'page' => $args->page,
'columns' => $args->columns,
@ -457,12 +457,12 @@ class WC_Template_Loader {
'products' );
// Allow queries to run e.g. layered nav.
add_action( 'pre_get_posts', array( wc()->query, 'product_query' ) );
add_action( 'pre_get_posts', array( WC()->query, 'product_query' ) );
$content = $content . $shortcode->get_content();
// Remove actions and self to avoid nested calls.
remove_action( 'pre_get_posts', array( wc()->query, 'product_query' ) );
remove_action( 'pre_get_posts', array( WC()->query, 'product_query' ) );
WC()->query->remove_ordering_args();
}

View File

@ -66,7 +66,7 @@ class WC_Widget_Price_Filter extends WC_Widget {
return;
}
if ( ! wc()->query->get_main_query()->post_count ) {
if ( ! WC()->query->get_main_query()->post_count ) {
return;
}
@ -119,7 +119,7 @@ class WC_Widget_Price_Filter extends WC_Widget {
protected function get_filtered_price() {
global $wpdb;
$args = wc()->query->get_main_query()->query_vars;
$args = WC()->query->get_main_query()->query_vars;
$tax_query = isset( $args['tax_query'] ) ? $args['tax_query'] : array();
$meta_query = isset( $args['meta_query'] ) ? $args['meta_query'] : array();

View File

@ -91,7 +91,7 @@ class WC_Widget_Rating_Filter extends WC_Widget {
return;
}
if ( ! wc()->query->get_main_query()->post_count ) {
if ( ! WC()->query->get_main_query()->post_count ) {
return;
}

View File

@ -34,9 +34,9 @@ if ( ! class_exists( 'WooCommerce' ) ) {
* @since 2.1
* @return WooCommerce
*/
function wc() {
function WC() {
return WooCommerce::instance();
}
// Global for backwards compatibility.
$GLOBALS['woocommerce'] = wc();
$GLOBALS['woocommerce'] = WC();