esc_html__('Number of items per page', 'simple-tags'), 'default' => 20, 'option' => 'st_autoterms_logs_per_page' ]; $this->logs_table = new Autoterms_Logs(); }else{ $args = [ 'label' => esc_html__('Number of items per page', 'simple-tags'), 'default' => 20, 'option' => 'st_autoterms_per_page' ]; $this->terms_table = new Autoterms_List(); } add_screen_option($option, $args); } /** * Method for build the page HTML manage tags * * @return void * @author Olatechpro */ public function page_manage_autoterms() { // Default order if (!isset($_GET['order'])) { $_GET['order'] = 'name-asc'; } settings_errors(__CLASS__); if (isset($_GET['tab']) && $_GET['tab'] === 'logs') { //autoterms logs $delete_all_link = add_query_arg([ 'page' => 'st_autoterms', 'tab' => 'logs', 'action' => 'taxopress-delete-autoterm-logs', '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce') ], admin_url('admin.php') ); $enable_log_link = add_query_arg([ 'page' => 'st_autoterms', 'tab' => 'logs', 'action' => 'taxopress-enable-autoterm-logs', '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce') ], admin_url('admin.php') ); $disable_log_link = add_query_arg([ 'page' => 'st_autoterms', 'tab' => 'logs', 'action' => 'taxopress-disable-autoterm-logs', '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce') ], admin_url('admin.php') ); ?>

' . esc_html__('Search results for “%s”', 'simple-tags') . '', esc_html($search)); } ?> logs_table->prepare_items(); ?>
logs_table->search_box(esc_html__('Search Auto Terms Logs', 'simple-tags'), 'term'); ?>
logs_table->display(); //Display the table ?>

autoterms_logs_count()); ?>
' . esc_html__('Search results for “%s”', 'simple-tags') . '', esc_html($search)); } ?> terms_table->prepare_items(); ?>
terms_table->search_box(esc_html__('Search Auto Terms', 'simple-tags'), 'term'); ?>
terms_table->display(); //Display the table ?>

taxopress_manage_autoterms(); echo '
'; } } ?>
0 && apply_filters('taxopress_autoterms_create_limit', true)) { $autoterm_limit = true; } $ui = new taxopress_admin_ui(); ?>

autoterms_logs_count()); ?>

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

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

' . esc_html__('With TaxoPress Pro, you can create unlimited Auto Terms. You can create Auto 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_autoterm', '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_autoterm', 'name' => 'taxonomy', 'class' => 'st-post-taxonomy-select', 'labeltext' => esc_html__('Taxonomy', 'simple-tags'), 'required' => true, 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => 'post_content', 'text' => esc_attr__('Post Content', 'simple-tags') ], [ 'attr' => 'post_title', 'text' => esc_attr__('Post Title', 'simple-tags') ], [ 'attr' => 'posts', 'text' => esc_attr__('Post Content and Title', 'simple-tags'), 'default' => 'true' ] ], ]; $selected = (isset($current) && isset($current['autoterm_from'])) ? taxopress_disp_boolean($current['autoterm_from']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_from'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_from', 'labeltext' => esc_html__('Find term in:', 'simple-tags'), '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'), ], ], ]; }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['autoterm_use_taxonomy'])) ? taxopress_disp_boolean($current['autoterm_use_taxonomy']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_use_taxonomy'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_use_taxonomy', 'class' => 'autoterm_use_taxonomy', 'labeltext' => esc_html__('Existing taxonomy terms', 'simple-tags'), 'aftertext' => esc_html__('This will add existing terms from the taxonomy selected in the "General" tab.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 'required' => true, ]); if($autoterm_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['autoterm_useall'])) ? taxopress_disp_boolean($current['autoterm_useall']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_useall'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_useall', 'class' => 'autoterm_useall autoterm-terms-to-use-field', 'labeltext' => '', 'aftertext' => esc_html__('Use all the terms in the selected taxonomy. Please test this option carefully as it can use significant server resources if you have many terms.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped '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['autoterm_useonly'])) ? taxopress_disp_boolean($current['autoterm_useonly']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_useonly'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_useonly', 'class' => 'autoterm_useonly autoterm-terms-to-use-field', 'labeltext' => ' ', 'aftertext' => esc_html__('Use only some terms in the selected taxonomy.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $specific_terms = ( isset($current) && isset($current['specific_terms'])) ? taxopress_change_to_strings($current['specific_terms']) : ''; echo ''; do_action('taxopress_autoterms_after_autoterm_terms_to_use', $current); ?>
'; echo ''; echo '
'; echo '
get_number_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'terms_limit', 'textvalue' => isset($current['terms_limit']) ? esc_attr($current['terms_limit']) : '', 'labeltext' => esc_html__('Auto Terms Limit', 'simple-tags'), 'helptext' => esc_html__('Limit the number of generated Auto Terms. \'0\' for unlimited terms', 'simple-tags'), 'min' => '0', '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['autoterm_target'])) ? taxopress_disp_boolean($current['autoterm_target']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_target'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_target', 'class' => '', 'labeltext' => esc_html__('Target content', 'simple-tags'), 'aftertext' => esc_html__('Only use Auto Terms on posts with no added terms.', '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) && isset($current['autoterm_word'])) ? taxopress_disp_boolean($current['autoterm_word']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_word'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_word', 'class' => '', 'labeltext' => esc_html__('Whole words', 'simple-tags'), 'aftertext' => esc_html__('Only add terms when the word is an exact match. Do not make matches for partial words.', '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) && isset($current['autoterm_hash'])) ? taxopress_disp_boolean($current['autoterm_hash']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_hash'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_hash', 'class' => '', 'labeltext' => esc_html__('Hashtags', 'simple-tags'), 'aftertext' => esc_html__('Support hashtags symbols # in Auto Terms.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $post_status_options = ['publish' => esc_html__('Add terms for published content.', 'simple-tags'), 'draft' => esc_html__('Add terms for unpublished content.', 'simple-tags')]; echo ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_tr_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_th_start(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_label('autoterm_exclude', esc_html__('Stop words', '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([ 'labeltext' => esc_html__('Stop words', 'simple-tags'), 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_exclude', 'textvalue' => isset($current['autoterm_exclude']) ? esc_attr($current['autoterm_exclude']) : '', 'maxlength' => '', 'helptext' => esc_html__('Choose terms to be excluded from auto terms.', 'simple-tags'), 'class' => 'st-full-width auto-terms-stopwords', 'aftertext' => '', 'required' => false, 'placeholder' => false, 'wrap' => false, ]); ?>
*'; echo ''; $autoterms_post_status = (!empty($current['post_status'])) ? (array)$current['post_status'] : ['publish']; foreach ($post_status_options as $key => $value) { $checked_status = (in_array($key, $autoterms_post_status)) ? 'checked' : ''; echo ' ' . esc_html($value) . '

'; } echo '
[ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = (isset($current) && isset($current['autoterm_existing_content_exclude'])) ? taxopress_disp_boolean($current['autoterm_existing_content_exclude']) : ''; $select['selected'] = !empty($selected) ? $current['autoterm_existing_content_exclude'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'autoterm_existing_content_exclude', 'class' => '', 'labeltext' => esc_html__('Exclude previously analyzed content', 'simple-tags'), 'aftertext' => esc_html__('This enables you to skip posts that have already been analyzed by the Existing Content feature.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'existing_terms_batches', 'textvalue' => isset($current['existing_terms_batches']) ? esc_attr($current['existing_terms_batches']) : '20', 'labeltext' => esc_html__('Limit per batches', 'simple-tags'), 'helptext' => esc_html__('This enables you to add Auto Terms to existing content in batches. If you have a lot of existing content, set this to a lower number to avoid timeouts.', 'simple-tags'), 'min' => '1', 'required' => true, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_autoterm', 'name' => 'existing_terms_sleep', 'textvalue' => isset($current['existing_terms_sleep']) ? esc_attr($current['existing_terms_sleep']) : '10', 'labeltext' => esc_html__('Batches wait time', 'simple-tags'), 'helptext' => esc_html__('This is the wait time (in seconds) between processing batches of Auto Terms. If you have a lot of existing content, set this to a higher number to avoid timeouts.', 'simple-tags'), 'min' => '0', 'required' => true, ]); $select = [ 'options' => [ [ 'attr' => '1', 'text' => esc_attr__('24 hours ago', 'simple-tags') ], [ 'attr' => '7', 'text' => esc_attr__('7 days ago', 'simple-tags') ], [ 'attr' => '14', 'text' => esc_attr__('2 weeks ago', 'simple-tags') ], [ 'attr' => '30', 'text' => esc_attr__('1 month ago', 'simple-tags'), 'default' => 'true' ], [ 'attr' => '180', 'text' => esc_attr__('6 months ago', 'simple-tags') ], [ 'attr' => '365', 'text' => esc_attr__('1 year ago', 'simple-tags') ], [ 'attr' => '0', 'text' => esc_attr__('No limit', 'simple-tags') ], ], ]; if(isset($current) && is_array($current)){ $select = [ 'options' => [ [ 'attr' => '1', 'text' => esc_attr__('24 hours ago', 'simple-tags') ], [ 'attr' => '7', 'text' => esc_attr__('7 days ago', 'simple-tags') ], [ 'attr' => '14', 'text' => esc_attr__('2 weeks ago', 'simple-tags') ], [ 'attr' => '30', 'text' => esc_attr__('1 month ago', 'simple-tags'), ], [ 'attr' => '180', 'text' => esc_attr__('6 months ago', 'simple-tags') ], [ 'attr' => '365', 'text' => esc_attr__('1 year ago', 'simple-tags') ], [ 'attr' => '0', 'text' => esc_attr__('No limit', 'simple-tags'), 'default' => 'true' ], ], ]; } $selected = (isset($current) && isset($current['limit_days'])) ? taxopress_disp_boolean($current['limit_days']) : ''; $select['selected'] = !empty($selected) ? $current['limit_days'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_number_select([ 'namearray' => 'taxopress_autoterm', 'name' => 'limit_days', 'labeltext' => esc_html__('Limit Auto Terms, based on published date', 'simple-tags'), 'aftertext' => esc_html__('This setting allows you to add Auto Terms only to recent content.', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); ?>