PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.6.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.6.0
3.53.0 3.52.0 3.51.0 3.50.0 3.45.0 3.38.0 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.40.0 3.40.1 3.41.0 3.42.0 3.43.0 3.44.0 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 All 177 releases
simple-tags / inc / terms.php

terms.php in Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms 3.6.0, at inc/terms.php

173 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class SimpleTags_Terms
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 // Javascript
27 add_action('admin_enqueue_scripts', [__CLASS__, 'admin_enqueue_scripts'], 11);
28
29 }
30
31 /**
32 * Init somes JS and CSS need for this feature
33 *
34 * @return void
35 * @author Olatechpro
36 */
37 public static function admin_enqueue_scripts()
38 {
39
40 // add JS for manage click tags
41 if (isset($_GET['page']) && $_GET['page'] == 'st_terms') {
42 wp_enqueue_style('st-taxonomies-css');
43 }
44 }
45
46 public static function set_screen($status, $option, $value)
47 {
48 return $value;
49 }
50
51 /** Singleton instance */
52 public static function get_instance()
53 {
54 if (!isset(self::$instance)) {
55 self::$instance = new self();
56 }
57
58 return self::$instance;
59 }
60
61 /**
62 * Add WP admin menu for Tags
63 *
64 * @return void
65 * @author Olatechpro
66 */
67 public function admin_menu()
68 {
69 $hook = add_submenu_page(
70 self::MENU_SLUG,
71 esc_html__('Terms', 'simple-tags'),
72 esc_html__('Terms', 'simple-tags'),
73 'simple_tags',
74 'st_terms',
75 [
76 $this,
77 'page_manage_terms',
78 ]
79 );
80
81 if (taxopress_is_screen_main_page()) {
82 add_action("load-$hook", [$this, 'screen_option']);
83 }
84 }
85
86 /**
87 * Screen options
88 */
89 public function screen_option()
90 {
91
92 $option = 'per_page';
93 $args = [
94 'label' => esc_html__('Number of items per page', 'simple-tags'),
95 'default' => 20,
96 'option' => 'st_terms_per_page'
97 ];
98
99 add_screen_option($option, $args);
100
101 $this->terms_table = new Taxopress_Terms_List();
102 }
103
104 /**
105 * Method for build the page HTML manage tags
106 *
107 * @return void
108 * @author Olatechpro
109 */
110 public function page_manage_terms()
111 {
112 // Default order
113 if (!isset($_GET['order'])) {
114 $_GET['order'] = 'name-asc';
115 }
116
117 settings_errors(__CLASS__);
118
119 ?>
120 <div class="wrap st_wrap st-manage-taxonomies-page">
121
122 <div id="">
123 <h1 class="wp-heading-inline"><?php esc_html_e('Terms', 'simple-tags'); ?></h1>
124 <div class="taxopress-description">
125 <?php esc_html_e('This feature list all the terms on your site.', 'simple-tags'); ?>
126 </div>
127
128
129 <?php
130 if (isset($_REQUEST['s']) && $search = esc_attr(sanitize_text_field(wp_unslash($_REQUEST['s'])))) {
131 /* translators: %s: search keywords */
132 printf(' <span class="subtitle">' . esc_html__('Search results for &#8220;%s&#8221;',
133 'simple-tags') . '</span>', esc_html($search));
134 }
135 ?>
136 <?php
137
138 //the terms table instance
139 $this->terms_table->prepare_items();
140 ?>
141
142
143 <hr class="wp-header-end">
144 <div id="ajax-response"></div>
145 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
146 <?php $this->terms_table->search_box(esc_html__('Search Terms', 'simple-tags'), 'term'); ?>
147 </form>
148 <div class="clear"></div>
149
150 <div id="col-container" class="wp-clearfix">
151
152 <div class="col-wrap">
153 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
154 <?php $this->terms_table->display(); //Display the table ?>
155 </form>
156 <div class="form-wrap edit-term-notes">
157 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
158 </div>
159 </div>
160
161
162 </div>
163
164
165 </div>
166
167 <?php SimpleTags_Admin::printAdminFooter(); ?>
168 </div>
169 <?php
170 }
171
172 }
173