Changeset 47808 for trunk/src/wp-includes/class-wp-term-query.php
- Timestamp:
- 05/16/2020 06:40:52 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-term-query.php
r46652 r47808 254 254 } 255 255 256 if ( 'all' == $query['get'] ) {256 if ( 'all' === $query['get'] ) { 257 257 $query['childless'] = false; 258 258 $query['child_of'] = 0; … … 342 342 } 343 343 344 if ( 'all' == $args['get'] ) {344 if ( 'all' === $args['get'] ) { 345 345 $args['childless'] = false; 346 346 $args['child_of'] = 0; … … 383 383 384 384 if ( ! $in_hierarchy ) { 385 if ( 'count' == $args['fields'] ) {385 if ( 'count' === $args['fields'] ) { 386 386 return 0; 387 387 } else { … … 546 546 547 547 $hierarchical = $args['hierarchical']; 548 if ( 'count' == $args['fields'] ) {548 if ( 'count' === $args['fields'] ) { 549 549 $hierarchical = false; 550 550 } … … 710 710 } 711 711 712 if ( 'count' == $_fields ) {712 if ( 'count' === $_fields ) { 713 713 $count = $wpdb->get_var( $this->request ); 714 714 wp_cache_set( $cache_key, $count, 'terms' ); … … 717 717 718 718 $terms = $wpdb->get_results( $this->request ); 719 if ( 'all' == $_fields || 'all_with_object_id' === $_fields ) { 719 720 if ( 'all' === $_fields || 'all_with_object_id' === $_fields ) { 720 721 update_term_cache( $terms ); 721 722 } … … 742 743 743 744 // Update term counts to include children. 744 if ( $args['pad_counts'] && 'all' == $_fields ) {745 if ( $args['pad_counts'] && 'all' === $_fields ) { 745 746 foreach ( $taxonomies as $_tax ) { 746 747 _pad_term_counts( $terms, $_tax ); … … 774 775 * removed. 775 776 */ 776 if ( ! empty( $args['object_ids'] ) && 'all_with_object_id' != $_fields ) {777 if ( ! empty( $args['object_ids'] ) && 'all_with_object_id' !== $_fields ) { 777 778 $_tt_ids = array(); 778 779 $_terms = array(); … … 790 791 791 792 $_terms = array(); 792 if ( 'id=>parent' == $_fields ) {793 if ( 'id=>parent' === $_fields ) { 793 794 foreach ( $terms as $term ) { 794 795 $_terms[ $term->term_id ] = $term->parent; 795 796 } 796 } elseif ( 'ids' == $_fields ) {797 } elseif ( 'ids' === $_fields ) { 797 798 foreach ( $terms as $term ) { 798 799 $_terms[] = (int) $term->term_id; 799 800 } 800 } elseif ( 'tt_ids' == $_fields ) {801 } elseif ( 'tt_ids' === $_fields ) { 801 802 foreach ( $terms as $term ) { 802 803 $_terms[] = (int) $term->term_taxonomy_id; 803 804 } 804 } elseif ( 'names' == $_fields ) {805 } elseif ( 'names' === $_fields ) { 805 806 foreach ( $terms as $term ) { 806 807 $_terms[] = $term->name; 807 808 } 808 } elseif ( 'slugs' == $_fields ) {809 } elseif ( 'slugs' === $_fields ) { 809 810 foreach ( $terms as $term ) { 810 811 $_terms[] = $term->slug; 811 812 } 812 } elseif ( 'id=>name' == $_fields ) {813 } elseif ( 'id=>name' === $_fields ) { 813 814 foreach ( $terms as $term ) { 814 815 $_terms[ $term->term_id ] = $term->name; 815 816 } 816 } elseif ( 'id=>slug' == $_fields ) {817 } elseif ( 'id=>slug' === $_fields ) { 817 818 foreach ( $terms as $term ) { 818 819 $_terms[ $term->term_id ] = $term->slug; … … 863 864 } elseif ( 'term_order' === $_orderby ) { 864 865 $orderby = 'tr.term_order'; 865 } elseif ( 'include' == $_orderby && ! empty( $this->query_vars['include'] ) ) {866 } elseif ( 'include' === $_orderby && ! empty( $this->query_vars['include'] ) ) { 866 867 $include = implode( ',', wp_parse_id_list( $this->query_vars['include'] ) ); 867 868 $orderby = "FIELD( t.term_id, $include )"; 868 } elseif ( 'slug__in' == $_orderby && ! empty( $this->query_vars['slug'] ) && is_array( $this->query_vars['slug'] ) ) {869 } elseif ( 'slug__in' === $_orderby && ! empty( $this->query_vars['slug'] ) && is_array( $this->query_vars['slug'] ) ) { 869 870 $slugs = implode( "', '", array_map( 'sanitize_title_for_query', $this->query_vars['slug'] ) ); 870 871 $orderby = "FIELD( t.slug, '" . $slugs . "')"; 871 } elseif ( 'none' == $_orderby ) {872 } elseif ( 'none' === $_orderby ) { 872 873 $orderby = ''; 873 } elseif ( empty( $_orderby ) || 'id' == $_orderby || 'term_id' === $_orderby ) {874 } elseif ( empty( $_orderby ) || 'id' === $_orderby || 'term_id' === $_orderby ) { 874 875 $orderby = 't.term_id'; 875 876 } else {
Note: See TracChangeset
for help on using the changeset viewer.