PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.54.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.54.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.54.0, at inc/taxonomies.php

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