PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.50.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.50.0
3.54.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 All 178 releases
simple-tags / inc / tag-clouds.php

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

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