PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.44.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.44.0
3.53.0 3.52.0 3.51.0 3.50.0 3.45.0 3.38.0 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.40.0 3.40.1 3.41.0 3.42.0 3.43.0 3.44.0 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 All 177 releases
simple-tags / inc / tag-clouds.php

tag-clouds.php in Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms 3.44.0, at inc/tag-clouds.php

1,181 lines 75.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class SimpleTags_Tag_Clouds
4 {
5
6 const MENU_SLUG = 'st_options';
7
8 // class instance
9 static $instance;
10
11 // WP_List_Table object
12 public $terms_table;
13
14 /**
15 * Constructor
16 *
17 * @return void
18 * @author Olatechpro
19 */
20 public function __construct()
21 {
22
23 add_filter('set-screen-option', [__CLASS__, 'set_screen'], 10, 3);
24 // Admin menu
25 add_action('admin_menu', [$this, 'admin_menu']);
26
27 // Javascript
28 add_action('admin_enqueue_scripts', [__CLASS__, 'admin_enqueue_scripts'], 11);
29
30 add_action('wp_ajax_taxopress_terms_display_preview', [$this, 'handle_termsdisplay_preview']);
31
32 }
33
34 /**
35 * Init somes JS and CSS need for this feature
36 *
37 * @return void
38 * @author Olatechpro
39 */
40 public static function admin_enqueue_scripts()
41 {
42
43 // add JS for manage click tags
44 if (isset($_GET['page']) && $_GET['page'] == 'st_terms_display') {
45 wp_enqueue_style('st-taxonomies-css');
46 }
47 }
48
49 public static function set_screen($status, $option, $value)
50 {
51 return $value;
52 }
53
54 /** Singleton instance */
55 public static function get_instance()
56 {
57 if (!isset(self::$instance)) {
58 self::$instance = new self();
59 }
60
61 return self::$instance;
62 }
63
64 /**
65 * Add WP admin menu for Tags
66 *
67 * @return void
68 * @author Olatechpro
69 */
70 public function admin_menu()
71 {
72 $hook = add_submenu_page(
73 self::MENU_SLUG,
74 esc_html__('Terms Display', 'simple-tags'),
75 esc_html__('Terms Display', 'simple-tags'),
76 'simple_tags',
77 'st_terms_display',
78 [
79 $this,
80 'page_manage_tagclouds',
81 ]
82 );
83
84 if(taxopress_is_screen_main_page()){
85 add_action("load-$hook", [$this, 'screen_option']);
86 }
87 }
88
89 /**
90 * Screen options
91 */
92 public function screen_option()
93 {
94
95 $option = 'per_page';
96 $args = [
97 'label' => esc_html__('Number of items per page', 'simple-tags'),
98 'default' => 20,
99 'option' => 'st_terms_display_per_page'
100 ];
101
102 add_screen_option($option, $args);
103
104 $this->terms_table = new TagClouds_List();
105 }
106
107 /**
108 * Method for build the page HTML manage tags
109 *
110 * @return void
111 * @author Olatechpro
112 */
113 public function page_manage_tagclouds()
114 {
115 // Default order
116 if (!isset($_GET['order'])) {
117 $_GET['order'] = 'name-asc';
118 }
119
120 settings_errors(__CLASS__);
121
122 if (!isset($_GET['add'])) {
123 //all tax
124 ?>
125 <div class="wrap st_wrap st-manage-taxonomies-page">
126
127 <div id="">
128 <h1 class="wp-heading-inline"><?php _e('Terms Display', 'simple-tags'); ?></h1>
129 <a href="<?php echo esc_url(admin_url('admin.php?page=st_terms_display&add=new_item')); ?>"
130 class="page-title-action taxopress">
131 <span class="dashicons dashicons-lock"></span>
132 <?php esc_html_e('Add New Terms Display', 'simple-tags'); ?>
133 </a>
134
135 <div class="taxopress-description"><?php esc_html_e('This feature allows you to create a customizable display of all the terms in one taxonomy.', 'simple-tags'); ?></div>
136
137
138 <?php
139 if (isset($_REQUEST['s']) && $search = sanitize_text_field(wp_unslash($_REQUEST['s']))) {
140 /* translators: %s: search keywords */
141 printf(' <span class="subtitle">' . esc_html__('Search results for &#8220;%s&#8221;',
142 'simple-tags') . '</span>', esc_html($search));
143 }
144 ?>
145 <?php
146
147 //the terms table instance
148 $this->terms_table->prepare_items();
149 ?>
150
151
152 <hr class="wp-header-end">
153 <div id="ajax-response"></div>
154 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
155 <?php $this->terms_table->search_box(esc_html__('Search Terms Display', 'simple-tags'), 'term'); ?>
156 </form>
157 <div class="clear"></div>
158
159 <div id="col-container" class="wp-clearfix">
160
161 <div class="col-wrap">
162 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
163 <?php $this->terms_table->display(); //Display the table ?>
164 </form>
165 <div class="form-wrap edit-term-notes">
166 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
167 </div>
168 </div>
169
170
171 </div>
172
173
174 </div>
175 <?php } else {
176 if ($_GET['add'] == 'new_item') {
177 //add/edit taxonomy
178 $this->taxopress_manage_tagclouds();
179 echo '<div>';
180 }
181 } ?>
182
183
184 <?php SimpleTags_Admin::printAdminFooter(); ?>
185 </div>
186 <?php
187 }
188
189
190 /**
191 * Create our settings page output.
192 *
193 * @internal
194 */
195 public function taxopress_manage_tagclouds()
196 {
197
198 $tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new';
199 $tab_class = 'taxopress-' . $tab;
200 $current = null;
201
202 ?>
203
204 <div class="wrap <?php echo esc_attr($tab_class); ?>">
205
206 <?php
207
208 $tagclouds = taxopress_get_tagcloud_data();
209 $tag_cloud_edit = false;
210 $tag_cloud_limit = false;
211
212 if ('edit' === $tab) {
213
214
215 $selected_tagcloud = taxopress_get_current_tagcloud();
216
217 if ($selected_tagcloud && array_key_exists($selected_tagcloud, $tagclouds)) {
218 $current = $tagclouds[$selected_tagcloud];
219 $tag_cloud_edit = true;
220 }
221
222 }
223
224
225 if(!isset($current['title']) && count($tagclouds) > 0 && apply_filters('taxopress_tag_clouds_create_limit', true)){
226 $tag_cloud_limit = true;
227 }
228
229
230 $ui = new taxopress_admin_ui();
231 ?>
232
233
234
235
236 <div class="wrap <?php echo esc_attr($tab_class); ?>">
237 <h1><?php echo esc_html__('Manage Terms Display', 'simple-tags'); ?></h1>
238 <div class="wp-clearfix"></div>
239
240 <form method="post" action="">
241
242
243 <div class="tagcloudui st-tabbed">
244
245 <?php if (isset($_GET['action']) && $_GET['action'] === 'edit') : ?>
246
247 <div class="tagclouds-postbox-container terms-display-preview">
248 <div id="poststuff" class="taxopress-preview-box">
249 <div class="taxopress-section postbox">
250 <div class="postbox-header">
251 <h2 class="hndle ui-sortable-handle">
252 <?php echo esc_html__('Preview Terms Display', 'simple-tags'); ?>
253 </h2>
254
255 <div class="handle-actions hide-if-no-js">
256 <span class="term-panel-move up dashicons dashicons-arrow-up-alt2"
257 title="<?php esc_attr_e('Move up', 'simple-tags'); ?>">
258 </span>
259 <span class="term-panel-move down dashicons dashicons-arrow-down-alt2"
260 title="<?php esc_attr_e('Move down', 'simple-tags'); ?>">
261 </span>
262 <button type="button" class="handlediv" aria-expanded="true">
263 <span class="screen-reader-text">
264 <?php esc_html_e('Toggle panel', 'simple-tags'); ?>
265 </span>
266 <span class="toggle-indicator dashicons dashicons-arrow-down" aria-hidden="true"></span>
267 </button>
268 </div>
269 </div>
270
271 <div class="inside">
272 <div class="taxopress-preview-wrapper">
273 <div class="taxopress-preview-control">
274 <?php
275 $preview_display_id = isset($current['ID']) ? (int) $current['ID'] : 0;
276 ?>
277 <span class="spinner" style="visibility:hidden;"></span>
278 </div>
279 <div id="term-display-preview" class="taxopress-preview-content">
280 </div>
281 </div>
282 </div>
283 </div>
284 </div>
285 </div>
286 <?php endif; ?>
287
288
289 <div class="tagclouds-postbox-container">
290 <div id="poststuff">
291 <div class="taxopress-section postbox">
292 <div class="postbox-header">
293 <h2 class="hndle ui-sortable-handle">
294 <?php
295 if ($tag_cloud_edit) {
296 $active_tab = ( isset($current['active_tab']) && !empty(trim($current['active_tab'])) ) ? $current['active_tab'] : 'tagcloud_general';
297 echo esc_html__('Edit Terms Display', 'simple-tags');
298 echo '<input type="hidden" name="edited_tagcloud" value="' . esc_attr($current['ID']) . '" />';
299 echo '<input type="hidden" name="taxopress_tag_cloud[ID]" value="' . esc_attr($current['ID']) . '" />';
300 echo '<input type="hidden" name="taxopress_tag_cloud[active_tab]" class="taxopress-active-subtab" value="'.esc_attr($active_tab).'" />';
301 } else {
302 $active_tab = 'tagcloud_general';
303 echo '<input type="hidden" name="taxopress_tag_cloud[active_tab]" class="taxopress-active-subtab" value="" />';
304 echo esc_html__('Add new Terms Display', 'simple-tags');
305 }
306 ?>
307 </h2>
308 </div>
309 <div class="inside">
310 <div class="main">
311
312
313 <?php if ($tag_cloud_limit) {
314 echo '<div class="st-taxonomy-content promo-box-area"><div class="taxopress-warning upgrade-pro">
315 <h2 style="margin-bottom: 5px;">' . esc_html__('To create more Terms Display, please upgrade to TaxoPress Pro.','simple-tags').'</h2>
316 <p>
317
318 ' . esc_html__('With TaxoPress Pro, you can create unlimited Terms Display. You can create Terms Display for any taxonomy and then display those Terms Display anywhere on your site.','simple-tags').'
319
320 </p>
321 </div></div>';
322
323 } else {
324 ?>
325
326
327 <ul class="taxopress-tab">
328 <li aria-current="<?php echo $active_tab === 'tagcloud_general' ? 'true' : 'false'; ?>" class="tagcloud_general_tab <?php echo $active_tab === 'tagcloud_general' ? 'active' : ''; ?>" data-content="tagcloud_general">
329 <a href="#tagcloud_general"><span><?php esc_html_e('General',
330 'simple-tags'); ?></span></a>
331 </li>
332
333 <li aria-current="<?php echo $active_tab === 'tagcloud_terms' ? 'true' : 'false'; ?>" class="tagcloud_terms_tab <?php echo $active_tab === 'tagcloud_terms' ? 'active' : ''; ?>" data-content="tagcloud_terms">
334 <a href="#tagcloud_terms"><span><?php esc_html_e('Choose Terms',
335 'simple-tags'); ?></span></a>
336 </li>
337
338 <li aria-current="<?php echo $active_tab === 'tagcloud_options' ? 'true' : 'false'; ?>" class="tagcloud_options_tab <?php echo $active_tab === 'tagcloud_options' ? 'active' : ''; ?>" data-content="tagcloud_options">
339 <a href="#tagcloud_options"><span><?php esc_html_e('Options',
340 'simple-tags'); ?></span></a>
341 </li>
342
343 <li aria-current="<?php echo $active_tab === 'tagcloud_layout' ? 'true' : 'false'; ?>" class="tagcloud_layout_tab <?php echo $active_tab === 'tagcloud_layout' ? 'active' : ''; ?>" data-content="tagcloud_layout">
344 <a href="#tagcloud_layout"><span><?php esc_html_e('Layout',
345 'simple-tags'); ?></span></a>
346 </li>
347
348 <li aria-current="<?php echo $active_tab === 'tagcloud_exceptions' ? 'true' : 'false'; ?>" class="tagcloud_exceptions_tab <?php echo $active_tab === 'tagcloud_exceptions' ? 'active' : ''; ?>" data-content="tagcloud_exceptions">
349 <a href="#tagcloud_exceptions"><span><?php esc_html_e('Exceptions',
350 'simple-tags'); ?></span></a>
351 </li>
352
353 <li aria-current="<?php echo $active_tab === 'tagcloud_design' ? 'true' : 'false'; ?>" class="tagcloud_design_tab <?php echo $active_tab === 'tagcloud_design' ? 'active' : ''; ?>" data-content="tagcloud_design">
354 <a href="#tagcloud_design"><span><?php esc_html_e('Design',
355 'simple-tags'); ?></span></a>
356 </li>
357
358 <li aria-current="<?php echo $active_tab === 'tagcloud_advanced' ? 'true' : 'false'; ?>" class="tagcloud_advanced_tab <?php echo $active_tab === 'tagcloud_advanced' ? 'active' : ''; ?>" data-content="tagcloud_advanced">
359 <a href="#tagcloud_advanced"><span><?php esc_html_e('Display Format',
360 'simple-tags'); ?></span></a>
361 </li>
362
363 </ul>
364
365 <div class="st-taxonomy-content taxopress-tab-content">
366
367
368 <table class="form-table taxopress-table tagcloud_general"
369 style="<?php echo $active_tab === 'tagcloud_general' ? '' : 'display:none;'; ?>">
370 <?php
371 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
372 echo $ui->get_tr_start();
373
374
375 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
376 echo $ui->get_th_start();
377
378 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
379 echo $ui->get_label('name', esc_html__('Title', 'simple-tags')) . $ui->get_required_span();
380 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
381 echo $ui->get_th_end() . $ui->get_td_start();
382
383 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
384 echo $ui->get_text_input([
385 'namearray' => 'taxopress_tag_cloud',
386 'name' => 'title',
387 'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '',
388 'maxlength' => '32',
389 'helptext' => '',
390 'required' => true,
391 'placeholder' => false,
392 'wrap' => false,
393 ]);
394
395 $select = [
396 'options' => [
397 [
398 'attr' => '0',
399 'text' => esc_attr__('False', 'simple-tags'),
400 'default' => 'true',
401 ],
402 [
403 'attr' => '1',
404 'text' => esc_attr__('True', 'simple-tags'),
405 ],
406 ],
407 ];
408 $selected = ( isset($current) && isset($current['hide_title']) ) ? taxopress_disp_boolean($current['hide_title']) : '';
409 $select['selected'] = !empty($selected) ? $current['hide_title'] : '';
410 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
411 echo $ui->get_select_checkbox_input([
412 'namearray' => 'taxopress_tag_cloud',
413 'name' => 'hide_title',
414 'labeltext' => esc_html__('Hide title in output?', 'simple-tags'),
415 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
416 ]);
417
418
419
420 $options[] = [ 'attr' => '', 'text' => esc_html__('All post types', 'simple-tags'), 'default' => 'true' ];
421 foreach ( get_post_types(['public' => true], 'objects') as $post_type ) {
422 if (!in_array($post_type->name, ['attachment'])) {
423 $options[] = [ 'attr' => $post_type->name, 'text' => $post_type->label ];
424 }
425 }
426
427 $select = [
428 'options' => $options,
429 ];
430 $selected = ( isset( $current ) && isset($current['post_type']) ) ? taxopress_disp_boolean( $current['post_type'] ) : '';
431 $select['selected'] = ! empty( $selected ) ? $current['post_type'] : '';
432 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
433 echo $ui->get_select_checkbox_input_main( [
434 'namearray' => 'taxopress_tag_cloud',
435 'name' => 'post_type',
436 'class' => 'st-post-type-select',
437 'labeltext' => esc_html__( 'Post Type', 'simple-tags' ),
438 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
439 ] );
440
441 $options = [];
442 foreach ( get_all_taxopress_taxonomies() as $_taxonomy ) {
443 $_taxonomy = $_taxonomy->name;
444 $tax = get_taxonomy( $_taxonomy );
445 if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) || $_taxonomy === 'link_category' ) {
446 continue;
447 }
448 if($tax->name === 'post_tag'){
449 $options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')', 'default' => 'true' ];
450 }else{
451 $options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')' ];
452 }
453 }
454
455 $select = [
456 'options' => $options,
457 ];
458 $selected = isset( $current ) ? taxopress_disp_boolean( $current['taxonomy'] ) : '';
459 $select['selected'] = ! empty( $selected ) ? $current['taxonomy'] : '';
460 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
461 echo $ui->get_select_checkbox_input_main( [
462 'namearray' => 'taxopress_tag_cloud',
463 'name' => 'taxonomy',
464 'class' => 'st-post-taxonomy-select',
465 'labeltext' => esc_html__( 'Taxonomy', 'simple-tags' ),
466 'required' => true,
467 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
468 ] );
469
470 $options = [
471 ['attr' => 'all', 'text' => esc_html__('All Parent Terms', 'simple-tags'), 'default' => 'true']
472 ];
473 if (!empty($current['taxonomy'])) {
474 $taxonomy = $current['taxonomy'];
475
476 $all_terms = get_terms([
477 'taxonomy' => $taxonomy,
478 'hide_empty' => false,
479 ]);
480
481 if (!empty($all_terms) && !is_wp_error($all_terms)) {
482 $child_term_ids = [];
483 $parent_term_ids = [];
484
485 // Build child-parent mapping
486 foreach ($all_terms as $term) {
487 if ($term->parent) {
488 $child_term_ids[] = $term->term_id;
489 $parent_term_ids[] = $term->parent;
490 }
491 }
492
493 $parent_term_ids = array_unique($parent_term_ids);
494
495 foreach ($all_terms as $term) {
496 $term_id = $term->term_id;
497
498 if (in_array($term_id, $parent_term_ids, true) || $term->parent == 0) {
499 $options[] = [
500 'attr' => strval($term_id),
501 'text' => esc_html($term->name)
502 ];
503 }
504 }
505 }
506 }
507
508 $selected = isset($current['parent_term']) ? (array) $current['parent_term'] : ['all'];
509 $select['selected'] = isset($current['parent_term']) ? $current['parent_term'] : 'all';
510
511 $select = [
512 'options' => $options,
513 'selected' => $selected
514 ];
515
516 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
517 echo $ui->get_select_checkbox_input_main([
518 'namearray' => 'taxopress_tag_cloud',
519 'name' => 'parent_term',
520 'class' => 'taxopress-single-select2',
521 'labeltext' => esc_html__('Parent Term', 'simple-tags'),
522 'selections' => $select // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
523 ]);
524
525 $select = [
526 'options' => [
527 [ 'attr' => 'parents_only', 'text' => esc_attr__('Display only Parent Terms', 'simple-tags') ],
528 [ 'attr' => 'sub_terms_only', 'text' => esc_attr__('Display only Sub-Terms', 'simple-tags') ],
529 [ 'attr' => 'parents_and_sub', 'text' => esc_attr__('Display Parents and Sub-Terms', 'simple-tags'), 'default' => 'true' ]
530 ]
531 ];
532
533 $selected = isset($current['display_mode']) ? taxopress_disp_boolean($current['display_mode']) : '';
534 $select['selected'] = ! empty( $selected ) ? $current['display_mode'] : '';
535 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
536 echo $ui->get_select_checkbox_input_main([
537 'namearray' => 'taxopress_tag_cloud',
538 'name' => 'display_mode',
539 'labeltext' => esc_html__('Display Mode', 'simple-tags'),
540 'selections' => $select // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
541 ]);
542 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
543 echo $ui->get_td_end() . $ui->get_tr_end();
544 ?>
545 </table>
546
547
548
549
550 <table class="form-table taxopress-table tagcloud_terms"
551 style="<?php echo $active_tab === 'tagcloud_terms' ? '' : 'display:none;'; ?>">
552 <?php
553
554 ?>
555 <tr valign="top">
556 <th scope="row"><label><?php esc_html_e('Term selection mode', 'simple-tags'); ?></label></th>
557 <td>
558 <?php
559 $current_mode = isset($current['term_selection_mode']) ? $current['term_selection_mode'] : 'automatic';
560 ?>
561 <div style="margin-bottom: 10px;">
562 <label>
563 <input type="radio" name="taxopress_tag_cloud[term_selection_mode]" value="automatic" <?php checked($current_mode, 'automatic'); ?> />
564 <?php esc_html_e('Automatic', 'simple-tags'); ?>
565 </label>
566 <p class="description" style="margin-left: 25px; margin-top: 5px;">
567 <?php esc_html_e('Display terms based on settings in the "General" tab.', 'simple-tags'); ?>
568 </p>
569 </div>
570 <div style="margin-bottom: 10px;">
571 <label>
572 <input type="radio" name="taxopress_tag_cloud[term_selection_mode]" value="custom" <?php checked($current_mode, 'custom'); ?> />
573 <?php esc_html_e('Custom', 'simple-tags'); ?>
574 </label>
575 <p class="description" style="margin-left: 25px; margin-top: 5px;">
576 <?php esc_html_e('Display only the specific terms entered in the "Custom terms to display" field below.', 'simple-tags'); ?>
577 </p>
578 </div>
579 <div>
580 <label>
581 <input type="radio" name="taxopress_tag_cloud[term_selection_mode]" value="combined" <?php checked($current_mode, 'combined'); ?> />
582 <?php esc_html_e('Combined', 'simple-tags'); ?>
583 </label>
584 <p class="description" style="margin-left: 25px; margin-top: 5px;">
585 <?php esc_html_e('Display automatic terms plus any additional custom terms specified below.', 'simple-tags'); ?>
586 </p>
587 </div>
588 </td>
589 </tr>
590 <?php
591
592 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
593 echo $ui->get_textarea_input([
594 'namearray' => 'taxopress_tag_cloud',
595 'name' => 'include_terms',
596 'rows' => '4',
597 'cols' => '40',
598 'class' => 'autocomplete-input tagclouds-include',
599 'textvalue' => isset($current['include_terms']) ? esc_attr($current['include_terms']) : '',
600 'labeltext' => esc_html__('Custom terms to display', 'simple-tags'),
601 'helptext' => esc_html__('Enter terms (comma-separated) to display. Used in Custom and Combined modes.', 'simple-tags'),
602 'required' => false,
603 ]);
604
605 $select = [
606 'options' => [
607 [ 'attr' => '1', 'text' => esc_attr__( '24 hours', 'simple-tags' ) ],
608 [ 'attr' => '7', 'text' => esc_attr__( '7 days', 'simple-tags' ) ],
609 [ 'attr' => '14', 'text' => esc_attr__( '2 weeks', 'simple-tags' ) ],
610 [ 'attr' => '30', 'text' => esc_attr__( '1 month', 'simple-tags' ) ],
611 [ 'attr' => '180', 'text' => esc_attr__( '6 months', 'simple-tags' ) ],
612 [ 'attr' => '365', 'text' => esc_attr__( '1 year', 'simple-tags' ) ],
613 [ 'attr' => '0', 'text' => esc_attr__( 'No limit', 'simple-tags'), 'default' => 'true' ],
614 ],
615 ];
616 $selected = isset( $current ) ? taxopress_disp_boolean( $current['limit_days'] ) : '';
617 $select['selected'] = ! empty( $selected ) ? $current['limit_days'] : '';
618 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
619 echo $ui->get_select_number_select( [
620 'namearray' => 'taxopress_tag_cloud',
621 'name' => 'limit_days',
622 'labeltext' => esc_html__( 'Limit terms based on timeframe', 'simple-tags' ),
623 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
624 ] );
625
626 do_action('taxopress_tagcloud_ordering_method', $current);
627
628
629 $select = [
630 'options' => [
631 [ 'attr' => 'asc', 'text' => esc_attr__( 'Ascending', 'simple-tags' ) ],
632 [ 'attr' => 'desc', 'text' => esc_attr__( 'Descending', 'simple-tags'), 'default' => 'true' ],
633 ],
634 ];
635 $selected = isset( $current ) ? taxopress_disp_boolean( $current['order'] ) : '';
636 $select['selected'] = ! empty( $selected ) ? $current['order'] : '';
637 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
638 echo $ui->get_select_checkbox_input_main( [
639 'namearray' => 'taxopress_tag_cloud',
640 'name' => 'order',
641 'labeltext' => esc_html__( 'Ordering for choosing terms for display', 'simple-tags' ),
642 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
643 ] );
644
645
646
647 ?>
648 </table>
649
650
651 <table class="form-table taxopress-table tagcloud_layout"
652 style="<?php echo $active_tab === 'tagcloud_layout' ? '' : 'display:none;'; ?>">
653 <?php
654
655 $select = [
656 'options' => [
657 [ 'attr' => 'flat', 'text' => esc_attr__( 'Cloud', 'simple-tags' )],
658 [ 'attr' => 'list', 'text' => esc_attr__( 'Unordered List (UL/LI)', 'simple-tags' ) ],
659 [ 'attr' => 'ol', 'text' => esc_attr__( 'Ordered List (OL/LI)', 'simple-tags' ) ],
660 [ 'attr' => 'comma', 'text' => esc_attr__( 'WordPress Default', 'simple-tags' ), 'default' => 'true'],
661 ['attr' => 'table', 'text' => esc_attr__('Table List', 'simple-tags')],
662 ['attr' => 'border', 'text' => esc_attr__('Border Cloud', 'simple-tags'), 'default' => 'true' ],
663 ['attr' => 'parent/child', 'text' => esc_attr__('Parent / Child', 'simple-tags')],
664 ],
665 ];
666 $selected = isset( $current ) ? taxopress_disp_boolean( $current['format'] ) : '';
667 $select['selected'] = ! empty( $selected ) ? $current['format'] : '';
668 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
669 echo $ui->get_select_checkbox_input_main( [
670 'namearray' => 'taxopress_tag_cloud',
671 'name' => 'format',
672 'labeltext' => esc_html__( 'Display format', 'simple-tags' ),
673 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
674 ] );
675 ?>
676
677 </table>
678
679
680
681 <table class="form-table taxopress-table tagcloud_options"
682 style="<?php echo $active_tab === 'tagcloud_options' ? '' : 'display:none;'; ?>">
683 <?php
684
685 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
686 echo $ui->get_text_input([
687 'namearray' => 'taxopress_tag_cloud',
688 'name' => 'before',
689 'textvalue' => isset($current['before']) ? esc_attr($current['before']) : '',
690 'labeltext' => esc_html__(
691 'Text to display before terms list',
692 'simple-tags'
693 ),
694 'helptext' => esc_html__(
695 'Enter the text that should be display before terms list. This field accepts basic HTML.',
696 'simple-tags'
697 ),
698 'required' => false,
699 ]);
700
701 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
702 echo $ui->get_text_input([
703 'namearray' => 'taxopress_tag_cloud',
704 'name' => 'after',
705 'textvalue' => isset($current['after']) ? esc_attr($current['after']) : '',
706 'labeltext' => esc_html__(
707 'Text to display after terms list',
708 'simple-tags'
709 ),
710 'helptext' => esc_html__(
711 'Enter the text that should be display after terms list. This field accepts basic HTML.',
712 'simple-tags'
713 ),
714 'required' => false,
715 ]);
716 ?>
717 </table>
718
719 <table class="form-table taxopress-table tagcloud_exceptions"
720 style="<?php echo $active_tab === 'tagcloud_exceptions' ? '' : 'display:none;'; ?>">
721 <?php
722
723 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
724 echo $ui->get_textarea_input([
725 'namearray' => 'taxopress_tag_cloud',
726 'name' => 'exclude_terms',
727 'rows' => '4',
728 'cols' => '40',
729 'class' => 'autocomplete-input tagclouds-exclude',
730 'textvalue' => isset($current['exclude_terms']) ? esc_attr($current['exclude_terms']) : '',
731 'labeltext' => esc_html__('Exclude terms from terms display', 'simple-tags'),
732 'helptext' => esc_html__('Enter terms (comma-separated) to exclude from the terms display.', 'simple-tags'),
733 'required' => false,
734 ]);
735
736 $enable_hidden_terms = SimpleTags_Plugin::get_option_value('enable_hidden_terms');
737
738 if ($enable_hidden_terms) {
739 $select = [
740 'options' => [
741 [
742 'attr' => '0',
743 'text' => esc_attr__('False', 'simple-tags'),
744 'default' => 'true',
745 ],
746 [
747 'attr' => '1',
748 'text' => esc_attr__('True', 'simple-tags'),
749 ],
750 ],
751 ];
752
753 $selected = isset($current['hide_terms']) ? taxopress_disp_boolean($current['hide_terms']) : '0';
754 $select['selected'] = !empty($selected) ? $selected : '0';
755
756 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
757 echo $ui->get_select_checkbox_input([
758 'namearray' => 'taxopress_tag_cloud',
759 'name' => 'hide_terms',
760 'labeltext' => esc_html__('Exclude hidden terms from Terms Display?', 'simple-tags'),
761 'selections' => $select, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
762 ]);
763 } else {
764 if (isset($current['hide_terms']) && $current['hide_terms'] !== '0') {
765 $current['hide_terms'] = '0';
766 }
767 }
768
769 ?>
770 </table>
771
772
773 <table class="form-table taxopress-table tagcloud_design"
774 style="<?php echo $active_tab === 'tagcloud_design' ? '' : 'display:none;'; ?>">
775 <?php
776
777 $select = [
778 'options' => [
779 [
780 'attr' => '0',
781 'text' => esc_attr__('False', 'simple-tags'),
782 'default' => 'true',
783 ],
784 [
785 'attr' => '1',
786 'text' => esc_attr__('True', 'simple-tags'),
787 ],
788 ],
789 ];
790 $selected = ( isset($current) && isset($current['hide_output']) ) ? taxopress_disp_boolean($current['hide_output']) : '';
791 $select['selected'] = !empty($selected) ? $current['hide_output'] : '';
792 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
793 echo $ui->get_select_checkbox_input([
794 'namearray' => 'taxopress_tag_cloud',
795 'name' => 'hide_output',
796 'labeltext' => esc_html__('Hide display output if no terms?', 'simple-tags'),
797 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
798 ]);
799
800 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
801 echo $ui->get_number_input([
802 'namearray' => 'taxopress_tag_cloud',
803 'name' => 'max',
804 'textvalue' => isset($current['max']) ? esc_attr($current['max']) : '20 ',
805 'labeltext' => esc_html__('Maximum terms to display', 'simple-tags'),
806 'helptext' => '',
807 'required' => true,
808 ]);
809
810 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
811 echo $ui->get_number_input([
812 'namearray' => 'taxopress_tag_cloud',
813 'name' => 'smallest',
814 'textvalue' => isset($current['smallest']) ? esc_attr($current['smallest']) : '12',
815 'labeltext' => esc_html__('Font size minimum', 'simple-tags'),
816 'helptext' => '',
817 'required' => true,
818 ]);
819
820 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
821 echo $ui->get_number_input([
822 'namearray' => 'taxopress_tag_cloud',
823 'name' => 'largest',
824 'textvalue' => isset($current['largest']) ? esc_attr($current['largest']) : '12',
825 'labeltext' => esc_html__('Font size maximum', 'simple-tags'),
826 'helptext' => '',
827 'required' => true,
828 ]);
829
830 $select = [
831 'options' => [
832 [ 'attr' => 'pt', 'text' => esc_attr__( 'Point', 'simple-tags' ), 'default' => 'true' ],
833 [ 'attr' => 'px', 'text' => esc_attr__( 'Pixel', 'simple-tags' ) ],
834 [ 'attr' => 'em', 'text' => esc_attr__( 'Em', 'simple-tags') ],
835 [ 'attr' => '%', 'text' => esc_attr__( 'Percent', 'simple-tags') ],
836 ],
837 ];
838 $selected = isset( $current ) ? taxopress_disp_boolean( $current['unit'] ) : '';
839 $select['selected'] = ! empty( $selected ) ? $current['unit'] : '';
840 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
841 echo $ui->get_select_checkbox_input_main( [
842 'namearray' => 'taxopress_tag_cloud',
843 'name' => 'unit',
844 'labeltext' => esc_html__( 'Unit font size', 'simple-tags' ),
845 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
846 ] );
847
848
849
850 $select = [
851 'options' => [
852 [
853 'attr' => '0',
854 'text' => esc_attr__('False', 'simple-tags'),
855 ],
856 [
857 'attr' => '1',
858 'text' => esc_attr__('True', 'simple-tags'),
859 //'default' => 'true', removed when default value is checked as this mean box is always checked even when user uncheck it since it's defau;t
860 ],
861 ],
862 ];
863 $selected = ( isset($current) && isset($current['color']) ) ? taxopress_disp_boolean($current['color']) : '';
864
865 if($tag_cloud_edit){
866 $select['selected'] = !empty($selected) ? $current['color'] : '';
867 }else{
868 $select['selected'] = 1; //makeup for default when creating new term display
869 }
870 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
871 echo $ui->get_select_checkbox_input([
872 'namearray' => 'taxopress_tag_cloud',
873 'name' => 'color',
874 'class' => 'tag-cloud-color-option',
875 'labeltext' => esc_html__('Enable colors for terms', 'simple-tags'),
876 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
877 ]);
878
879 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
880 echo $ui->get_text_input([
881 'namearray' => 'taxopress_tag_cloud',
882 'name' => 'mincolor',
883 'class' => 'text-color tag-cloud-min',
884 'textvalue' => isset($current['mincolor']) ? esc_attr($current['mincolor']) : '#353535',
885 'labeltext' => esc_html__('Font color minimum', 'simple-tags'),
886 'helptext' => esc_html__('This is the color of the least popular term', 'simple-tags'),
887 'required' => true,
888 ]);
889
890 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
891 echo $ui->get_text_input([
892 'namearray' => 'taxopress_tag_cloud',
893 'name' => 'maxcolor',
894 'class' => 'text-color tag-cloud-max',
895 'textvalue' => isset($current['maxcolor']) ? esc_attr($current['maxcolor']) : '#000000',
896 'labeltext' => esc_html__('Font color maximum', 'simple-tags'),
897 'helptext' => esc_html__('This is the color of the most popular term', 'simple-tags'),
898 'required' => true,
899 ]);
900
901
902 ?>
903
904 </table>
905
906
907 <table class="form-table taxopress-table tagcloud_advanced"
908 style="<?php echo $active_tab === 'tagcloud_advanced' ? '' : 'display:none;'; ?>">
909 <?php
910
911 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
912 echo $ui->get_text_input([
913 'namearray' => 'taxopress_tag_cloud',
914 'name' => 'wrap_class',
915 'class' => '',
916 'textvalue' => isset($current['wrap_class']) ? esc_attr($current['wrap_class']) : '',
917 'labeltext' => esc_html__('Term display div class', 'simple-tags'),
918 'helptext' => '',
919 'required' => false,
920 ]);
921
922 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
923 echo $ui->get_text_input([
924 'namearray' => 'taxopress_tag_cloud',
925 'name' => 'link_class',
926 'class' => '',
927 'textvalue' => isset($current['link_class']) ? esc_attr($current['link_class']) : '',
928 'labeltext' => esc_html__('Term link class', 'simple-tags'),
929 'helptext' => '',
930 'required' => false,
931 ]);
932
933 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
934 echo $ui->get_textarea_input([
935 'namearray' => 'taxopress_tag_cloud',
936 'name' => 'xformat',
937 'class' => 'st-full-width',
938 'rows' => '4',
939 'cols' => '40',
940 'textvalue' => isset($current['xformat']) ? esc_attr($current['xformat']) : esc_attr('<a href="%tag_link%" id="tag-link-%tag_id%" class="st-tags t%tag_scale%" title="%tag_count% topics" %tag_rel% style="%tag_size% %tag_color%">%tag_name%</a>'),
941 'labeltext' => esc_html__('Term link format', 'simple-tags'),
942 'helptext' => sprintf(esc_html__('This option allows you to change the format of your terms. You can use any of the tokens in the "Terms Display format" sidebar". Find more details %1sin the documentation%2s.', 'simple-tags'), '<a target="blank" href="https://taxopress.com/docs/format-tag-clouds/">', '</a>'),
943 'required' => false,
944 ]);
945
946
947 ?>
948 </table>
949
950
951 </div>
952
953
954 <?php }//end new fields
955 ?>
956
957
958 <div class="clear"></div>
959
960
961 </div>
962 </div>
963 </div>
964
965
966 <?php if ($tag_cloud_limit) { ?>
967
968 <div class="pp-version-notice-bold-purple" style="margin-left:0px;">
969 <div class="pp-version-notice-bold-purple-message"><?php echo esc_html__('You\'re using TaxoPress Free.
970 The Pro version has more features and support.', 'simple-tags'); ?>
971 </div>
972 <div class="pp-version-notice-bold-purple-button"><a
973 href="https://taxopress.com/taxopress/" target="_blank"><?php echo esc_html__('Upgrade to Pro', 'simple-tags'); ?></a>
974 </div>
975 </div>
976
977 <?php } ?>
978 <input type="hidden" class="pp-terms-display-fontsize-warning" value="<?php echo esc_attr__('Font size minimum must not be greater than Font size maximum value.', 'simple-tags'); ?>" />
979 <?php
980 /**
981 * Fires after the default fieldsets on the taxonomy screen.
982 *
983 * @param taxopress_admin_ui $ui Admin UI instance.
984 */
985 do_action('taxopress_taxonomy_after_fieldsets', $ui);
986 ?>
987
988 </div>
989 </div>
990
991
992 </div>
993
994 <div class="taxopress-right-sidebar">
995 <div class="taxopress-right-sidebar-wrapper" style="min-height: 205px;<?php echo ($tag_cloud_limit) ? 'display: none;' : ''; ?>">
996
997
998 <?php
999 if(!$tag_cloud_limit){ ?>
1000 <p class="submit">
1001
1002 <?php
1003 wp_nonce_field('taxopress_addedit_tagcloud_nonce_action',
1004 'taxopress_addedit_tagcloud_nonce_field');
1005 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?>
1006 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit"
1007 value="<?php echo esc_attr(esc_attr__('Save Terms Display', 'simple-tags')); ?>"/>
1008 <?php
1009 } else { ?>
1010 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit"
1011 value="<?php echo esc_attr(esc_attr__('Add Terms Display', 'simple-tags')); ?>"/>
1012 <?php } ?>
1013
1014 <input type="hidden" name="cpt_tax_status" id="cpt_tax_status"
1015 value="<?php echo esc_attr($tab); ?>"/>
1016 </p>
1017
1018 <?php if (!empty($current)) {
1019 ?>
1020 <p>
1021 <?php echo '<div class="taxopress-warning" style="">' . esc_html__('Shortcode: ','simple-tags'); ?> &nbsp;
1022 <textarea style="resize: none;padding: 5px;" readonly>[taxopress_termsdisplay id="<?php echo (int)$current['ID']; ?>"]</textarea>
1023 </div>
1024 </p>
1025 <?php } ?>
1026
1027 <?php
1028 }
1029 ?>
1030
1031 </div>
1032
1033 <div class="taxopress-token-right-sidebar">
1034 <div id="postbox-container-1" class="postbox-container">
1035 <div class="meta-box-sortables">
1036 <div class="postbox">
1037 <div class="postbox-header">
1038 <h3 class="hndle is-non-sortable">
1039 <span><?php echo esc_html__('Terms Display format', 'simple-tags'); ?></span>
1040 </h3>
1041 </div>
1042
1043 <div class="inside">
1044 <p><?php echo esc_html__('Here are the tokens you can use for Term link format', 'simple-tags'); ?>:</p>
1045 <ul>
1046 <li><code>%tag_link%</code> <?php echo esc_html__('The URL of the term', 'simple-tags'); ?></li>
1047 <li><code>%tag_id%</code> <?php echo esc_html__('The ID of the term', 'simple-tags'); ?></li>
1048 <li><code>t%tag_scale%</code> <?php echo esc_html__('The weighted size of the term in the display', 'simple-tags'); ?></li>
1049 <li><code>%tag_count%</code> <?php echo esc_html__('The number of times the term is used', 'simple-tags'); ?></li>
1050 <li><code>%tag_rel%</code> <?php echo esc_html__('This provides rel tag markup', 'simple-tags'); ?> (<?php echo esc_html__('it creates', 'simple-tags'); ?> <code>rel="tag"</code>)</li>
1051 <li><code>%tag_size%</code> <?php echo esc_html__('The font size for the term', 'simple-tags'); ?></li>
1052 <li><code>%tag_color%</code> <?php echo esc_html__('The font color for the term', 'simple-tags'); ?></li>
1053 <li><code>%tag_name%</code> <?php echo esc_html__('The name of the term', 'simple-tags'); ?></li>
1054 <li><code>%tag_name_attribute%</code> <?php echo esc_html__('The name of the term with any HTML stripped out', 'simple-tags'); ?></li>
1055 <li><code>%tag_description%</code> <?php echo esc_html__('The description of the term', 'simple-tags'); ?></li>
1056 </ul>
1057 </div>
1058 </div>
1059 </div>
1060 </div>
1061 </div>
1062
1063
1064 <?php do_action('taxopress_admin_after_sidebar'); ?>
1065 </div>
1066
1067 <div class="clear"></div>
1068
1069
1070
1071 </form>
1072
1073 </div><!-- End .wrap -->
1074
1075 <div class="clear"></div>
1076
1077
1078
1079 <?php # Modal Windows; ?>
1080 <div class="remodal" data-remodal-id="taxopress-modal-alert"
1081 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1082 <div class="" style="color:red;"><?php echo esc_html__('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div>
1083 <div id="taxopress-modal-alert-content"></div>
1084 <br>
1085 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('Okay', 'simple-tags'); ?></button>
1086 </div>
1087
1088 <div class="remodal" data-remodal-id="taxopress-modal-confirm"
1089 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1090 <div id="taxopress-modal-confirm-content"></div>
1091 <br>
1092 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('No', 'simple-tags'); ?></button>
1093 <button data-remodal-action="confirm"
1094 class="remodal-confirm"><?php echo esc_html__('Yes', 'simple-tags'); ?></button>
1095 </div>
1096
1097 <?php
1098 do_action( 'simpletags-terms_display' );
1099 }
1100
1101 /**
1102 * Handle the AJAX request for previewing terms display.
1103 */
1104 public function handle_termsdisplay_preview() {
1105 // Validate nonce
1106 if (!isset($_POST['nonce']) || !check_ajax_referer('st-admin-js', 'nonce', false)) {
1107 wp_send_json_error(['message' => __('Invalid nonce', 'simple-tags')]);
1108 }
1109
1110 if (!current_user_can('simple_tags')) {
1111 wp_send_json_error(['message' => __('Permission denied.', 'simple-tags')]);
1112 }
1113
1114 if (!isset($_POST['taxopress_termsdisplay'])) {
1115 wp_send_json_error(['message' => __('Missing display ID.', 'simple-tags')]);
1116 }
1117
1118 $display_id = sanitize_text_field($_POST['taxopress_termsdisplay']);
1119
1120 // Get the display configuration
1121 $tagclouds = taxopress_get_tagcloud_data();
1122 if (!array_key_exists($display_id, $tagclouds)) {
1123 wp_send_json_error(['message' => __('Invalid terms display configuration.', 'simple-tags')]);
1124 }
1125
1126 $config = $tagclouds[$display_id];
1127
1128 // Create tag cloud client instance
1129 $client = new SimpleTags_Client_TagCloud();
1130
1131 // Convert config to query args format
1132 $args = http_build_query([
1133 'taxonomy' => $config['taxonomy'] ?? 'post_tag',
1134 'selectionby' => $config['selectionby'] ?? 'count',
1135 'selection' => $config['selection'] ?? 'desc',
1136 'orderby' => $config['orderby'] ?? 'random',
1137 'order' => $config['order'] ?? 'desc',
1138 'format' => $config['format'] ?? 'border',
1139 'number' => $config['max'] ?? 20,
1140 'largest' => $config['largest'] ?? 12,
1141 'smallest' => $config['smallest'] ?? 12,
1142 'unit' => $config['unit'] ?? 'pt',
1143 'color' => !empty($config['color']),
1144 'mincolor' => $config['mincolor'] ?? '#353535',
1145 'maxcolor' => $config['maxcolor'] ?? '#000000',
1146 'hide_empty' => !empty($config['hide_empty']),
1147 'hide_title' => !empty($config['hide_title']),
1148 'hide_output' => !empty($config['hide_output']),
1149 'notagstext' => !empty($config['notagstext']),
1150 'title' => $config['title'] ?? '',
1151 'exclude_terms'=> $config['exclude_terms'] ?? '',
1152 'term_selection_mode' => $config['term_selection_mode'] ?? 'automatic',
1153 'include_terms' => $config['include_terms'] ?? '',
1154 'hide_terms' => !empty($config['hide_terms']),
1155 'before' => $config['before'] ?? '',
1156 'after' => $config['after'] ?? '',
1157 'xformat' => $config['xformat'] ?? '',
1158 'wrap_class' => $config['wrap_class'] ?? '',
1159 'link_class' => $config['link_class'] ?? '',
1160 'parent_term' => $config['parent_term'] ?? 'all',
1161 'display_mode'=> $config['display_mode'] ?? 'parents_and_sub',
1162 'max' => $config['max'] ?? 20,
1163 'limit_days' => $config['limit_days'] ?? '',
1164 ]);
1165
1166 // Get the tag cloud output
1167 $output = $client->extendedTagCloud($args);
1168
1169 if (empty($output)) {
1170 if (!empty($config['hide_output'])) {
1171 wp_send_json_success(['html' => '']);
1172 }
1173 $notagstext = esc_html__('There are no terms in this taxonomy.', 'simple-tags');
1174 wp_send_json_success(['html' => '<p>' . $notagstext . '</p>']);
1175 }
1176
1177 wp_send_json_success(['html' => $output]);
1178 }
1179
1180 }
1181