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