PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.51.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.51.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 / taxonomies.php

taxonomies.php in Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms 3.51.0, at inc/taxonomies.php

1,981 lines 121.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class SimpleTags_Admin_Taxonomies
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_select2_term_filter', [$this, 'handle_taxopress_select2_filter']);
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 wp_register_script(
41 'st-taxonomies',
42 STAGS_URL . '/assets/js/taxonomies.js',
43 ['jquery', 'jquery-ui-dialog', 'postbox'],
44 STAGS_VERSION
45 );
46 wp_register_style(
47 'st-taxonomies-css',
48 STAGS_URL . '/assets/css/taxonomies.css',
49 ['wp-jquery-ui-dialog'],
50 STAGS_VERSION,
51 'all'
52 );
53
54 // add JS for manage click tags
55 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
56 if (isset($_GET['page']) && $_GET['page'] == 'st_taxonomies') {
57 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
58 wp_enqueue_script('st-taxonomies');
59 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
60 wp_enqueue_style('st-taxonomies-css');
61
62
63 $core = get_taxonomies(['_builtin' => true]);
64 $public = get_taxonomies([
65 '_builtin' => false,
66 'public' => true,
67 ]);
68 $private = get_taxonomies([
69 '_builtin' => false,
70 'public' => false,
71 ]);
72 $registered_taxonomies = array_merge($core, $public, $private);
73 wp_localize_script(
74 'st-taxonomies',
75 'taxopress_tax_data',
76 [
77 'confirm' => esc_html__(
78 'Are you sure you want to delete this? Deleting will NOT remove created content.',
79 'simple-tags'
80 ),
81 'no_associated_type' => esc_html__('Please select at least one post type.', 'simple-tags'),
82 'existing_taxonomies' => $registered_taxonomies,
83 'integer_error' => esc_html__('Taxonomy slug cannot be numbers only.', 'simple-tags'),
84 ]
85 );
86 }
87 }
88
89 public static function set_screen($status, $option, $value)
90 {
91 return $value;
92 }
93
94 /** Singleton instance */
95 public static function get_instance()
96 {
97 if (!isset(self::$instance)) {
98 self::$instance = new self();
99 }
100
101 return self::$instance;
102 }
103
104 /**
105 * Add WP admin menu for Tags
106 *
107 * @return void
108 * @author Olatechpro
109 */
110 public function admin_menu()
111 {
112 $hook = add_submenu_page(
113 self::MENU_SLUG,
114 esc_html__('Taxonomies', 'simple-tags'),
115 esc_html__('Taxonomies', 'simple-tags'),
116 'simple_tags',
117 'st_taxonomies',
118 [
119 $this,
120 'page_manage_taxonomies',
121 ]
122 );
123
124 if (taxopress_is_screen_main_page()) {
125 add_action("load-$hook", [$this, 'screen_option']);
126 }
127 }
128
129 /**
130 * Screen options
131 */
132 public function screen_option()
133 {
134
135 $option = 'per_page';
136 $args = [
137 'label' => esc_html__('Number of items per page', 'simple-tags'),
138 'default' => 20,
139 'option' => 'st_taxonomies_per_page'
140 ];
141
142 add_screen_option($option, $args);
143
144 $this->terms_table = new Taxonomy_List();
145 }
146
147 /**
148 * Method for build the page HTML manage tags
149 *
150 * @return void
151 * @author Olatechpro
152 */
153 public function page_manage_taxonomies()
154 {
155 // Default order
156 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for default value
157 if (!isset($_GET['order'])) {
158 $_GET['order'] = 'name-asc';
159 }
160
161 settings_errors(__CLASS__);
162
163 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for page display
164 if (!isset($_GET['add'])) {
165 //all tax
166 ?>
167 <div class="wrap st_wrap st-manage-taxonomies-page">
168
169 <div id="">
170 <h1 class="wp-heading-inline"><?php _e('Taxonomies', 'simple-tags'); ?></h1>
171 <a href="<?php echo esc_url(admin_url('admin.php?page=st_taxonomies&add=taxonomy')); ?>"
172 class="page-title-action"><?php esc_html_e('Add New', 'simple-tags'); ?></a>
173
174 <div class="taxopress-description"><?php esc_html_e('This feature allows you to create new taxonomies and edit all the settings for each taxonomy.', 'simple-tags'); ?></div>
175
176
177 <?php
178 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
179 if (isset($_REQUEST['s']) && $search = sanitize_text_field(wp_unslash($_REQUEST['s']))) {
180 /* translators: %s: search keywords */
181 printf(' <span class="subtitle-text">' . esc_html__(
182 'Search results for &#8220;%s&#8221;',
183 'simple-tags'
184 ) . '</span>', esc_html($search));
185 }
186 ?>
187 <?php
188
189 //the terms table instance
190 $this->terms_table->prepare_items();
191 ?>
192
193
194 <hr class="wp-header-end">
195 <div id="ajax-response"></div>
196 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
197 <?php $this->terms_table->search_box(__('Search Taxonomies', 'simple-tags'), 'term'); ?>
198 </form>
199 <div class="clear"></div>
200
201 <div id="col-container" class="wp-clearfix">
202 <div class="col-wrap">
203 <?php
204 $selected_option = 'public';
205 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for UI display
206 if (isset($_GET['taxonomy_type']) && $_GET['taxonomy_type'] === 'all') {
207 $selected_option = 'all';
208 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for UI display
209 } elseif (isset($_GET['taxonomy_type']) && $_GET['taxonomy_type'] === 'private') {
210 $selected_option = 'private';
211 }
212 ?>
213 <div class="taxopress-taxonomy-type-wrap">
214 <select name="taxopress-taxonomy-type" class="taxopress-taxonomy-type">
215 <option value="all" <?php echo($selected_option === 'all' ? 'selected="selected"' : ''); ?>><?php echo esc_html__('All Taxonomies', 'simple-tags'); ?></option>
216 <option value="public" <?php echo($selected_option === 'public' ? 'selected="selected"' : ''); ?>><?php echo esc_html__('Public Taxonomies', 'simple-tags'); ?></option>
217 <option value="private" <?php echo($selected_option === 'private' ? 'selected="selected"' : ''); ?>><?php echo esc_html__('Private Taxonomies', 'simple-tags'); ?></option>
218 </select>
219 </div>
220 <?php
221 $post_types = get_post_types(
222 array(
223 'show_ui' => true,
224 ),
225 'objects'
226 );
227
228 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for filter display
229 $selected_post_type = isset($_GET['taxopress_taxonomy_post_type'])
230 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
231 ? sanitize_key(wp_unslash($_GET['taxopress_taxonomy_post_type']))
232 : 'all';
233 ?>
234 <div class="taxopress-taxonomy-post-type-wrap">
235 <select name="taxopress_taxonomy_post_type" class="taxopress-taxonomy-post-type">
236 <option value="all" <?php echo('all' === $selected_post_type ? 'selected="selected"' : ''); ?>>
237 <?php echo esc_html__('All Post Types', 'simple-tags'); ?>
238 </option>
239 <?php
240 if (! empty($post_types) && is_array($post_types)) {
241 foreach ($post_types as $post_type) {
242 ?>
243 <option value="<?php echo esc_attr($post_type->name); ?>" <?php selected($selected_post_type, $post_type->name); ?>>
244 <?php echo esc_html($post_type->labels->singular_name); ?>
245 </option>
246 <?php
247 }
248 }
249 ?>
250 </select>
251 </div>
252
253 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
254 <?php $this->terms_table->display(); //Display the table?>
255 </form>
256 <div class="form-wrap edit-term-notes">
257 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
258 </div>
259 </div>
260
261 </div>
262
263
264 </div>
265 <?php } else {
266 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for page routing
267 if (isset($_GET['add']) && $_GET['add'] === 'taxonomy') {
268 //add/edit taxonomy
269 $this->taxopress_manage_taxonomies();
270 echo '<div>';
271 }
272 } ?>
273
274
275 <?php SimpleTags_Admin::printAdminFooter(); ?>
276 </div>
277 <?php
278 do_action('simpletags-taxonomies', SimpleTags_Admin::$taxonomy);
279 }
280
281 /**
282 * Select2 Search taxonomy terms query
283 */
284 public function handle_taxopress_select2_filter()
285 {
286 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified in wp_verify_nonce call below
287 $search_term = isset($_GET['s']) ? sanitize_text_field(wp_unslash($_GET['s'])) : '';
288 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified in wp_verify_nonce call below
289 $taxonomy = isset($_GET['taxonomy']) ? sanitize_text_field(wp_unslash($_GET['taxonomy'])) : 'category';
290 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified in wp_verify_nonce call below
291 $nonce = isset($_REQUEST['nonce']) ? sanitize_text_field(wp_unslash($_REQUEST['nonce'])) : '';
292 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce verified in wp_verify_nonce call below
293 $page = isset($_GET['page']) ? max(1, (int) $_GET['page']) : 1;
294 $per_page = 20;
295
296 if (empty($nonce) || !wp_verify_nonce($nonce, 'st-admin-js')) {
297 wp_send_json_error(array('message' => esc_html__('Invalid nonce. Request is not authorized.', 'simple-tags')));
298 }
299
300 $args = array(
301 'taxonomy' => $taxonomy,
302 'hide_empty' => false,
303 'number' => $per_page,
304 'offset' => ($page - 1) * $per_page,
305 'search' => $search_term,
306 'orderby' => 'name',
307 'order' => 'ASC',
308 );
309
310 $terms = get_terms($args);
311
312 $count_args = $args;
313 unset($count_args['number'], $count_args['offset']);
314 $total_terms = wp_count_terms($taxonomy, $count_args);
315 if (is_wp_error($total_terms)) {
316 $total_terms = 0;
317 }
318
319 $context = isset($_GET['context']) ? sanitize_text_field($_GET['context']) : '';
320 $show_slug = (
321 'mass_edit' === $context
322 && (int) SimpleTags_Plugin::get_option_value('enable_mass-edit_terms_slug') === 1
323 );
324
325 $results = array();
326 foreach ($terms as $term) {
327 $text = $term->name;
328 if ($show_slug) {
329 $text = sprintf('%s (%s)', $term->name, $term->slug);
330 }
331
332 $results[] = array(
333 'id' => $term->slug,
334 'text' => $text,
335 );
336 }
337
338 wp_send_json(array(
339 'items' => $results,
340 'more' => ($page * $per_page < $total_terms),
341 ));
342 }
343
344
345
346 /**
347 * Create our settings page output.
348 *
349 * @internal
350 */
351 public function taxopress_manage_taxonomies()
352 {
353
354 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
355 $tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new';
356 $tab_class = 'taxopress-' . $tab;
357 $current = null;
358
359 ?>
360
361 <div class="wrap <?php echo esc_attr($tab_class); ?>">
362
363 <?php
364 /**
365 * Fires right inside the wrap div for the taxonomy editor screen.
366 */
367 do_action('taxopress_inside_taxonomy_wrap');
368
369 /**
370 * Filters whether or not a taxonomy was deleted.
371 *
372 * @param bool $value Whether or not taxonomy deleted. Default false.
373 */
374 $taxonomy_deleted = apply_filters('taxopress_taxonomy_deleted', false);
375
376 /**
377 * Fires below the output for the tab menu on the taxonomy add/edit screen.
378 */
379 do_action('taxopress_below_taxonomy_tab_menu');
380
381 $external_edit = false;
382 $taxonomy_edit = false;
383 $core_edit = false;
384
385 if ('edit' === $tab) {
386 $taxonomies = taxopress_get_taxonomy_data();
387
388 $selected_taxonomy = taxopress_get_current_taxonomy($taxonomy_deleted);
389 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for taxonomy selection
390 $request_tax = isset($_GET['taxopress_taxonomy']) ? sanitize_text_field($_GET['taxopress_taxonomy']) : '';
391
392 if ($selected_taxonomy && array_key_exists($selected_taxonomy, $taxonomies)) {
393 $current = $taxonomies[$selected_taxonomy];
394 $taxonomy_edit = true;
395 } elseif (taxonomy_exists($request_tax)) {
396 //not out taxonomy
397 $external_taxonomy = get_taxonomies(['name' => $request_tax], 'objects');
398 if (isset($external_taxonomy) > 0) {
399 $current = taxopress_convert_external_taxonomy(
400 $external_taxonomy[$request_tax],
401 $request_tax
402 );
403 $external_edit = true;
404 $taxonomy_edit = true;
405 }
406 }
407
408 if ($request_tax === 'media_tag') {
409 $external_edit = false;
410 }
411 }
412
413 if ($taxonomy_edit) {
414 $wordpress_core_tax = array_keys(get_taxonomies(['_builtin' => true]));
415 $wordpress_core_tax[] = 'post_tag';
416 $wordpress_core_tax[] = 'category';
417 if (in_array($current['name'], $wordpress_core_tax)) {
418 $core_edit = true;
419 }
420 }
421
422 $ui = new taxopress_admin_ui();
423 ?>
424
425
426 <div class="wrap <?php echo esc_attr($tab_class); ?>">
427 <h1><?php echo esc_html__('Manage Taxonomy', 'simple-tags'); ?></h1>
428 <div class="wp-clearfix"></div>
429
430 <form method="post" action="<?php echo esc_url(taxopress_get_post_form_action($ui)); ?>">
431
432 <?php
433 if ($external_edit) {
434 echo '<input type="hidden" name="taxonomy_external_edit" aria-current="false" class="taxonomy_external_edit" value="1" />';
435 }
436 ?>
437
438
439 <div class="taxonomiesui">
440
441
442 <div class="postbox-container">
443 <div id="poststuff">
444 <div class="taxopress-section postbox">
445 <div class="postbox-header">
446 <h2 class="hndle ui-sortable-handle">
447 <?php
448 if ($taxonomy_edit) {
449 echo esc_html__('Edit Taxonomy', 'simple-tags');
450 } else {
451 echo esc_html__('Add new Taxonomy', 'simple-tags');
452 }
453 ?>
454 </h2>
455 </div>
456 <div class="inside">
457 <div class="main">
458
459 <ul class="st-taxonomy-tab">
460 <li aria-current="true" class="taxonomy_general_tab active" data-content="taxonomy_general">
461 <a href="#taxonomy_general">
462 <span><?php esc_html_e('General', 'simple-tags'); ?></span>
463 </a>
464 </li>
465
466 <li aria-current="false" class="taxonomy_posttypes_tab" data-content="taxonomy_posttypes">
467 <a href="#taxonomy_posttypes">
468 <span><?php esc_html_e('Post Types', 'simple-tags'); ?></span>
469 </a>
470 </li>
471
472 <li aria-current="false" class="taxonomy_permalinks_tab" data-content="taxonomy_permalinks">
473 <a href="#taxonomy_permalinks">
474 <span><?php esc_html_e('Permalinks', 'simple-tags'); ?></span>
475 </a>
476 </li>
477
478 <li aria-current="false" class="taxonomy_menus_tab" data-content="taxonomy_menus">
479 <a href="#taxonomy_menus"><span><?php esc_html_e('Admin Area', 'simple-tags'); ?></span></a>
480 </li>
481
482 <li aria-current="false" class="taxonomy_labels_tab" data-content="taxonomy_labels">
483 <a href="#taxonomy_labels"><span><?php esc_html_e('Other Labels', 'simple-tags'); ?></span></a>
484 </li>
485
486 <li aria-current="false" class="taxonomy_restapi_tab" data-content="taxonomy_restapi">
487 <a href="#taxonomy_restapi"><span><?php esc_html_e('REST API', 'simple-tags'); ?></span></a>
488 </li>
489
490 <li aria-current="false" class="taxonomy_advanced_tab" data-content="taxonomy_advanced">
491 <a href="#taxonomy_advanced"><span><?php esc_html_e('Advanced', 'simple-tags'); ?></span></a>
492 </li>
493
494 <li aria-current="false" class="taxonomy_order_tab" data-content="taxonomy_order">
495 <a href="#taxonomy_order"><span><?php esc_html_e('Order', 'simple-tags'); ?></span></a>
496 </li>
497
498 <?php if ($taxonomy_edit && !$external_edit) { ?>
499 <li aria-current="false" class="taxonomy_slug_tab" data-content="taxonomy_slug">
500 <a href="#taxonomy_slug"><span><?php esc_html_e('Slug', 'simple-tags'); ?></span></a>
501 </li>
502 <?php } ?>
503
504 <?php
505 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for conditional UI display
506 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) {
507 ?>
508 <li aria-current="false" class="taxonomy_delete_tab" data-content="taxonomy_delete">
509 <a href="#taxonomy_delete"><span><?php esc_html_e('Deactivate or Delete', 'simple-tags'); ?></span></a>
510 </li>
511 <?php } ?>
512 </ul>
513
514
515 <div class="st-taxonomy-content">
516
517
518 <table class="form-table taxopress-table taxonomy_general">
519 <?php
520 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
521 echo $ui->get_tr_start();
522
523 if (!$taxonomy_edit) {
524 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
525 echo $ui->get_th_start();
526 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
527 echo $ui->get_label('name', esc_html__('Taxonomy Slug', 'simple-tags')) . $ui->get_required_span();
528
529 if ('edit' === $tab) {
530 echo '<p id="slugchanged" class="hidemessage">' . esc_html__(
531 'Slug has changed',
532 'simple-tags'
533 ) . '<span class="dashicons dashicons-warning"></span></p>';
534 }
535 echo '<p id="slugexists" class="hidemessage">' . esc_html__(
536 'Slug already exists',
537 'simple-tags'
538 ) . '<span class="dashicons dashicons-warning"></span></p>';
539 echo '<p id="st-tags-slug-error-input" class="hidemessage">' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>';
540
541 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
542 echo $ui->get_th_end() . $ui->get_td_start();
543
544 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
545 echo $ui->get_text_input([
546 'namearray' => 'cpt_custom_tax',
547 'name' => 'name',
548 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '',
549 'maxlength' => '32',
550 'helptext' => esc_html__(
551 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and underscores.',
552 'simple-tags'
553 ),
554 'class' => 'tax-slug-input',
555 'required' => true,
556 'placeholder' => false,
557 'wrap' => false,
558 ]);
559
560 if ('edit' === $tab) {
561 echo '<p>';
562 esc_html_e(
563 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.',
564 'simple-tags'
565 );
566 echo '</p>';
567
568 echo '<div class="taxopress-spacer">';
569 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
570 echo $ui->get_check_input([
571 'checkvalue' => 'update_taxonomy',
572 'checked' => 'false',
573 'name' => 'update_taxonomy',
574 'namearray' => 'update_taxonomy',
575 'labeltext' => esc_html__(
576 'Migrate terms to newly renamed taxonomy?',
577 'simple-tags'
578 ),
579 'helptext' => '',
580 'default' => false,
581 'wrap' => false,
582 ]);
583 echo '</div>';
584 }
585 }
586
587
588
589 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
590 echo $ui->get_text_input([
591 'namearray' => 'cpt_custom_tax',
592 'name' => 'label',
593 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '',
594 'aftertext' => esc_html__('(e.g. Jobs)', 'simple-tags'),
595 'labeltext' => esc_html__('Plural Label', 'simple-tags'),
596 'maxlength' => '100',
597 'helptext' => '',
598 'required' => true,
599 ]);
600
601 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
602 echo $ui->get_text_input([
603 'namearray' => 'cpt_custom_tax',
604 'name' => 'singular_label',
605 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '',
606 'aftertext' => esc_html__('(e.g. Job)', 'simple-tags'),
607 'labeltext' => esc_html__('Singular Label', 'simple-tags'),
608 'maxlength' => '100',
609 'helptext' => '',
610 'required' => true,
611 ]);
612
613
614
615 $select = [
616 'options' => [
617 [
618 'attr' => '0',
619 'text' => esc_attr__('False', 'simple-tags'),
620 'default' => 'true',
621 ],
622 [
623 'attr' => '1',
624 'text' => esc_attr__('True', 'simple-tags'),
625 ],
626 ],
627 ];
628 $selected = isset($current) ? taxopress_disp_boolean($current['hierarchical']) : '';
629 $select['selected'] = !empty($selected) ? $current['hierarchical'] : '';
630 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
631 echo $ui->get_select_checkbox_input([
632 'namearray' => 'cpt_custom_tax',
633 'name' => 'hierarchical',
634 'labeltext' => esc_html__('Parent-Child Relationships', 'simple-tags'),
635 'aftertext' => esc_html__(
636 'Can terms in this taxonomy be organized into hierarchical relationships?',
637 'simple-tags'
638 ),
639 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
640 ]);
641
642
643
644 if (isset($current['description'])) {
645 $current['description'] = stripslashes_deep($current['description']);
646 }
647 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
648 echo $ui->get_textarea_input([
649 'namearray' => 'cpt_custom_tax',
650 'name' => 'description',
651 'rows' => '4',
652 'cols' => '40',
653 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '',
654 'labeltext' => esc_html__('Description', 'simple-tags'),
655 'helptext' => esc_attr__(
656 'Describe what your taxonomy is used for.',
657 'simple-tags'
658 ),
659 ]);
660
661 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
662 echo $ui->get_text_input([
663 'namearray' => 'cpt_custom_tax',
664 'name' => 'default_term',
665 'textvalue' => isset($current['default_term']) ? esc_attr($current['default_term']) : '',
666 'labeltext' => esc_html__('Default Terms', 'simple-tags'),
667 'helptext' => esc_html__(
668 'Set the default terms for this taxonomy. These will be automatically added to all new posts. Enter the term names or slugs. Separate multiple terms with by comma.',
669 'simple-tags'
670 ),
671 ]);
672
673
674 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
675 echo $ui->get_td_end() . $ui->get_tr_end();
676 ?>
677 </table>
678
679
680 <table class="form-table taxopress-table taxonomy_posttypes"
681 style="display:none;">
682 <?php
683
684 /**
685 * Filters the arguments for post types to list for taxonomy association.
686 *
687 *
688 * @param array $value Array of default arguments.
689 */
690 $args = apply_filters(
691 'taxopress_attach_post_types_to_taxonomy',
692 ['public' => true]
693 );
694
695 // If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
696 if (!is_array($args)) {
697 $args = ['public' => true];
698 }
699 $output = 'objects'; // Or objects.
700
701 /**
702 * Filters the results returned to display for available post types for taxonomy.
703 *
704 * @param array $value Array of post type objects.
705 * @param array $args Array of arguments for the post type query.
706 * @param string $output The output type we want for the results.
707 */
708 $post_types = apply_filters(
709 'taxopress_get_post_types_for_taxonomies',
710 get_post_types($args, $output),
711 $args,
712 $output
713 );
714
715 foreach ($post_types as $post_type) {
716 $core_label = in_array($post_type->name, [
717 'post',
718 'page',
719 'attachment',
720 ], true) ? '' : '';
721
722
723 echo '<tr valign="top"><th scope="row"><label for="' . esc_attr($post_type->name) . '">' . esc_html($post_type->label) . '</label></th><td>';
724
725 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
726 echo $ui->get_check_input([
727 'checkvalue' => esc_attr($post_type->name),
728 'checked' => (!empty($current['object_types']) && is_array($current['object_types']) && in_array(
729 $post_type->name,
730 $current['object_types'],
731 true
732 )) ? 'true' : 'false',
733 'name' => esc_attr($post_type->name),
734 'namearray' => 'cpt_post_types',
735 'textvalue' => esc_attr($post_type->name),
736 'labeltext' => "",
737 'wrap' => false,
738 ]);
739
740 echo '</td></tr>';
741 }
742
743
744 if ($taxonomy_edit) {
745 $select = [
746 'options' => [
747 [
748 'attr' => '0',
749 'text' => esc_attr__('False', 'simple-tags'),
750 'default' => 'true',
751 ],
752 [
753 'attr' => '1',
754 'text' => esc_attr__('True', 'simple-tags'),
755 ],
756 ],
757 ];
758 } else {
759 $select = [
760 'options' => [
761 [
762 'attr' => '0',
763 'text' => esc_attr__('False', 'simple-tags'),
764 ],
765 [
766 'attr' => '1',
767 'text' => esc_attr__('True', 'simple-tags'),
768 'default' => 'true',
769 ],
770 ],
771 ];
772 }
773 $selected = isset($current) && isset($current['include_in_result']) ? taxopress_disp_boolean($current['include_in_result']) : '';
774 $select['selected'] = !empty($selected) ? $current['include_in_result'] : '';
775
776 echo '<td><hr /></td>';
777
778 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
779 echo $ui->get_select_checkbox_input([
780 'namearray' => 'cpt_custom_tax',
781 'name' => 'include_in_result',
782 'labeltext' => esc_html__('Archive page result', 'simple-tags'),
783 'aftertext' => esc_html__(
784 'Normally, WordPress will only show one post type on taxonomy archive pages. Enable this feature to show content from all selected posts types.',
785 'simple-tags'
786 ),
787 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
788 ]);
789
790
791 ?>
792
793 </table>
794
795
796 <table class="form-table taxopress-table taxonomy_slug"
797 style="display:none;">
798 <?php
799
800
801 if ($taxonomy_edit) {
802 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
803 echo $ui->get_th_start();
804 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
805 echo $ui->get_label('name', esc_html__('Taxonomy Slug', 'simple-tags')) . $ui->get_required_span();
806
807 if ('edit' === $tab) {
808 echo '<p id="slugchanged" class="hidemessage">' . esc_html__(
809 'Slug has changed',
810 'simple-tags'
811 ) . '<span class="dashicons dashicons-warning"></span></p>';
812 }
813 echo '<p id="slugexists" class="hidemessage">' . esc_html__(
814 'Slug already exists',
815 'simple-tags'
816 ) . '<span class="dashicons dashicons-warning"></span></p>';
817
818 echo '<p id="st-tags-slug-error-input" class="hidemessage">' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '<span class="dashicons dashicons-warning"></span></p>';
819
820 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
821 echo $ui->get_th_end() . $ui->get_td_start();
822
823 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
824 echo $ui->get_text_input([
825 'namearray' => 'cpt_custom_tax',
826 'name' => 'name',
827 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '',
828 'maxlength' => '32',
829 'helptext' => 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and underscores.',
830 'class' => 'tax-slug-input',
831 'required' => true,
832 'placeholder' => false,
833 'wrap' => false,
834 ]);
835
836 if ('edit' === $tab) {
837 echo '<p>';
838 esc_html_e(
839 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.',
840 'simple-tags'
841 );
842 echo '</p>';
843
844 echo '<div class="taxopress-spacer">';
845 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
846 echo $ui->get_check_input([
847 'checkvalue' => 'update_taxonomy',
848 'checked' => 'false',
849 'name' => 'update_taxonomy',
850 'namearray' => 'update_taxonomy',
851 'labeltext' => esc_html__(
852 'Migrate terms to newly renamed taxonomy?',
853 'simple-tags'
854 ),
855 'helptext' => '',
856 'default' => false,
857 'wrap' => false,
858 ]);
859 echo '</div>';
860 }
861 }
862
863 ?>
864
865 </table>
866
867
868 <table class="form-table taxopress-table taxonomy_permalinks"
869 style="display:none;">
870 <?php
871
872
873 $select = [
874 'options' => [
875 [
876 'attr' => '0',
877 'text' => esc_attr__('False', 'simple-tags'),
878 ],
879 [
880 'attr' => '1',
881 'text' => esc_attr__('True', 'simple-tags'),
882 'default' => 'true',
883 ],
884 ],
885 ];
886 $selected = isset($current) ? taxopress_disp_boolean($current['rewrite']) : '';
887 $select['selected'] = !empty($selected) ? $current['rewrite'] : '';
888 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
889 echo $ui->get_select_checkbox_input([
890 'namearray' => 'cpt_custom_tax',
891 'name' => 'rewrite',
892 'labeltext' => esc_html__('Rewrite', 'simple-tags'),
893 'aftertext' => esc_html__(
894 'WordPress can use a custom permalink for this taxonomy. It does not have to match the slug.',
895 'simple-tags'
896 ),
897 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
898 ]);
899
900 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
901 echo $ui->get_text_input([
902 'namearray' => 'cpt_custom_tax',
903 'name' => 'rewrite_slug',
904 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '',
905 'aftertext' => esc_attr__('(default: taxonomy name)', 'simple-tags'),
906 'labeltext' => esc_html__('Custom Rewrite Slug', 'simple-tags'),
907 'helptext' => esc_html__(
908 'Custom taxonomy rewrite slug.',
909 'simple-tags'
910 ),
911 ]);
912
913 $select = [
914 'options' => [
915 [
916 'attr' => '0',
917 'text' => esc_attr__('False', 'simple-tags'),
918 ],
919 [
920 'attr' => '1',
921 'text' => esc_attr__('True', 'simple-tags'),
922 'default' => 'true',
923 ],
924 ],
925 ];
926 $selected = isset($current) ? taxopress_disp_boolean($current['rewrite_withfront']) : '';
927 $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : '';
928 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
929 echo $ui->get_select_checkbox_input([
930 'namearray' => 'cpt_custom_tax',
931 'name' => 'rewrite_withfront',
932 'labeltext' => esc_html__('Rewrite With Front', 'simple-tags'),
933 'aftertext' => esc_html__(
934 'Should the permastruct be prepended with the front base.',
935 'simple-tags'
936 ),
937 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
938 ]);
939
940 $select = [
941 'options' => [
942 [
943 'attr' => '0',
944 'text' => esc_attr__('False', 'simple-tags'),
945 'default' => 'false',
946 ],
947 [
948 'attr' => '1',
949 'text' => esc_attr__('True', 'simple-tags'),
950 ],
951 ],
952 ];
953 $selected = isset($current) ? taxopress_disp_boolean($current['rewrite_hierarchical']) : '';
954 $select['selected'] = !empty($selected) ? $current['rewrite_hierarchical'] : '';
955 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
956 echo $ui->get_select_checkbox_input([
957 'namearray' => 'cpt_custom_tax',
958 'name' => 'rewrite_hierarchical',
959 'labeltext' => esc_html__('Rewrite Hierarchical', 'simple-tags'),
960 'aftertext' => esc_html__(
961 'Should the permastruct allow hierarchical urls.',
962 'simple-tags'
963 ),
964 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
965 ]);
966
967 ?>
968
969 </table>
970
971
972 <table class="form-table taxopress-table taxonomy_menus"
973 style="display:none;">
974 <?php
975
976
977 $select = [
978 'options' => [
979 [
980 'attr' => '0',
981 'text' => esc_attr__('False', 'simple-tags'),
982 ],
983 [
984 'attr' => '1',
985 'text' => esc_attr__('True', 'simple-tags'),
986 'default' => 'true',
987 ],
988 ],
989 ];
990 $selected = isset($current) ? taxopress_disp_boolean($current['show_ui']) : '';
991 $select['selected'] = !empty($selected) ? $current['show_ui'] : '';
992 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
993 echo $ui->get_select_checkbox_input([
994 'namearray' => 'cpt_custom_tax',
995 'name' => 'show_ui',
996 'labeltext' => esc_html__('Show user interface', 'simple-tags'),
997 'aftertext' => esc_html__('Should there be a visible interface in the WordPress admin area to manage these terms?', 'simple-tags'),
998 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
999 ]);
1000
1001 $select = [
1002 'options' => [
1003 [
1004 'attr' => '0',
1005 'text' => esc_attr__('False', 'simple-tags'),
1006 ],
1007 [
1008 'attr' => '1',
1009 'text' => esc_attr__('True', 'simple-tags'),
1010 'default' => 'true',
1011 ],
1012 ],
1013 ];
1014 $selected = isset($current) ? taxopress_disp_boolean($current['show_in_menu']) : '';
1015 $select['selected'] = !empty($selected) ? $current['show_in_menu'] : '';
1016 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1017 echo $ui->get_select_checkbox_input([
1018 'namearray' => 'cpt_custom_tax',
1019 'name' => 'show_in_menu',
1020 'labeltext' => esc_html__('Show in admin menus', 'simple-tags'),
1021 'aftertext' => esc_html__('Should there be links to this taxonomy in the WordPress admin menus?', 'simple-tags'),
1022 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1023 ]);
1024
1025 $select = [
1026 'options' => [
1027 [
1028 'attr' => '0',
1029 'text' => esc_attr__('False', 'simple-tags'),
1030 ],
1031 [
1032 'attr' => '1',
1033 'text' => esc_attr__('True', 'simple-tags'),
1034 'default' => 'true',
1035 ],
1036 ],
1037 ];
1038 $selected = (isset($current) && !empty($current['show_in_nav_menus'])) ? taxopress_disp_boolean($current['show_in_nav_menus']) : '';
1039 $select['selected'] = !empty($selected) ? $current['show_in_nav_menus'] : '';
1040 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1041 echo $ui->get_select_checkbox_input([
1042 'namearray' => 'cpt_custom_tax',
1043 'name' => 'show_in_nav_menus',
1044 'labeltext' => esc_html__('Show in frontend menus', 'simple-tags'),
1045 'aftertext' => esc_html__('Should this taxonomy be available for the frontend “Menus” and “Navigation” options?', 'simple-tags'),
1046 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1047 ]);
1048
1049
1050 $select = [
1051 'options' => [
1052 [
1053 'attr' => '0',
1054 'text' => esc_attr__('False', 'simple-tags'),
1055 'default' => 'true',
1056 ],
1057 [
1058 'attr' => '1',
1059 'text' => esc_attr__('True', 'simple-tags'),
1060 ],
1061 ],
1062 ];
1063 $selected = isset($current) ? taxopress_disp_boolean($current['show_admin_column']) : '';
1064 $select['selected'] = !empty($selected) ? $current['show_admin_column'] : '';
1065 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1066 echo $ui->get_select_checkbox_input([
1067 'namearray' => 'cpt_custom_tax',
1068 'name' => 'show_admin_column',
1069 'labeltext' => esc_html__('Show admin column', 'simple-tags'),
1070 'aftertext' => esc_html__('Should a column for this taxonomy appear on screens such as “Posts” and “Pages”?', 'simple-tags'),
1071 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1072 ]);
1073
1074 $select = [
1075 'options' => [
1076 [
1077 'attr' => '0',
1078 'text' => esc_attr__('False', 'simple-tags'),
1079 'default' => 'false',
1080 ],
1081 [
1082 'attr' => '1',
1083 'text' => esc_attr__('True', 'simple-tags'),
1084 ],
1085 ],
1086 ];
1087 $selected = (isset($current) && !empty($current['show_in_quick_edit'])) ? taxopress_disp_boolean($current['show_in_quick_edit']) : '';
1088 $select['selected'] = !empty($selected) ? $current['show_in_quick_edit'] : '';
1089 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1090 echo $ui->get_select_checkbox_input([
1091 'namearray' => 'cpt_custom_tax',
1092 'name' => 'show_in_quick_edit',
1093 'labeltext' => esc_html__(
1094 'Show in "Quick Edit" and "Bulk Edit"',
1095 'simple-tags'
1096 ),
1097 'aftertext' => esc_html__('Should this taxonomy be available in editing tools on screens such as “Posts” and “Pages”?', 'simple-tags'),
1098 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1099 ]);
1100
1101 $select = array(
1102 'options' => array(
1103 array(
1104 'attr' => '0',
1105 'text' => esc_attr__('False', 'simple-tags'),
1106 'default' => 'false',
1107 ),
1108 array(
1109 'attr' => '1',
1110 'text' => esc_attr__('True', 'simple-tags'),
1111 ),
1112 ),
1113 );
1114 $selected = (isset($current) && ! empty($current['show_in_filter'])) ? taxopress_disp_boolean($current['show_in_filter']) : '';
1115 $select['selected'] = ! empty($selected) ? $current['show_in_filter'] : '';
1116 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1117 echo $ui->get_select_checkbox_input(
1118 array(
1119 'namearray' => 'cpt_custom_tax',
1120 'name' => 'show_in_filter',
1121 'labeltext' => esc_html__(
1122 'Show in Filter',
1123 'simple-tags'
1124 ),
1125 'aftertext' => esc_html__('Should this taxonomy be available in filters on screens such as “Posts” and “Pages”?', 'simple-tags'),
1126 'selections' => $select, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1127 )
1128 );
1129
1130 ?>
1131
1132 </table>
1133
1134
1135 <table class="form-table taxopress-table taxonomy_labels"
1136 style="display:none;">
1137
1138 <?php
1139 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1140 echo $ui->get_text_input([
1141 'namearray' => 'cpt_tax_labels',
1142 'name' => 'menu_name',
1143 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '',
1144 'aftertext' => esc_attr__('(e.g. Jobs)', 'simple-tags'),
1145 'labeltext' => esc_html__('Menu Name', 'simple-tags'),
1146 'helptext' => esc_html__(
1147 'Custom admin menu name for your taxonomy.',
1148 'simple-tags'
1149 ),
1150 'maxlength' => '100',
1151 'data' => [
1152 'label' => 'item', // Not localizing because it's isolated.
1153 'plurality' => 'plural',
1154 ],
1155 ]);
1156
1157 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1158 echo $ui->get_text_input([
1159 'namearray' => 'cpt_tax_labels',
1160 'name' => 'all_items',
1161 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '',
1162 'aftertext' => esc_attr__('(e.g. All Jobs)', 'simple-tags'),
1163 'labeltext' => esc_html__('All Items', 'simple-tags'),
1164 'helptext' => esc_html__(
1165 'Used as tab text when showing all terms for hierarchical taxonomy while editing post.',
1166 'simple-tags'
1167 ),
1168 'data' => [
1169 /* translators: Used for autofill */
1170 'label' => sprintf(
1171 esc_attr__('All %s', 'simple-tags'),
1172 'item'
1173 ),
1174 'plurality' => 'plural',
1175 ],
1176 ]);
1177
1178 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1179 echo $ui->get_text_input([
1180 'namearray' => 'cpt_tax_labels',
1181 'name' => 'edit_item',
1182 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '',
1183 'aftertext' => esc_attr__('(e.g. Edit Job)', 'simple-tags'),
1184 'labeltext' => esc_html__('Edit Item', 'simple-tags'),
1185 'helptext' => esc_html__(
1186 'Used at the top of the term editor screen for an existing taxonomy term.',
1187 'simple-tags'
1188 ),
1189 'data' => [
1190 /* translators: Used for autofill */
1191 'label' => sprintf(
1192 esc_attr__('Edit %s', 'simple-tags'),
1193 'item'
1194 ),
1195 'plurality' => 'singular',
1196 ],
1197 ]);
1198
1199 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1200 echo $ui->get_text_input([
1201 'namearray' => 'cpt_tax_labels',
1202 'name' => 'view_item',
1203 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '',
1204 'aftertext' => esc_attr__('(e.g. View Job)', 'simple-tags'),
1205 'labeltext' => esc_html__('View Item', 'simple-tags'),
1206 'helptext' => esc_html__(
1207 'Used in the admin bar when viewing editor screen for an existing taxonomy term.',
1208 'simple-tags'
1209 ),
1210 'data' => [
1211 /* translators: Used for autofill */
1212 'label' => sprintf(
1213 esc_attr__('View %s', 'simple-tags'),
1214 'item'
1215 ),
1216 'plurality' => 'singular',
1217 ],
1218 ]);
1219
1220 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1221 echo $ui->get_text_input([
1222 'namearray' => 'cpt_tax_labels',
1223 'name' => 'update_item',
1224 'textvalue' => isset($current['labels']['update_item']) ? esc_attr($current['labels']['update_item']) : '',
1225 'aftertext' => esc_attr__('(e.g. Update Job Name)', 'simple-tags'),
1226 'labeltext' => esc_html__('Update Item Name', 'simple-tags'),
1227 'helptext' => esc_html__(
1228 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1229 'simple-tags'
1230 ),
1231 'data' => [
1232 /* translators: Used for autofill */
1233 'label' => sprintf(
1234 esc_attr__(
1235 'Update %s name',
1236 'simple-tags'
1237 ),
1238 'item'
1239 ),
1240 'plurality' => 'singular',
1241 ],
1242 ]);
1243
1244 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1245 echo $ui->get_text_input([
1246 'namearray' => 'cpt_tax_labels',
1247 'name' => 'add_new_item',
1248 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '',
1249 'aftertext' => esc_attr__('(e.g. Add New Job)', 'simple-tags'),
1250 'labeltext' => esc_html__('Add New Item', 'simple-tags'),
1251 'helptext' => esc_html__(
1252 'Used at the top of the term editor screen and button text for a new taxonomy term.',
1253 'simple-tags'
1254 ),
1255 'data' => [
1256 /* translators: Used for autofill */
1257 'label' => sprintf(
1258 esc_attr__('Add new %s', 'simple-tags'),
1259 'item'
1260 ),
1261 'plurality' => 'singular',
1262 ],
1263 ]);
1264
1265 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1266 echo $ui->get_text_input([
1267 'namearray' => 'cpt_tax_labels',
1268 'name' => 'new_item_name',
1269 'textvalue' => isset($current['labels']['new_item_name']) ? esc_attr($current['labels']['new_item_name']) : '',
1270 'aftertext' => esc_attr__('(e.g. New Job Name)', 'simple-tags'),
1271 'labeltext' => esc_html__('New Item Name', 'simple-tags'),
1272 'helptext' => esc_html__(
1273 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1274 'simple-tags'
1275 ),
1276 'data' => [
1277 /* translators: Used for autofill */
1278 'label' => sprintf(
1279 esc_attr__('New %s name', 'simple-tags'),
1280 'item'
1281 ),
1282 'plurality' => 'singular',
1283 ],
1284 ]);
1285
1286 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1287 echo $ui->get_text_input([
1288 'namearray' => 'cpt_tax_labels',
1289 'name' => 'parent_item',
1290 'textvalue' => isset($current['labels']['parent_item']) ? esc_attr($current['labels']['parent_item']) : '',
1291 'aftertext' => esc_attr__('(e.g. Parent Job)', 'simple-tags'),
1292 'labeltext' => esc_html__('Parent Item', 'simple-tags'),
1293 'helptext' => esc_html__(
1294 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1295 'simple-tags'
1296 ),
1297 'data' => [
1298 /* translators: Used for autofill */
1299 'label' => sprintf(
1300 esc_attr__('Parent %s', 'simple-tags'),
1301 'item'
1302 ),
1303 'plurality' => 'singular',
1304 ],
1305 ]);
1306
1307 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1308 echo $ui->get_text_input([
1309 'namearray' => 'cpt_tax_labels',
1310 'name' => 'parent_item_colon',
1311 'textvalue' => isset($current['labels']['parent_item_colon']) ? esc_attr($current['labels']['parent_item_colon']) : '',
1312 'aftertext' => esc_attr__('(e.g. Parent Job:)', 'simple-tags'),
1313 'labeltext' => esc_html__('Parent Item Colon', 'simple-tags'),
1314 'helptext' => esc_html__(
1315 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1316 'simple-tags'
1317 ),
1318 'data' => [
1319 /* translators: Used for autofill */
1320 'label' => sprintf(
1321 esc_attr__('Parent %s:', 'simple-tags'),
1322 'item'
1323 ),
1324 'plurality' => 'singular',
1325 ],
1326 ]);
1327
1328 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1329 echo $ui->get_text_input([
1330 'namearray' => 'cpt_tax_labels',
1331 'name' => 'search_items',
1332 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '',
1333 'aftertext' => esc_attr__('(e.g. Search Jobs)', 'simple-tags'),
1334 'labeltext' => esc_html__('Search Items', 'simple-tags'),
1335 'helptext' => esc_html__(
1336 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1337 'simple-tags'
1338 ),
1339 'data' => [
1340 /* translators: Used for autofill */
1341 'label' => sprintf(
1342 esc_attr__('Search %s', 'simple-tags'),
1343 'item'
1344 ),
1345 'plurality' => 'plural',
1346 ],
1347 ]);
1348
1349 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1350 echo $ui->get_text_input([
1351 'namearray' => 'cpt_tax_labels',
1352 'name' => 'popular_items',
1353 'textvalue' => isset($current['labels']['popular_items']) ? esc_attr($current['labels']['popular_items']) : null,
1354 'aftertext' => esc_attr__('(e.g. Popular Jobs)', 'simple-tags'),
1355 'labeltext' => esc_html__('Popular Items', 'simple-tags'),
1356 'helptext' => esc_html__(
1357 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1358 'simple-tags'
1359 ),
1360 'data' => [
1361 /* translators: Used for autofill */
1362 'label' => sprintf(
1363 esc_attr__('Popular %s', 'simple-tags'),
1364 'item'
1365 ),
1366 'plurality' => 'plural',
1367 ],
1368 ]);
1369
1370 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1371 echo $ui->get_text_input([
1372 'namearray' => 'cpt_tax_labels',
1373 'name' => 'separate_items_with_commas',
1374 'textvalue' => isset($current['labels']['separate_items_with_commas']) ? esc_attr($current['labels']['separate_items_with_commas']) : null,
1375 'aftertext' => esc_attr__(
1376 '(e.g. Separate Jobs with commas)',
1377 'simple-tags'
1378 ),
1379 'labeltext' => esc_html__(
1380 'Separate Items with Commas',
1381 'simple-tags'
1382 ),
1383 'helptext' => esc_html__(
1384 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1385 'simple-tags'
1386 ),
1387 'data' => [
1388 /* translators: Used for autofill */
1389 'label' => sprintf(esc_attr__(
1390 'Separate %s with commas',
1391 'simple-tags'
1392 ), 'item'),
1393 'plurality' => 'plural',
1394 ],
1395 ]);
1396
1397 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1398 echo $ui->get_text_input([
1399 'namearray' => 'cpt_tax_labels',
1400 'name' => 'add_or_remove_items',
1401 'textvalue' => isset($current['labels']['add_or_remove_items']) ? esc_attr($current['labels']['add_or_remove_items']) : null,
1402 'aftertext' => esc_attr__(
1403 '(e.g. Add or remove Jobs)',
1404 'simple-tags'
1405 ),
1406 'labeltext' => esc_html__('Add or Remove Items', 'simple-tags'),
1407 'helptext' => esc_html__(
1408 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1409 'simple-tags'
1410 ),
1411 'data' => [
1412 /* translators: Used for autofill */
1413 'label' => sprintf(
1414 esc_attr__(
1415 'Add or remove %s',
1416 'simple-tags'
1417 ),
1418 'item'
1419 ),
1420 'plurality' => 'plural',
1421 ],
1422 ]);
1423
1424 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1425 echo $ui->get_text_input([
1426 'namearray' => 'cpt_tax_labels',
1427 'name' => 'choose_from_most_used',
1428 'textvalue' => isset($current['labels']['choose_from_most_used']) ? esc_attr($current['labels']['choose_from_most_used']) : null,
1429 'aftertext' => esc_attr__(
1430 '(e.g. Choose from the most used Jobs)',
1431 'simple-tags'
1432 ),
1433 'labeltext' => esc_html__('Choose From Most Used', 'simple-tags'),
1434 'helptext' => esc_html__(
1435 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.',
1436 'simple-tags'
1437 ),
1438 'data' => [
1439 /* translators: Used for autofill */
1440 'label' => sprintf(esc_attr__(
1441 'Choose from the most used %s',
1442 'simple-tags'
1443 ), 'item'),
1444 'plurality' => 'plural',
1445 ],
1446 ]);
1447
1448 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1449 echo $ui->get_text_input([
1450 'namearray' => 'cpt_tax_labels',
1451 'name' => 'no_terms',
1452 'textvalue' => isset($current['labels']['no_terms']) ? esc_attr($current['labels']['no_terms']) : null,
1453 'aftertext' => esc_html__('(e.g. No jobs)', 'simple-tags'),
1454 'labeltext' => esc_html__('No terms', 'simple-tags'),
1455 'helptext' => esc_attr__(
1456 'Used when indicating that there are no terms in the given taxonomy associated with an object.',
1457 'simple-tags'
1458 ),
1459 'data' => [
1460 /* translators: Used for autofill */
1461 'label' => sprintf(
1462 esc_attr__('No %s', 'simple-tags'),
1463 'item'
1464 ),
1465 'plurality' => 'plural',
1466 ],
1467 ]);
1468
1469 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1470 echo $ui->get_text_input([
1471 'namearray' => 'cpt_tax_labels',
1472 'name' => 'items_list_navigation',
1473 'textvalue' => isset($current['labels']['items_list_navigation']) ? esc_attr($current['labels']['items_list_navigation']) : null,
1474 'aftertext' => esc_html__(
1475 '(e.g. Jobs list navigation)',
1476 'simple-tags'
1477 ),
1478 'labeltext' => esc_html__('Items List Navigation', 'simple-tags'),
1479 'helptext' => esc_attr__(
1480 'Screen reader text for the pagination heading on the term listing screen.',
1481 'simple-tags'
1482 ),
1483 'data' => [
1484 /* translators: Used for autofill */
1485 'label' => sprintf(
1486 esc_attr__(
1487 '%s list navigation',
1488 'simple-tags'
1489 ),
1490 'item'
1491 ),
1492 'plurality' => 'plural',
1493 ],
1494 ]);
1495
1496 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1497 echo $ui->get_text_input([
1498 'namearray' => 'cpt_tax_labels',
1499 'name' => 'items_list',
1500 'textvalue' => isset($current['labels']['items_list']) ? esc_attr($current['labels']['items_list']) : null,
1501 'aftertext' => esc_html__('(e.g. Jobs list)', 'simple-tags'),
1502 'labeltext' => esc_html__('Items List', 'simple-tags'),
1503 'helptext' => esc_attr__(
1504 'Screen reader text for the items list heading on the term listing screen.',
1505 'simple-tags'
1506 ),
1507 'data' => [
1508 /* translators: Used for autofill */
1509 'label' => sprintf(
1510 esc_attr__('%s list', 'simple-tags'),
1511 'item'
1512 ),
1513 'plurality' => 'plural',
1514 ],
1515 ]);
1516
1517 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1518 echo $ui->get_text_input([
1519 'namearray' => 'cpt_tax_labels',
1520 'name' => 'not_found',
1521 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null,
1522 'aftertext' => esc_html__('(e.g. No jobs found)', 'simple-tags'),
1523 'labeltext' => esc_html__('Not Found', 'simple-tags'),
1524 'helptext' => esc_attr__(
1525 'The text displayed via clicking ‘Choose from the most used items’ in the taxonomy meta box when no items are available.',
1526 'simple-tags'
1527 ),
1528 'data' => [
1529 /* translators: Used for autofill */
1530 'label' => sprintf(
1531 esc_attr__('No %s found', 'simple-tags'),
1532 'item'
1533 ),
1534 'plurality' => 'plural',
1535 ],
1536 ]);
1537
1538 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1539 echo $ui->get_text_input([
1540 'namearray' => 'cpt_tax_labels',
1541 'name' => 'back_to_items',
1542 'textvalue' => isset($current['labels']['back_to_items']) ? esc_attr($current['labels']['back_to_items']) : null,
1543 'aftertext' => esc_html__(
1544 '(e.g. &larr; Back to jobs',
1545 'simple-tags'
1546 ),
1547 'labeltext' => esc_html__('Back to Items', 'simple-tags'),
1548 'helptext' => esc_attr__(
1549 'The text displayed after a term has been updated for a link back to main index.',
1550 'simple-tags'
1551 ),
1552 'data' => [
1553 /* translators: Used for autofill */
1554 'label' => sprintf(
1555 esc_attr__('Back to %s', 'simple-tags'),
1556 'item'
1557 ),
1558 'plurality' => 'plural',
1559 ],
1560 ]);
1561 ?>
1562 </table>
1563
1564 <table class="form-table taxopress-table taxonomy_restapi"
1565 style="display:none;">
1566 <?php
1567
1568 $select = [
1569 'options' => [
1570 [
1571 'attr' => '0',
1572 'text' => esc_attr__('False', 'simple-tags'),
1573 ],
1574 [
1575 'attr' => '1',
1576 'text' => esc_attr__('True', 'simple-tags'),
1577 'default' => 'true',
1578 ],
1579 ],
1580 ];
1581 $selected = isset($current) ? taxopress_disp_boolean($current['show_in_rest']) : '';
1582 $select['selected'] = !empty($selected) ? $current['show_in_rest'] : '';
1583 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1584 echo $ui->get_select_checkbox_input([
1585 'namearray' => 'cpt_custom_tax',
1586 'name' => 'show_in_rest',
1587 'labeltext' => esc_html__('Show in REST API', 'simple-tags'),
1588 'aftertext' => esc_attr__('Add the taxonomy to the WordPress wp-json API.', 'simple-tags'),
1589 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1590 ]);
1591
1592 $rest_base_slug = '';
1593
1594 if (!empty($current['rest_base'])) {
1595 $rest_base_slug .= $current['rest_base'];
1596 } elseif (!empty($current['name'])) {
1597 $rest_base_slug .= $current['name'];
1598 } else {
1599 $rest_base_slug .= '{taxonomy}';
1600 }
1601
1602 // phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- Reference comment for clarity
1603 // $current['name']
1604 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in get_text_input method
1605 echo $ui->get_text_input([
1606 'namearray' => 'cpt_custom_tax',
1607 'name' => 'rest_base',
1608 'labeltext' => esc_html__('REST API base slug', 'simple-tags'),
1609 'helptext' => esc_attr__('The base slug that this taxonomy will use in the REST API.', 'simple-tags') . ' <a target="blank" href="' . esc_url(home_url('/wp-json/wp/v2/' . $rest_base_slug)) . '">' . esc_url(home_url('/wp-json/wp/v2/' . $rest_base_slug)) . '</a>',
1610 'textvalue' => isset($current['rest_base']) ? esc_attr($current['rest_base']) : '',
1611 ]);
1612
1613 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1614 echo $ui->get_text_input([
1615 'namearray' => 'cpt_custom_tax',
1616 'name' => 'rest_controller_class',
1617 'labeltext' => esc_html__(
1618 'REST API controller class',
1619 'simple-tags'
1620 ),
1621 'helptext' => esc_attr__('The name of a custom Rest Controller class instead of WP_REST_Terms_Controller.', 'simple-tags'),
1622 'aftertext' => esc_attr__(
1623 'Custom controller to use instead of WP_REST_Terms_Controller.',
1624 'simple-tags'
1625 ),
1626 'textvalue' => isset($current['rest_controller_class']) ? esc_attr($current['rest_controller_class']) : '',
1627 ]);
1628
1629
1630 ?>
1631
1632 </div>
1633
1634
1635 <table class="form-table taxopress-table taxonomy_advanced"
1636 style="display:none;">
1637 <?php
1638
1639 $select = [
1640 'options' => [
1641 [
1642 'attr' => '0',
1643 'text' => esc_attr__('False', 'simple-tags'),
1644 ],
1645 [
1646 'attr' => '1',
1647 'text' => esc_attr__('True', 'simple-tags'),
1648 'default' => 'true',
1649 ],
1650 ],
1651 ];
1652 $selected = isset($current) ? taxopress_disp_boolean($current['public']) : '';
1653 $select['selected'] = !empty($selected) ? $current['public'] : '';
1654 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1655 echo $ui->get_select_checkbox_input([
1656 'namearray' => 'cpt_custom_tax',
1657 'name' => 'public',
1658 'labeltext' => esc_html__('Public', 'simple-tags'),
1659 'aftertext' => esc_html__(
1660 'The taxonomy is for public use. It can be seen by frontend users.',
1661 'simple-tags'
1662 ),
1663 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1664 ]);
1665
1666 $select = [
1667 'options' => [
1668 [
1669 'attr' => '0',
1670 'text' => esc_attr__('False', 'simple-tags'),
1671 ],
1672 [
1673 'attr' => '1',
1674 'text' => esc_attr__('True', 'simple-tags'),
1675 'default' => 'true',
1676 ],
1677 ],
1678 ];
1679 $selected = isset($current) ? taxopress_disp_boolean($current['publicly_queryable']) : '';
1680 $select['selected'] = !empty($selected) ? $current['publicly_queryable'] : '';
1681 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1682 echo $ui->get_select_checkbox_input([
1683 'namearray' => 'cpt_custom_tax',
1684 'name' => 'publicly_queryable',
1685 'labeltext' => esc_html__('Public Queryable', 'simple-tags'),
1686 'aftertext' => esc_html__(
1687 'The taxonomy is publicly queryable.',
1688 'simple-tags'
1689 ),
1690 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1691 ]);
1692
1693 $select = [
1694 'options' => [
1695 [
1696 'attr' => '0',
1697 'text' => esc_attr__('False', 'simple-tags'),
1698 ],
1699 [
1700 'attr' => '1',
1701 'text' => esc_attr__('True', 'simple-tags'),
1702 'default' => 'true',
1703 ],
1704 ],
1705 ];
1706 $selected = isset($current) ? taxopress_disp_boolean($current['query_var']) : '';
1707 $select['selected'] = !empty($selected) ? $current['query_var'] : '';
1708 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1709 echo $ui->get_select_checkbox_input([
1710 'namearray' => 'cpt_custom_tax',
1711 'name' => 'query_var',
1712 'labeltext' => esc_html__('Query Var', 'simple-tags'),
1713 'aftertext' => esc_html__(
1714 'Enable a custom query_var key for this taxonomy.',
1715 'simple-tags'
1716 ),
1717 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1718 ]);
1719
1720 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1721 echo $ui->get_text_input([
1722 'namearray' => 'cpt_custom_tax',
1723 'name' => 'query_var_slug',
1724 'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '',
1725 'aftertext' => '',
1726 'labeltext' => esc_html__('Custom Query Var String', 'simple-tags'),
1727 'helptext' => esc_html__(
1728 'Sets a custom query_var slug for this taxonomy.',
1729 'simple-tags'
1730 ),
1731 ]);
1732
1733 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1734 echo $ui->get_text_input([
1735 'namearray' => 'cpt_custom_tax',
1736 'name' => 'meta_box_cb',
1737 'textvalue' => isset($current['meta_box_cb']) ? esc_attr($current['meta_box_cb']) : '',
1738 'labeltext' => esc_html__('Metabox callback', 'simple-tags'),
1739 'helptext' => esc_html__(
1740 'Sets a callback function name for the meta box display. Hierarchical default: post_categories_meta_box, non-hierarchical default: post_tags_meta_box. To remove the metabox completely, use "false".',
1741 'simple-tags'
1742 ),
1743 ]);
1744 ?>
1745 </table>
1746
1747 <table class="form-table taxopress-table taxonomy_order"
1748 style="display:none;">
1749 <?php
1750 $taxonomy_label = !empty($current['label']) ? $current['label'] : esc_html__('Categories', 'simple-tags');
1751 ?>
1752 <tr>
1753 <td colspan="2">
1754 <div class="taxopress-description">
1755 <?php
1756 echo esc_html(
1757 sprintf(
1758 __('This feature controls the order of %s when you\'re editing posts, and in frontend displays.', 'simple-tags'),
1759 $taxonomy_label
1760 )
1761 );
1762 ?>
1763 </div>
1764 </td>
1765 </tr>
1766 <tr>
1767 <th scope="row">
1768 <label for="taxopress_enable_ordering"><?php esc_html_e('Enable TaxoPress ordering', 'simple-tags'); ?></label>
1769 </th>
1770 <td>
1771 <input type="checkbox" name="cpt_custom_tax[enable_taxopress_ordering]" id="taxopress_enable_ordering" value="1"
1772 <?php checked(!empty($current['enable_taxopress_ordering']), 1); ?> />
1773 <span class="description"><?php esc_html_e('Enable TaxoPress ordering for this taxonomy in the frontend and admin area.', 'simple-tags'); ?></span>
1774 </td>
1775 </tr>
1776 <?php
1777 do_action('taxopress_terms_order', $current);
1778 ?>
1779 </table>
1780
1781
1782
1783 <table class="form-table taxopress-table taxonomy_delete"
1784 style="display:none;">
1785 <?php
1786 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1787 echo $ui->get_tr_start() . $ui->get_th_start();
1788
1789 ?>
1790 <?php
1791 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for conditional UI display
1792 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?>
1793 <?php
1794
1795 $activate_action_link = add_query_arg(
1796 [
1797 'page' => 'st_taxonomies',
1798 'add' => 'taxonomy',
1799 'action' => 'edit',
1800 'action2' => 'taxopress-reactivate-taxonomy',
1801 'taxonomy' => esc_attr($request_tax),
1802 '_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'),
1803 'taxopress_taxonomy' => esc_attr($request_tax),
1804 ],
1805 taxopress_admin_url('admin.php')
1806 );
1807 $deactivate_action_link = add_query_arg(
1808 [
1809 'page' => 'st_taxonomies',
1810 'add' => 'taxonomy',
1811 'action' => 'edit',
1812 'action2' => 'taxopress-deactivate-taxonomy',
1813 'taxonomy' => esc_attr($request_tax),
1814 '_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'),
1815 'taxopress_taxonomy' => esc_attr($request_tax),
1816 ],
1817 taxopress_admin_url('admin.php')
1818 );
1819
1820 if (in_array($request_tax, taxopress_get_deactivated_taxonomy())) {
1821 ?>
1822 <span class="action-button reactivate"><a class="button-primary"
1823 href="<?php echo esc_url($activate_action_link); ?>"><?php echo esc_html__('Re-activate Taxonomy', 'simple-tags'); ?></a></span>
1824 <?php } else { ?>
1825 <span class="action-button deactivate"><a class="button-primary"
1826 href="<?php echo esc_url($deactivate_action_link); ?>"><?php echo esc_html__('Deactivate Taxonomy', 'simple-tags'); ?></a></span>
1827 <?php }
1828 /**
1829 * Filters the text value to use on the button when deleting.
1830 *
1831 * @param string $value Text to use for the button.
1832 */
1833 if (!$external_edit) {
1834 ?>
1835 <input type="submit" class="button-secondary taxopress-delete-bottom"
1836 name="cpt_delete"
1837 id="cpt_submit_delete"
1838 value="<?php echo esc_attr(apply_filters(
1839 'taxopress_taxonomy_submit_delete',
1840 esc_html__('Delete Taxonomy', 'simple-tags')
1841 )); ?>"/>
1842 <?php } elseif ($external_edit && array_key_exists($current['name'], taxopress_get_extername_taxonomy_data())) { ?>
1843 <input type="submit" class="button-secondary taxopress-delete-bottom"
1844 name="cpt_delete"
1845 id="cpt_submit_delete"
1846 value="<?php echo esc_attr(apply_filters(
1847 'taxopress_taxonomy_submit_delete',
1848 esc_html__('Delete TaxoPress Edit Data', 'simple-tags')
1849 )); ?>"/>
1850 <?php
1851 echo '<div class="taxopress-warning"">' . esc_html__(
1852 'You can only delete taxonomies created with TaxoPress. However, you can delete any changes or edit made from TaxoPress which will remove TaxoPress version edit restoring original taxonomies data or removing it if already deleted',
1853 'simple-tags'
1854 ) . '</div>';
1855 }
1856 }
1857 ?>
1858
1859 <?php
1860
1861 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1862 echo $ui->get_th_end() . $ui->get_tr_end();
1863
1864
1865 ?>
1866
1867 </table>
1868
1869
1870 </div>
1871 <div class="clear"></div>
1872
1873
1874 </div>
1875 </div>
1876 </div>
1877
1878
1879 <?php
1880 /**
1881 * Fires after the default fieldsets on the taxonomy screen.
1882 *
1883 * @param taxopress_admin_ui $ui Admin UI instance.
1884 */
1885 do_action('taxopress_taxonomy_after_fieldsets', $ui);
1886 ?>
1887
1888 </div>
1889 </div>
1890 </div>
1891
1892
1893
1894 <div class="taxopress-right-sidebar">
1895 <div class="taxopress-right-sidebar-wrapper">
1896
1897
1898 <p class="submit">
1899
1900 <?php
1901 wp_nonce_field(
1902 'taxopress_addedit_taxonomy_nonce_action',
1903 'taxopress_addedit_taxonomy_nonce_field'
1904 );
1905 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for conditional UI display
1906 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?>
1907 <?php
1908
1909 /**
1910 * Filters the text value to use on the button when editing.
1911 *
1912 * @param string $value Text to use for the button.
1913 */
1914 ?>
1915 <input type="submit" class="button-primary taxopress-taxonomy-submit" name="cpt_submit"
1916 value="<?php echo esc_attr(apply_filters(
1917 'taxopress_taxonomy_submit_edit',
1918 esc_attr__('Save Taxonomy', 'simple-tags')
1919 )); ?>"/>
1920 <?php
1921 } else { ?>
1922 <?php
1923
1924 /**
1925 * Filters the text value to use on the button when adding.
1926 *
1927 * @param string $value Text to use for the button.
1928 */
1929 ?>
1930 <input type="submit" class="button-primary taxopress-taxonomy-submit" name="cpt_submit"
1931 value="<?php echo esc_attr(apply_filters(
1932 'taxopress_taxonomy_submit_add',
1933 esc_attr__('Add Taxonomy', 'simple-tags')
1934 )); ?>"/>
1935 <?php } ?>
1936 <div class="taxonomy-required-field"></div>
1937
1938 <?php if (!empty($current)) { ?>
1939 <input type="hidden" name="tax_original" id="tax_original"
1940 value="<?php echo esc_attr($current['name']); ?>"/>
1941 <?php
1942 }
1943
1944 // Used to check and see if we should prevent duplicate slugs.
1945 ?>
1946 <input type="hidden" name="cpt_tax_status" id="cpt_tax_status"
1947 value="<?php echo esc_attr($tab); ?>"/>
1948 </p>
1949 </div>
1950
1951 <?php do_action('taxopress_admin_after_sidebar'); ?>
1952 </div>
1953
1954
1955 </form>
1956 </div><!-- End .wrap -->
1957
1958 <div class="clear"></div>
1959
1960 <?php # Modal Windows;?>
1961 <div class="remodal" data-remodal-id="taxopress-modal-alert"
1962 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1963 <div class="" style="color:red;"><?php echo esc_html__('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div>
1964 <div id="taxopress-modal-alert-content"></div>
1965 <br>
1966 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('Okay', 'simple-tags'); ?></button>
1967 </div>
1968
1969 <div class="remodal" data-remodal-id="taxopress-modal-confirm"
1970 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1971 <div id="taxopress-modal-confirm-content"></div>
1972 <br>
1973 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('No', 'simple-tags'); ?></button>
1974 <button data-remodal-action="confirm"
1975 class="remodal-confirm"><?php echo esc_html__('Yes', 'simple-tags'); ?></button>
1976 </div>
1977
1978 <?php
1979 }
1980 }
1981