- Timestamp:
- 06/01/2024 10:19:51 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/classes/class-bp-walker-category-checklist.php
r10811 r13887 1 1 <?php 2 /** 3 * BP_Walker_Category_Checklist class. 4 * 5 * @package BuddyPress 6 * @subpackage Core 7 * @since 2.5.0 8 */ 9 10 // Exit if accessed directly. 11 defined( 'ABSPATH' ) || exit; 12 2 13 /** 3 14 * Walker class to output an unordered list of category checkbox input elements. … … 10 21 */ 11 22 class BP_Walker_Category_Checklist extends Walker { 23 /** 24 * Tree type. 25 * 26 * @since 2.5.0 27 * 28 * @var string 29 */ 12 30 public $tree_type = 'category'; 13 public $db_fields = array( 'parent' => 'parent', 'id' => 'term_id' ); 31 32 /** 33 * DB Fields. 34 * 35 * @since 2.5.0 36 * 37 * @var array 38 */ 39 public $db_fields = array( 40 'parent' => 'parent', 41 'id' => 'term_id', 42 ); 14 43 15 44 /** … … 37 66 */ 38 67 public function end_lvl( &$output, $depth = 0, $args = array() ) { 39 $indent = str_repeat( "\t", $depth );68 $indent = str_repeat( "\t", $depth ); 40 69 $output .= "$indent</ul>\n"; 41 70 } … … 57 86 } 58 87 59 if ( $taxonomy == 'category') {88 if ( 'category' === $taxonomy ) { 60 89 $name = 'post_category'; 61 90 } else { … … 64 93 65 94 $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; 66 $class = in_array( $category->term_id, $args['popular_cats']) ? ' class="popular-category"' : '';95 $class = in_array( $category->term_id, $args['popular_cats'], true ) ? ' class="popular-category"' : ''; 67 96 68 97 $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; … … 70 99 if ( ! empty( $args['list_only'] ) ) { 71 100 $aria_cheched = 'false'; 72 $inner_class = 'category';101 $inner_class = 'category'; 73 102 74 if ( in_array( $category->term_id, $args['selected_cats'] ) ) {103 if ( in_array( $category->term_id, $args['selected_cats'], true ) ) { 75 104 $inner_class .= ' selected'; 76 105 $aria_cheched = 'true'; … … 85 114 /** This filter is documented in wp-includes/category-template.php */ 86 115 $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . 87 '<label for="in-' .$taxonomy.'-' . $category->term_id . '" class="selectit"><input value="' . $category->slug . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' .88 checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) .116 '<label for="in-' . $taxonomy . '-' . $category->term_id . '" class="selectit"><input value="' . $category->slug . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category->term_id . '"' . 117 checked( in_array( $category->term_id, $args['selected_cats'], true ), true, false ) . 89 118 disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . 90 119 esc_html( apply_filters( 'the_category', $category->description ) ) . '</label>'; … … 102 131 * @param object $category The current term object. 103 132 * @param int $depth Depth of the term in reference to parents. Default 0. 104 * @param array $args An array of arguments. @see wp_terms_checklist()133 * @param array $args An array of arguments. 105 134 */ 106 135 public function end_el( &$output, $category, $depth = 0, $args = array() ) {
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)