PluginProbe ʕ •ᴥ•ʔ
Strong Testimonials / 2.38
Strong Testimonials v2.38
3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.0.1 2.30.9 2.31.10 2.32 2.32.1 2.32.2 2.32.3 2.32.4 2.33 2.34 2.35 2.36 2.37 2.38 2.38.1 2.39 2.39.1 2.39.2 2.39.3 2.40.0 2.40.1 2.40.2 2.40.3 2.40.4 2.40.5 2.40.6 2.40.7 2.41.0 2.41.1 2.50.0 2.50.1 2.50.2 2.50.3 2.50.4 2.51.0 2.51.1 2.51.2 2.51.3 2.51.4 2.51.5 2.51.6 2.51.7 2.51.8 2.51.9 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.1.10 3.1.11 3.1.12 3.1.13 3.1.14 3.1.15 3.1.16 3.1.17 3.1.18 3.1.19 3.1.2 3.1.20 3.1.3 3.1.4 3.1.5 3.1.6 3.1.7 3.1.8 3.1.9 3.2.0 3.2.1 3.2.10 3.2.11 3.2.12 3.2.13 3.2.14 3.2.15 3.2.16 3.2.17 3.2.18 3.2.19 3.2.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0
strong-testimonials / admin / class-walker-strong-category-checklist.php
strong-testimonials / admin Last commit date
about 7 years ago css 7 years ago img 7 years ago js 7 years ago menu 7 years ago partials 7 years ago scss 7 years ago settings 7 years ago admin-notices.php 7 years ago admin.php 7 years ago class-strong-testimonials-addons.php 7 years ago class-strong-testimonials-admin-category-list.php 7 years ago class-strong-testimonials-admin-list.php 7 years ago class-strong-testimonials-admin-scripts.php 7 years ago class-strong-testimonials-defaults.php 7 years ago class-strong-testimonials-exporter.php 7 years ago class-strong-testimonials-help.php 7 years ago class-strong-testimonials-list-table.php 7 years ago class-strong-testimonials-page-shortcodes.php 7 years ago class-strong-testimonials-post-editor.php 7 years ago class-strong-testimonials-updater.php 7 years ago class-strong-testimonials-upsell.php 7 years ago class-strong-views-list-table.php 7 years ago class-walker-strong-category-checklist.php 7 years ago class-walker-strong-form-category-checklist.php 7 years ago compat.php 7 years ago custom-fields-ajax.php 7 years ago custom-fields.php 7 years ago form-preview.php 7 years ago view-list-order.php 7 years ago views-ajax.php 7 years ago views-validate.php 7 years ago views.php 7 years ago
class-walker-strong-category-checklist.php
128 lines
1 <?php
2 /**
3 * Taxonomy API: Walker_Strong_Category_Checklist class
4 *
5 * @since 2.2.0
6 */
7
8 /**
9 * Custom walker class to output an unordered list of category checkbox input elements.
10 *
11 * @since 2.5.1
12 *
13 * @see Walker
14 * @see wp_category_checklist()
15 * @see wp_terms_checklist()
16 */
17 class Walker_Strong_Category_Checklist extends Walker {
18 public $tree_type = 'category';
19 public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
20
21 /**
22 * Starts the list before the elements are added.
23 *
24 * @see Walker:start_lvl()
25 *
26 * @since 2.5.1
27 *
28 * @param string $output Passed by reference. Used to append additional content.
29 * @param int $depth Depth of category. Used for tab indentation.
30 * @param array $args An array of arguments. @see wp_terms_checklist()
31 */
32 public function start_lvl( &$output, $depth = 0, $args = array() ) {
33 $indent = str_repeat("\t", $depth);
34 $output .= "$indent<ul class='children'>\n";
35 }
36
37 /**
38 * Ends the list of after the elements are added.
39 *
40 * @see Walker::end_lvl()
41 *
42 * @since 2.5.1
43 *
44 * @param string $output Passed by reference. Used to append additional content.
45 * @param int $depth Depth of category. Used for tab indentation.
46 * @param array $args An array of arguments. @see wp_terms_checklist()
47 */
48 public function end_lvl( &$output, $depth = 0, $args = array() ) {
49 $indent = str_repeat("\t", $depth);
50 $output .= "$indent</ul>\n";
51 }
52
53 /**
54 * Start the element output.
55 *
56 * @see Walker::start_el()
57 *
58 * @since 2.5.1
59 *
60 * @param string $output Passed by reference. Used to append additional content.
61 * @param object $category The current term object.
62 * @param int $depth Depth of the term in reference to parents. Default 0.
63 * @param array $args An array of arguments. @see wp_terms_checklist()
64 * @param int $id ID of the current term.
65 */
66 public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) {
67 if ( empty( $args['taxonomy'] ) ) {
68 $taxonomy = 'wpm-testimonial-category';
69 } else {
70 $taxonomy = $args['taxonomy'];
71 }
72
73 $name = "view[data][category]";
74
75 $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats'];
76 $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : '';
77
78 $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats'];
79
80 $args['cat_counts'] = empty( $args['cat_counts'] ) ? array() : $args['cat_counts'];
81
82 if ( ! empty( $args['list_only'] ) ) {
83 $aria_cheched = 'false';
84 $inner_class = 'category';
85
86 if ( in_array( $category->term_id, $args['selected_cats'] ) ) {
87 $inner_class .= ' selected';
88 $aria_cheched = 'true';
89 }
90
91 /** This filter is documented in wp-includes/category-template.php */
92 $output .= "\n" . '<li' . $class . '>' .
93 '<div class="' . $inner_class . '" data-term-id=' . $category->term_id .
94 ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' .
95 esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>';
96 }
97 else {
98 /** This filter is documented in wp-includes/category-template.php */
99 // newlines make for consistent spacing without extra CSS
100 $output .= "\n" . '<li id="li-category-' . $category->term_id . '"' . $class . '>' . "\n";
101 $output .= '<input value="' . $category->term_id . '" type="checkbox" name="' . $name . '[]"'
102 . ' id="category-' . $category->term_id . '"'
103 . checked( in_array( $category->term_id, $args['selected_cats'] ), true, false )
104 . disabled( empty( $args['disabled'] ), false, false ) . ' />' . "\n";
105 $output .= '<label class="selectit" for="category-' . $category->term_id . '">' . "\n";
106 $output .= esc_html( apply_filters( 'the_category', $category->name ) )
107 . ' <span class="cat-count">(' . $category->count . ')</span>';
108 $output .= '</label>';
109 }
110 }
111
112 /**
113 * Ends the element output, if needed.
114 *
115 * @see Walker::end_el()
116 *
117 * @since 2.5.1
118 *
119 * @param string $output Passed by reference. Used to append additional content.
120 * @param object $category The current term object.
121 * @param int $depth Depth of the term in reference to parents. Default 0.
122 * @param array $args An array of arguments. @see wp_terms_checklist()
123 */
124 public function end_el( &$output, $category, $depth = 0, $args = array() ) {
125 $output .= "</li>\n";
126 }
127 }
128