PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.6.2
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.6.2
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.6.2, at inc/tag-clouds.php

854 lines 49.1 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 }
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 if (isset($_GET['page']) && $_GET['page'] == 'st_terms_display') {
43 wp_enqueue_style('st-taxonomies-css');
44 }
45 }
46
47 public static function set_screen($status, $option, $value)
48 {
49 return $value;
50 }
51
52 /** Singleton instance */
53 public static function get_instance()
54 {
55 if (!isset(self::$instance)) {
56 self::$instance = new self();
57 }
58
59 return self::$instance;
60 }
61
62 /**
63 * Add WP admin menu for Tags
64 *
65 * @return void
66 * @author Olatechpro
67 */
68 public function admin_menu()
69 {
70 $hook = add_submenu_page(
71 self::MENU_SLUG,
72 esc_html__('Terms Display', 'simple-tags'),
73 esc_html__('Terms Display', 'simple-tags'),
74 'simple_tags',
75 'st_terms_display',
76 [
77 $this,
78 'page_manage_tagclouds',
79 ]
80 );
81
82 if(taxopress_is_screen_main_page()){
83 add_action("load-$hook", [$this, 'screen_option']);
84 }
85 }
86
87 /**
88 * Screen options
89 */
90 public function screen_option()
91 {
92
93 $option = 'per_page';
94 $args = [
95 'label' => esc_html__('Number of items per page', 'simple-tags'),
96 'default' => 20,
97 'option' => 'st_terms_display_per_page'
98 ];
99
100 add_screen_option($option, $args);
101
102 $this->terms_table = new TagClouds_List();
103 }
104
105 /**
106 * Method for build the page HTML manage tags
107 *
108 * @return void
109 * @author Olatechpro
110 */
111 public function page_manage_tagclouds()
112 {
113 // Default order
114 if (!isset($_GET['order'])) {
115 $_GET['order'] = 'name-asc';
116 }
117
118 settings_errors(__CLASS__);
119
120 if (!isset($_GET['add'])) {
121 //all tax
122 ?>
123 <div class="wrap st_wrap st-manage-taxonomies-page">
124
125 <div id="">
126 <h1 class="wp-heading-inline"><?php _e('Terms Display', 'simple-tags'); ?></h1>
127 <a href="<?php echo esc_url(admin_url('admin.php?page=st_terms_display&add=new_item')); ?>"
128 class="page-title-action"><?php esc_html_e('Add New', 'simple-tags'); ?></a>
129
130 <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>
131
132
133 <?php
134 if (isset($_REQUEST['s']) && $search = sanitize_text_field(wp_unslash($_REQUEST['s']))) {
135 /* translators: %s: search keywords */
136 printf(' <span class="subtitle">' . esc_html__('Search results for &#8220;%s&#8221;',
137 'simple-tags') . '</span>', esc_html($search));
138 }
139 ?>
140 <?php
141
142 //the terms table instance
143 $this->terms_table->prepare_items();
144 ?>
145
146
147 <hr class="wp-header-end">
148 <div id="ajax-response"></div>
149 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
150 <?php $this->terms_table->search_box(esc_html__('Search Terms Display', 'simple-tags'), 'term'); ?>
151 </form>
152 <div class="clear"></div>
153
154 <div id="col-container" class="wp-clearfix">
155
156 <div class="col-wrap">
157 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
158 <?php $this->terms_table->display(); //Display the table ?>
159 </form>
160 <div class="form-wrap edit-term-notes">
161 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
162 </div>
163 </div>
164
165
166 </div>
167
168
169 </div>
170 <?php } else {
171 if ($_GET['add'] == 'new_item') {
172 //add/edit taxonomy
173 $this->taxopress_manage_tagclouds();
174 echo '<div>';
175 }
176 } ?>
177
178
179 <?php SimpleTags_Admin::printAdminFooter(); ?>
180 </div>
181 <?php
182 }
183
184
185 /**
186 * Create our settings page output.
187 *
188 * @internal
189 */
190 public function taxopress_manage_tagclouds()
191 {
192
193 $tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new';
194 $tab_class = 'taxopress-' . $tab;
195 $current = null;
196
197 ?>
198
199 <div class="wrap <?php echo esc_attr($tab_class); ?>">
200
201 <?php
202
203 $tagclouds = taxopress_get_tagcloud_data();
204 $tag_cloud_edit = false;
205 $tag_cloud_limit = false;
206
207 if ('edit' === $tab) {
208
209
210 $selected_tagcloud = taxopress_get_current_tagcloud();
211
212 if ($selected_tagcloud && array_key_exists($selected_tagcloud, $tagclouds)) {
213 $current = $tagclouds[$selected_tagcloud];
214 $tag_cloud_edit = true;
215 }
216
217 }
218
219
220 if(!isset($current['title']) && count($tagclouds) > 0 && apply_filters('taxopress_tag_clouds_create_limit', true)){
221 $tag_cloud_limit = true;
222 }
223
224
225 $ui = new taxopress_admin_ui();
226 ?>
227
228
229
230
231 <div class="wrap <?php echo esc_attr($tab_class); ?>">
232 <h1><?php echo esc_html__('Manage Terms Display', 'simple-tags'); ?></h1>
233 <div class="wp-clearfix"></div>
234
235 <form method="post" action="">
236
237
238 <div class="tagcloudui st-tabbed">
239
240
241 <div class="tagclouds-postbox-container">
242 <div id="poststuff">
243 <div class="taxopress-section postbox">
244 <div class="postbox-header">
245 <h2 class="hndle ui-sortable-handle">
246 <?php
247 if ($tag_cloud_edit) {
248 $active_tab = ( isset($current['active_tab']) && !empty(trim($current['active_tab'])) ) ? $current['active_tab'] : 'tagcloud_general';
249 echo esc_html__('Edit Terms Display', 'simple-tags');
250 echo '<input type="hidden" name="edited_tagcloud" value="' . esc_attr($current['ID']) . '" />';
251 echo '<input type="hidden" name="taxopress_tag_cloud[ID]" value="' . esc_attr($current['ID']) . '" />';
252 echo '<input type="hidden" name="taxopress_tag_cloud[active_tab]" class="taxopress-active-subtab" value="'.esc_attr($active_tab).'" />';
253 } else {
254 $active_tab = 'tagcloud_general';
255 echo '<input type="hidden" name="taxopress_tag_cloud[active_tab]" class="taxopress-active-subtab" value="" />';
256 echo esc_html__('Add new Terms Display', 'simple-tags');
257 }
258 ?>
259 </h2>
260 </div>
261 <div class="inside">
262 <div class="main">
263
264
265 <?php if ($tag_cloud_limit) {
266 echo '<div class="st-taxonomy-content"><div class="taxopress-warning upgrade-pro">
267 <p>
268
269 <h2 style="margin-bottom: 5px;">' . esc_html__('To create more Terms Display, please upgrade to TaxoPress Pro.','simple-tags').'</h2>
270 ' . 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').'
271
272 </p>
273 </div></div>';
274
275 } else {
276 ?>
277
278
279 <ul class="taxopress-tab">
280 <li class="tagcloud_general_tab <?php echo $active_tab === 'tagcloud_general' ? 'active' : ''; ?>" data-content="tagcloud_general">
281 <a href="#tagcloud_general"><span><?php esc_html_e('General',
282 'simple-tags'); ?></span></a>
283 </li>
284
285 <li class="tagcloud_terms_tab <?php echo $active_tab === 'tagcloud_terms' ? 'active' : ''; ?>" data-content="tagcloud_terms">
286 <a href="#tagcloud_terms"><span><?php esc_html_e('Choose Terms',
287 'simple-tags'); ?></span></a>
288 </li>
289
290 <li class="tagcloud_design_tab <?php echo $active_tab === 'tagcloud_design' ? 'active' : ''; ?>" data-content="tagcloud_design">
291 <a href="#tagcloud_design"><span><?php esc_html_e('Design',
292 'simple-tags'); ?></span></a>
293 </li>
294
295 <li class="tagcloud_advanced_tab <?php echo $active_tab === 'tagcloud_advanced' ? 'active' : ''; ?>" data-content="tagcloud_advanced">
296 <a href="#tagcloud_advanced"><span><?php esc_html_e('Display Format',
297 'simple-tags'); ?></span></a>
298 </li>
299
300 </ul>
301
302 <div class="st-taxonomy-content taxopress-tab-content">
303
304
305 <table class="form-table taxopress-table tagcloud_general"
306 style="<?php echo $active_tab === 'tagcloud_general' ? '' : 'display:none;'; ?>">
307 <?php
308 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
309 echo $ui->get_tr_start();
310
311
312 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
313 echo $ui->get_th_start();
314
315 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
316 echo $ui->get_label('name', esc_html__('Title', 'simple-tags')) . $ui->get_required_span();
317 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
318 echo $ui->get_th_end() . $ui->get_td_start();
319
320 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
321 echo $ui->get_text_input([
322 'namearray' => 'taxopress_tag_cloud',
323 'name' => 'title',
324 'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '',
325 'maxlength' => '32',
326 'helptext' => '',
327 'required' => true,
328 'placeholder' => false,
329 'wrap' => false,
330 ]);
331
332
333
334 $options[] = [ 'attr' => '', 'text' => esc_html__('All post types', 'simple-tags'), 'default' => 'true' ];
335 foreach ( get_post_types(['public' => true], 'objects') as $post_type ) {
336 $options[] = [ 'attr' => $post_type->name, 'text' => $post_type->label ];
337 }
338
339 $select = [
340 'options' => $options,
341 ];
342 $selected = ( isset( $current ) && isset($current['post_type']) ) ? taxopress_disp_boolean( $current['post_type'] ) : '';
343 $select['selected'] = ! empty( $selected ) ? $current['post_type'] : '';
344 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
345 echo $ui->get_select_checkbox_input_main( [
346 'namearray' => 'taxopress_tag_cloud',
347 'name' => 'post_type',
348 'class' => 'st-post-type-select',
349 'labeltext' => esc_html__( 'Post Type', 'simple-tags' ),
350 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
351 ] );
352
353 $options = [];
354 foreach ( get_all_taxopress_taxonomies() as $_taxonomy ) {
355 $_taxonomy = $_taxonomy->name;
356 $tax = get_taxonomy( $_taxonomy );
357 if ( ! $tax->show_tagcloud || empty( $tax->labels->name ) ) {
358 continue;
359 }
360 if($tax->name === 'post_tag'){
361 $options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')', 'default' => 'true' ];
362 }else{
363 $options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')' ];
364 }
365 }
366
367 $select = [
368 'options' => $options,
369 ];
370 $selected = isset( $current ) ? taxopress_disp_boolean( $current['taxonomy'] ) : '';
371 $select['selected'] = ! empty( $selected ) ? $current['taxonomy'] : '';
372 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
373 echo $ui->get_select_checkbox_input_main( [
374 'namearray' => 'taxopress_tag_cloud',
375 'name' => 'taxonomy',
376 'class' => 'st-post-taxonomy-select',
377 'labeltext' => esc_html__( 'Taxonomy', 'simple-tags' ),
378 'required' => true,
379 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
380 ] );
381
382 $select = [
383 'options' => [
384 [ 'attr' => 'flat', 'text' => esc_attr__( 'Cloud', 'simple-tags' ), 'default' => 'true' ],
385 [ 'attr' => 'list', 'text' => esc_attr__( 'List (UL/LI)', 'simple-tags' ) ],
386 ],
387 ];
388 $selected = isset( $current ) ? taxopress_disp_boolean( $current['format'] ) : '';
389 $select['selected'] = ! empty( $selected ) ? $current['format'] : '';
390 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
391 echo $ui->get_select_checkbox_input_main( [
392 'namearray' => 'taxopress_tag_cloud',
393 'name' => 'format',
394 'labeltext' => esc_html__( 'Display format', 'simple-tags' ),
395 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
396 ] );
397 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
398 echo $ui->get_td_end() . $ui->get_tr_end();
399 ?>
400 </table>
401
402
403
404
405 <table class="form-table taxopress-table tagcloud_terms"
406 style="<?php echo $active_tab === 'tagcloud_terms' ? '' : 'display:none;'; ?>">
407 <?php
408
409
410 $select = [
411 'options' => [
412 [ 'attr' => '1', 'text' => esc_attr__( '24 hours', 'simple-tags' ) ],
413 [ 'attr' => '7', 'text' => esc_attr__( '7 days', 'simple-tags' ) ],
414 [ 'attr' => '14', 'text' => esc_attr__( '2 weeks', 'simple-tags' ) ],
415 [ 'attr' => '30', 'text' => esc_attr__( '1 month', 'simple-tags' ) ],
416 [ 'attr' => '180', 'text' => esc_attr__( '6 months', 'simple-tags' ) ],
417 [ 'attr' => '365', 'text' => esc_attr__( '1 year', 'simple-tags' ) ],
418 [ 'attr' => '0', 'text' => esc_attr__( 'No limit', 'simple-tags'), 'default' => 'true' ],
419 ],
420 ];
421 $selected = isset( $current ) ? taxopress_disp_boolean( $current['limit_days'] ) : '';
422 $select['selected'] = ! empty( $selected ) ? $current['limit_days'] : '';
423 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
424 echo $ui->get_select_number_select( [
425 'namearray' => 'taxopress_tag_cloud',
426 'name' => 'limit_days',
427 'labeltext' => esc_html__( 'Limit terms based on timeframe', 'simple-tags' ),
428 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
429 ] );
430
431
432 $select = [
433 'options' => [
434 [ 'attr' => 'name', 'text' => esc_attr__( 'Name', 'simple-tags' ) ],
435 [ 'attr' => 'slug', 'text' => esc_attr__( 'Slug', 'simple-tags' ) ],
436 [ 'attr' => 'count', 'text' => esc_attr__( 'Counter', 'simple-tags'), 'default' => 'true' ],
437 [ 'attr' => 'random', 'text' => esc_attr__( 'Random', 'simple-tags' ) ],
438 ],
439 ];
440 $selected = isset( $current ) ? taxopress_disp_boolean( $current['selectionby'] ) : '';
441 $select['selected'] = ! empty( $selected ) ? $current['selectionby'] : '';
442 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
443 echo $ui->get_select_checkbox_input_main( [
444 'namearray' => 'taxopress_tag_cloud',
445 'name' => 'selectionby',
446 'labeltext' => esc_html__( 'Method for choosing terms from the database', 'simple-tags' ),
447 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
448 ] );
449
450
451 $select = [
452 'options' => [
453 [ 'attr' => 'asc', 'text' => esc_attr__( 'Ascending', 'simple-tags' ) ],
454 [ 'attr' => 'desc', 'text' => esc_attr__( 'Descending', 'simple-tags'), 'default' => 'true' ],
455 ],
456 ];
457 $selected = isset( $current ) ? taxopress_disp_boolean( $current['selection'] ) : '';
458 $select['selected'] = ! empty( $selected ) ? $current['selection'] : '';
459 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
460 echo $ui->get_select_checkbox_input_main( [
461 'namearray' => 'taxopress_tag_cloud',
462 'name' => 'selection',
463 'labeltext' => esc_html__( 'Ordering for choosing term from the database', 'simple-tags' ),
464 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
465 ] );
466
467
468 $select = [
469 'options' => [
470 [ 'attr' => 'name', 'text' => esc_attr__( 'Name', 'simple-tags' ) ],
471 [ 'attr' => 'count', 'text' => esc_attr__( 'Counter', 'simple-tags') ],
472 [ 'attr' => 'random', 'text' => esc_attr__( 'Random', 'simple-tags' ), 'default' => 'true' ],
473 ],
474 ];
475 $selected = isset( $current ) ? taxopress_disp_boolean( $current['orderby'] ) : '';
476 $select['selected'] = ! empty( $selected ) ? $current['orderby'] : '';
477 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
478 echo $ui->get_select_checkbox_input_main( [
479 'namearray' => 'taxopress_tag_cloud',
480 'name' => 'orderby',
481 'labeltext' => esc_html__( 'Method for choosing terms for display', 'simple-tags' ),
482 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
483 ] );
484
485
486 $select = [
487 'options' => [
488 [ 'attr' => 'asc', 'text' => esc_attr__( 'Ascending', 'simple-tags' ) ],
489 [ 'attr' => 'desc', 'text' => esc_attr__( 'Descending', 'simple-tags'), 'default' => 'true' ],
490 ],
491 ];
492 $selected = isset( $current ) ? taxopress_disp_boolean( $current['order'] ) : '';
493 $select['selected'] = ! empty( $selected ) ? $current['order'] : '';
494 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
495 echo $ui->get_select_checkbox_input_main( [
496 'namearray' => 'taxopress_tag_cloud',
497 'name' => 'order',
498 'labeltext' => esc_html__( 'Ordering for choosing terms for display', 'simple-tags' ),
499 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
500 ] );
501
502
503
504 ?>
505 </table>
506
507
508 <table class="form-table taxopress-table tagcloud_design"
509 style="<?php echo $active_tab === 'tagcloud_design' ? '' : 'display:none;'; ?>">
510 <?php
511
512 $select = [
513 'options' => [
514 [
515 'attr' => '0',
516 'text' => esc_attr__('False', 'simple-tags'),
517 'default' => 'true',
518 ],
519 [
520 'attr' => '1',
521 'text' => esc_attr__('True', 'simple-tags'),
522 ],
523 ],
524 ];
525 $selected = ( isset($current) && isset($current['hide_title']) ) ? taxopress_disp_boolean($current['hide_title']) : '';
526 $select['selected'] = !empty($selected) ? $current['hide_title'] : '';
527 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
528 echo $ui->get_select_checkbox_input([
529 'namearray' => 'taxopress_tag_cloud',
530 'name' => 'hide_title',
531 'labeltext' => esc_html__('Hide title in output?', 'simple-tags'),
532 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
533 ]);
534
535 $select = [
536 'options' => [
537 [
538 'attr' => '0',
539 'text' => esc_attr__('False', 'simple-tags'),
540 'default' => 'true',
541 ],
542 [
543 'attr' => '1',
544 'text' => esc_attr__('True', 'simple-tags'),
545 ],
546 ],
547 ];
548 $selected = ( isset($current) && isset($current['hide_output']) ) ? taxopress_disp_boolean($current['hide_output']) : '';
549 $select['selected'] = !empty($selected) ? $current['hide_output'] : '';
550 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
551 echo $ui->get_select_checkbox_input([
552 'namearray' => 'taxopress_tag_cloud',
553 'name' => 'hide_output',
554 'labeltext' => esc_html__('Hide display output if no terms?', 'simple-tags'),
555 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
556 ]);
557
558 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
559 echo $ui->get_number_input([
560 'namearray' => 'taxopress_tag_cloud',
561 'name' => 'max',
562 'textvalue' => isset($current['max']) ? esc_attr($current['max']) : '45',
563 'labeltext' => esc_html__('Maximum terms to display', 'simple-tags'),
564 'helptext' => '',
565 'required' => true,
566 ]);
567
568 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
569 echo $ui->get_number_input([
570 'namearray' => 'taxopress_tag_cloud',
571 'name' => 'smallest',
572 'textvalue' => isset($current['smallest']) ? esc_attr($current['smallest']) : '8',
573 'labeltext' => esc_html__('Font size minimum', 'simple-tags'),
574 'helptext' => '',
575 'required' => true,
576 ]);
577
578 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
579 echo $ui->get_number_input([
580 'namearray' => 'taxopress_tag_cloud',
581 'name' => 'largest',
582 'textvalue' => isset($current['largest']) ? esc_attr($current['largest']) : '22',
583 'labeltext' => esc_html__('Font size maximum', 'simple-tags'),
584 'helptext' => '',
585 'required' => true,
586 ]);
587
588 $select = [
589 'options' => [
590 [ 'attr' => 'pt', 'text' => esc_attr__( 'Point', 'simple-tags' ), 'default' => 'true' ],
591 [ 'attr' => 'px', 'text' => esc_attr__( 'Pixel', 'simple-tags' ) ],
592 [ 'attr' => 'em', 'text' => esc_attr__( 'Em', 'simple-tags') ],
593 [ 'attr' => '%', 'text' => esc_attr__( 'Percent', 'simple-tags') ],
594 ],
595 ];
596 $selected = isset( $current ) ? taxopress_disp_boolean( $current['unit'] ) : '';
597 $select['selected'] = ! empty( $selected ) ? $current['unit'] : '';
598 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
599 echo $ui->get_select_checkbox_input_main( [
600 'namearray' => 'taxopress_tag_cloud',
601 'name' => 'unit',
602 'labeltext' => esc_html__( 'Unit font size', 'simple-tags' ),
603 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
604 ] );
605
606 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
607 echo $ui->get_text_input([
608 'namearray' => 'taxopress_tag_cloud',
609 'name' => 'mincolor',
610 'class' => 'text-color tag-cloud-min',
611 'textvalue' => isset($current['mincolor']) ? esc_attr($current['mincolor']) : '#CCCCCC',
612 'labeltext' => esc_html__('Font color minimum', 'simple-tags'),
613 'required' => true,
614 ]);
615
616 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
617 echo $ui->get_text_input([
618 'namearray' => 'taxopress_tag_cloud',
619 'name' => 'maxcolor',
620 'class' => 'text-color tag-cloud-max',
621 'textvalue' => isset($current['maxcolor']) ? esc_attr($current['maxcolor']) : '#000000',
622 'labeltext' => esc_html__('Font color maximum', 'simple-tags'),
623 'required' => true,
624 ]);
625
626
627
628 $select = [
629 'options' => [
630 [
631 'attr' => '0',
632 'text' => esc_attr__('False', 'simple-tags'),
633 ],
634 [
635 'attr' => '1',
636 'text' => esc_attr__('True', 'simple-tags'),
637 //'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
638 ],
639 ],
640 ];
641 $selected = ( isset($current) && isset($current['color']) ) ? taxopress_disp_boolean($current['color']) : '';
642
643 if($tag_cloud_edit){
644 $select['selected'] = !empty($selected) ? $current['color'] : '';
645 }else{
646 $select['selected'] = 1; //makeup for default when creating new term display
647 }
648 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
649 echo $ui->get_select_checkbox_input([
650 'namearray' => 'taxopress_tag_cloud',
651 'name' => 'color',
652 'labeltext' => esc_html__('Automatically fill colors between maximum and minimum', 'simple-tags'),
653 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
654 ]);
655
656
657 ?>
658
659 </table>
660
661
662 <table class="form-table taxopress-table tagcloud_advanced"
663 style="<?php echo $active_tab === 'tagcloud_advanced' ? '' : 'display:none;'; ?>">
664 <?php
665
666 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
667 echo $ui->get_text_input([
668 'namearray' => 'taxopress_tag_cloud',
669 'name' => 'wrap_class',
670 'class' => '',
671 'textvalue' => isset($current['wrap_class']) ? esc_attr($current['wrap_class']) : '',
672 'labeltext' => esc_html__('Term display div class', 'simple-tags'),
673 'helptext' => '',
674 'required' => false,
675 ]);
676
677 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
678 echo $ui->get_text_input([
679 'namearray' => 'taxopress_tag_cloud',
680 'name' => 'link_class',
681 'class' => '',
682 'textvalue' => isset($current['link_class']) ? esc_attr($current['link_class']) : '',
683 'labeltext' => esc_html__('Term link class', 'simple-tags'),
684 'helptext' => '',
685 'required' => false,
686 ]);
687
688 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
689 echo $ui->get_textarea_input([
690 'namearray' => 'taxopress_tag_cloud',
691 'name' => 'xformat',
692 'class' => 'st-full-width',
693 'rows' => '4',
694 'cols' => '40',
695 '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>'),
696 'labeltext' => esc_html__('Term link format', 'simple-tags'),
697 '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>'),
698 'required' => false,
699 ]);
700
701
702 ?>
703 </table>
704
705
706 </div>
707
708
709 <?php }//end new fields
710 ?>
711
712
713 <div class="clear"></div>
714
715
716 </div>
717 </div>
718 </div>
719
720
721 <?php if ($tag_cloud_limit) { ?>
722
723 <div class="pp-version-notice-bold-purple" style="margin-left:0px;">
724 <div class="pp-version-notice-bold-purple-message"><?php echo esc_html__('You\'re using TaxoPress Free.
725 The Pro version has more features and support.', 'simple-tags'); ?>
726 </div>
727 <div class="pp-version-notice-bold-purple-button"><a
728 href="https://taxopress.com/pro" target="_blank"><?php echo esc_html__('Upgrade to Pro', 'simple-tags'); ?></a>
729 </div>
730 </div>
731
732 <?php } ?>
733 <?php
734 /**
735 * Fires after the default fieldsets on the taxonomy screen.
736 *
737 * @param taxopress_admin_ui $ui Admin UI instance.
738 */
739 do_action('taxopress_taxonomy_after_fieldsets', $ui);
740 ?>
741
742 </div>
743 </div>
744
745
746 </div>
747
748 <div class="taxopress-right-sidebar">
749 <div class="taxopress-right-sidebar-wrapper" style="min-height: 205px;">
750
751
752 <?php
753 if(!$tag_cloud_limit){ ?>
754 <p class="submit">
755
756 <?php
757 wp_nonce_field('taxopress_addedit_tagcloud_nonce_action',
758 'taxopress_addedit_tagcloud_nonce_field');
759 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?>
760 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit"
761 value="<?php echo esc_attr(esc_attr__('Save Terms Display', 'simple-tags')); ?>"/>
762 <?php
763 } else { ?>
764 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-tag-cloud-submit" name="tagcloud_submit"
765 value="<?php echo esc_attr(esc_attr__('Add Terms Display', 'simple-tags')); ?>"/>
766 <?php } ?>
767
768 <input type="hidden" name="cpt_tax_status" id="cpt_tax_status"
769 value="<?php echo esc_attr($tab); ?>"/>
770 </p>
771
772 <?php if (!empty($current)) {
773 ?>
774 <p>
775 <?php echo '<div class="taxopress-warning" style="">' . esc_html__('Shortcode: ','simple-tags'); ?> &nbsp;
776 <textarea style="resize: none;padding: 5px;" readonly>[taxopress_termsdisplay id="<?php echo (int)$current['ID']; ?>"]</textarea>
777 </div>
778 </p>
779 <?php } ?>
780
781 <?php
782 }
783 ?>
784
785 </div>
786
787 <div class="taxopress-token-right-sidebar">
788 <div id="postbox-container-1" class="postbox-container">
789 <div class="meta-box-sortables">
790 <div class="postbox">
791 <div class="postbox-header">
792 <h3 class="hndle is-non-sortable">
793 <span><?php echo esc_html__('Terms Display format', 'simple-tags'); ?></span>
794 </h3>
795 </div>
796
797 <div class="inside">
798 <p><?php echo esc_html__('Here are the tokens you can use for Term link format', 'simple-tags'); ?>:</p>
799 <ul>
800 <li><code>%tag_link%</code> <?php echo esc_html__('The URL of the term', 'simple-tags'); ?></li>
801 <li><code>%tag_id%</code> <?php echo esc_html__('The ID of the term', 'simple-tags'); ?></li>
802 <li><code>t%tag_scale%</code> <?php echo esc_html__('The weighted size of the term in the display', 'simple-tags'); ?></li>
803 <li><code>%tag_count%</code> <?php echo esc_html__('The number of times the term is used', 'simple-tags'); ?></li>
804 <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>
805 <li><code>%tag_size%</code> <?php echo esc_html__('The font size for the term', 'simple-tags'); ?></li>
806 <li><code>%tag_color%</code> <?php echo esc_html__('The font color for the term', 'simple-tags'); ?></li>
807 <li><code>%tag_name%</code> <?php echo esc_html__('The name of the term', 'simple-tags'); ?></li>
808 <li><code>%tag_name_attribute%</code> <?php echo esc_html__('The name of the term with any HTML stripped out', 'simple-tags'); ?></li>
809 </ul>
810 </div>
811 </div>
812 </div>
813 </div>
814 </div>
815
816
817 <?php do_action('taxopress_admin_after_sidebar'); ?>
818 </div>
819
820 <div class="clear"></div>
821
822
823
824 </form>
825
826 </div><!-- End .wrap -->
827
828 <div class="clear"></div>
829
830
831
832 <?php # Modal Windows; ?>
833 <div class="remodal" data-remodal-id="taxopress-modal-alert"
834 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
835 <div class="" style="color:red;"><?php echo esc_html__('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div>
836 <div id="taxopress-modal-alert-content"></div>
837 <br>
838 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('Okay', 'simple-tags'); ?></button>
839 </div>
840
841 <div class="remodal" data-remodal-id="taxopress-modal-confirm"
842 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
843 <div id="taxopress-modal-confirm-content"></div>
844 <br>
845 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('No', 'simple-tags'); ?></button>
846 <button data-remodal-action="confirm"
847 class="remodal-confirm"><?php echo esc_html__('Yes', 'simple-tags'); ?></button>
848 </div>
849
850 <?php
851 }
852
853 }
854