PluginProbe
Post Grid Gutenberg Blocks – PostX / 5.0.4
Post Grid Gutenberg Blocks – PostX v5.0.4
5.0.39 5.0.38 5.0.37 5.0.36 5.0.35 5.0.34 5.0.33 5.0.32 5.0.31 5.0.30 5.0.29 5.0.28 5.0.27 5.0.26 5.0.25 5.0.23 5.0.24 5.0.22 5.0.21 5.0.20 5.0.19 5.0.18 5.0.17 2.1.1 2.1.2 All 237 releases
ultimate-post / blocks / Advanced_Filter.php

Advanced_Filter.php in Post Grid Gutenberg Blocks – PostX 5.0.4, at blocks/Advanced_Filter.php

816 lines 20.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace ULTP\blocks;
3
4 use WP_Taxonomy;
5
6 defined( 'ABSPATH' ) || exit;
7
8 /**
9 * Class Advanced_Filter
10 */
11 class Advanced_Filter {
12 /**
13 * Types of pro select filters supported by the advanced filter.
14 *
15 * @var array
16 */
17 private $pro_select_types = array(
18 'adv_sort',
19 'custom_tax',
20 );
21
22 /**
23 * Order Value for select
24 *
25 * @var array
26 */
27 public $order = array(
28 array(
29 'id' => 'DESC',
30 'name' => 'DESC',
31 ),
32 array(
33 'id' => 'ASC',
34 'name' => 'ASC',
35 ),
36 );
37
38 /**
39 * Order by Value for select
40 *
41 * @var array
42 */
43 public $order_by = array(
44 array(
45 'id' => 'date',
46 'name' => 'Created Date',
47 ),
48 array(
49 'id' => 'modified',
50 'name' => 'Date Modified',
51 ),
52 array(
53 'id' => 'title',
54 'name' => 'Title',
55 ),
56 array(
57 'id' => 'menu_order',
58 'name' => 'Menu Order',
59 ),
60 array(
61 'id' => 'rand',
62 'name' => 'Random',
63 ),
64 // array(
65 // 'id' => 'post__in',
66 // 'name' => 'Post In',
67 // ),
68 array(
69 'id' => 'comment_count',
70 'name' => 'Number of Comments',
71 ),
72 );
73
74 /**
75 * Filter_select_options
76 *
77 * @param MIXED | $options (ARRAY).
78 * @param mixed | $filter (ARRAY).
79 * @return array
80 */
81 private function filter_select_options( $options, $filter ) {
82 $res = array();
83 $map = array();
84
85 foreach ( $options as $option ) {
86 $map[ $option['id'] ] = $option['name'];
87 }
88
89 foreach ( $filter as $f ) {
90
91 if ( isset( $map[ $f ] ) ) {
92 $res[] = array(
93 'id' => strtolower( $f ),
94 'name' => $map[ $f ],
95 );
96 }
97 }
98
99 return $res;
100 }
101
102 /**
103 * Advanced_Filter constructor.
104 */
105 public function __construct() {
106 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
107 add_action( 'init', array( $this, 'register' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
108 }
109
110 /**
111 * Get_adv_filter_options
112 *
113 * @return array
114 */
115 private function get_adv_filter_options() {
116 return array(
117 array(
118 'id' => 'popular_post_1_day_view',
119 'name' => __( 'Trending Today', 'ultimate-post' ),
120 ),
121 array(
122 'id' => 'popular_post_7_days_view',
123 'name' => __( 'This Week’s Popular Posts', 'ultimate-post' ),
124 ),
125 array(
126 'id' => 'popular_post_30_days_view',
127 'name' => __( 'Top Posts of the Month', 'ultimate-post' ),
128 ),
129 array(
130 'id' => 'popular_post_all_times_view',
131 'name' => __( 'All-Time Favorites', 'ultimate-post' ),
132 ),
133 array(
134 'id' => 'random_post',
135 'name' => __( 'Random Posts', 'ultimate-post' ),
136 ),
137 array(
138 'id' => 'random_post_7_days',
139 'name' => __( 'Random Posts (7 Days)', 'ultimate-post' ),
140 ),
141 array(
142 'id' => 'random_post_30_days',
143 'name' => __( 'Random Posts (30 Days)', 'ultimate-post' ),
144 ),
145 array(
146 'id' => 'latest_post_published',
147 'name' => __( 'Latest Posts - Published Date', 'ultimate-post' ),
148 ),
149 array(
150 'id' => 'latest_post_modified',
151 'name' => __( 'Latest Posts - Last Modified Date', 'ultimate-post' ),
152 ),
153 array(
154 'id' => 'oldest_post_published',
155 'name' => __( 'Oldest Posts - Published Date', 'ultimate-post' ),
156 ),
157 array(
158 'id' => 'oldest_post_modified',
159 'name' => __( 'Oldest Posts - Last Modified Date', 'ultimate-post' ),
160 ),
161 array(
162 'id' => 'alphabet_asc',
163 'name' => __( 'Alphabetical ASC', 'ultimate-post' ),
164 ),
165 array(
166 'id' => 'alphabet_desc',
167 'name' => __( 'Alphabetical DESC', 'ultimate-post' ),
168 ),
169 array(
170 'id' => 'sticky_posts',
171 'name' => __( 'Sticky Post', 'ultimate-post' ),
172 ),
173 array(
174 'id' => 'most_comment',
175 'name' => __( 'Most Comments', 'ultimate-post' ),
176 ),
177 array(
178 'id' => 'most_comment_1_day',
179 'name' => __( 'Most Comments (1 Day)', 'ultimate-post' ),
180 ),
181 array(
182 'id' => 'most_comment_7_days',
183 'name' => __( 'Most Comments (7 Days)', 'ultimate-post' ),
184 ),
185 array(
186 'id' => 'most_comment_30_days',
187 'name' => __( 'Most Comments (30 Days)', 'ultimate-post' ),
188 ),
189 );
190 }
191
192 /**
193 * Get_select_attributes
194 *
195 * @return array
196 */
197 public function get_select_attributes() {
198 return array(
199 'advanceId' => '',
200 'blockId' => '',
201 'advanceCss' => '',
202 'filterStyle' => 'dropdown',
203 'filterValues' => '["_all"]',
204 'dropdownOptionsType' => 'all',
205 'dropdownOptions' => '["_all"]',
206 'allText' => 'All',
207 'sPlaceholderText' => 'Search...',
208 'searchEnabled' => false,
209 );
210 }
211
212 /**
213 * Get_search_attributes
214 *
215 * @return array
216 */
217 public function get_search_attributes() {
218 return array(
219 'advanceId' => '',
220 'blockId' => '',
221 'advanceCss' => '',
222 'placeholder' => 'Search...',
223 );
224 }
225
226 /**
227 * Get_clear_attributes
228 *
229 * @return array
230 */
231 public function get_clear_attributes() {
232 return array(
233 'advanceId' => '',
234 'blockId' => '',
235 'clearButtonText' => 'Clear Filters',
236 'clearButtonPosition' => 'normal',
237 'cAlign' => 'margin-bottom: inherit',
238 );
239 }
240
241 public function register() {
242 register_block_type(
243 'ultimate-post/filter-select',
244 array(
245 'editor_script' => 'ultp-blocks-editor-script',
246 'editor_style' => 'ultp-blocks-editor-css',
247 'render_callback' => array( $this, 'select_content' ),
248 )
249 );
250
251 register_block_type(
252 'ultimate-post/filter-search-adv',
253 array(
254 'editor_script' => 'ultp-blocks-editor-script',
255 'editor_style' => 'ultp-blocks-editor-css',
256 'render_callback' => array( $this, 'search_content' ),
257 )
258 );
259
260 register_block_type(
261 'ultimate-post/filter-clear',
262 array(
263 'editor_script' => 'ultp-blocks-editor-script',
264 'editor_style' => 'ultp-blocks-editor-css',
265 'render_callback' => array( $this, 'clear_content' ),
266 )
267 );
268 }
269
270 /**
271 * Get_button_data
272 *
273 * @param mixed $type string.
274 * @param mixed $ids string.
275 * @param mixed $post_types string.
276 * @param mixed $allText string.
277 * @return array
278 */
279 public function get_button_data( $type, $ids, $post_types = '', $allText = 'All' ) {
280 $res = array();
281
282 if ( in_array( '_all', $ids ) ) {
283 $res['_all'] = $allText;
284 // $ids = array_filter($ids, function ($item) {
285 // return $item != '_all';
286 // });
287 }
288
289 $ids = implode( ',', $ids );
290
291 $adv_sort = $this->get_adv_filter_options();
292
293 switch ( $type ) {
294 case 'adv_sort':
295 $adv_sort_id = explode( ',', $ids );
296 foreach ( $adv_sort as $adv ) {
297 foreach ( $adv_sort_id as $id ) {
298 if ( $adv['id'] === $id ) {
299 $res[ $id ] = $adv['name'];
300 }
301 }
302 }
303 break;
304 case 'category':
305 if ( ! empty( $ids ) && $ids !== '_all' ) {
306 $categories = get_categories(
307 array(
308 'per_page' => -1,
309 'include' => $ids,
310 )
311 );
312
313 foreach ( $categories as $category ) {
314 $res[ $category->slug ] = $category->name;
315 }
316 }
317 break;
318 case 'tags':
319 if ( ! empty( $ids ) && $ids !== '_all' ) {
320 $tags = get_tags(
321 array(
322 'per_page' => -1,
323 'include' => $ids,
324 )
325 );
326
327 foreach ( $tags as $tag ) {
328 $res[ $tag->slug ] = $tag->name;
329 }
330 }
331 break;
332 case 'author':
333 if ( ! empty( $ids ) && $ids !== '_all' ) {
334 $authors = get_users(
335 array(
336 'per_page' => -1,
337 'role__in' => array( 'author' ),
338 'include' => $ids,
339 )
340 );
341
342 foreach ( $authors as $author ) {
343 $res[ $author->ID ] = $author->display_name;
344 }
345 }
346
347 break;
348 case 'order':
349 foreach ( $this->order as $order ) {
350 $res[ $order['id'] ] = $order['name'];
351 }
352 break;
353 case 'order_by':
354 $orders = explode( ',', $ids );
355 foreach ( $this->order_by as $order_by ) {
356 foreach ( $orders as $order ) {
357 if ( $order_by['id'] === $order ) {
358 $res[ $order ] = $order_by['name'];
359 }
360 }
361 }
362 break;
363 case 'custom_tax':
364 if ( $post_types == '' ) {
365 break;
366 }
367
368 $post_types = json_decode( $post_types );
369
370 foreach ( $post_types as $post_type ) {
371 $taxonomies = get_object_taxonomies( $post_type );
372 foreach ( $taxonomies as $taxonomy ) {
373 $terms = get_terms(
374 array(
375 'taxonomy' => $taxonomy,
376 'hide_empty' => false,
377 )
378 );
379 foreach ( $terms as $term ) {
380 $res[ $term->slug ] = array(
381 'name' => $term->name,
382 'taxonomy' => $taxonomy,
383 );
384 }
385 }
386 }
387
388 default:
389 break;
390 }
391
392 return $res;
393 }
394
395 /**
396 * Inserts all option depending on condition
397 *
398 * @param array $arr array.
399 * @param array $item all item.
400 * @param int $idx all item idx.
401 * @param string $mode mode.
402 * @return void
403 */
404 private function maybe_insert_all_option( &$arr, &$item, $idx, $mode ) {
405 if ( 'all' === $mode ) {
406 array_unshift( $arr, $item );
407 } elseif ( ! empty( $item ) && false !== $idx ) {
408 array_splice( $arr, $idx, 0, array( $item ) );
409 }
410 }
411
412 public function get_select_data( $type, $all_text, $post_types = '', $specific = array(), $mode = 'all' ) {
413
414 $all = null;
415 $all_idx = array_search( '_all', $specific, true );
416 $filtered_specific = $specific;
417
418 if ( false !== $all_idx || 'all' === $mode ) {
419 $all = array(
420 'id' => '_all',
421 'name' => $all_text,
422 );
423
424 $filtered_specific = array_filter(
425 $specific,
426 function ( $item ) {
427 return '_all' !== $item;
428 }
429 );
430 }
431
432 $adv_sort = $this->get_adv_filter_options();
433
434 switch ( $type ) {
435
436 case 'category':
437 $categories = array();
438
439 if ( 'all' === $mode || ( 'specific' === $mode && count( $filtered_specific ) > 0 ) ) {
440 $categories = get_categories(
441 array(
442 'per_page' => -1,
443
444 'include' => $filtered_specific,
445 'orderby' => 'include',
446 )
447 );
448
449 $categories = array_map(
450 function ( $category ) {
451 return array(
452 'id' => $category->slug,
453 'name' => $category->name,
454 );
455 },
456 $categories
457 );
458 }
459
460 $this->maybe_insert_all_option( $categories, $all, $all_idx, $mode );
461
462 return $categories;
463
464 case 'tags':
465 $tags = array();
466
467 if ( 'all' === $mode || ( 'specific' === $mode && count( $filtered_specific ) > 0 ) ) {
468 $tags = get_tags(
469 array(
470 'per_page' => -1,
471 'include' => $filtered_specific,
472 )
473 );
474 $tags = array_map(
475 function ( \WP_Term $tag ) {
476 return array(
477 'id' => $tag->slug,
478 'name' => $tag->name,
479 );
480 },
481 $tags
482 );
483 }
484
485 $this->maybe_insert_all_option( $tags, $all, $all_idx, $mode );
486
487 return $tags;
488
489 case 'author':
490 $authors = array();
491
492 if ( 'all' === $mode || ( 'specific' === $mode && count( $filtered_specific ) > 0 ) ) {
493
494 $authors = get_users(
495 array(
496 'per_page' => -1,
497 'include' => $filtered_specific,
498 'role__not_in' => array( 'subscriber', 'translator' ),
499 )
500 );
501
502 $authors = array_map(
503 function ( $author ) {
504 return array(
505 'id' => $author->ID,
506 'name' => $author->display_name,
507 );
508 },
509 $authors
510 );
511 }
512
513 $this->maybe_insert_all_option( $authors, $all, $all_idx, $mode );
514
515 return $authors;
516
517 case 'order':
518 $filtered_specific = array_map( 'strtoupper', $filtered_specific );
519
520 return 'specific' === $mode ?
521 $this->filter_select_options( $this->order, $filtered_specific )
522 : $this->order;
523
524 case 'order_by':
525 return 'specific' === $mode ?
526 $this->filter_select_options( $this->order_by, $filtered_specific )
527 : $this->order_by;
528
529 case 'adv_sort':
530 $data = 'specific' === $mode ?
531 $this->filter_select_options( $adv_sort, $filtered_specific )
532 : $adv_sort;
533
534 $this->maybe_insert_all_option( $data, $all, $all_idx, $mode );
535
536 return $data;
537
538 case 'custom_tax':
539 if ( '' == $post_types ) {
540 return array();
541 }
542
543 $post_types = json_decode( $post_types );
544
545 $data = array();
546
547 foreach ( $post_types as $post_type ) {
548 $taxonomies = get_object_taxonomies( sanitize_text_field( $post_type ) );
549 foreach ( $taxonomies as $taxonomy ) {
550 $terms = array();
551
552 if ( 'specific' === $mode && count( $filtered_specific ) > 0 ) {
553 foreach ( $filtered_specific as $s ) {
554 $res = get_term_by( 'slug', $s, $taxonomy );
555 if ( ! empty( $res ) ) {
556 $terms[] = $res;
557 }
558 }
559 } else {
560 $terms = get_terms(
561 array(
562 'taxonomy' => $taxonomy,
563 'hide_empty' => false,
564 )
565 );
566 }
567
568 foreach ( $terms as $term ) {
569 $data[] = array(
570 'id' => $term->slug,
571 'name' => $term->name,
572 'taxonomy' => $taxonomy,
573 );
574 }
575 }
576 }
577
578 $this->maybe_insert_all_option( $data, $all, $all_idx, $mode );
579
580 return $data;
581 default:
582 return array();
583 }
584 }
585
586 public function select_content( $attr ) {
587 $block_name = 'filter-select';
588 $is_active = ultimate_post()->is_lc_active();
589 $attr = wp_parse_args( $attr, $this->get_select_attributes() );
590
591 if ( ! $is_active && in_array( $attr['type'], $this->pro_select_types ) ) {
592 return '';
593 }
594
595 $post_types = isset( $attr['postTypes'] ) ? $attr['postTypes'] : '';
596
597 $attr['blockId'] = ultimate_post()->sanitize_attr( $attr, 'blockId', 'sanitize_html_class', 'missing_block_id' );
598 $attr['allText'] = ultimate_post()->sanitize_attr( $attr, 'allText', 'sanitize_text_field', 'missing_block_id' );
599
600 if ( 'inline' === $attr['filterStyle'] ) {
601 $inline_values = json_decode( $attr['filterValues'], true );
602
603 if ( ! is_array( $inline_values ) ) {
604 return '';
605 }
606
607 $data = $this->get_button_data( $attr['type'], $inline_values, $post_types, $attr['allText'] );
608
609 $btn_wrapper_attrs = get_block_wrapper_attributes(
610 array(
611 'class' => 'ultp-block-' . $attr['blockId'] . ' ultp-filter-button',
612 'role' => 'button',
613 'data-blockId' => $attr['blockId'],
614 'data-is-active' => 'false',
615 )
616 );
617
618 ob_start();
619 ?>
620
621 <div class="ultp-block-<?php echo esc_attr( $attr['blockId'] ); ?>-wrapper">
622 <?php foreach ( $data as $key => $value ) : ?>
623 <?php
624 if ( is_array( $value ) ) {
625 $name = $value['name'];
626 $tax = isset( $value['taxonomy'] ) ? 'data-tax="' . esc_attr( $value['taxonomy'] ) . '"' : '';
627 } else {
628 $name = $value;
629 $tax = '';
630 }
631 ?>
632 <div <?php echo $btn_wrapper_attrs; ?> <?php echo $tax; ?> data-selected="<?php echo esc_attr( $key ); ?>" data-type="<?php echo esc_attr( $attr['type'] ); ?>">
633 <?php echo $name; ?>
634 </div>
635 <?php endforeach ?>
636 </div>
637 <?php
638
639 $content = ob_get_clean();
640 return $content;
641 } elseif ( 'dropdown' === $attr['filterStyle'] ) {
642
643 $mode = 'all';
644 $specific = array();
645
646 if ( 'specific' === $attr['dropdownOptionsType'] && isset( $attr['dropdownOptions'] ) ) {
647 $specific_data = json_decode( stripslashes( $attr['dropdownOptions'] ) );
648 $mode = 'specific';
649 if ( is_array( $specific_data ) ) {
650 $specific = array_map(
651 function ( $item ) {
652 return sanitize_text_field( $item );
653 },
654 $specific_data
655 );
656 }
657 }
658
659 $data = $this->get_select_data( $attr['type'], $attr['allText'], $post_types, $specific, $mode );
660
661 $def_value = ! empty( current( $data ) ) ? current( $data ) : null;
662
663 $wrapper_attrs = get_block_wrapper_attributes(
664 array(
665 'class' => 'ultp-block-' . $attr['blockId'] . ' ultp-filter-select',
666 'data-selected' => isset( $def_value['id'] ) ? $def_value['id'] : 0,
667 'data-type' => $attr['type'],
668 'data-blockId' => $attr['blockId'],
669 'aria-expanded' => 'false',
670 'aria-label' => 'Select Filter (' . $attr['type'] . ')',
671 )
672 );
673
674 ob_start();
675 ?>
676 <div <?php echo $wrapper_attrs; ?>>
677 <div class="ultp-filter-select-field ultp-filter-select__parent">
678 <span class="ultp-filter-select-field-selected ultp-filter-select__parent-inner">
679 <?php echo esc_html( isset( $def_value['name'] ) ? $def_value['name'] : '' ); ?>
680 </span>
681 <span class="ultp-filter-select-field-icon">
682 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 34.1 19.95"><path d="M17.05 19.949.601 3.499a2.05 2.05 0 0 1 2.9-2.9l13.551 13.55L30.603.599a2.05 2.05 0 0 1 2.9 2.9Z"/></svg>
683 </span>
684 </div>
685 <ul style="display: none;" class="ultp-filter-select-options ultp-filter-select__dropdown">
686
687 <?php
688 if ( isset( $attr['searchEnabled'] ) && $attr['searchEnabled'] ) :
689 ?>
690 <input
691 type="search"
692 class="ultp-filter-select-search"
693 placeholder="<?php echo esc_attr( isset( $attr['sPlaceholderText'] ) ? $attr['sPlaceholderText'] : '' ); ?>"
694 />
695 <?php endif; ?>
696
697 <?php foreach ( $data as $item ) : ?>
698 <?php
699 $tax = isset( $item['taxonomy'] ) ? 'data-tax="' . esc_attr( $item['taxonomy'] ) . '"' : '';
700 ?>
701 <li class="ultp-filter-select__dropdown-inner" <?php echo $tax; ?> data-id="<?php echo esc_attr( $item['id'] ); ?>">
702 <?php echo esc_html( $item['name'] ); ?>
703 </li>
704 <?php endforeach; ?>
705
706 </ul>
707 </div>
708
709 <?php
710 $content = ob_get_clean();
711 return $content;
712 }
713
714 return '';
715 }
716
717 /**
718 * Search_content
719 *
720 * @param mixed $attr array.
721 * @return string
722 */
723 public function search_content( $attr ) {
724 $block_name = 'filter-search-adv';
725 $is_active = ultimate_post()->is_lc_active();
726
727 if ( ! $is_active ) {
728 return '';
729 }
730
731 $attr = wp_parse_args( $attr, $this->get_search_attributes() );
732
733 $attr['blockId'] = ultimate_post()->sanitize_attr( $attr, 'blockId', 'sanitize_html_class', 'missing_block_id' );
734 $attr['placeholder'] = ultimate_post()->sanitize_attr( $attr, 'placeholder', 'sanitize_text_field' );
735
736 $wrapper_attrs = get_block_wrapper_attributes(
737 array(
738 'class' => 'ultp-block-' . $attr['blockId'] . ' ultp-filter-search',
739 'aria-label' => 'Search Filter',
740 'role' => 'searchbox',
741 )
742 );
743
744 ob_start();
745 ?>
746 <div <?php echo $wrapper_attrs; ?>>
747 <div class="ultp-filter-search-input">
748 <input
749 type="search"
750 placeholder="<?php echo esc_attr( $attr['placeholder'] ); ?>"
751 />
752 <span class="ultp-filter-search-input-icon">
753 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 47.05 47.05"><path stroke="rgba(0,0,0,0)" strokeMiterlimit="10" d="m43.051 45.948-9.618-9.616a20.183 20.183 0 1 1 2.9-2.9l9.617 9.616a2.05 2.05 0 1 1-2.9 2.9Zm-22.367-9.179A16.084 16.084 0 1 0 4.6 20.684a16.1 16.1 0 0 0 16.084 16.085Z"/></svg>
754 </span>
755 </div>
756 </div>
757 <?php
758 $content = ob_get_clean();
759 return $content;
760 }
761
762 /**
763 * Clear_content
764 *
765 * @param mixed $attr array.
766 * @return array
767 */
768 public function clear_content( $attr ) {
769 $block_name = 'filter-clear';
770 // $is_active = ultimate_post()->is_lc_active();
771 $attr = wp_parse_args( $attr, $this->get_clear_attributes() );
772
773 $attr['blockId'] = ultimate_post()->sanitize_attr( $attr, 'blockId', 'sanitize_html_class', 'missing_block_id' );
774 $attr['clearButtonText'] = ultimate_post()->sanitize_attr( $attr, 'clearButtonText', 'sanitize_text_field' );
775
776 $wrapper_attrs = get_block_wrapper_attributes(
777 array(
778 'class' => 'ultp-block-' . $attr['blockId'] . ' ultp-filter-clear ultp-filter-clear-button ',
779 'data-blockid' => $attr['blockId'],
780 )
781 );
782
783 $selected_filter_wrapper_attr = get_block_wrapper_attributes(
784 array(
785 'class' => 'ultp-block-' . $attr['blockId'] . ' ultp-filter-clear ultp-filter-clear-template',
786 'style' => 'display: none;',
787 )
788 );
789
790 ob_start();
791 ?>
792
793 <div class="ultp-block-<?php echo $attr['blockId']; ?>-wrapper">
794 <div <?php echo $selected_filter_wrapper_attr; ?>>
795 <div class="ultp-selected-filter">
796 <span class="ultp-selected-filter-icon" role="button">
797 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 31.1 31.25"><path stroke="rgba(0,0,0,0)" strokeMiterlimit="10" d="M27.1 30.153 15.549 18.601 4 30.153a2.05 2.05 0 0 1-2.9-2.9l11.551-11.55L1.1 4.153a2.05 2.05 0 0 1 2.9-2.9l11.549 11.552L27.1 1.253a2.05 2.05 0 0 1 2.9 2.9l-11.553 11.55L30 27.253a2.05 2.05 0 1 1-2.9 2.9Z"/></svg>
798 </span>
799 <span class="ultp-selected-filter-text">
800 </span>
801 </div>
802 </div>
803
804 <div <?php echo $wrapper_attrs; ?>>
805 <button class="ultp-clear-button">
806 <?php echo esc_html( $attr['clearButtonText'] ); ?>
807 </button>
808 </div>
809 </div>
810
811 <?php
812 $content = ob_get_clean();
813 return $content;
814 }
815 }
816