Skip to content

Commit

Permalink
Fix linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
louwie17 committed Feb 23, 2023
1 parent e19baf0 commit 470f1e0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
Expand Up @@ -4,14 +4,12 @@
*
* Display the product images meta box.
*
* @author WooThemes
* @category Admin
* @package WooCommerce\Admin\Meta Boxes
* @version 2.1.0
* @version 7.5.0
*/

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}

/**
Expand All @@ -22,7 +20,19 @@ class WC_Meta_Box_Product_Categories {
/**
* Output the metabox.
*
* @param WP_Post $post
* @param WP_Post $post Current post object.
* @param array $box {
* Categories meta box arguments.
*
* @type string $id Meta box 'id' attribute.
* @type string $title Meta box title.
* @type callable $callback Meta box display callback.
* @type array $args {
* Extra meta box arguments.
*
* @type string $taxonomy Taxonomy. Default 'category'.
* }
* }
*/
public static function output( $post, $box ) {
$defaults = array( 'taxonomy' => 'category' );
Expand All @@ -32,18 +42,18 @@ public static function output( $post, $box ) {
$args = $box['args'];
}
$parsed_args = wp_parse_args( $args, $defaults );
$tax_name = esc_attr( $parsed_args['taxonomy'] );
$tax_name = $parsed_args['taxonomy'];
$selected_categories = wp_get_object_terms( $post->ID, 'product_cat' );
?>
<div id="taxonomy-<?php echo $tax_name; ?>-metabox"></div>
<? foreach ( (array) $selected_categories as $term ) { ?>
<div id="taxonomy-<?php echo esc_attr( $tax_name ); ?>-metabox"></div>
<?php foreach ( (array) $selected_categories as $term ) { ?>
<input
type="hidden"
value="<?php echo $term->term_id; ?>"
name="tax_input[<?php echo $tax_name; ?>][]"
data-name="<?php echo $term->name; ?>"
value="<?php echo esc_attr( $term->term_id ); ?>"
name="tax_input[<?php echo esc_attr( $tax_name ); ?>][]"
data-name="<?php echo esc_attr( $term->name ); ?>"
/>
<?php
<?php
}
}
}
}
4 changes: 2 additions & 2 deletions plugins/woocommerce/includes/class-wc-ajax.php
Expand Up @@ -1700,7 +1700,7 @@ public static function json_search_categories() {
}

$hide_empty = isset( $_GET['hide_empty'] ) ? wc_clean( wp_unslash( $_GET['hide_empty'] ) ) : true;
$hide_empty = $hide_empty === 'false' ? false : true;
$hide_empty = 'false' === $hide_empty ? false : true;
$found_categories = array();
$args = array(
'taxonomy' => array( 'product_cat' ),
Expand Down Expand Up @@ -1800,7 +1800,7 @@ function( $term ) use ( $current_child ) {
$parent_terms = array_filter(
array_values( $terms_map ),
function( $term ) {
return $term->parent === 0;
return 0 === $term->parent;
}
);
wp_send_json( apply_filters( 'woocommerce_json_search_found_categories', $parent_terms ) );
Expand Down

0 comments on commit 470f1e0

Please sign in to comment.