Changeset 45667 for trunk/src/wp-admin/includes/template.php
- Timestamp:
- 07/25/2019 12:47:53 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/template.php
r45657 r45667 101 101 $params = apply_filters( 'wp_terms_checklist_args', $args, $post_id ); 102 102 103 $ r= wp_parse_args( $params, $defaults );104 105 if ( empty( $ r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {103 $parsed_args = wp_parse_args( $params, $defaults ); 104 105 if ( empty( $parsed_args['walker'] ) || ! ( $parsed_args['walker'] instanceof Walker ) ) { 106 106 $walker = new Walker_Category_Checklist; 107 107 } else { 108 $walker = $ r['walker'];109 } 110 111 $taxonomy = $ r['taxonomy'];112 $descendants_and_self = (int) $ r['descendants_and_self'];108 $walker = $parsed_args['walker']; 109 } 110 111 $taxonomy = $parsed_args['taxonomy']; 112 $descendants_and_self = (int) $parsed_args['descendants_and_self']; 113 113 114 114 $args = array( 'taxonomy' => $taxonomy ); … … 117 117 $args['disabled'] = ! current_user_can( $tax->cap->assign_terms ); 118 118 119 $args['list_only'] = ! empty( $ r['list_only'] );120 121 if ( is_array( $ r['selected_cats'] ) ) {122 $args['selected_cats'] = $ r['selected_cats'];119 $args['list_only'] = ! empty( $parsed_args['list_only'] ); 120 121 if ( is_array( $parsed_args['selected_cats'] ) ) { 122 $args['selected_cats'] = $parsed_args['selected_cats']; 123 123 } elseif ( $post_id ) { 124 124 $args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) ); … … 126 126 $args['selected_cats'] = array(); 127 127 } 128 if ( is_array( $ r['popular_cats'] ) ) {129 $args['popular_cats'] = $ r['popular_cats'];128 if ( is_array( $parsed_args['popular_cats'] ) ) { 129 $args['popular_cats'] = $parsed_args['popular_cats']; 130 130 } else { 131 131 $args['popular_cats'] = get_terms( … … 157 157 $output = ''; 158 158 159 if ( $ r['checked_ontop'] ) {159 if ( $parsed_args['checked_ontop'] ) { 160 160 // Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache) 161 161 $checked_categories = array(); … … 175 175 $output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) ); 176 176 177 if ( $ r['echo'] ) {177 if ( $parsed_args['echo'] ) { 178 178 echo $output; 179 179 } … … 2442 2442 */ 2443 2443 function wp_star_rating( $args = array() ) { 2444 $defaults = array(2444 $defaults = array( 2445 2445 'rating' => 0, 2446 2446 'type' => 'rating', … … 2448 2448 'echo' => true, 2449 2449 ); 2450 $ r= wp_parse_args( $args, $defaults );2450 $parsed_args = wp_parse_args( $args, $defaults ); 2451 2451 2452 2452 // Non-English decimal places when the $rating is coming from a string 2453 $rating = (float) str_replace( ',', '.', $ r['rating'] );2453 $rating = (float) str_replace( ',', '.', $parsed_args['rating'] ); 2454 2454 2455 2455 // Convert Percentage to star rating, 0..5 in .5 increments 2456 if ( 'percent' === $ r['type'] ) {2456 if ( 'percent' === $parsed_args['type'] ) { 2457 2457 $rating = round( $rating / 10, 0 ) / 2; 2458 2458 } … … 2463 2463 $empty_stars = 5 - $full_stars - $half_stars; 2464 2464 2465 if ( $ r['number'] ) {2465 if ( $parsed_args['number'] ) { 2466 2466 /* translators: 1: the rating, 2: the number of ratings */ 2467 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $ r['number'] );2468 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $ r['number'] ) );2467 $format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $parsed_args['number'] ); 2468 $title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $parsed_args['number'] ) ); 2469 2469 } else { 2470 2470 /* translators: %s: the rating */ … … 2479 2479 $output .= '</div>'; 2480 2480 2481 if ( $ r['echo'] ) {2481 if ( $parsed_args['echo'] ) { 2482 2482 echo $output; 2483 2483 }
Note: See TracChangeset
for help on using the changeset viewer.