esc_html__('Number of items per page', 'simple-tags'), 'default' => 20, 'option' => 'st_suggestterms_per_page' ]; add_screen_option($option, $args); $this->terms_table = new SuggestTerms_List(); } /** * Method for build the page HTML manage tags * * @return void * @author Olatechpro */ public function page_manage_suggestterms() { // Default order if (!isset($_GET['order'])) { $_GET['order'] = 'name-asc'; } settings_errors(__CLASS__); 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(esc_html__('Search Suggest Terms', 'simple-tags'), 'term'); ?>
terms_table->display(); //Display the table ?>

taxopress_manage_suggestterms(); echo '
'; } } ?>
0 && apply_filters('taxopress_suggestterms_create_limit', true)) { $suggestterm_limit = true; } $ui = new taxopress_admin_ui(); ?>

'; echo ''; echo ''; } else { $active_tab = 'suggestterm_general'; echo ''; echo esc_html__('Add new Suggest Terms', 'simple-tags'); } ?>

' . esc_html__('To create more Suggest Terms, please upgrade to TaxoPress Pro.', 'simple-tags') . '

' . esc_html__('With TaxoPress Pro, you can create unlimited Suggest Terms. You can create Suggest Terms for any taxonomy.', 'simple-tags') . '

'; } else { ?>
get_tr_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_th_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_label('title', esc_html__('Title', 'simple-tags')) . $ui->get_required_span(); // 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' => 'taxopress_suggestterm', 'name' => 'title', 'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '', 'maxlength' => '32', 'helptext' => '', 'required' => true, 'placeholder' => false, 'wrap' => false, ]); $options = []; foreach (get_all_taxopress_public_taxonomies() as $_taxonomy) { $_taxonomy = $_taxonomy->name; $tax = get_taxonomy($_taxonomy); if (empty($tax->labels->name)) { continue; } if ($tax->name === 'post_tag') { $options[] = [ 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')', 'default' => 'true', ]; } else { $options[] = [ 'attr' => $tax->name, 'text' => $tax->labels->name. ' ('.$tax->name.')', ]; } } $select = [ 'options' => $options, ]; $selected = isset($current) ? taxopress_disp_boolean($current['taxonomy']) : ''; $select['selected'] = !empty($selected) ? $current['taxonomy'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_suggestterm', 'name' => 'taxonomy', 'class' => 'st-post-taxonomy-select', 'labeltext' => esc_html__('Default Taxonomy', 'simple-tags'), 'required' => true, 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); /** * Filters the arguments for post types to list for taxonomy association. * * * @param array $value Array of default arguments. */ $args = apply_filters('taxopress_attach_post_types_to_taxonomy', ['public' => 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); $term_auto_locations = []; foreach ($post_types as $post_type) { $term_auto_locations[$post_type->name] = $post_type->label; } echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_td_end() . $ui->get_tr_end(); ?>
'; foreach ($term_auto_locations as $key => $value) { echo ''; } echo '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_check_input([ 'checkvalue' => esc_attr($key), 'checked' => (!empty($current['post_types']) && is_array($current['post_types']) && in_array($key, $current['post_types'], true)) ? 'true' : 'false', 'name' => esc_attr($key), 'namearray' => 'post_types', 'textvalue' => esc_attr($key), 'labeltext' => "", 'wrap' => false, ]); echo '
[ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = (isset($current) && isset($current['enable_existing_terms'])) ? taxopress_disp_boolean($current['enable_existing_terms']) : ''; $select['selected'] = !empty($selected) ? $current['enable_existing_terms'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'enable_existing_terms', 'labeltext' => esc_html__('Show existing terms', 'simple-tags'), 'aftertext' => '', 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); if (!isset($current)) { $maximum_terms = 100; } else { $maximum_terms = isset($current['number']) ? esc_attr($current['number']) : '0'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'number', 'textvalue' => (int)$maximum_terms, 'labeltext' => esc_html__('Maximum terms', 'simple-tags'), 'helptext' => esc_html__('Set (0) for no limit.', 'simple-tags'), 'min' => '0', 'required' => true, ]); $select = [ 'options' => [ [ 'attr' => 'name', 'text' => esc_attr__('Name', 'simple-tags') ], [ 'attr' => 'count', 'text' => esc_attr__('Counter', 'simple-tags'), 'default' => 'true' ], [ 'attr' => 'random', 'text' => esc_attr__('Random', 'simple-tags') ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['orderby']) : ''; $select['selected'] = !empty($selected) ? $current['orderby'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_suggestterm', 'name' => 'orderby', 'labeltext' => esc_html__('Method for choosing terms', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => 'asc', 'text' => esc_attr__('Ascending', 'simple-tags') ], [ 'attr' => 'desc', 'text' => esc_attr__('Descending', 'simple-tags'), 'default' => 'true' ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['order']) : ''; $select['selected'] = !empty($selected) ? $current['order'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_suggestterm', 'name' => 'order', 'labeltext' => esc_html__('Ordering for choosing terms', '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', ], ], ]; }else{ $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; } $selected = (isset($current) && isset($current['suggest_term_use_local'])) ? taxopress_disp_boolean($current['suggest_term_use_local']) : ''; $select['selected'] = !empty($selected) ? $current['suggest_term_use_local'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'suggest_term_use_local', 'class' => 'suggest_term_use_local', 'labeltext' => esc_html__('Suggest existing terms on your site', 'simple-tags'), 'aftertext' => '', '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) && isset($current['suggest_term_use_dandelion'])) ? taxopress_disp_boolean($current['suggest_term_use_dandelion']) : ''; $select['selected'] = !empty($selected) ? $current['suggest_term_use_dandelion'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'suggest_term_use_dandelion', 'class' => 'suggest_term_use_dandelion', 'labeltext' => esc_html__('Suggest new terms from the Dandelion service', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'terms_datatxt_access_token', 'class' => 'terms_datatxt_access_token', 'textvalue' => isset($current['terms_datatxt_access_token']) ? esc_attr($current['terms_datatxt_access_token']) : '', 'labeltext' => esc_html__('Dandelion API token', 'simple-tags'), 'helptext' => sprintf(esc_html__('You need an API key to use Dandelion to suggest terms. %1sClick here for documentation.%2s.', 'simple-tags'), '', ''), 'required' => false, ]); if (!isset($current)) { $terms_datatxt_min_confidence = '0.6'; } else { $terms_datatxt_min_confidence = isset($current['terms_datatxt_min_confidence']) ? esc_attr($current['terms_datatxt_min_confidence']) : '0'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'terms_datatxt_min_confidence', 'class' => 'terms_datatxt_min_confidence', 'textvalue' => esc_html($terms_datatxt_min_confidence), 'labeltext' => esc_html__('Dandelion API confidence value', 'simple-tags'), 'helptext' => esc_html__('Choose a value between 0 and 1. A high value such as 0.8 will provide a few, accurate suggestions. A low value such as 0.2 will produce more suggestions, but they may be less accurate.', 'simple-tags'), 'min' => '0', 'max' => '1', 'other_attr' => 'step=".1"', 'required' => false, ]); $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = (isset($current) && isset($current['suggest_term_use_opencalais'])) ? taxopress_disp_boolean($current['suggest_term_use_opencalais']) : ''; $select['selected'] = !empty($selected) ? $current['suggest_term_use_opencalais'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'suggest_term_use_opencalais', 'class' => 'suggest_term_use_opencalais', 'labeltext' => esc_html__('Suggest new terms from the Open Calais service', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_suggestterm', 'name' => 'terms_opencalais_key', 'class' => 'terms_opencalais_key', 'textvalue' => isset($current['terms_opencalais_key']) ? esc_attr($current['terms_opencalais_key']) : '', 'labeltext' => esc_html__('OpenCalais API Key', 'simple-tags'), 'helptext' => sprintf(esc_html__('You need an API key to use OpenCalais to suggest terms. %1sClick here for documentation.%2s.', 'simple-tags'), '', ''), 'required' => false, ]); ?>