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

taxopress_manage_tagclouds(); echo '
'; } } ?>
0 && apply_filters('taxopress_tag_clouds_create_limit', true)) { $tag_cloud_limit = true; } $ui = new taxopress_admin_ui(); ?>

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

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

' . esc_html__('With TaxoPress Pro, you can create unlimited Terms Display. You can create Terms Display for any taxonomy and then display those Terms Display anywhere on your site.', '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('name', 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_tag_cloud', 'name' => 'title', 'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '', 'maxlength' => '32', 'helptext' => '', 'required' => true, 'placeholder' => false, 'wrap' => 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['hide_title'])) ? taxopress_disp_boolean($current['hide_title']) : ''; $select['selected'] = !empty($selected) ? $current['hide_title'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'hide_title', 'labeltext' => esc_html__('Hide title in output?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $options[] = [ 'attr' => '', 'text' => esc_html__('All post types', 'simple-tags'), 'default' => 'true' ]; foreach (get_post_types(['public' => true], 'objects') as $post_type) { if (!in_array($post_type->name, ['attachment'])) { $options[] = [ 'attr' => $post_type->name, 'text' => $post_type->label ]; } } $select = [ 'options' => $options, ]; $selected = (isset($current) && isset($current['post_type'])) ? taxopress_disp_boolean($current['post_type']) : ''; $select['selected'] = ! empty($selected) ? $current['post_type'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'post_type', 'class' => 'st-post-type-select', 'labeltext' => esc_html__('Post Type', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $options = []; foreach (get_all_taxopress_taxonomies() as $_taxonomy) { $_taxonomy = $_taxonomy->name; $tax = get_taxonomy($_taxonomy); if (! $tax->show_tagcloud || empty($tax->labels->name) || $_taxonomy === 'link_category') { continue; } if ($tax->name === 'post_tag') { $options[] = [ 'post_type' => join(',', $tax->object_type), 'attr' => $tax->name, 'text' => $tax->labels->name . ' (' . $tax->name . ')', 'default' => 'true' ]; } else { $options[] = [ 'post_type' => join(',', $tax->object_type), '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_tag_cloud', 'name' => 'taxonomy', 'class' => 'st-post-taxonomy-select', 'labeltext' => esc_html__('Taxonomy', 'simple-tags'), 'required' => true, 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $options = [ ['attr' => 'all', 'text' => esc_html__('All Parent Terms', 'simple-tags'), 'default' => 'true'] ]; if (!empty($current['taxonomy'])) { $taxonomy = $current['taxonomy']; $all_terms = get_terms([ 'taxonomy' => $taxonomy, 'hide_empty' => false, ]); if (!empty($all_terms) && !is_wp_error($all_terms)) { $child_term_ids = []; $parent_term_ids = []; // Build child-parent mapping foreach ($all_terms as $term) { if ($term->parent) { $child_term_ids[] = $term->term_id; $parent_term_ids[] = $term->parent; } } $parent_term_ids = array_unique($parent_term_ids); foreach ($all_terms as $term) { $term_id = $term->term_id; if (in_array($term_id, $parent_term_ids, true) || $term->parent == 0) { $options[] = [ 'attr' => strval($term_id), 'text' => esc_html($term->name) ]; } } } } $selected = isset($current['parent_term']) ? (array) $current['parent_term'] : ['all']; $select['selected'] = isset($current['parent_term']) ? $current['parent_term'] : 'all'; $select = [ 'options' => $options, 'selected' => $selected ]; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'parent_term', 'class' => 'taxopress-single-select2', 'labeltext' => esc_html__('Parent Term', 'simple-tags'), 'selections' => $select // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); $select = [ 'options' => [ [ 'attr' => 'parents_only', 'text' => esc_attr__('Display only Parent Terms', 'simple-tags') ], [ 'attr' => 'sub_terms_only', 'text' => esc_attr__('Display only Sub-Terms', 'simple-tags') ], [ 'attr' => 'parents_and_sub', 'text' => esc_attr__('Display Parents and Sub-Terms', 'simple-tags'), 'default' => 'true' ] ] ]; $selected = isset($current['display_mode']) ? taxopress_disp_boolean($current['display_mode']) : ''; $select['selected'] = ! empty($selected) ? $current['display_mode'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'display_mode', 'labeltext' => esc_html__('Display Mode', 'simple-tags'), 'selections' => $select // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_td_end() . $ui->get_tr_end(); ?>
get_textarea_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'include_terms', 'rows' => '4', 'cols' => '40', 'class' => 'autocomplete-input tagclouds-include', 'textvalue' => isset($current['include_terms']) ? esc_attr($current['include_terms']) : '', 'labeltext' => esc_html__('Custom terms to display', 'simple-tags'), 'helptext' => esc_html__('Enter terms (comma-separated) to display. Used in Custom and Combined modes.', 'simple-tags'), 'required' => false, ]); $select = [ 'options' => [ [ 'attr' => '1', 'text' => esc_attr__('24 hours', 'simple-tags') ], [ 'attr' => '7', 'text' => esc_attr__('7 days', 'simple-tags') ], [ 'attr' => '14', 'text' => esc_attr__('2 weeks', 'simple-tags') ], [ 'attr' => '30', 'text' => esc_attr__('1 month', 'simple-tags') ], [ 'attr' => '180', 'text' => esc_attr__('6 months', 'simple-tags') ], [ 'attr' => '365', 'text' => esc_attr__('1 year', 'simple-tags') ], [ 'attr' => '0', 'text' => esc_attr__('No limit', 'simple-tags'), 'default' => 'true' ], ], ]; $selected = isset($current) ? 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_tag_cloud', 'name' => 'limit_days', 'labeltext' => esc_html__('Limit terms based on timeframe', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); do_action('taxopress_tagcloud_ordering_method', $current); $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_tag_cloud', 'name' => 'order', 'labeltext' => esc_html__('Ordering for choosing terms for display', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); ?>

[ [ 'attr' => 'flat', 'text' => esc_attr__('Cloud', 'simple-tags')], [ 'attr' => 'list', 'text' => esc_attr__('Unordered List (UL/LI)', 'simple-tags') ], [ 'attr' => 'ol', 'text' => esc_attr__('Ordered List (OL/LI)', 'simple-tags') ], [ 'attr' => 'comma', 'text' => esc_attr__('WordPress Default', 'simple-tags'), 'default' => 'true'], ['attr' => 'table', 'text' => esc_attr__('Table List', 'simple-tags')], ['attr' => 'border', 'text' => esc_attr__('Border Cloud', 'simple-tags'), 'default' => 'true' ], ['attr' => 'parent/child', 'text' => esc_attr__('Parent / Child', 'simple-tags')], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['format']) : ''; $select['selected'] = ! empty($selected) ? $current['format'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'format', 'labeltext' => esc_html__('Display format', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); ?>
get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'before', 'textvalue' => isset($current['before']) ? esc_attr($current['before']) : '', 'labeltext' => esc_html__( 'Text to display before terms list', 'simple-tags' ), 'helptext' => esc_html__( 'Enter the text that should be display before terms list. This field accepts basic HTML.', 'simple-tags' ), 'required' => false, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'after', 'textvalue' => isset($current['after']) ? esc_attr($current['after']) : '', 'labeltext' => esc_html__( 'Text to display after terms list', 'simple-tags' ), 'helptext' => esc_html__( 'Enter the text that should be display after terms list. This field accepts basic HTML.', 'simple-tags' ), 'required' => false, ]); ?>
get_textarea_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'exclude_terms', 'rows' => '4', 'cols' => '40', 'class' => 'autocomplete-input tagclouds-exclude', 'textvalue' => isset($current['exclude_terms']) ? esc_attr($current['exclude_terms']) : '', 'labeltext' => esc_html__('Exclude terms from terms display', 'simple-tags'), 'helptext' => esc_html__('Enter terms (comma-separated) to exclude from the terms display.', 'simple-tags'), 'required' => false, ]); $enable_hidden_terms = SimpleTags_Plugin::get_option_value('enable_hidden_terms'); if ($enable_hidden_terms) { $select = [ 'options' => [ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = isset($current['hide_terms']) ? taxopress_disp_boolean($current['hide_terms']) : '0'; $select['selected'] = !empty($selected) ? $selected : '0'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'hide_terms', 'labeltext' => esc_html__('Exclude hidden terms from Terms Display?', 'simple-tags'), 'selections' => $select, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); } else { if (isset($current['hide_terms']) && $current['hide_terms'] !== '0') { $current['hide_terms'] = '0'; } } ?>
[ [ 'attr' => '0', 'text' => esc_attr__('False', 'simple-tags'), 'default' => 'true', ], [ 'attr' => '1', 'text' => esc_attr__('True', 'simple-tags'), ], ], ]; $selected = (isset($current) && isset($current['hide_output'])) ? taxopress_disp_boolean($current['hide_output']) : ''; $select['selected'] = !empty($selected) ? $current['hide_output'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'hide_output', 'labeltext' => esc_html__('Hide display output if no terms?', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'max', 'textvalue' => isset($current['max']) ? esc_attr($current['max']) : '20 ', 'labeltext' => esc_html__('Maximum terms to display', 'simple-tags'), 'helptext' => '', 'required' => true, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'smallest', 'textvalue' => isset($current['smallest']) ? esc_attr($current['smallest']) : '12', 'labeltext' => esc_html__('Font size minimum', 'simple-tags'), 'helptext' => '', 'required' => true, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_number_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'largest', 'textvalue' => isset($current['largest']) ? esc_attr($current['largest']) : '12', 'labeltext' => esc_html__('Font size maximum', 'simple-tags'), 'helptext' => '', 'required' => true, ]); $select = [ 'options' => [ [ 'attr' => 'pt', 'text' => esc_attr__('Point', 'simple-tags'), 'default' => 'true' ], [ 'attr' => 'px', 'text' => esc_attr__('Pixel', 'simple-tags') ], [ 'attr' => 'em', 'text' => esc_attr__('Em', 'simple-tags') ], [ 'attr' => '%', 'text' => esc_attr__('Percent', 'simple-tags') ], ], ]; $selected = isset($current) ? taxopress_disp_boolean($current['unit']) : ''; $select['selected'] = ! empty($selected) ? $current['unit'] : ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input_main([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'unit', 'labeltext' => esc_html__('Unit font size', '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', removed when default value is checked as this mean box is always checked even when user uncheck it since it's defau;t ], ], ]; $selected = (isset($current) && isset($current['color'])) ? taxopress_disp_boolean($current['color']) : ''; if ($tag_cloud_edit) { $select['selected'] = !empty($selected) ? $current['color'] : ''; } else { $select['selected'] = 1; //makeup for default when creating new term display } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_select_checkbox_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'color', 'class' => 'tag-cloud-color-option', 'labeltext' => esc_html__('Enable colors for terms', 'simple-tags'), 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'mincolor', 'class' => 'text-color tag-cloud-min', 'textvalue' => isset($current['mincolor']) ? esc_attr($current['mincolor']) : '#353535', 'labeltext' => esc_html__('Font color minimum', 'simple-tags'), 'helptext' => esc_html__('This is the color of the least popular term', 'simple-tags'), 'required' => true, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'maxcolor', 'class' => 'text-color tag-cloud-max', 'textvalue' => isset($current['maxcolor']) ? esc_attr($current['maxcolor']) : '#000000', 'labeltext' => esc_html__('Font color maximum', 'simple-tags'), 'helptext' => esc_html__('This is the color of the most popular term', 'simple-tags'), 'required' => true, ]); ?>
get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'wrap_class', 'class' => '', 'textvalue' => isset($current['wrap_class']) ? esc_attr($current['wrap_class']) : '', 'labeltext' => esc_html__('Term display div class', 'simple-tags'), 'helptext' => '', 'required' => false, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_text_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'link_class', 'class' => '', 'textvalue' => isset($current['link_class']) ? esc_attr($current['link_class']) : '', 'labeltext' => esc_html__('Term link class', 'simple-tags'), 'helptext' => '', 'required' => false, ]); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo $ui->get_textarea_input([ 'namearray' => 'taxopress_tag_cloud', 'name' => 'xformat', 'class' => 'st-full-width', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['xformat']) ? esc_attr($current['xformat']) : esc_attr('%tag_name%'), 'labeltext' => esc_html__('Term link format', 'simple-tags'), 'helptext' => sprintf(esc_html__('This option allows you to change the format of your terms. You can use any of the tokens in the "Terms Display format" sidebar". Find more details %1sin the documentation%2s.', 'simple-tags'), '', ''), 'required' => false, ]); ?>

' . esc_html__('Shortcode: ', 'simple-tags'); ?>  

:

  • %tag_link% –
  • %tag_id% –
  • t%tag_scale% –
  • %tag_count% –
  • %tag_rel% – ( rel="tag")
  • %tag_size% –
  • %tag_color% –
  • %tag_name% –
  • %tag_name_attribute% –
  • %tag_description% –


__('Invalid nonce', 'simple-tags')]); } if (!current_user_can('simple_tags')) { wp_send_json_error(['message' => __('Permission denied.', 'simple-tags')]); } if (!isset($_POST['taxopress_termsdisplay'])) { wp_send_json_error(['message' => __('Missing display ID.', 'simple-tags')]); } $display_id = sanitize_text_field(wp_unslash($_POST['taxopress_termsdisplay'])); // Get the display configuration $tagclouds = taxopress_get_tagcloud_data(); if (!array_key_exists($display_id, $tagclouds)) { wp_send_json_error(['message' => __('Invalid terms display configuration.', 'simple-tags')]); } $config = $tagclouds[$display_id]; // Create tag cloud client instance $client = new SimpleTags_Client_TagCloud(); // Convert config to query args format $args = http_build_query([ 'taxonomy' => $config['taxonomy'] ?? 'post_tag', 'selectionby' => $config['selectionby'] ?? 'count', 'selection' => $config['selection'] ?? 'desc', 'orderby' => $config['orderby'] ?? 'random', 'order' => $config['order'] ?? 'desc', 'format' => $config['format'] ?? 'border', 'number' => $config['max'] ?? 20, 'largest' => $config['largest'] ?? 12, 'smallest' => $config['smallest'] ?? 12, 'unit' => $config['unit'] ?? 'pt', 'color' => !empty($config['color']), 'mincolor' => $config['mincolor'] ?? '#353535', 'maxcolor' => $config['maxcolor'] ?? '#000000', 'hide_empty' => !empty($config['hide_empty']), 'hide_title' => !empty($config['hide_title']), 'hide_output' => !empty($config['hide_output']), 'notagstext' => !empty($config['notagstext']), 'title' => $config['title'] ?? '', 'exclude_terms' => $config['exclude_terms'] ?? '', 'term_selection_mode' => $config['term_selection_mode'] ?? 'automatic', 'include_terms' => $config['include_terms'] ?? '', 'hide_terms' => !empty($config['hide_terms']), 'before' => $config['before'] ?? '', 'after' => $config['after'] ?? '', 'xformat' => $config['xformat'] ?? '', 'wrap_class' => $config['wrap_class'] ?? '', 'link_class' => $config['link_class'] ?? '', 'parent_term' => $config['parent_term'] ?? 'all', 'display_mode' => $config['display_mode'] ?? 'parents_and_sub', 'max' => $config['max'] ?? 20, 'limit_days' => $config['limit_days'] ?? '', ]); // Get the tag cloud output $output = $client->extendedTagCloud($args); if (empty($output)) { if (!empty($config['hide_output'])) { wp_send_json_success(['html' => '']); } $notagstext = esc_html__('There are no terms in this taxonomy.', 'simple-tags'); wp_send_json_success(['html' => '

' . $notagstext . '

']); } wp_send_json_success(['html' => $output]); } }