true]); $public = get_taxonomies([ '_builtin' => false, 'public' => true, ]); $private = get_taxonomies([ '_builtin' => false, 'public' => false, ]); $registered_taxonomies = array_merge($core, $public, $private); wp_localize_script( 'st-taxonomies', 'taxopress_tax_data', [ 'confirm' => esc_html__( 'Are you sure you want to delete this? Deleting will NOT remove created content.', 'simple-tags' ), 'no_associated_type' => esc_html__('Please select at least one post type.', 'simple-tags'), 'existing_taxonomies' => $registered_taxonomies, 'integer_error' => esc_html__('Taxonomy slug cannot be numbers only.', 'simple-tags'), ] ); } } public static function set_screen($status, $option, $value) { return $value; } /** Singleton instance */ public static function get_instance() { if (!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; } /** * Add WP admin menu for Tags * * @return void * @author Olatechpro */ public function admin_menu() { $hook = add_submenu_page( self::MENU_SLUG, esc_html__('Taxonomies', 'simple-tags'), esc_html__('Taxonomies', 'simple-tags'), 'simple_tags', 'st_taxonomies', [ $this, 'page_manage_taxonomies', ] ); if (taxopress_is_screen_main_page()) { add_action("load-$hook", [$this, 'screen_option']); } } /** * Screen options */ public function screen_option() { $option = 'per_page'; $args = [ 'label' => esc_html__('Number of items per page', 'simple-tags'), 'default' => 20, 'option' => 'st_taxonomies_per_page' ]; add_screen_option($option, $args); $this->terms_table = new Taxonomy_List(); } /** * Method for build the page HTML manage tags * * @return void * @author Olatechpro */ public function page_manage_taxonomies() { // Default order // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for default value if (!isset($_GET['order'])) { $_GET['order'] = 'name-asc'; } settings_errors(__CLASS__); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for page display if (!isset($_GET['add'])) { //all tax ?>

' . esc_html__( 'Search results for “%s”', 'simple-tags' ) . '', esc_html($search)); } ?> terms_table->prepare_items(); ?>
terms_table->search_box(__('Search Taxonomies', 'simple-tags'), 'term'); ?>
true, ), 'objects' ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reading non-state-modifying GET parameter for filter display $selected_post_type = isset($_GET['taxopress_taxonomy_post_type']) // phpcs:ignore WordPress.Security.NonceVerification.Recommended ? sanitize_key(wp_unslash($_GET['taxopress_taxonomy_post_type'])) : 'all'; ?>
terms_table->display(); //Display the table?>

taxopress_manage_taxonomies(); echo '
'; } } ?>
esc_html__('Invalid nonce. Request is not authorized.', 'simple-tags')), 403); } $taxonomy_object = get_taxonomy($taxonomy); if ( !current_user_can('simple_tags') || !$taxonomy_object || empty($taxonomy_object->cap->assign_terms) || !current_user_can($taxonomy_object->cap->assign_terms) ) { wp_send_json_error(array('message' => esc_html__('You do not have permission to view terms in this taxonomy.', 'simple-tags')), 403); } $args = array( 'taxonomy' => $taxonomy, 'hide_empty' => false, 'number' => $per_page, 'offset' => ($page - 1) * $per_page, 'search' => $search_term, 'orderby' => 'name', 'order' => 'ASC', ); $terms = get_terms($args); if (is_wp_error($terms)) { wp_send_json_error(array('message' => esc_html__('Unable to retrieve terms for this taxonomy.', 'simple-tags')), 400); } $count_args = $args; unset($count_args['number'], $count_args['offset']); $total_terms = wp_count_terms($count_args); if (is_wp_error($total_terms)) { $total_terms = 0; } $context = isset($_GET['context']) ? sanitize_text_field(wp_unslash($_GET['context'])) : ''; $show_slug = ( 'mass_edit' === $context && (int) SimpleTags_Plugin::get_option_value('enable_mass-edit_terms_slug') === 1 ); $results = array(); foreach ($terms as $term) { $text = $term->name; if ($show_slug) { $text = sprintf('%s (%s)', $term->name, $term->slug); } $results[] = array( 'id' => $term->slug, 'text' => $text, ); } wp_send_json(array( 'items' => $results, 'more' => ($page * $per_page < $total_terms), )); } /** * Create our settings page output. * * @internal */ public function taxopress_manage_taxonomies() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended $tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new'; $tab_class = 'taxopress-' . $tab; $current = null; ?>
$request_tax], 'objects'); if (isset($external_taxonomy) > 0) { $current = taxopress_convert_external_taxonomy( $external_taxonomy[$request_tax], $request_tax ); $external_edit = true; $taxonomy_edit = true; } } if ($request_tax === 'media_tag') { $external_edit = false; } } if ($taxonomy_edit) { $wordpress_core_tax = array_keys(get_taxonomies(['_builtin' => true])); $wordpress_core_tax[] = 'post_tag'; $wordpress_core_tax[] = 'category'; if (in_array($current['name'], $wordpress_core_tax)) { $core_edit = true; } } $ui = new taxopress_admin_ui(); ?>

'; } ?>

get_tr_start(); if (!$taxonomy_edit) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_th_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_label('name', esc_html__('Taxonomy Slug', 'simple-tags')) . $ui->get_required_span(); if ('edit' === $tab) { echo '

' . esc_html__( 'Slug has changed', 'simple-tags' ) . '

'; } echo '

' . esc_html__( 'Slug already exists', 'simple-tags' ) . '

'; echo '

' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_th_end() . $ui->get_td_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '32', '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.', 'simple-tags' ), 'class' => 'tax-slug-input', 'required' => true, 'placeholder' => false, 'wrap' => false, ]); if ('edit' === $tab) { echo '

'; esc_html_e( 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'simple-tags' ); echo '

'; echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_check_input([ 'checkvalue' => 'update_taxonomy', 'checked' => 'false', 'name' => 'update_taxonomy', 'namearray' => 'update_taxonomy', 'labeltext' => esc_html__( 'Migrate terms to newly renamed taxonomy?', 'simple-tags' ), 'helptext' => '', 'default' => false, 'wrap' => false, ]); echo '
'; } } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'aftertext' => esc_html__('(e.g. Jobs)', 'simple-tags'), 'labeltext' => esc_html__('Plural Label', 'simple-tags'), 'maxlength' => '100', 'helptext' => '', 'required' => true, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'aftertext' => esc_html__('(e.g. Job)', 'simple-tags'), 'labeltext' => esc_html__('Singular Label', 'simple-tags'), 'maxlength' => '100', 'helptext' => '', 'required' => true, ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['hierarchical']) : ''; $select['selected'] = !empty($selected) ? $current['hierarchical'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'hierarchical', 'labeltext' => esc_html__('Parent-Child Relationships', 'simple-tags'), 'aftertext' => esc_html__( 'Can terms in this taxonomy be organized into hierarchical relationships?', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); if (isset($current['description'])) { $current['description'] = stripslashes_deep($current['description']); } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_textarea_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'description', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', 'labeltext' => esc_html__('Description', 'simple-tags'), 'helptext' => esc_attr__( 'Describe what your taxonomy is used for.', 'simple-tags' ), ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'default_term', 'textvalue' => isset($current['default_term']) ? esc_attr($current['default_term']) : '', 'labeltext' => esc_html__('Default Terms', 'simple-tags'), '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.', 'simple-tags' ), ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_td_end() . $ui->get_tr_end(); ?>
true] ); // 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. if (!is_array($args)) { $args = ['public' => true]; } $output = 'objects'; // Or objects. /** * Filters the results returned to display for available post types for taxonomy. * * @param array $value Array of post type objects. * @param array $args Array of arguments for the post type query. * @param string $output The output type we want for the results. */ $post_types = apply_filters( 'taxopress_get_post_types_for_taxonomies', get_post_types($args, $output), $args, $output ); foreach ($post_types as $post_type) { $core_label = in_array($post_type->name, [ 'post', 'page', 'attachment', ], true) ? '' : ''; echo ''; } if ($taxonomy_edit) { $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; } else { $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; } $selected = isset($current) && isset($current['include_in_result']) ? taxopress_disp_boolean($current['include_in_result']) : ''; $select['selected'] = !empty($selected) ? $current['include_in_result'] : ''; echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'include_in_result', 'labeltext' => esc_html__('Archive page result', 'simple-tags'), '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.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); ?> get_th_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_label('name', esc_html__('Taxonomy Slug', 'simple-tags')) . $ui->get_required_span(); if ('edit' === $tab) { echo '

' . esc_html__( 'Slug has changed', 'simple-tags' ) . '

'; } echo '

' . esc_html__( 'Slug already exists', 'simple-tags' ) . '

'; echo '

' . esc_html__('Special character not allowed in slug.', 'simple-tags') . '

'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_th_end() . $ui->get_td_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '32', 'helptext' => 'The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and underscores.', 'class' => 'tax-slug-input', 'required' => true, 'placeholder' => false, 'wrap' => false, ]); if ('edit' === $tab) { echo '

'; esc_html_e( 'DO NOT EDIT the taxonomy slug unless also planning to migrate terms. Changing the slug registers a new taxonomy entry.', 'simple-tags' ); echo '

'; echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_check_input([ 'checkvalue' => 'update_taxonomy', 'checked' => 'false', 'name' => 'update_taxonomy', 'namearray' => 'update_taxonomy', 'labeltext' => esc_html__( 'Migrate terms to newly renamed taxonomy?', 'simple-tags' ), 'helptext' => '', 'default' => false, 'wrap' => false, ]); echo '
'; } } ?> [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['rewrite']) : ''; $select['selected'] = !empty($selected) ? $current['rewrite'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rewrite', 'labeltext' => esc_html__('Rewrite', 'simple-tags'), 'aftertext' => esc_html__( 'WordPress can use a custom permalink for this taxonomy. It does not have to match the slug.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rewrite_slug', 'textvalue' => isset($current['rewrite_slug']) ? esc_attr($current['rewrite_slug']) : '', 'aftertext' => esc_attr__('(default: taxonomy name)', 'simple-tags'), 'labeltext' => esc_html__('Custom Rewrite Slug', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy rewrite slug.', 'simple-tags' ), ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['rewrite_withfront']) : ''; $select['selected'] = !empty($selected) ? $current['rewrite_withfront'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rewrite_withfront', 'labeltext' => esc_html__('Rewrite With Front', 'simple-tags'), 'aftertext' => esc_html__( 'Should the permastruct be prepended with the front base.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'false', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['rewrite_hierarchical']) : ''; $select['selected'] = !empty($selected) ? $current['rewrite_hierarchical'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rewrite_hierarchical', 'labeltext' => esc_html__('Rewrite Hierarchical', 'simple-tags'), 'aftertext' => esc_html__( 'Should the permastruct allow hierarchical urls.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); ?> [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['show_ui']) : ''; $select['selected'] = !empty($selected) ? $current['show_ui'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_ui', 'labeltext' => esc_html__('Show user interface', 'simple-tags'), 'aftertext' => esc_html__('Should there be a visible interface in the WordPress admin area to manage these terms?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['show_in_menu']) : ''; $select['selected'] = !empty($selected) ? $current['show_in_menu'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_in_menu', 'labeltext' => esc_html__('Show in admin menus', 'simple-tags'), 'aftertext' => esc_html__('Should there be links to this taxonomy in the WordPress admin menus?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = (isset($current) && !empty($current['show_in_nav_menus'])) ? taxopress_disp_boolean($current['show_in_nav_menus']) : ''; $select['selected'] = !empty($selected) ? $current['show_in_nav_menus'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_in_nav_menus', 'labeltext' => esc_html__('Show in frontend menus', 'simple-tags'), 'aftertext' => esc_html__('Should this taxonomy be available for the frontend “Menus” and “Navigation” options?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['show_admin_column']) : ''; $select['selected'] = !empty($selected) ? $current['show_admin_column'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_admin_column', 'labeltext' => esc_html__('Show admin column', 'simple-tags'), 'aftertext' => esc_html__('Should a column for this taxonomy appear on screens such as “Posts” and “Pages”?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'false', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = (isset($current) && !empty($current['show_in_quick_edit'])) ? taxopress_disp_boolean($current['show_in_quick_edit']) : ''; $select['selected'] = !empty($selected) ? $current['show_in_quick_edit'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_in_quick_edit', 'labeltext' => esc_html__( 'Show in "Quick Edit" and "Bulk Edit"', 'simple-tags' ), 'aftertext' => esc_html__('Should this taxonomy be available in editing tools on screens such as “Posts” and “Pages”?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = array( 'options' => array( array( 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'false', ), array( 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ), ), ); $selected = (isset($current) && ! empty($current['show_in_filter'])) ? taxopress_disp_boolean($current['show_in_filter']) : ''; $select['selected'] = ! empty($selected) ? $current['show_in_filter'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input( array( 'namearray' => 'cpt_custom_tax', 'name' => 'show_in_filter', 'labeltext' => esc_html__( 'Show in Filter', 'simple-tags' ), 'aftertext' => esc_html__('Should this taxonomy be available in filters on screens such as “Posts” and “Pages”?', 'simple-tags'), 'selections' => $select, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ) ); ?> get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'menu_name', 'textvalue' => isset($current['labels']['menu_name']) ? esc_attr($current['labels']['menu_name']) : '', 'aftertext' => esc_attr__('(e.g. Jobs)', 'simple-tags'), 'labeltext' => esc_html__('Menu Name', 'simple-tags'), 'helptext' => esc_html__( 'Custom admin menu name for your taxonomy.', 'simple-tags' ), 'maxlength' => '100', 'data' => [ 'label' => 'item', // Not localizing because it's isolated. 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'all_items', 'textvalue' => isset($current['labels']['all_items']) ? esc_attr($current['labels']['all_items']) : '', 'aftertext' => esc_attr__('(e.g. All Jobs)', 'simple-tags'), 'labeltext' => esc_html__('All Items', 'simple-tags'), 'helptext' => esc_html__( 'Used as tab text when showing all terms for hierarchical taxonomy while editing post.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('All %s', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'edit_item', 'textvalue' => isset($current['labels']['edit_item']) ? esc_attr($current['labels']['edit_item']) : '', 'aftertext' => esc_attr__('(e.g. Edit Job)', 'simple-tags'), 'labeltext' => esc_html__('Edit Item', 'simple-tags'), 'helptext' => esc_html__( 'Used at the top of the term editor screen for an existing taxonomy term.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Edit %s', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'view_item', 'textvalue' => isset($current['labels']['view_item']) ? esc_attr($current['labels']['view_item']) : '', 'aftertext' => esc_attr__('(e.g. View Job)', 'simple-tags'), 'labeltext' => esc_html__('View Item', 'simple-tags'), 'helptext' => esc_html__( 'Used in the admin bar when viewing editor screen for an existing taxonomy term.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('View %s', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'update_item', 'textvalue' => isset($current['labels']['update_item']) ? esc_attr($current['labels']['update_item']) : '', 'aftertext' => esc_attr__('(e.g. Update Job Name)', 'simple-tags'), 'labeltext' => esc_html__('Update Item Name', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__( 'Update %s name', 'simple-tags' ), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'add_new_item', 'textvalue' => isset($current['labels']['add_new_item']) ? esc_attr($current['labels']['add_new_item']) : '', 'aftertext' => esc_attr__('(e.g. Add New Job)', 'simple-tags'), 'labeltext' => esc_html__('Add New Item', 'simple-tags'), 'helptext' => esc_html__( 'Used at the top of the term editor screen and button text for a new taxonomy term.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Add new %s', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'new_item_name', 'textvalue' => isset($current['labels']['new_item_name']) ? esc_attr($current['labels']['new_item_name']) : '', 'aftertext' => esc_attr__('(e.g. New Job Name)', 'simple-tags'), 'labeltext' => esc_html__('New Item Name', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('New %s name', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'parent_item', 'textvalue' => isset($current['labels']['parent_item']) ? esc_attr($current['labels']['parent_item']) : '', 'aftertext' => esc_attr__('(e.g. Parent Job)', 'simple-tags'), 'labeltext' => esc_html__('Parent Item', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Parent %s', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'parent_item_colon', 'textvalue' => isset($current['labels']['parent_item_colon']) ? esc_attr($current['labels']['parent_item_colon']) : '', 'aftertext' => esc_attr__('(e.g. Parent Job:)', 'simple-tags'), 'labeltext' => esc_html__('Parent Item Colon', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Parent %s:', 'simple-tags'), 'item' ), 'plurality' => 'singular', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'search_items', 'textvalue' => isset($current['labels']['search_items']) ? esc_attr($current['labels']['search_items']) : '', 'aftertext' => esc_attr__('(e.g. Search Jobs)', 'simple-tags'), 'labeltext' => esc_html__('Search Items', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Search %s', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'popular_items', 'textvalue' => isset($current['labels']['popular_items']) ? esc_attr($current['labels']['popular_items']) : null, 'aftertext' => esc_attr__('(e.g. Popular Jobs)', 'simple-tags'), 'labeltext' => esc_html__('Popular Items', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Popular %s', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'separate_items_with_commas', 'textvalue' => isset($current['labels']['separate_items_with_commas']) ? esc_attr($current['labels']['separate_items_with_commas']) : null, 'aftertext' => esc_attr__( '(e.g. Separate Jobs with commas)', 'simple-tags' ), 'labeltext' => esc_html__( 'Separate Items with Commas', 'simple-tags' ), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf(esc_attr__( 'Separate %s with commas', 'simple-tags' ), 'item'), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'add_or_remove_items', 'textvalue' => isset($current['labels']['add_or_remove_items']) ? esc_attr($current['labels']['add_or_remove_items']) : null, 'aftertext' => esc_attr__( '(e.g. Add or remove Jobs)', 'simple-tags' ), 'labeltext' => esc_html__('Add or Remove Items', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__( 'Add or remove %s', 'simple-tags' ), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'choose_from_most_used', 'textvalue' => isset($current['labels']['choose_from_most_used']) ? esc_attr($current['labels']['choose_from_most_used']) : null, 'aftertext' => esc_attr__( '(e.g. Choose from the most used Jobs)', 'simple-tags' ), 'labeltext' => esc_html__('Choose From Most Used', 'simple-tags'), 'helptext' => esc_html__( 'Custom taxonomy label. Used in the admin menu for displaying taxonomies.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf(esc_attr__( 'Choose from the most used %s', 'simple-tags' ), 'item'), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'no_terms', 'textvalue' => isset($current['labels']['no_terms']) ? esc_attr($current['labels']['no_terms']) : null, 'aftertext' => esc_html__('(e.g. No jobs)', 'simple-tags'), 'labeltext' => esc_html__('No terms', 'simple-tags'), 'helptext' => esc_attr__( 'Used when indicating that there are no terms in the given taxonomy associated with an object.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('No %s', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'items_list_navigation', 'textvalue' => isset($current['labels']['items_list_navigation']) ? esc_attr($current['labels']['items_list_navigation']) : null, 'aftertext' => esc_html__( '(e.g. Jobs list navigation)', 'simple-tags' ), 'labeltext' => esc_html__('Items List Navigation', 'simple-tags'), 'helptext' => esc_attr__( 'Screen reader text for the pagination heading on the term listing screen.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__( '%s list navigation', 'simple-tags' ), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'items_list', 'textvalue' => isset($current['labels']['items_list']) ? esc_attr($current['labels']['items_list']) : null, 'aftertext' => esc_html__('(e.g. Jobs list)', 'simple-tags'), 'labeltext' => esc_html__('Items List', 'simple-tags'), 'helptext' => esc_attr__( 'Screen reader text for the items list heading on the term listing screen.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('%s list', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'not_found', 'textvalue' => isset($current['labels']['not_found']) ? esc_attr($current['labels']['not_found']) : null, 'aftertext' => esc_html__('(e.g. No jobs found)', 'simple-tags'), 'labeltext' => esc_html__('Not Found', 'simple-tags'), 'helptext' => esc_attr__( 'The text displayed via clicking ‘Choose from the most used items’ in the taxonomy meta box when no items are available.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('No %s found', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_tax_labels', 'name' => 'back_to_items', 'textvalue' => isset($current['labels']['back_to_items']) ? esc_attr($current['labels']['back_to_items']) : null, 'aftertext' => esc_html__( '(e.g. ← Back to jobs', 'simple-tags' ), 'labeltext' => esc_html__('Back to Items', 'simple-tags'), 'helptext' => esc_attr__( 'The text displayed after a term has been updated for a link back to main index.', 'simple-tags' ), 'data' => [ /* translators: Used for autofill */ 'label' => sprintf( esc_attr__('Back to %s', 'simple-tags'), 'item' ), 'plurality' => 'plural', ], ]); ?> [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['show_in_rest']) : ''; $select['selected'] = !empty($selected) ? $current['show_in_rest'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'show_in_rest', 'labeltext' => esc_html__('Show in REST API', 'simple-tags'), 'aftertext' => esc_attr__('Add the taxonomy to the WordPress wp-json API.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $rest_base_slug = ''; if (!empty($current['rest_base'])) { $rest_base_slug .= $current['rest_base']; } elseif (!empty($current['name'])) { $rest_base_slug .= $current['name']; } else { $rest_base_slug .= '{taxonomy}'; } // phpcs:ignore Squiz.PHP.CommentedOutCode.Found -- Reference comment for clarity // $current['name'] // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output escaped in get_text_input method echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rest_base', 'labeltext' => esc_html__('REST API base slug', 'simple-tags'), 'helptext' => esc_attr__('The base slug that this taxonomy will use in the REST API.', 'simple-tags') . ' ' . esc_url(home_url('/wp-json/wp/v2/' . $rest_base_slug)) . '', 'textvalue' => isset($current['rest_base']) ? esc_attr($current['rest_base']) : '', ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'rest_controller_class', 'labeltext' => esc_html__( 'REST API controller class', 'simple-tags' ), 'helptext' => esc_attr__('The name of a custom Rest Controller class instead of WP_REST_Terms_Controller.', 'simple-tags'), 'aftertext' => esc_attr__( 'Custom controller to use instead of WP_REST_Terms_Controller.', 'simple-tags' ), 'textvalue' => isset($current['rest_controller_class']) ? esc_attr($current['rest_controller_class']) : '', ]); ?> [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['public']) : ''; $select['selected'] = !empty($selected) ? $current['public'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'public', 'labeltext' => esc_html__('Public', 'simple-tags'), 'aftertext' => esc_html__( 'The taxonomy is for public use. It can be seen by frontend users.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['publicly_queryable']) : ''; $select['selected'] = !empty($selected) ? $current['publicly_queryable'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'publicly_queryable', 'labeltext' => esc_html__('Public Queryable', 'simple-tags'), 'aftertext' => esc_html__( 'The taxonomy is publicly queryable.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), 'default' => 'true', ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['query_var']) : ''; $select['selected'] = !empty($selected) ? $current['query_var'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'query_var', 'labeltext' => esc_html__('Query Var', 'simple-tags'), 'aftertext' => esc_html__( 'Enable a custom query_var key for this taxonomy.', 'simple-tags' ), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'query_var_slug', 'textvalue' => isset($current['query_var_slug']) ? esc_attr($current['query_var_slug']) : '', 'aftertext' => '', 'labeltext' => esc_html__('Custom Query Var String', 'simple-tags'), 'helptext' => esc_html__( 'Sets a custom query_var slug for this taxonomy.', 'simple-tags' ), ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'cpt_custom_tax', 'name' => 'meta_box_cb', 'textvalue' => isset($current['meta_box_cb']) ? esc_attr($current['meta_box_cb']) : '', 'labeltext' => esc_html__('Metabox callback', 'simple-tags'), '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".', 'simple-tags' ), ]); ?> get_tr_start() . $ui->get_th_start(); ?> 'st_taxonomies', 'add' => 'taxonomy', 'action' => 'edit', 'action2' => 'taxopress-reactivate-taxonomy', 'taxonomy' => esc_attr($request_tax), '_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'), 'taxopress_taxonomy' => esc_attr($request_tax), ], taxopress_admin_url('admin.php') ); $deactivate_action_link = add_query_arg( [ 'page' => 'st_taxonomies', 'add' => 'taxonomy', 'action' => 'edit', 'action2' => 'taxopress-deactivate-taxonomy', 'taxonomy' => esc_attr($request_tax), '_wpnonce' => wp_create_nonce('taxonomy-action-request-nonce'), 'taxopress_taxonomy' => esc_attr($request_tax), ], taxopress_admin_url('admin.php') ); if (in_array($request_tax, taxopress_get_deactivated_taxonomy())) { ?> ' . 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', 'simple-tags' ) . ''; } } ?> get_th_end() . $ui->get_tr_end(); ?>