PHPCS fixes
This commit is contained in:
parent
9eb31f5d14
commit
7e4e0de090
|
@ -165,14 +165,17 @@ function wc_setup_loop( $args = array() ) {
|
||||||
|
|
||||||
// If this is a main WC query, use global args as defaults.
|
// If this is a main WC query, use global args as defaults.
|
||||||
if ( $GLOBALS['wp_query']->get( 'wc_query' ) ) {
|
if ( $GLOBALS['wp_query']->get( 'wc_query' ) ) {
|
||||||
$default_args = array_merge( $default_args, array(
|
$default_args = array_merge(
|
||||||
|
$default_args,
|
||||||
|
array(
|
||||||
'is_search' => $GLOBALS['wp_query']->is_search(),
|
'is_search' => $GLOBALS['wp_query']->is_search(),
|
||||||
'is_filtered' => is_filtered(),
|
'is_filtered' => is_filtered(),
|
||||||
'total' => $GLOBALS['wp_query']->found_posts,
|
'total' => $GLOBALS['wp_query']->found_posts,
|
||||||
'total_pages' => $GLOBALS['wp_query']->max_num_pages,
|
'total_pages' => $GLOBALS['wp_query']->max_num_pages,
|
||||||
'per_page' => $GLOBALS['wp_query']->get( 'posts_per_page' ),
|
'per_page' => $GLOBALS['wp_query']->get( 'posts_per_page' ),
|
||||||
'current_page' => max( 1, $GLOBALS['wp_query']->get( 'paged', 1 ) ),
|
'current_page' => max( 1, $GLOBALS['wp_query']->get( 'paged', 1 ) ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge any existing values.
|
// Merge any existing values.
|
||||||
|
@ -1181,12 +1184,17 @@ if ( ! function_exists( 'woocommerce_template_loop_add_to_cart' ) ) {
|
||||||
if ( $product ) {
|
if ( $product ) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'quantity' => 1,
|
'quantity' => 1,
|
||||||
'class' => implode( ' ', array_filter( array(
|
'class' => implode(
|
||||||
|
' ',
|
||||||
|
array_filter(
|
||||||
|
array(
|
||||||
'button',
|
'button',
|
||||||
'product_type_' . $product->get_type(),
|
'product_type_' . $product->get_type(),
|
||||||
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
|
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
|
||||||
$product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
|
$product->supports( 'ajax_add_to_cart' ) && $product->is_purchasable() && $product->is_in_stock() ? 'ajax_add_to_cart' : '',
|
||||||
) ) ),
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'data-product_id' => $product->get_id(),
|
'data-product_id' => $product->get_id(),
|
||||||
'data-product_sku' => $product->get_sku(),
|
'data-product_sku' => $product->get_sku(),
|
||||||
|
@ -1291,14 +1299,17 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$show_default_orderby = 'menu_order' === apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
$show_default_orderby = 'menu_order' === apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
|
||||||
$catalog_orderby_options = apply_filters( 'woocommerce_catalog_orderby', array(
|
$catalog_orderby_options = apply_filters(
|
||||||
|
'woocommerce_catalog_orderby',
|
||||||
|
array(
|
||||||
'menu_order' => __( 'Default sorting', 'woocommerce' ),
|
'menu_order' => __( 'Default sorting', 'woocommerce' ),
|
||||||
'popularity' => __( 'Sort by popularity', 'woocommerce' ),
|
'popularity' => __( 'Sort by popularity', 'woocommerce' ),
|
||||||
'rating' => __( 'Sort by average rating', 'woocommerce' ),
|
'rating' => __( 'Sort by average rating', 'woocommerce' ),
|
||||||
'date' => __( 'Sort by latest', 'woocommerce' ),
|
'date' => __( 'Sort by latest', 'woocommerce' ),
|
||||||
'price' => __( 'Sort by price: low to high', 'woocommerce' ),
|
'price' => __( 'Sort by price: low to high', 'woocommerce' ),
|
||||||
'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),
|
'price-desc' => __( 'Sort by price: high to low', 'woocommerce' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
|
$default_orderby = wc_get_loop_prop( 'is_search' ) ? 'relevance' : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby', '' ) );
|
||||||
$orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok.
|
$orderby = isset( $_GET['orderby'] ) ? wc_clean( wp_unslash( $_GET['orderby'] ) ) : $default_orderby; // WPCS: sanitization ok, input var ok, CSRF ok.
|
||||||
|
@ -1321,11 +1332,14 @@ if ( ! function_exists( 'woocommerce_catalog_ordering' ) ) {
|
||||||
$orderby = current( array_keys( $catalog_orderby_options ) );
|
$orderby = current( array_keys( $catalog_orderby_options ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_get_template( 'loop/orderby.php', array(
|
wc_get_template(
|
||||||
|
'loop/orderby.php',
|
||||||
|
array(
|
||||||
'catalog_orderby_options' => $catalog_orderby_options,
|
'catalog_orderby_options' => $catalog_orderby_options,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
'show_default_orderby' => $show_default_orderby,
|
'show_default_orderby' => $show_default_orderby,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1396,7 +1410,12 @@ function wc_get_gallery_image_html( $attachment_id, $main_image = false ) {
|
||||||
$full_size = apply_filters( 'woocommerce_gallery_full_size', apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ) );
|
$full_size = apply_filters( 'woocommerce_gallery_full_size', apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ) );
|
||||||
$thumbnail_src = wp_get_attachment_image_src( $attachment_id, $thumbnail_size );
|
$thumbnail_src = wp_get_attachment_image_src( $attachment_id, $thumbnail_size );
|
||||||
$full_src = wp_get_attachment_image_src( $attachment_id, $full_size );
|
$full_src = wp_get_attachment_image_src( $attachment_id, $full_size );
|
||||||
$image = wp_get_attachment_image( $attachment_id, $image_size, false, apply_filters( 'woocommerce_gallery_image_html_attachment_image_params',
|
$image = wp_get_attachment_image(
|
||||||
|
$attachment_id,
|
||||||
|
$image_size,
|
||||||
|
false,
|
||||||
|
apply_filters(
|
||||||
|
'woocommerce_gallery_image_html_attachment_image_params',
|
||||||
array(
|
array(
|
||||||
'title' => get_post_field( 'post_title', $attachment_id ),
|
'title' => get_post_field( 'post_title', $attachment_id ),
|
||||||
'data-caption' => get_post_field( 'post_excerpt', $attachment_id ),
|
'data-caption' => get_post_field( 'post_excerpt', $attachment_id ),
|
||||||
|
@ -1405,7 +1424,10 @@ function wc_get_gallery_image_html( $attachment_id, $main_image = false ) {
|
||||||
'data-large_image_width' => $full_src[1],
|
'data-large_image_width' => $full_src[1],
|
||||||
'data-large_image_height' => $full_src[2],
|
'data-large_image_height' => $full_src[2],
|
||||||
'class' => $main_image ? 'wp-post-image' : '',
|
'class' => $main_image ? 'wp-post-image' : '',
|
||||||
), $attachment_id, $image_size )
|
),
|
||||||
|
$attachment_id,
|
||||||
|
$image_size
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
return '<div data-thumb="' . esc_url( $thumbnail_src[0] ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url( $full_src[0] ) . '">' . $image . '</a></div>';
|
return '<div data-thumb="' . esc_url( $thumbnail_src[0] ) . '" class="woocommerce-product-gallery__image"><a href="' . esc_url( $full_src[0] ) . '">' . $image . '</a></div>';
|
||||||
|
@ -1516,11 +1538,14 @@ if ( ! function_exists( 'woocommerce_grouped_add_to_cart' ) ) {
|
||||||
$products = array_filter( array_map( 'wc_get_product', $product->get_children() ), 'wc_products_array_filter_visible_grouped' );
|
$products = array_filter( array_map( 'wc_get_product', $product->get_children() ), 'wc_products_array_filter_visible_grouped' );
|
||||||
|
|
||||||
if ( $products ) {
|
if ( $products ) {
|
||||||
wc_get_template( 'single-product/add-to-cart/grouped.php', array(
|
wc_get_template(
|
||||||
|
'single-product/add-to-cart/grouped.php',
|
||||||
|
array(
|
||||||
'grouped_product' => $product,
|
'grouped_product' => $product,
|
||||||
'grouped_products' => $products,
|
'grouped_products' => $products,
|
||||||
'quantites_required' => false,
|
'quantites_required' => false,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1539,11 +1564,14 @@ if ( ! function_exists( 'woocommerce_variable_add_to_cart' ) ) {
|
||||||
$get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
$get_variations = count( $product->get_children() ) <= apply_filters( 'woocommerce_ajax_variation_threshold', 30, $product );
|
||||||
|
|
||||||
// Load the template.
|
// Load the template.
|
||||||
wc_get_template( 'single-product/add-to-cart/variable.php', array(
|
wc_get_template(
|
||||||
|
'single-product/add-to-cart/variable.php',
|
||||||
|
array(
|
||||||
'available_variations' => $get_variations ? $product->get_available_variations() : false,
|
'available_variations' => $get_variations ? $product->get_available_variations() : false,
|
||||||
'attributes' => $product->get_variation_attributes(),
|
'attributes' => $product->get_variation_attributes(),
|
||||||
'selected_attributes' => $product->get_default_attributes(),
|
'selected_attributes' => $product->get_default_attributes(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
||||||
|
@ -1558,10 +1586,13 @@ if ( ! function_exists( 'woocommerce_external_add_to_cart' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_get_template( 'single-product/add-to-cart/external.php', array(
|
wc_get_template(
|
||||||
|
'single-product/add-to-cart/external.php',
|
||||||
|
array(
|
||||||
'product_url' => $product->add_to_cart_url(),
|
'product_url' => $product->add_to_cart_url(),
|
||||||
'button_text' => $product->single_add_to_cart_text(),
|
'button_text' => $product->single_add_to_cart_text(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1726,11 +1757,14 @@ if ( ! function_exists( 'woocommerce_comments' ) ) {
|
||||||
*/
|
*/
|
||||||
function woocommerce_comments( $comment, $args, $depth ) {
|
function woocommerce_comments( $comment, $args, $depth ) {
|
||||||
$GLOBALS['comment'] = $comment; // WPCS: override ok.
|
$GLOBALS['comment'] = $comment; // WPCS: override ok.
|
||||||
wc_get_template( 'single-product/review.php', array(
|
wc_get_template(
|
||||||
|
'single-product/review.php',
|
||||||
|
array(
|
||||||
'comment' => $comment,
|
'comment' => $comment,
|
||||||
'args' => $args,
|
'args' => $args,
|
||||||
'depth' => $depth,
|
'depth' => $depth,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1854,11 +1888,14 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle the legacy filter which controlled posts per page etc.
|
// Handle the legacy filter which controlled posts per page etc.
|
||||||
$args = apply_filters( 'woocommerce_upsell_display_args', array(
|
$args = apply_filters(
|
||||||
|
'woocommerce_upsell_display_args',
|
||||||
|
array(
|
||||||
'posts_per_page' => $limit,
|
'posts_per_page' => $limit,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
wc_set_loop_prop( 'name', 'up-sells' );
|
wc_set_loop_prop( 'name', 'up-sells' );
|
||||||
wc_set_loop_prop( 'columns', apply_filters( 'woocommerce_upsells_columns', isset( $args['columns'] ) ? $args['columns'] : $columns ) );
|
wc_set_loop_prop( 'columns', apply_filters( 'woocommerce_upsells_columns', isset( $args['columns'] ) ? $args['columns'] : $columns ) );
|
||||||
|
|
||||||
|
@ -1869,14 +1906,17 @@ if ( ! function_exists( 'woocommerce_upsell_display' ) ) {
|
||||||
$upsells = wc_products_array_orderby( array_filter( array_map( 'wc_get_product', $product->get_upsell_ids() ), 'wc_products_array_filter_visible' ), $orderby, $order );
|
$upsells = wc_products_array_orderby( array_filter( array_map( 'wc_get_product', $product->get_upsell_ids() ), 'wc_products_array_filter_visible' ), $orderby, $order );
|
||||||
$upsells = $limit > 0 ? array_slice( $upsells, 0, $limit ) : $upsells;
|
$upsells = $limit > 0 ? array_slice( $upsells, 0, $limit ) : $upsells;
|
||||||
|
|
||||||
wc_get_template( 'single-product/up-sells.php', array(
|
wc_get_template(
|
||||||
|
'single-product/up-sells.php',
|
||||||
|
array(
|
||||||
'upsells' => $upsells,
|
'upsells' => $upsells,
|
||||||
|
|
||||||
// Not used now, but used in previous version of up-sells.php.
|
// Not used now, but used in previous version of up-sells.php.
|
||||||
'posts_per_page' => $limit,
|
'posts_per_page' => $limit,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1894,9 +1934,12 @@ if ( ! function_exists( 'woocommerce_shipping_calculator' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wp_enqueue_script( 'wc-country-select' );
|
wp_enqueue_script( 'wc-country-select' );
|
||||||
wc_get_template( 'cart/shipping-calculator.php', array(
|
wc_get_template(
|
||||||
|
'cart/shipping-calculator.php',
|
||||||
|
array(
|
||||||
'button_text' => $button_text,
|
'button_text' => $button_text,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1940,14 +1983,17 @@ if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) {
|
||||||
$limit = apply_filters( 'woocommerce_cross_sells_total', $limit );
|
$limit = apply_filters( 'woocommerce_cross_sells_total', $limit );
|
||||||
$cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells;
|
$cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells;
|
||||||
|
|
||||||
wc_get_template( 'cart/cross-sells.php', array(
|
wc_get_template(
|
||||||
|
'cart/cross-sells.php',
|
||||||
|
array(
|
||||||
'cross_sells' => $cross_sells,
|
'cross_sells' => $cross_sells,
|
||||||
|
|
||||||
// Not used now, but used in previous version of up-sells.php.
|
// Not used now, but used in previous version of up-sells.php.
|
||||||
'posts_per_page' => $limit,
|
'posts_per_page' => $limit,
|
||||||
'orderby' => $orderby,
|
'orderby' => $orderby,
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2031,9 +2077,12 @@ if ( ! function_exists( 'woocommerce_checkout_login_form' ) ) {
|
||||||
* Output the WooCommerce Checkout Login Form.
|
* Output the WooCommerce Checkout Login Form.
|
||||||
*/
|
*/
|
||||||
function woocommerce_checkout_login_form() {
|
function woocommerce_checkout_login_form() {
|
||||||
wc_get_template( 'checkout/form-login.php', array(
|
wc_get_template(
|
||||||
|
'checkout/form-login.php',
|
||||||
|
array(
|
||||||
'checkout' => WC()->checkout(),
|
'checkout' => WC()->checkout(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2045,14 +2094,20 @@ if ( ! function_exists( 'woocommerce_breadcrumb' ) ) {
|
||||||
* @param array $args Arguments.
|
* @param array $args Arguments.
|
||||||
*/
|
*/
|
||||||
function woocommerce_breadcrumb( $args = array() ) {
|
function woocommerce_breadcrumb( $args = array() ) {
|
||||||
$args = wp_parse_args( $args, apply_filters( 'woocommerce_breadcrumb_defaults', array(
|
$args = wp_parse_args(
|
||||||
|
$args,
|
||||||
|
apply_filters(
|
||||||
|
'woocommerce_breadcrumb_defaults',
|
||||||
|
array(
|
||||||
'delimiter' => ' / ',
|
'delimiter' => ' / ',
|
||||||
'wrap_before' => '<nav class="woocommerce-breadcrumb">',
|
'wrap_before' => '<nav class="woocommerce-breadcrumb">',
|
||||||
'wrap_after' => '</nav>',
|
'wrap_after' => '</nav>',
|
||||||
'before' => '',
|
'before' => '',
|
||||||
'after' => '',
|
'after' => '',
|
||||||
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
|
'home' => _x( 'Home', 'breadcrumb', 'woocommerce' ),
|
||||||
) ) );
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$breadcrumbs = new WC_Breadcrumb();
|
$breadcrumbs = new WC_Breadcrumb();
|
||||||
|
|
||||||
|
@ -2081,9 +2136,12 @@ if ( ! function_exists( 'woocommerce_order_review' ) ) {
|
||||||
* @param bool $deprecated Deprecated param.
|
* @param bool $deprecated Deprecated param.
|
||||||
*/
|
*/
|
||||||
function woocommerce_order_review( $deprecated = false ) {
|
function woocommerce_order_review( $deprecated = false ) {
|
||||||
wc_get_template( 'checkout/review-order.php', array(
|
wc_get_template(
|
||||||
|
'checkout/review-order.php',
|
||||||
|
array(
|
||||||
'checkout' => WC()->checkout(),
|
'checkout' => WC()->checkout(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2100,11 +2158,14 @@ if ( ! function_exists( 'woocommerce_checkout_payment' ) ) {
|
||||||
$available_gateways = array();
|
$available_gateways = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_get_template( 'checkout/payment.php', array(
|
wc_get_template(
|
||||||
|
'checkout/payment.php',
|
||||||
|
array(
|
||||||
'checkout' => WC()->checkout(),
|
'checkout' => WC()->checkout(),
|
||||||
'available_gateways' => $available_gateways,
|
'available_gateways' => $available_gateways,
|
||||||
'order_button_text' => apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) ),
|
'order_button_text' => apply_filters( 'woocommerce_order_button_text', __( 'Place order', 'woocommerce' ) ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2114,9 +2175,12 @@ if ( ! function_exists( 'woocommerce_checkout_coupon_form' ) ) {
|
||||||
* Output the Coupon form for the checkout.
|
* Output the Coupon form for the checkout.
|
||||||
*/
|
*/
|
||||||
function woocommerce_checkout_coupon_form() {
|
function woocommerce_checkout_coupon_form() {
|
||||||
wc_get_template( 'checkout/form-coupon.php', array(
|
wc_get_template(
|
||||||
|
'checkout/form-coupon.php',
|
||||||
|
array(
|
||||||
'checkout' => WC()->checkout(),
|
'checkout' => WC()->checkout(),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2196,9 +2260,11 @@ if ( ! function_exists( 'woocommerce_maybe_show_product_subcategories' ) ) {
|
||||||
// If displaying categories, append to the loop.
|
// If displaying categories, append to the loop.
|
||||||
if ( 'subcategories' === $display_type || 'both' === $display_type ) {
|
if ( 'subcategories' === $display_type || 'both' === $display_type ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
woocommerce_output_product_categories( array(
|
woocommerce_output_product_categories(
|
||||||
|
array(
|
||||||
'parent_id' => is_product_category() ? get_queried_object_id() : 0,
|
'parent_id' => is_product_category() ? get_queried_object_id() : 0,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
$loop_html .= ob_get_clean();
|
$loop_html .= ob_get_clean();
|
||||||
|
|
||||||
if ( 'subcategories' === $display_type ) {
|
if ( 'subcategories' === $display_type ) {
|
||||||
|
@ -2245,11 +2311,13 @@ if ( ! function_exists( 'woocommerce_product_subcategories' ) ) {
|
||||||
|
|
||||||
if ( $args['force_display'] ) {
|
if ( $args['force_display'] ) {
|
||||||
// We can still render if display is forced.
|
// We can still render if display is forced.
|
||||||
woocommerce_output_product_categories( array(
|
woocommerce_output_product_categories(
|
||||||
|
array(
|
||||||
'before' => $args['before'],
|
'before' => $args['before'],
|
||||||
'after' => $args['after'],
|
'after' => $args['after'],
|
||||||
'parent_id' => is_product_category() ? get_queried_object_id() : 0,
|
'parent_id' => is_product_category() ? get_queried_object_id() : 0,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
// Output nothing. woocommerce_maybe_show_product_subcategories will handle the output of cats.
|
// Output nothing. woocommerce_maybe_show_product_subcategories will handle the output of cats.
|
||||||
|
@ -2282,11 +2350,14 @@ if ( ! function_exists( 'woocommerce_output_product_categories' ) ) {
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
function woocommerce_output_product_categories( $args = array() ) {
|
function woocommerce_output_product_categories( $args = array() ) {
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args(
|
||||||
|
$args,
|
||||||
|
array(
|
||||||
'before' => apply_filters( 'woocommerce_before_output_product_categories', '' ),
|
'before' => apply_filters( 'woocommerce_before_output_product_categories', '' ),
|
||||||
'after' => apply_filters( 'woocommerce_after_output_product_categories', '' ),
|
'after' => apply_filters( 'woocommerce_after_output_product_categories', '' ),
|
||||||
'parent_id' => 0,
|
'parent_id' => 0,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$product_categories = woocommerce_get_product_subcategories( $args['parent_id'] );
|
$product_categories = woocommerce_get_product_subcategories( $args['parent_id'] );
|
||||||
|
|
||||||
|
@ -2297,9 +2368,12 @@ if ( ! function_exists( 'woocommerce_output_product_categories' ) ) {
|
||||||
echo $args['before']; // WPCS: XSS ok.
|
echo $args['before']; // WPCS: XSS ok.
|
||||||
|
|
||||||
foreach ( $product_categories as $category ) {
|
foreach ( $product_categories as $category ) {
|
||||||
wc_get_template( 'content-product_cat.php', array(
|
wc_get_template(
|
||||||
|
'content-product_cat.php',
|
||||||
|
array(
|
||||||
'category' => $category,
|
'category' => $category,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo $args['after']; // WPCS: XSS ok.
|
echo $args['after']; // WPCS: XSS ok.
|
||||||
|
@ -2321,14 +2395,19 @@ if ( ! function_exists( 'woocommerce_get_product_subcategories' ) ) {
|
||||||
|
|
||||||
if ( false === $product_categories ) {
|
if ( false === $product_categories ) {
|
||||||
// NOTE: using child_of instead of parent - this is not ideal but due to a WP bug ( https://core.trac.wordpress.org/ticket/15626 ) pad_counts won't work.
|
// NOTE: using child_of instead of parent - this is not ideal but due to a WP bug ( https://core.trac.wordpress.org/ticket/15626 ) pad_counts won't work.
|
||||||
$product_categories = get_categories( apply_filters( 'woocommerce_product_subcategories_args', array(
|
$product_categories = get_categories(
|
||||||
|
apply_filters(
|
||||||
|
'woocommerce_product_subcategories_args',
|
||||||
|
array(
|
||||||
'parent' => $parent_id,
|
'parent' => $parent_id,
|
||||||
'menu_order' => 'ASC',
|
'menu_order' => 'ASC',
|
||||||
'hide_empty' => 0,
|
'hide_empty' => 0,
|
||||||
'hierarchical' => 1,
|
'hierarchical' => 1,
|
||||||
'taxonomy' => 'product_cat',
|
'taxonomy' => 'product_cat',
|
||||||
'pad_counts' => 1,
|
'pad_counts' => 1,
|
||||||
) ) );
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
wp_cache_set( 'product-category-hierarchy-' . $parent_id, $product_categories, 'product_cat' );
|
wp_cache_set( 'product-category-hierarchy-' . $parent_id, $product_categories, 'product_cat' );
|
||||||
}
|
}
|
||||||
|
@ -2391,9 +2470,12 @@ if ( ! function_exists( 'woocommerce_order_details_table' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_get_template( 'order/order-details.php', array(
|
wc_get_template(
|
||||||
|
'order/order-details.php',
|
||||||
|
array(
|
||||||
'order_id' => $order_id,
|
'order_id' => $order_id,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2409,9 +2491,12 @@ if ( ! function_exists( 'woocommerce_order_downloads_table' ) ) {
|
||||||
if ( ! $downloads ) {
|
if ( ! $downloads ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wc_get_template( 'order/order-downloads.php', array(
|
wc_get_template(
|
||||||
|
'order/order-downloads.php',
|
||||||
|
array(
|
||||||
'downloads' => $downloads,
|
'downloads' => $downloads,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2427,10 +2512,13 @@ if ( ! function_exists( 'woocommerce_order_again_button' ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
wc_get_template( 'order/order-again.php', array(
|
wc_get_template(
|
||||||
|
'order/order-again.php',
|
||||||
|
array(
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'order_again_url' => wp_nonce_url( add_query_arg( 'order_again', $order->get_id(), wc_get_cart_url() ), 'woocommerce-order_again' ),
|
'order_again_url' => wp_nonce_url( add_query_arg( 'order_again', $order->get_id(), wc_get_cart_url() ), 'woocommerce-order_again' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2701,9 +2789,12 @@ if ( ! function_exists( 'get_product_search_form' ) ) {
|
||||||
|
|
||||||
do_action( 'pre_get_product_search_form' );
|
do_action( 'pre_get_product_search_form' );
|
||||||
|
|
||||||
wc_get_template( 'product-searchform.php', array(
|
wc_get_template(
|
||||||
|
'product-searchform.php',
|
||||||
|
array(
|
||||||
'index' => $product_search_form_index++,
|
'index' => $product_search_form_index++,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$form = apply_filters( 'get_product_search_form', ob_get_clean() );
|
$form = apply_filters( 'get_product_search_form', ob_get_clean() );
|
||||||
|
|
||||||
|
@ -2764,7 +2855,9 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) {
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
*/
|
*/
|
||||||
function wc_dropdown_variation_attribute_options( $args = array() ) {
|
function wc_dropdown_variation_attribute_options( $args = array() ) {
|
||||||
$args = wp_parse_args( apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ), array(
|
$args = wp_parse_args(
|
||||||
|
apply_filters( 'woocommerce_dropdown_variation_attribute_options_args', $args ),
|
||||||
|
array(
|
||||||
'options' => false,
|
'options' => false,
|
||||||
'attribute' => false,
|
'attribute' => false,
|
||||||
'product' => false,
|
'product' => false,
|
||||||
|
@ -2773,7 +2866,8 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) {
|
||||||
'id' => '',
|
'id' => '',
|
||||||
'class' => '',
|
'class' => '',
|
||||||
'show_option_none' => __( 'Choose an option', 'woocommerce' ),
|
'show_option_none' => __( 'Choose an option', 'woocommerce' ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Get selected value.
|
// Get selected value.
|
||||||
if ( false === $args['selected'] && $args['attribute'] && $args['product'] instanceof WC_Product ) {
|
if ( false === $args['selected'] && $args['attribute'] && $args['product'] instanceof WC_Product ) {
|
||||||
|
@ -2801,9 +2895,13 @@ if ( ! function_exists( 'wc_dropdown_variation_attribute_options' ) ) {
|
||||||
if ( ! empty( $options ) ) {
|
if ( ! empty( $options ) ) {
|
||||||
if ( $product && taxonomy_exists( $attribute ) ) {
|
if ( $product && taxonomy_exists( $attribute ) ) {
|
||||||
// Get terms if this is a taxonomy - ordered. We need the names too.
|
// Get terms if this is a taxonomy - ordered. We need the names too.
|
||||||
$terms = wc_get_product_terms( $product->get_id(), $attribute, array(
|
$terms = wc_get_product_terms(
|
||||||
|
$product->get_id(),
|
||||||
|
$attribute,
|
||||||
|
array(
|
||||||
'fields' => 'all',
|
'fields' => 'all',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ( $terms as $term ) {
|
foreach ( $terms as $term ) {
|
||||||
if ( in_array( $term->slug, $options, true ) ) {
|
if ( in_array( $term->slug, $options, true ) ) {
|
||||||
|
@ -2848,9 +2946,12 @@ if ( ! function_exists( 'woocommerce_account_content' ) ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No endpoint found? Default to dashboard.
|
// No endpoint found? Default to dashboard.
|
||||||
wc_get_template( 'myaccount/dashboard.php', array(
|
wc_get_template(
|
||||||
|
'myaccount/dashboard.php',
|
||||||
|
array(
|
||||||
'current_user' => get_user_by( 'id', get_current_user_id() ),
|
'current_user' => get_user_by( 'id', get_current_user_id() ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2873,11 +2974,16 @@ if ( ! function_exists( 'woocommerce_account_orders' ) ) {
|
||||||
*/
|
*/
|
||||||
function woocommerce_account_orders( $current_page ) {
|
function woocommerce_account_orders( $current_page ) {
|
||||||
$current_page = empty( $current_page ) ? 1 : absint( $current_page );
|
$current_page = empty( $current_page ) ? 1 : absint( $current_page );
|
||||||
$customer_orders = wc_get_orders( apply_filters( 'woocommerce_my_account_my_orders_query', array(
|
$customer_orders = wc_get_orders(
|
||||||
|
apply_filters(
|
||||||
|
'woocommerce_my_account_my_orders_query',
|
||||||
|
array(
|
||||||
'customer' => get_current_user_id(),
|
'customer' => get_current_user_id(),
|
||||||
'page' => $current_page,
|
'page' => $current_page,
|
||||||
'paginate' => true,
|
'paginate' => true,
|
||||||
) ) );
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
wc_get_template(
|
wc_get_template(
|
||||||
'myaccount/orders.php',
|
'myaccount/orders.php',
|
||||||
|
@ -2991,7 +3097,11 @@ if ( ! function_exists( 'wc_get_email_order_items' ) ) {
|
||||||
$args = wp_parse_args( $args, $defaults );
|
$args = wp_parse_args( $args, $defaults );
|
||||||
$template = $args['plain_text'] ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
|
$template = $args['plain_text'] ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
|
||||||
|
|
||||||
wc_get_template( $template, apply_filters( 'woocommerce_email_order_items_args', array(
|
wc_get_template(
|
||||||
|
$template,
|
||||||
|
apply_filters(
|
||||||
|
'woocommerce_email_order_items_args',
|
||||||
|
array(
|
||||||
'order' => $order,
|
'order' => $order,
|
||||||
'items' => $order->get_items(),
|
'items' => $order->get_items(),
|
||||||
'show_download_links' => $order->is_download_permitted() && ! $args['sent_to_admin'],
|
'show_download_links' => $order->is_download_permitted() && ! $args['sent_to_admin'],
|
||||||
|
@ -3001,7 +3111,9 @@ if ( ! function_exists( 'wc_get_email_order_items' ) ) {
|
||||||
'image_size' => $args['image_size'],
|
'image_size' => $args['image_size'],
|
||||||
'plain_text' => $args['plain_text'],
|
'plain_text' => $args['plain_text'],
|
||||||
'sent_to_admin' => $args['sent_to_admin'],
|
'sent_to_admin' => $args['sent_to_admin'],
|
||||||
) ) );
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_email_order_items_table', ob_get_clean(), $order );
|
return apply_filters( 'woocommerce_email_order_items_table', ob_get_clean(), $order );
|
||||||
}
|
}
|
||||||
|
@ -3019,7 +3131,9 @@ if ( ! function_exists( 'wc_display_item_meta' ) ) {
|
||||||
function wc_display_item_meta( $item, $args = array() ) {
|
function wc_display_item_meta( $item, $args = array() ) {
|
||||||
$strings = array();
|
$strings = array();
|
||||||
$html = '';
|
$html = '';
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args(
|
||||||
|
$args,
|
||||||
|
array(
|
||||||
'before' => '<ul class="wc-item-meta"><li>',
|
'before' => '<ul class="wc-item-meta"><li>',
|
||||||
'after' => '</li></ul>',
|
'after' => '</li></ul>',
|
||||||
'separator' => '</li><li>',
|
'separator' => '</li><li>',
|
||||||
|
@ -3027,7 +3141,8 @@ if ( ! function_exists( 'wc_display_item_meta' ) ) {
|
||||||
'autop' => false,
|
'autop' => false,
|
||||||
'label_before' => '<strong class="wc-item-meta-label">',
|
'label_before' => '<strong class="wc-item-meta-label">',
|
||||||
'label_after' => ':</strong> ',
|
'label_after' => ':</strong> ',
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
foreach ( $item->get_formatted_meta_data() as $meta_id => $meta ) {
|
foreach ( $item->get_formatted_meta_data() as $meta_id => $meta ) {
|
||||||
$value = $args['autop'] ? wp_kses_post( $meta->display_value ) : wp_kses_post( make_clickable( trim( $meta->display_value ) ) );
|
$value = $args['autop'] ? wp_kses_post( $meta->display_value ) : wp_kses_post( make_clickable( trim( $meta->display_value ) ) );
|
||||||
|
@ -3060,13 +3175,16 @@ if ( ! function_exists( 'wc_display_item_downloads' ) ) {
|
||||||
function wc_display_item_downloads( $item, $args = array() ) {
|
function wc_display_item_downloads( $item, $args = array() ) {
|
||||||
$strings = array();
|
$strings = array();
|
||||||
$html = '';
|
$html = '';
|
||||||
$args = wp_parse_args( $args, array(
|
$args = wp_parse_args(
|
||||||
|
$args,
|
||||||
|
array(
|
||||||
'before' => '<ul class ="wc-item-downloads"><li>',
|
'before' => '<ul class ="wc-item-downloads"><li>',
|
||||||
'after' => '</li></ul>',
|
'after' => '</li></ul>',
|
||||||
'separator' => '</li><li>',
|
'separator' => '</li><li>',
|
||||||
'echo' => true,
|
'echo' => true,
|
||||||
'show_url' => false,
|
'show_url' => false,
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$downloads = is_object( $item ) && $item->is_type( 'line_item' ) ? $item->get_item_downloads() : array();
|
$downloads = is_object( $item ) && $item->is_type( 'line_item' ) ? $item->get_item_downloads() : array();
|
||||||
|
|
||||||
|
@ -3118,11 +3236,14 @@ if ( ! function_exists( 'woocommerce_photoswipe' ) ) {
|
||||||
* @param WC_Product $product Product Object.
|
* @param WC_Product $product Product Object.
|
||||||
*/
|
*/
|
||||||
function wc_display_product_attributes( $product ) {
|
function wc_display_product_attributes( $product ) {
|
||||||
wc_get_template( 'single-product/product-attributes.php', array(
|
wc_get_template(
|
||||||
|
'single-product/product-attributes.php',
|
||||||
|
array(
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'attributes' => array_filter( $product->get_attributes(), 'wc_attributes_array_filter_visible' ),
|
'attributes' => array_filter( $product->get_attributes(), 'wc_attributes_array_filter_visible' ),
|
||||||
'display_dimensions' => apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ),
|
'display_dimensions' => apply_filters( 'wc_product_enable_dimensions_display', $product->has_weight() || $product->has_dimensions() ),
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3139,11 +3260,14 @@ function wc_get_stock_html( $product ) {
|
||||||
if ( ! empty( $availability['availability'] ) ) {
|
if ( ! empty( $availability['availability'] ) ) {
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
wc_get_template( 'single-product/stock.php', array(
|
wc_get_template(
|
||||||
|
'single-product/stock.php',
|
||||||
|
array(
|
||||||
'product' => $product,
|
'product' => $product,
|
||||||
'class' => $availability['class'],
|
'class' => $availability['class'],
|
||||||
'availability' => $availability['availability'],
|
'availability' => $availability['availability'],
|
||||||
) );
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$html = ob_get_clean();
|
$html = ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue