PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.51.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.51.0
3.54.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 All 178 releases
simple-tags / inc / autoterms.php

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

1,772 lines 122.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class SimpleTags_Autoterms
4 {
5 public const MENU_SLUG = 'st_options';
6
7 // class instance
8 public static $instance;
9
10 // WP_List_Table object
11 public $terms_table;
12
13 // WP_List_Table object
14 public $logs_table;
15
16 /**
17 * Constructor
18 *
19 * @return void
20 * @author Olatechpro
21 */
22 public function __construct()
23 {
24
25 add_filter('set-screen-option', [__CLASS__, 'set_screen'], 10, 3);
26 // Admin menu
27 add_action('admin_menu', [$this, 'admin_menu']);
28 // Javascript
29 add_action('admin_enqueue_scripts', [__CLASS__, 'admin_enqueue_scripts'], 11);
30
31 }
32
33 /**
34 * Init somes JS and CSS need for this feature
35 *
36 * @return void
37 * @author Olatechpro
38 */
39 public static function admin_enqueue_scripts()
40 {
41
42 // add JS for manage click tags
43 if (isset($_GET['page']) && $_GET['page'] == 'st_autoterms') {
44 wp_enqueue_style('st-taxonomies-css');
45 }
46 }
47
48 public static function set_screen($status, $option, $value)
49 {
50 return $value;
51 }
52
53 /** Singleton instance */
54 public static function get_instance()
55 {
56 if (!isset(self::$instance)) {
57 self::$instance = new self();
58 }
59
60 return self::$instance;
61 }
62
63 /**
64 * Add WP admin menu for Tags
65 *
66 * @return void
67 * @author Olatechpro
68 */
69 public function admin_menu()
70 {
71 $hook = add_submenu_page(
72 self::MENU_SLUG,
73 esc_html__('Auto Terms', 'simple-tags'),
74 esc_html__('Auto Terms', 'simple-tags'),
75 'simple_tags',
76 'st_autoterms',
77 [
78 $this,
79 'page_manage_autoterms',
80 ]
81 );
82
83 if (taxopress_is_screen_main_page()) {
84 add_action("load-$hook", [$this, 'screen_option']);
85 }
86 }
87
88 public function autoterms_logs_count()
89 {
90
91 $count = taxopress_autoterms_logs_data(1)['counts'];
92 return '('. number_format_i18n($count) .')';
93 }
94
95 /**
96 * Screen options
97 */
98 public function screen_option()
99 {
100
101 $option = 'per_page';
102
103 if (isset($_GET['tab']) && $_GET['tab'] === 'logs') {
104 $args = [
105 'label' => esc_html__('Number of items per page', 'simple-tags'),
106 'default' => 20,
107 'option' => 'st_autoterms_logs_per_page'
108 ];
109 $this->logs_table = new Autoterms_Logs();
110 } else {
111 $args = [
112 'label' => esc_html__('Number of items per page', 'simple-tags'),
113 'default' => 20,
114 'option' => 'st_autoterms_per_page'
115 ];
116 $this->terms_table = new Autoterms_List();
117 }
118
119 add_screen_option($option, $args);
120 }
121
122 /**
123 * Method for build the page HTML manage tags
124 *
125 * @return void
126 * @author Olatechpro
127 */
128 public function page_manage_autoterms()
129 {
130 // Default order
131 if (!isset($_GET['order'])) {
132 $_GET['order'] = 'name-asc';
133 }
134
135 settings_errors(__CLASS__);
136
137 if (isset($_GET['tab']) && $_GET['tab'] === 'logs') {
138 //autoterms logs
139
140 $delete_all_link = add_query_arg(
141 [
142 'page' => 'st_autoterms',
143 'tab' => 'logs',
144 'action' => 'taxopress-delete-autoterm-logs',
145 '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce')
146 ],
147 admin_url('admin.php')
148 );
149
150 $enable_log_link = add_query_arg(
151 [
152 'page' => 'st_autoterms',
153 'tab' => 'logs',
154 'action' => 'taxopress-enable-autoterm-logs',
155 '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce')
156 ],
157 admin_url('admin.php')
158 );
159
160 $disable_log_link = add_query_arg(
161 [
162 'page' => 'st_autoterms',
163 'tab' => 'logs',
164 'action' => 'taxopress-disable-autoterm-logs',
165 '_wpnonce' => wp_create_nonce('autoterm-action-request-nonce')
166 ],
167 admin_url('admin.php')
168 );
169 ?>
170 <div class="wrap st_wrap st-manage-taxonomies-page">
171
172 <div id="">
173 <h1 class="wp-heading-inline"><?php esc_html_e('Auto Terms Logs', 'simple-tags'); ?></h1>
174 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms')); ?>"
175 class="page-title-action"><?php esc_html_e('Auto Terms', 'simple-tags'); ?></a>
176
177 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms&add=new_item')); ?>"
178 class="page-title-action"><?php esc_html_e('Add New Auto Terms', 'simple-tags'); ?></a>
179
180 <?php if (get_option('taxopress_autoterms_logs_disabled')) { ?>
181 <a href="<?php echo esc_url($enable_log_link); ?>" class="page-title-action taxopress-logs-tablenav-enable-logs"><?php esc_html_e('Enable Logs', 'simple-tags'); ?></a>
182 <?php } else { ?>
183 <a href="<?php echo esc_url($disable_log_link); ?>" class="page-title-action taxopress-logs-tablenav-disable-logs" onclick="return confirm('<?php esc_attr_e('Are you sure you want to disable logs?', 'simple-tags'); ?>')"><?php esc_html_e('Disable Logs', 'simple-tags'); ?></a>
184 <?php } ?>
185
186 <a href="<?php echo esc_url($delete_all_link); ?>" class="page-title-action taxopress-logs-tablenav-purge-logs" onclick="return confirm('<?php esc_attr_e('Are you sure you want to delete all logs?', 'simple-tags'); ?>')"><?php esc_html_e('Delete All Logs', 'simple-tags'); ?></a>
187
188 <div class="taxopress-description">
189 <?php esc_html_e('Auto Terms logs history.', 'simple-tags'); ?>
190 </div>
191
192
193 <?php
194 if (isset($_REQUEST['s']) && $search = esc_attr(sanitize_text_field(wp_unslash($_REQUEST['s'])))) {
195 /* translators: %s: search keywords */
196 printf(' <span class="subtitle">' . esc_html__(
197 'Search results for &#8220;%s&#8221;',
198 'simple-tags'
199 ) . '</span>', esc_html($search));
200 }
201 ?>
202 <?php
203
204 //the terms table instance
205 $this->logs_table->prepare_items();
206 ?>
207
208
209 <hr class="wp-header-end">
210 <div id="ajax-response"></div>
211 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
212 <?php $this->logs_table->search_box(esc_html__('Search Auto Terms Logs', 'simple-tags'), 'term'); ?>
213 </form>
214 <div class="clear"></div>
215
216 <div id="col-container" class="wp-clearfix">
217
218 <div class="col-wrap">
219 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
220 <?php $this->logs_table->display(); //Display the table?>
221 </form>
222 <div class="form-wrap edit-term-notes">
223 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
224 </div>
225 </div>
226
227
228 </div>
229
230
231 </div>
232 <?php } elseif (!isset($_GET['add'])) {
233 //all tax
234 ?>
235 <div class="wrap st_wrap st-manage-taxonomies-page">
236
237 <div id="">
238 <h1 class="wp-heading-inline"><?php esc_html_e('Auto Terms', 'simple-tags'); ?></h1>
239 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms&add=new_item')); ?>"
240 class="page-title-action taxopress">
241 <?php if (! taxopress_is_pro_version()) : ?>
242 <span class="dashicons dashicons-lock" aria-hidden="true"></span>
243 <?php endif; ?>
244 <?php esc_html_e('Add New Auto Terms', 'simple-tags'); ?>
245 </a>
246
247 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms&tab=logs')); ?>"
248 class="page-title-action"><?php esc_html_e('Logs', 'simple-tags'); ?> <span class="update-plugins"><span class="plugin-count"><?php echo esc_html($this->autoterms_logs_count()); ?></span></span></a>
249
250 <div class="taxopress-description">
251 <?php esc_html_e('Auto Terms can scan your content and automatically assign new and existing terms.', 'simple-tags'); ?>
252 </div>
253
254
255 <?php
256 if (isset($_REQUEST['s']) && $search = esc_attr(sanitize_text_field(wp_unslash($_REQUEST['s'])))) {
257 /* translators: %s: search keywords */
258 printf(' <span class="subtitle">' . esc_html__(
259 'Search results for &#8220;%s&#8221;',
260 'simple-tags'
261 ) . '</span>', esc_html($search));
262 }
263 ?>
264 <?php
265
266 //the terms table instance
267 $this->terms_table->prepare_items();
268 ?>
269
270
271 <hr class="wp-header-end">
272 <div id="ajax-response"></div>
273 <form class="search-form wp-clearfix st-taxonomies-search-form" method="get">
274 <?php $this->terms_table->search_box(esc_html__('Search Auto Terms', 'simple-tags'), 'term'); ?>
275 </form>
276 <div class="clear"></div>
277
278 <div id="col-container" class="wp-clearfix">
279
280 <div class="col-wrap">
281 <form action="<?php echo esc_url(add_query_arg('', '')); ?>" method="post">
282 <?php $this->terms_table->display(); //Display the table?>
283 </form>
284 <div class="form-wrap edit-term-notes">
285 <p><?php esc_html__('Description here.', 'simple-tags') ?></p>
286 </div>
287 </div>
288
289
290 </div>
291
292
293 </div>
294 <?php } else {
295 if ($_GET['add'] == 'new_item') {
296 //add/edit taxonomy
297 $this->taxopress_manage_autoterms();
298 echo '<div>';
299 }
300 } ?>
301
302
303 <?php SimpleTags_Admin::printAdminFooter(); ?>
304 </div>
305 <?php
306 }
307
308
309 /**
310 * Create our settings page output.
311 *
312 * @internal
313 */
314 public function taxopress_manage_autoterms()
315 {
316
317 $tab = (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) ? 'edit' : 'new';
318 $tab_class = 'taxopress-' . $tab;
319 $current = null;
320
321 ?>
322
323 <div class="wrap <?php echo esc_attr($tab_class); ?>">
324
325 <?php
326
327 $autoterms = taxopress_get_autoterm_data();
328 $autoterm_edit = false;
329 $autoterm_limit = false;
330
331 if ('edit' === $tab) {
332
333
334 $selected_autoterm = taxopress_get_current_autoterm();
335
336 if ($selected_autoterm && array_key_exists($selected_autoterm, $autoterms)) {
337 $current = $autoterms[$selected_autoterm];
338 $autoterm_edit = true;
339 }
340
341 }
342
343
344 if (!isset($current['title']) && count($autoterms) > 0 && apply_filters('taxopress_autoterms_create_limit', true)) {
345 $autoterm_limit = true;
346 }
347
348
349 $ui = new taxopress_admin_ui();
350
351 $taxonomy_replace_options = [
352 'options' => [
353 [
354 'attr' => 'append',
355 'text' => esc_attr__('Add new terms and keep existing terms.', 'simple-tags'),
356 'default' => 'true'
357 ],
358 [
359 'attr' => 'append_and_replace',
360 'text' => esc_attr__('Add new terms and remove existing terms.', 'simple-tags')
361 ],
362 [
363 'attr' => 'replace',
364 'text' => esc_attr__('Remove existing terms even if no new terms are found.', 'simple-tags')
365 ]
366 ],
367 ];
368 ?>
369
370
371 <div class="wrap <?php echo esc_attr($tab_class); ?>">
372 <h1><?php echo esc_html__('Manage Auto Terms', 'simple-tags'); ?>
373
374 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms')); ?>"
375 class="page-title-action"><?php esc_html_e('Auto Terms', 'simple-tags'); ?></a>
376
377 <a href="<?php echo esc_url(admin_url('admin.php?page=st_autoterms&tab=logs')); ?>"
378 class="page-title-action"><?php esc_html_e('Logs', 'simple-tags'); ?> <span class="update-plugins"><span class="plugin-count"><?php echo esc_html($this->autoterms_logs_count()); ?></span></span></a>
379
380 </h1>
381
382 <div class="wp-clearfix"></div>
383
384 <form method="post" action="">
385
386
387 <div class="tagcloudui st-tabbed">
388
389
390 <div class="autoterms-postbox-container">
391 <div id="poststuff">
392 <div class="taxopress-section postbox">
393 <div class="postbox-header">
394 <h2 class="hndle ui-sortable-handle">
395 <?php
396 if ($autoterm_edit) {
397 $active_tab = (isset($current['active_tab']) && !empty(trim($current['active_tab']))) ? $current['active_tab'] : 'autoterm_general';
398 echo esc_html__('Edit Auto Terms', 'simple-tags');
399 echo '<input type="hidden" name="edited_autoterm" value="' . esc_attr($current['ID']) . '" />';
400 echo '<input type="hidden" name="taxopress_autoterm[ID]" value="' . esc_attr($current['ID']) . '" />';
401 echo '<input type="hidden" name="taxopress_autoterm[active_tab]" class="taxopress-active-subtab" value="'.esc_attr($active_tab).'" />';
402 } else {
403 $active_tab = 'autoterm_general';
404 echo '<input type="hidden" name="taxopress_autoterm[active_tab]" class="taxopress-active-subtab" value="" />';
405 echo esc_html__('Add new Auto Terms', 'simple-tags');
406 }
407 ?>
408 </h2>
409 </div>
410 <div class="inside">
411 <div class="main">
412
413
414 <?php if ($autoterm_limit) {
415 echo '<div class="st-taxonomy-content promo-box-area"><div class="taxopress-warning upgrade-pro">
416
417 <h2 style="margin-bottom: 5px;">' . esc_html__(
418 'To create more Auto Terms, please upgrade to TaxoPress Pro.',
419 'simple-tags'
420 ) . '</h2>
421 <p>
422 ' . esc_html__(
423 'With TaxoPress Pro, you can create unlimited Auto Terms. You can create Auto Terms for any taxonomy.',
424 'simple-tags'
425 ) . '
426
427 </p>
428 </div></div>';
429
430 } else {
431 ?>
432
433
434 <ul class="taxopress-tab">
435 <li aria-current="<?php echo $active_tab === 'autoterm_general' ? 'true' : 'false'; ?>" class="autoterm_general_tab <?php echo $active_tab === 'autoterm_general' ? 'active' : ''; ?>" data-content="autoterm_general">
436 <a href="#autoterm_general"><span><?php esc_html_e('General',
437 'simple-tags'); ?></span></a>
438 </li>
439 <li aria-current="<?php echo $active_tab === 'autoterm_display' ? 'true' : 'false'; ?>" class="autoterm_display_tab <?php echo $active_tab === 'autoterm_display' ? 'active' : ''; ?>" data-content="autoterm_display">
440 <a href="#autoterm_display"><span><?php esc_html_e('Post Types',
441 'simple-tags'); ?></span></a>
442 </li>
443
444 <li aria-current="<?php echo $active_tab === 'autoterm_terms' ? 'true' : 'false'; ?>" class="autoterm_terms_tab <?php echo $active_tab === 'autoterm_terms' ? 'active' : ''; ?>" data-content="autoterm_terms">
445 <a href="#autoterm_terms"><span><?php esc_html_e('Sources',
446 'simple-tags'); ?></span></a>
447 </li>
448
449 <li aria-current="<?php echo $active_tab === 'autoterm_when_to_use' ? 'true' : 'false'; ?>" class="autoterm_when_to_use_tab <?php echo $active_tab === 'autoterm_when_to_use' ? 'active' : ''; ?>" data-content="autoterm_when_to_use">
450 <a href="#autoterm_when_to_use"><span><?php esc_html_e('When to Use',
451 'simple-tags'); ?></span></a>
452 </li>
453
454 <li aria-current="<?php echo $active_tab === 'autoterm_options' ? 'true' : 'false'; ?>" class="autoterm_options_tab <?php echo $active_tab === 'autoterm_options' ? 'active' : ''; ?>" data-content="autoterm_options">
455 <a href="#autoterm_options"><span><?php esc_html_e('Options',
456 'simple-tags'); ?></span></a>
457 </li>
458
459 <li aria-current="<?php echo $active_tab === 'autoterm_exceptions' ? 'true' : 'false'; ?>" class="autoterm_exceptions_tab <?php echo $active_tab === 'autoterm_exceptions' ? 'active' : ''; ?>" data-content="autoterm_exceptions">
460 <a href="#autoterm_exceptions"><span><?php esc_html_e(
461 'Exceptions',
462 'simple-tags'
463 ); ?></span></a>
464 </li>
465
466 <!--<li aria-current="<?php echo $active_tab === 'autoterm_oldcontent' ? 'true' : 'false'; ?>" class="autoterm_oldcontent_tab <?php echo $active_tab === 'autoterm_oldcontent' ? 'active' : ''; ?>" data-content="autoterm_oldcontent">
467 <a href="#autoterm_oldcontent"><span><?php esc_html_e('Existing Content',
468 'simple-tags'); ?></span></a>
469 </li>-->
470
471 <li aria-current="<?php echo $active_tab === 'autoterm_advanced' ? 'true' : 'false'; ?>" class="autoterm_advanced_tab <?php echo $active_tab === 'autoterm_advanced' ? 'active' : ''; ?>" data-content="autoterm_advanced">
472 <a href="#autoterm_advanced"><span><?php esc_html_e('Advanced',
473 'simple-tags'); ?></span></a>
474 </li>
475
476 <li aria-current="<?php echo $active_tab === 'autoterm_preview' ? 'true' : 'false'; ?>" class="autoterm_preview_tab <?php echo $active_tab === 'autoterm_preview' ? 'active' : ''; ?>" data-content="autoterm_preview">
477 <a href="#autoterm_preview"><span><?php esc_html_e('Preview',
478 'simple-tags'); ?></span></a>
479 </li>
480
481 </ul>
482
483 <div class="st-taxonomy-content taxopress-tab-content">
484
485
486 <table class="form-table taxopress-table autoterm_general"
487 style="<?php echo $active_tab === 'autoterm_general' ? '' : 'display:none;'; ?>">
488 <?php
489 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
490 echo $ui->get_tr_start();
491
492 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
493 echo $ui->get_th_start();
494 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
495 echo $ui->get_label('title', esc_html__('Title', 'simple-tags')) . $ui->get_required_span();
496 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
497 echo $ui->get_th_end() . $ui->get_td_start();
498
499 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
500 echo $ui->get_text_input([
501 'namearray' => 'taxopress_autoterm',
502 'name' => 'title',
503 'textvalue' => isset($current['title']) ? esc_attr($current['title']) : '',
504 'maxlength' => '32',
505 'helptext' => '',
506 'required' => true,
507 'placeholder' => false,
508 'wrap' => false,
509 ]);
510
511
512 $options = [];
513 foreach (get_all_taxopress_taxonomies() as $_taxonomy) {
514 $_taxonomy = $_taxonomy->name;
515 $tax = get_taxonomy($_taxonomy);
516 if (empty($tax->labels->name)) {
517 continue;
518 }
519 if ($tax->name === 'post_tag') {
520 $options[] = [
521 'attr' => $tax->name,
522 'text' => $tax->labels->name. ' ('.$tax->name.')',
523 'default' => 'true',
524 ];
525 } else {
526 $options[] = [
527 'attr' => $tax->name,
528 'text' => $tax->labels->name. ' ('.$tax->name.')',
529 ];
530 }
531 }
532
533 $select = [
534 'options' => $options,
535 ];
536 $selected = isset($current) ? taxopress_disp_boolean($current['taxonomy']) : '';
537 $select['selected'] = !empty($selected) ? $current['taxonomy'] : '';
538 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
539 echo $ui->get_select_checkbox_input_main([
540 'namearray' => 'taxopress_autoterm',
541 'name' => 'taxonomy',
542 'class' => 'st-post-taxonomy-select',
543 'labeltext' => esc_html__('Taxonomy', 'simple-tags'),
544 'required' => true,
545 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
546 ]);
547
548 $selected_option = (isset($current) && isset($current['autoterm_from'])) ? $current['autoterm_from'] : '';
549
550 $term_from_options = [
551 '' => esc_attr__('Don\'t scan Post Content or Title', 'simple-tags'),
552 'post_content' => esc_attr__('Post Content', 'simple-tags'),
553 'post_title' => esc_attr__('Post Title', 'simple-tags'),
554 'posts' => esc_attr__('Post Content and Title', 'simple-tags')
555 ];
556 ?>
557 <tr valign="top">
558 <th scope="row">
559 <label for="autoterm_from">
560 <?php esc_html_e('Find term in:', 'simple-tags'); ?>
561 </label>
562 </th>
563 <td>
564 <select class="" id="autoterm_from" name="taxopress_autoterm[autoterm_from]">
565 <?php foreach ($term_from_options as $option => $label) : ?>
566 <option value="<?php echo esc_attr($option); ?>" <?php selected($selected_option, $option); ?>>
567 <?php echo esc_html($label); ?>
568 </option>
569 <?php endforeach; ?>
570 </select>
571 </td>
572 </tr>
573 <tr valign="top">
574 <th></th>
575 <td style="margin-top: 0; padding-top: 0;">
576 <table class="visbile-table st-autoterm-area-table">
577 <tr>
578 <th scope="row" colspan="3" style="margin-top: 0; padding-top: 0; padding-bottom: 0;">
579 <label>
580 <?php echo esc_html__('Find in more areas:', 'simple-tags'); ?>
581 </label>
582 </th>
583 </tr>
584 <tr class="autoterm-custom-findin-row form-tr option">
585 <td style="padding-left: 0; padding-top: 0;" colspan="3">
586 <select class="autoterm-area-custom-type" style="max-width: 100%;">
587 <?php
588 $area_types = [
589 'custom_fields' => esc_html__('Custom Field', 'simple-tags'),
590 'taxonomies' => esc_html__('Taxonomy', 'simple-tags'),
591 ];
592 foreach ($area_types as $area_type_value => $area_type_label) : ?>
593 <option value="<?php echo esc_attr($area_type_value); ?>">
594 <?php echo esc_html($area_type_label); ?>
595 </option>
596 <?php endforeach; ?>
597 </select>
598 </td>
599 </tr>
600 <tr class="autoterm-custom-findin-row form-tr fields">
601 <td style="padding-left: 0; padding-top: 0;" colspan="3">
602 <select class="autoterm-area-custom-taxonomy st-hide-content find-in-content taxonomies" style="max-width: 100%"
603 placeholder="<?php echo esc_attr__("Search Taxonomy", "simple-tags"); ?>">
604 <option value=""><?php echo esc_html__("Search Taxonomy", "simple-tags"); ?></option>
605 <?php
606 foreach (get_all_taxopress_taxonomies() as $_taxonomy) :
607 $_taxonomy = $_taxonomy->name;
608 $tax = get_taxonomy($_taxonomy);
609 if (empty($tax->labels->name)) {
610 continue;
611 }
612 ?>
613 <option value="<?php echo esc_attr($tax->name); ?>">
614 <?php echo esc_html($tax->labels->name. ' ('.$tax->name.')'); ?>
615 </option>
616 <?php endforeach; ?>
617 </select>
618 <div class="autoterm-field-area">
619 <select style="width: 100%;" class="taxopress-custom-fields-search find-in-content custom_fields"
620 data-placeholder="<?php echo esc_attr__("Search Custom Field...", "simple-tags"); ?>"
621 data-nonce="<?php echo esc_attr(wp_create_nonce('taxopress-custom-fields-search')); ?>"></select>
622 </div>
623 </td>
624 </tr>
625 <?php
626 $find_in_customs_entries = (!empty($current['find_in_customs_entries']) && is_array($current['find_in_customs_entries'])) ? $current['find_in_customs_entries'] : [];
627
628 $find_in_custom_fields_custom_items = (!empty($current['find_in_custom_fields_custom_items']) && is_array($current['find_in_custom_fields_custom_items'])) ? $current['find_in_custom_fields_custom_items'] : [];
629
630 $find_in_taxonomies_custom_items = (!empty($current['find_in_taxonomies_custom_items']) && is_array($current['find_in_taxonomies_custom_items'])) ? $current['find_in_taxonomies_custom_items'] : [];
631
632 if (!empty($find_in_customs_entries)) :
633 foreach ($find_in_customs_entries as $entry_type => $entry_options) :
634
635 if (!empty($entry_options)) :
636 foreach ($entry_options as $entry_option) :
637 $checked_option = false;
638 if ($entry_type == 'custom_fields' && in_array($entry_option, $find_in_custom_fields_custom_items)) {
639 $checked_option = true;
640 } elseif (in_array($entry_option, $find_in_taxonomies_custom_items)) {
641 $checked_option = true;
642 }
643 ?>
644 <tr valign="top" class="find-in-customs-row <?php echo esc_attr($entry_type); ?> <?php echo esc_attr($entry_option); ?>">
645 <td colspan="2" class="item-header">
646 <div>
647 <span class="action-checkbox">
648 <input type="hidden" name="find_in_customs_entries[<?php echo esc_attr($entry_type); ?>][]" value="<?php echo esc_attr($entry_option); ?>" /><input type="checkbox" id="<?php echo esc_attr($entry_option); ?>" name="find_in_<?php echo esc_attr($entry_type); ?>_custom_items[]" value="<?php echo esc_attr($entry_option); ?>" <?php checked($checked_option, true); ?> />
649 </span>
650 <label for="<?php echo esc_attr($entry_option); ?>">
651 <?php echo esc_html($entry_option); ?>
652 </label>
653 </div>
654 </td>
655 <td>
656 <span class="delete">
657 <?php echo esc_html__("Delete", "simple-tags"); ?>
658 </span>
659 </td>
660 </tr>
661 <?php endforeach;
662 endif;
663
664 endforeach;
665 endif;
666
667 ?>
668 </table>
669 </td>
670 </tr>
671 <?php
672 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
673 echo $ui->get_td_end() . $ui->get_tr_end();
674 ?>
675 </table>
676
677 <table class="form-table taxopress-table autoterm_display"
678 style="<?php echo $active_tab === 'autoterm_display' ? '' : 'display:none;'; ?>">
679
680 <?php
681
682 /**
683 * Filters the arguments for post types to list for taxonomy association.
684 *
685 *
686 * @param array $value Array of default arguments.
687 */
688 $args = apply_filters(
689 'taxopress_attach_post_types_to_taxonomy',
690 ['public' => true]
691 );
692
693 // 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.
694 if (!is_array($args)) {
695 $args = ['public' => true];
696 }
697 $output = 'objects'; // Or objects.
698
699 /**
700 * Filters the results returned to display for available post types for taxonomy.
701 *
702 * @param array $value Array of post type objects.
703 * @param array $args Array of arguments for the post type query.
704 * @param string $output The output type we want for the results.
705 */
706 $post_types = apply_filters(
707 'taxopress_get_post_types_for_taxonomies',
708 get_post_types($args, $output),
709 $args,
710 $output
711 );
712
713 $term_auto_locations = [];
714 foreach ($post_types as $post_type) {
715 if (!in_array($post_type->name, ['attachment'])) {
716 $term_auto_locations[$post_type->name] = $post_type->label;
717 }
718 }
719
720 echo '<tr valign="top"><th scope="row"><label>' . esc_html__(
721 'Post Types to scan:',
722 'simple-tags'
723 ) . '</label> </th><td>
724 <table class="visbile-table">';
725 foreach ($term_auto_locations as $key => $value) {
726
727
728 echo '<tr valign="top"><th scope="row"><label for="' . esc_attr($key) . '">' . esc_html($value) . '</label></th><td>';
729 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
730 echo $ui->get_check_input([
731 'checkvalue' => esc_attr($key),
732 'checked' => (!empty($current['post_types']) && is_array($current['post_types']) && in_array($key, $current['post_types'], true)) ? 'true' : 'false',
733 'name' => esc_attr($key),
734 'namearray' => 'post_types',
735 'textvalue' => esc_attr($key),
736 'labeltext' => "",
737 'wrap' => false,
738 ]);
739
740 echo '</td></tr>';
741
742
743 }
744 echo '</table></td></tr>';
745 ?>
746
747 </table>
748
749
750 <table class="form-table taxopress-table autoterm_when_to_use"
751 style="<?php echo $active_tab === 'autoterm_when_to_use' ? '' : 'display:none;'; ?>">
752 <tr valign="top" class="tab-group-tr">
753 <td colspan="2">
754 <div class="taxopress-group-wrap autoterm-tab-group when">
755 <div class="taxopress-button-group">
756
757 <label class="post current">
758 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_when_to_use_tab][]" value="post"><?php esc_html_e('Posts', 'simple-tags'); ?></label>
759 <label class="schedule">
760 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_when_to_use_tab][]" value="schedule"><?php esc_html_e('Schedule', 'simple-tags'); ?></label>
761 <label class="existing-content">
762 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_when_to_use_tab][]" value="existing_content"><?php esc_html_e('Existing Content', 'simple-tags'); ?></label>
763 <label class="metaboxes">
764 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_when_to_use_tab][]" value="metaboxes"><?php esc_html_e('Metaboxes', 'simple-tags'); ?></label>
765 </div>
766 </div>
767 </td>
768 </tr>
769 <?php
770
771 if ($autoterm_edit) {
772 $default_select = [
773 'options' => [
774 [
775 'attr' => '0',
776 'text' => esc_attr__('False', 'simple-tags'),
777 'default' => 'true',
778 ],
779 [
780 'attr' => '1',
781 'text' => esc_attr__('True', 'simple-tags'),
782 ],
783 ],
784 ];
785 } else {
786 $default_select = [
787 'options' => [
788 [
789 'attr' => '0',
790 'text' => esc_attr__('False', 'simple-tags'),
791 ],
792 [
793 'attr' => '1',
794 'text' => esc_attr__('True', 'simple-tags'),
795 'default' => 'true',
796 ],
797 ],
798 ];
799
800 }
801
802 /**
803 * Post
804 */
805 $selected = (isset($current) && isset($current['autoterm_for_post'])) ? taxopress_disp_boolean($current['autoterm_for_post']) : '';
806 $default_select['selected'] = !empty($selected) ? $current['autoterm_for_post'] : '';
807 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
808 echo $ui->get_select_checkbox_input([
809 'namearray' => 'taxopress_autoterm',
810 'name' => 'autoterm_for_post',
811 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post fields-control',
812 'labeltext' => esc_html__('Post', 'simple-tags'),
813 'aftertext' => esc_html__('Enable Auto Terms when a post is saved or updated.', 'simple-tags'),
814 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
815 'required' => false,
816 ]);
817
818 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
819 echo $ui->get_number_input([
820 'namearray' => 'taxopress_autoterm',
821 'name' => 'terms_limit',
822 'textvalue' => isset($current['terms_limit']) ? esc_attr($current['terms_limit']) : '5',
823 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post',
824 'labeltext' => esc_html__(
825 'Auto Terms Limit',
826 'simple-tags'
827 ),
828 'helptext' => esc_html__('Limit the number of generated Auto Terms. \'0\' for unlimited terms', 'simple-tags'),
829 'min' => '0',
830 'required' => false,
831 ]);
832
833
834 $selected = (isset($current) && isset($current['autoterm_target'])) ? taxopress_disp_boolean($current['autoterm_target']) : '';
835 $default_select['selected'] = !empty($selected) ? $current['autoterm_target'] : '';
836 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
837 echo $ui->get_select_checkbox_input([
838 'namearray' => 'taxopress_autoterm',
839 'name' => 'autoterm_target',
840 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post',
841 'labeltext' => esc_html__('Target content', 'simple-tags'),
842 'aftertext' => esc_html__('Only use Auto Terms on posts with no added terms.', 'simple-tags'),
843 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
844 ]);
845
846
847 $selected = (isset($current) && isset($current['autoterm_word'])) ? taxopress_disp_boolean($current['autoterm_word']) : '';
848 $default_select['selected'] = !empty($selected) ? $current['autoterm_word'] : '';
849 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
850 echo $ui->get_select_checkbox_input([
851 'namearray' => 'taxopress_autoterm',
852 'name' => 'autoterm_word',
853 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post',
854 'labeltext' => esc_html__('Whole words', 'simple-tags'),
855 'aftertext' => esc_html__('Only add terms when the word is an exact match. Do not make matches for partial words.', 'simple-tags'),
856 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
857 ]);
858
859
860 $selected = (isset($current) && isset($current['autoterm_hash'])) ? taxopress_disp_boolean($current['autoterm_hash']) : '';
861 $default_select['selected'] = !empty($selected) ? $current['autoterm_hash'] : '';
862 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
863 echo $ui->get_select_checkbox_input([
864 'namearray' => 'taxopress_autoterm',
865 'name' => 'autoterm_hash',
866 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post',
867 'labeltext' => esc_html__('Hashtags', 'simple-tags'),
868 'aftertext' => esc_html__('Support hashtags symbols # in Auto Terms.', 'simple-tags'),
869 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
870 ]);
871
872 $selected = (isset($current) && isset($current['post_replace_type'])) ? taxopress_disp_boolean($current['post_replace_type']) : '';
873 $taxonomy_replace_options['selected'] = !empty($selected) ? $current['post_replace_type'] : '';
874 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
875 echo $ui->get_radio_input([
876 'namearray' => 'taxopress_autoterm',
877 'name' => 'post_replace_type',
878 'class' => 'autoterm_for_post autoterm-terms-when-to-field autoterm-terms-when-post',
879 'labeltext' => esc_html__(
880 'Auto Terms replacement settings',
881 'simple-tags'
882 ),
883 'aftertext' => esc_html__('This option determines what happens when adding new terms to posts.', 'simple-tags'),
884 'selections' => $taxonomy_replace_options,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
885 ]);
886
887
888 /**
889 * Schedule
890 */
891 $default_select = [
892 'options' => [
893 [
894 'attr' => '0',
895 'text' => esc_attr__('False', 'simple-tags'),
896 'default' => 'true',
897 ],
898 [
899 'attr' => '1',
900 'text' => esc_attr__('True', 'simple-tags'),
901 ],
902 ],
903 ];
904
905 $selected = (isset($current) && isset($current['autoterm_for_schedule'])) ? taxopress_disp_boolean($current['autoterm_for_schedule']) : '';
906 $default_select['selected'] = !empty($selected) ? $current['autoterm_for_schedule'] : '';
907 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
908 echo $ui->get_select_checkbox_input([
909 'namearray' => 'taxopress_autoterm',
910 'name' => 'autoterm_for_schedule',
911 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule fields-control',
912 'labeltext' => esc_html__('Schedule', 'simple-tags'),
913 'aftertext' => esc_html__('Enable Auto Terms for the "Schedule" feature.', 'simple-tags'),
914 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
915 'required' => false,
916 ]);
917
918 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
919 echo $ui->get_number_input([
920 'namearray' => 'taxopress_autoterm',
921 'name' => 'schedule_terms_limit',
922 'textvalue' => isset($current['schedule_terms_limit']) ? esc_attr($current['schedule_terms_limit']) : '5',
923 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule',
924 'labeltext' => esc_html__(
925 'Auto Terms Limit',
926 'simple-tags'
927 ),
928 'helptext' => esc_html__('Limit the number of generated Auto Terms. \'0\' for unlimited terms', 'simple-tags'),
929 'min' => '0',
930 'required' => false,
931 ]);
932
933
934 $selected = (isset($current) && isset($current['schedule_autoterm_target'])) ? taxopress_disp_boolean($current['schedule_autoterm_target']) : '';
935 $default_select['selected'] = !empty($selected) ? $current['schedule_autoterm_target'] : '';
936 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
937 echo $ui->get_select_checkbox_input([
938 'namearray' => 'taxopress_autoterm',
939 'name' => 'schedule_autoterm_target',
940 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule',
941 'labeltext' => esc_html__('Target content', 'simple-tags'),
942 'aftertext' => esc_html__('Only use Auto Terms on schedules with no added terms.', 'simple-tags'),
943 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
944 ]);
945
946
947 $selected = (isset($current) && isset($current['schedule_autoterm_word'])) ? taxopress_disp_boolean($current['schedule_autoterm_word']) : '';
948 $default_select['selected'] = !empty($selected) ? $current['schedule_autoterm_word'] : '';
949 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
950 echo $ui->get_select_checkbox_input([
951 'namearray' => 'taxopress_autoterm',
952 'name' => 'schedule_autoterm_word',
953 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule',
954 'labeltext' => esc_html__('Whole words', 'simple-tags'),
955 'aftertext' => esc_html__('Only add terms when the word is an exact match. Do not make matches for partial words.', 'simple-tags'),
956 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
957 ]);
958
959
960 $selected = (isset($current) && isset($current['schedule_autoterm_hash'])) ? taxopress_disp_boolean($current['schedule_autoterm_hash']) : '';
961 $default_select['selected'] = !empty($selected) ? $current['schedule_autoterm_hash'] : '';
962 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
963 echo $ui->get_select_checkbox_input([
964 'namearray' => 'taxopress_autoterm',
965 'name' => 'schedule_autoterm_hash',
966 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule',
967 'labeltext' => esc_html__('Hashtags', 'simple-tags'),
968 'aftertext' => esc_html__('Support hashtags symbols # in Auto Terms.', 'simple-tags'),
969 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
970 ]);
971
972 $taxonomy_replace_options = [
973 'options' => [
974 [
975 'attr' => '0',
976 'text' => esc_attr__('False', 'simple-tags'),
977 'default' => 'true',
978 ],
979 [
980 'attr' => '1',
981 'text' => esc_attr__('True', 'simple-tags'),
982 ],
983 ],
984 ];
985
986 $selected = (isset($current) && isset($current['schedule_replace_type'])) ? taxopress_disp_boolean($current['schedule_replace_type']) : '';
987 $taxonomy_replace_options['selected'] = !empty($selected) ? $current['schedule_replace_type'] : '';
988 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
989 echo $ui->get_radio_input([
990 'namearray' => 'taxopress_autoterm',
991 'name' => 'schedule_replace_type',
992 'class' => 'autoterm_for_schedule autoterm-terms-when-to-field autoterm-terms-when-schedule',
993 'labeltext' => esc_html__(
994 'Auto Terms replacement settings',
995 'simple-tags'
996 ),
997 'aftertext' => esc_html__('This option determines what happens when adding new terms to posts.', 'simple-tags'),
998 'selections' => $taxonomy_replace_options,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
999 ]);
1000
1001 /**
1002 * Existing Content
1003 */
1004 $selected = (isset($current) && isset($current['autoterm_for_existing_content'])) ? taxopress_disp_boolean($current['autoterm_for_existing_content']) : '';
1005 $default_select['selected'] = !empty($selected) ? $current['autoterm_for_existing_content'] : '';
1006 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1007 echo $ui->get_select_checkbox_input([
1008 'namearray' => 'taxopress_autoterm',
1009 'name' => 'autoterm_for_existing_content',
1010 'class' => 'autoterm_for_existing_content autoterm-terms-when-to-field autoterm-terms-when-existing-content fields-control',
1011 'labeltext' => esc_html__('Existing Content', 'simple-tags'),
1012 'aftertext' => esc_html__('Enable Auto Terms for the "Existing Content" feature.', 'simple-tags'),
1013 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1014 'required' => false,
1015 ]);
1016
1017 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1018 echo $ui->get_number_input([
1019 'namearray' => 'taxopress_autoterm',
1020 'name' => 'existing_content_terms_limit',
1021 'textvalue' => isset($current['existing_content_terms_limit']) ? esc_attr($current['existing_content_terms_limit']) : '5',
1022 'class' => 'autoterm_for_existing_content autoterm-terms-when-to-field autoterm-terms-when-existing-content',
1023 'labeltext' => esc_html__(
1024 'Auto Terms Limit',
1025 'simple-tags'
1026 ),
1027 'helptext' => esc_html__('Limit the number of generated Auto Terms. \'0\' for unlimited terms', 'simple-tags'),
1028 'min' => '0',
1029 'required' => false,
1030 ]);
1031
1032 $selected = (isset($current) && isset($current['existing_content_replace_type'])) ? taxopress_disp_boolean($current['existing_content_replace_type']) : '';
1033 $taxonomy_replace_options['selected'] = !empty($selected) ? $current['existing_content_replace_type'] : '';
1034 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1035 echo $ui->get_radio_input([
1036 'namearray' => 'taxopress_autoterm',
1037 'name' => 'existing_content_replace_type',
1038 'class' => 'autoterm_for_existing_content autoterm-terms-when-to-field autoterm-terms-when-existing-content',
1039 'labeltext' => esc_html__(
1040 'Auto Terms replacement settings',
1041 'simple-tags'
1042 ),
1043 'aftertext' => esc_html__('This option determines what happens when adding new terms to posts.', 'simple-tags'),
1044 'selections' => $taxonomy_replace_options,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1045 ]);
1046
1047
1048 /**
1049 * Metaboxes
1050 */
1051 $selected = (isset($current) && isset($current['autoterm_for_metaboxes'])) ? taxopress_disp_boolean($current['autoterm_for_metaboxes']) : '';
1052 $default_select['selected'] = !empty($selected) ? $current['autoterm_for_metaboxes'] : '';
1053 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1054 echo $ui->get_select_checkbox_input([
1055 'namearray' => 'taxopress_autoterm',
1056 'name' => 'autoterm_for_metaboxes',
1057 'class' => 'autoterm_for_metaboxes autoterm-terms-when-to-field autoterm-terms-when-metaboxes fields-control',
1058 'labeltext' => esc_html__('Metaboxes', 'simple-tags'),
1059 'aftertext' => esc_html__('Enable Auto Terms for the "Metaboxes" and the "Fast Update" feature.', 'simple-tags'),
1060 'selections' => $default_select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1061 'required' => false,
1062 ]);
1063 ?>
1064 </table>
1065
1066
1067
1068
1069 <table class="form-table taxopress-table autoterm_terms"
1070 style="<?php echo $active_tab === 'autoterm_terms' ? '' : 'display:none;'; ?>">
1071 <tr valign="top" class="tab-group-tr">
1072 <td colspan="2">
1073 <div class="taxopress-group-wrap autoterm-tab-group source">
1074 <div class="taxopress-button-group">
1075 <label class="existing current">
1076 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_tab][]" value="existing_terms"><?php esc_html_e('Existing Terms', 'simple-tags'); ?></label>
1077 <label class="openai">
1078 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_tab][]" value="open_ai"><?php esc_html_e('OpenAI', 'simple-tags'); ?></label>
1079 <label class="ibm-watson">
1080 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_tab][]" value="ibm_watson"><?php esc_html_e('IBM Watson', 'simple-tags'); ?></label>
1081 <label class="dandelion">
1082 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_tab][]" value="dandelion"><?php esc_html_e('Dandelion', 'simple-tags'); ?></label>
1083 <label class="lseg-refinitiv">
1084 <input disabled type="checkbox" name="taxopress_autoterm[autoterm_source_tab][]" value="lseg_refinitiv"><?php esc_html_e('LSEG / Refinitiv', 'simple-tags'); ?></label>
1085 </div>
1086 </div>
1087 </td>
1088 </tr>
1089 <?php
1090
1091 if ($autoterm_edit) {
1092 $select = [
1093 'options' => [
1094 [
1095 'attr' => '0',
1096 'text' => esc_attr__('False', 'simple-tags'),
1097 'default' => 'true',
1098 ],
1099 [
1100 'attr' => '1',
1101 'text' => esc_attr__('True', 'simple-tags'),
1102 ],
1103 ],
1104 ];
1105 } else {
1106 $select = [
1107 'options' => [
1108 [
1109 'attr' => '0',
1110 'text' => esc_attr__('False', 'simple-tags'),
1111 ],
1112 [
1113 'attr' => '1',
1114 'text' => esc_attr__('True', 'simple-tags'),
1115 'default' => 'true',
1116 ],
1117 ],
1118 ];
1119
1120 }
1121 $selected = (isset($current) && isset($current['autoterm_use_taxonomy'])) ? taxopress_disp_boolean($current['autoterm_use_taxonomy']) : '';
1122 $select['selected'] = !empty($selected) ? $current['autoterm_use_taxonomy'] : '';
1123 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1124 echo $ui->get_select_checkbox_input([
1125 'namearray' => 'taxopress_autoterm',
1126 'name' => 'autoterm_use_taxonomy',
1127 'class' => 'autoterm_use_taxonomy autoterm-terms-to-use-field autoterm-terms-use-existing fields-control',
1128 'labeltext' => esc_html__('Existing taxonomy terms', 'simple-tags'),
1129 'aftertext' => esc_html__('This will add existing terms from the taxonomy selected in the "General" tab.', 'simple-tags'),
1130 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1131 'required' => false,
1132 ]);
1133
1134
1135
1136 if ($autoterm_edit) {
1137 $select = [
1138 'options' => [
1139 [
1140 'attr' => '0',
1141 'text' => esc_attr__('False', 'simple-tags'),
1142 'default' => 'true',
1143 ],
1144 [
1145 'attr' => '1',
1146 'text' => esc_attr__('True', 'simple-tags'),
1147 ],
1148 ],
1149 ];
1150 } else {
1151 $select = [
1152 'options' => [
1153 [
1154 'attr' => '0',
1155 'text' => esc_attr__('False', 'simple-tags'),
1156 ],
1157 [
1158 'attr' => '1',
1159 'text' => esc_attr__('True', 'simple-tags'),
1160 'default' => 'true',
1161 ],
1162 ],
1163 ];
1164
1165 }
1166
1167 $selected = (isset($current) && isset($current['autoterm_useall'])) ? taxopress_disp_boolean($current['autoterm_useall']) : '';
1168 $select['selected'] = !empty($selected) ? $current['autoterm_useall'] : '';
1169 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1170 echo $ui->get_select_checkbox_input([
1171 'namearray' => 'taxopress_autoterm',
1172 'name' => 'autoterm_useall',
1173 'class' => 'autoterm_useall autoterm-terms-to-use-field autoterm-terms-use-existing',
1174 'labeltext' => '',
1175 'aftertext' => esc_html__('Use all the terms in the selected taxonomy.', 'simple-tags'),
1176 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1177 'required' => false,
1178 ]);
1179
1180
1181 $select = [
1182 'options' => [
1183 [
1184 'attr' => '0',
1185 'text' => esc_attr__('False', 'simple-tags'),
1186 'default' => 'true',
1187 ],
1188 [
1189 'attr' => '1',
1190 'text' => esc_attr__('True', 'simple-tags'),
1191 ],
1192 ],
1193 ];
1194 $selected = (isset($current) && isset($current['autoterm_useonly'])) ? taxopress_disp_boolean($current['autoterm_useonly']) : '';
1195 $select['selected'] = !empty($selected) ? $current['autoterm_useonly'] : '';
1196 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1197 echo $ui->get_select_checkbox_input([
1198 'namearray' => 'taxopress_autoterm',
1199 'name' => 'autoterm_useonly',
1200 'class' => 'autoterm_useonly autoterm-terms-to-use-field autoterm-terms-use-existing',
1201 'labeltext' => ' ',
1202 'aftertext' => esc_html__('Use only some terms in the selected taxonomy.', 'simple-tags'),
1203 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1204 ]);
1205
1206 $specific_terms = (isset($current) && isset($current['specific_terms'])) ? taxopress_change_to_array($current['specific_terms']) : '';
1207 echo '<tr class="autoterm_useonly_options '. ($selected === 'false' ? 'st-hide-content' : '') .'" valign="top"><th scope="row"><label for=""></label></th><td>';
1208 echo '<div class="auto-terms-to-use-error" style="display:none;"> '.esc_html__('Please choose an option for "Sources"', 'simple-tags').' </div>';
1209
1210 echo '<div class="st-autoterms-single-specific-term autoterm-terms-use-existing">
1211 <input autocomplete="off" type="text" class="st-full-width specific_terms_input" name="specific_terms_search" maxlength="32" placeholder="'. esc_attr(__('Choose the terms to use.', 'simple-tags')) .'" value="">
1212 </div>';
1213 echo '<ul class="taxopress-term-list-style">';
1214 if (!empty($specific_terms)) {
1215 foreach ($specific_terms as $specific_term) {
1216 if (!empty($specific_term)) {
1217 ?>
1218 <li class="taxopress-term-li">
1219 <span class="display-text"><?php echo esc_html($specific_term); ?></span>
1220 <span class="remove-term-row">
1221 <span class="dashicons dashicons-no-alt"></span>
1222 </span>
1223 <input type="hidden" class="taxopress-terms-names" name="specific_terms[]" value="<?php echo esc_attr($specific_term); ?>">
1224 </li>
1225 <?php
1226 }
1227 }
1228 }
1229 echo '</div>';
1230 echo '</td></tr>';
1231
1232
1233 $select = [
1234 'options' => [
1235 [
1236 'attr' => '0',
1237 'text' => esc_attr__('False', 'simple-tags'),
1238 'default' => 'true',
1239 ],
1240 [
1241 'attr' => '1',
1242 'text' => esc_attr__('True', 'simple-tags'),
1243 ],
1244 ],
1245 ];
1246 $selected = (isset($current) && isset($current['suggest_local_terms_show_post_count'])) ? taxopress_disp_boolean($current['suggest_local_terms_show_post_count']) : '';
1247 $select['selected'] = !empty($selected) ? $current['suggest_local_terms_show_post_count'] : '';
1248 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1249 echo $ui->get_select_checkbox_input([
1250 'namearray' => 'taxopress_autoterm',
1251 'name' => 'suggest_local_terms_show_post_count',
1252 'labeltext' => esc_html__('Show Term Post Count', 'simple-tags'),
1253 'aftertext' => esc_html__('This will show the number of posts attached to the terms.', 'simple-tags'),
1254 'class' => 'autoterm-terms-to-use-field autoterm-terms-use-existing',
1255 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1256 ]);
1257
1258 do_action('taxopress_autoterms_after_autoterm_terms_to_use', $current);
1259
1260 ?>
1261 </table>
1262
1263
1264 <table class="form-table taxopress-table autoterm_options"
1265 style="<?php echo $active_tab === 'autoterm_options' ? '' : 'display:none;'; ?>">
1266 <?php
1267
1268 if (taxopress_is_pro_version() && taxopress_is_synonyms_enabled()) {
1269 $select = [
1270 'options' => [
1271 [
1272 'attr' => '0',
1273 'text' => esc_attr__('False', 'simple-tags'),
1274 ],
1275 [
1276 'attr' => '1',
1277 'text' => esc_attr__('True', 'simple-tags'),
1278 'default' => 'true',
1279 ],
1280 ],
1281 ];
1282 $selected = (isset($current) && isset($current['synonyms_term'])) ? taxopress_disp_boolean($current['synonyms_term']) : '';
1283 $select['selected'] = !empty($selected) ? $current['synonyms_term'] : '';
1284 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1285 echo $ui->get_select_checkbox_input([
1286 'namearray' => 'taxopress_autoterm',
1287 'name' => 'synonyms_term',
1288 'labeltext' => esc_html__(
1289 'Add terms if synonyms found',
1290 'simple-tags'
1291 ),
1292 'aftertext' => esc_html__(
1293 'TaxoPress will add a term to the post if a synonym is found.',
1294 'simple-tags'
1295 ),
1296 'selections' => $select, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1297 ]);
1298 }
1299
1300
1301 $post_status_objects = taxopress_get_post_statuses();
1302 $post_status_options = [];
1303 foreach ($post_status_objects as $status_slug => $status_object) {
1304 if (in_array($status_slug, ['publish', 'future', 'draft', 'pending'])) {
1305 $post_status_options[$status_slug] = $status_object->label;
1306 }
1307 }
1308
1309 echo '<tr valign="top"><th scope="row"><label for="">' . esc_html__('Content statuses', 'simple-tags') . '</label> <span class="required">*</span></th><td>';
1310
1311 echo '<div class="auto-terms-post-status-error" style="display:none;"> '.esc_html__('Please choose an option for "Content statuses"', 'simple-tags').' </div>';
1312
1313 $autoterms_post_status = (!empty($current['post_status'])) ? (array)$current['post_status'] : ['publish'];
1314 foreach ($post_status_options as $key => $value) {
1315 $checked_status = (in_array($key, $autoterms_post_status)) ? 'checked' : '';
1316 echo '<input class="autoterm_post_status_'.esc_attr($key).'" type="checkbox" name="post_status[]" value="'.esc_attr($key).'" '.esc_attr($checked_status).'> ' . esc_html($value) . ' <br /><br />';
1317
1318 }
1319 echo '</td></tr>';
1320
1321 ?>
1322
1323 </table>
1324
1325
1326 <table class="form-table taxopress-table autoterm_exceptions" style="<?php echo $active_tab === 'autoterm_exceptions' ? '' : 'display:none;'; ?>">
1327 <?php
1328 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1329 echo $ui->get_textarea_input([
1330 'namearray' => 'taxopress_autoterm',
1331 'name' => 'autoterm_exclude',
1332 'rows' => '4',
1333 'cols' => '40',
1334 'class' => 'autocomplete-input auto-terms-stopwords',
1335 'textvalue' => isset($current['autoterm_exclude']) ? esc_attr($current['autoterm_exclude']) : '',
1336 'labeltext' => esc_html__(
1337 'Exclude terms from Auto Term',
1338 'simple-tags'
1339 ),
1340 'helptext' => esc_html__(
1341 'Choose terms to be excluded from auto terms.',
1342 'simple-tags'
1343 ),
1344 'required' => false,
1345 ]);
1346
1347 $html_exclusions = [
1348 //headers
1349 'h1' => esc_attr__('H1', 'simple-tags'),
1350 'h2' => esc_attr__('H2', 'simple-tags'),
1351 'h3' => esc_attr__('H3', 'simple-tags'),
1352 'h4' => esc_attr__('H4', 'simple-tags'),
1353 'h5' => esc_attr__('H5', 'simple-tags'),
1354 'h6' => esc_attr__('H6', 'simple-tags'),
1355 //html elements
1356 'a' => esc_attr__('a', 'simple-tags'),
1357 'script' => esc_attr__('script', 'simple-tags'),
1358 'style' => esc_attr__('style', 'simple-tags'),
1359 'pre' => esc_attr__('pre', 'simple-tags'),
1360 'code' => esc_attr__('code', 'simple-tags'),
1361 ];
1362
1363 echo '<tr valign="top"><th scope="row"><label>' . esc_html__(
1364 'Prevent Auto Term inside elements',
1365 'simple-tags'
1366 ) . '</label><br /><small style=" color: #646970;">' . esc_html__(
1367 'Terms inside these HTML tags will not be used to generate terms.',
1368 'simple-tags'
1369 ) . '</small></th><td>
1370 <table class="visbile-table st-html-exclusion-table" style="width: 100%;">';
1371 foreach ($html_exclusions as $key => $value) {
1372
1373 echo '<tr valign="top"><th scope="row"><label for="' . esc_attr($key) . '">' . esc_html($value) . '</label></th><td>';
1374
1375 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1376 echo $ui->get_check_input([
1377 'checkvalue' => $key,
1378 'checked' => (!empty($current['html_exclusion']) && is_array($current['html_exclusion']) && in_array(
1379 $key,
1380 $current['html_exclusion'],
1381 true
1382 )) ? 'true' : 'false',
1383 'name' => esc_attr($key),
1384 'namearray' => 'html_exclusion',
1385 'textvalue' => esc_attr($key),
1386 'labeltext' => esc_html($key),
1387 'labeldescription' => true,
1388 'wrap' => false,
1389 ]);
1390
1391 echo '</td></tr>';
1392
1393 if ($key === 'h6') {
1394 echo '<tr valign="top"><th style="padding: 0;" scope="row"><hr /></th><td style="padding: 0;"><hr /></td></tr>';
1395 }
1396 }
1397
1398 /**
1399 * Fires after the autoterms html_exclusions.
1400 * @param $current array
1401 * @param taxopress_admin_ui $ui Admin UI instance.
1402 */
1403 do_action('taxopress_autoterms_after_html_exclusions', $current, $ui);
1404
1405 echo '</table></td></tr>';
1406
1407 /**
1408 * Fires after the autoterms html_exclusions tr.
1409 * @param $current array
1410 * @param taxopress_admin_ui $ui Admin UI instance.
1411 */
1412 do_action('taxopress_autoterms_after_html_exclusions_tr', $current, $ui);
1413
1414 ?>
1415
1416 </table>
1417
1418
1419 <table class="form-table taxopress-table autoterm_oldcontent"
1420 style="<?php echo $active_tab === 'autoterm_oldcontent' ? '' : 'display:none;'; ?>">
1421
1422 <?php
1423
1424 $select = [
1425 'options' => [
1426 [
1427 'attr' => '0',
1428 'text' => esc_attr__('False', 'simple-tags'),
1429 'default' => 'true',
1430 ],
1431 [
1432 'attr' => '1',
1433 'text' => esc_attr__('True', 'simple-tags'),
1434 ],
1435 ],
1436 ];
1437 $selected = (isset($current) && isset($current['autoterm_existing_content_exclude'])) ? taxopress_disp_boolean($current['autoterm_existing_content_exclude']) : '';
1438 $select['selected'] = !empty($selected) ? $current['autoterm_existing_content_exclude'] : '';
1439 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1440 echo $ui->get_select_checkbox_input([
1441 'namearray' => 'taxopress_autoterm',
1442 'name' => 'autoterm_existing_content_exclude',
1443 'class' => '',
1444 'labeltext' => esc_html__('Exclude previously analyzed content', 'simple-tags'),
1445 'aftertext' => esc_html__('This enables you to skip posts that have already been analyzed by the Existing Content feature.', 'simple-tags'),
1446 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1447 ]);
1448
1449 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1450 echo $ui->get_number_input([
1451 'namearray' => 'taxopress_autoterm',
1452 'name' => 'existing_terms_batches',
1453 'textvalue' => isset($current['existing_terms_batches']) ? esc_attr($current['existing_terms_batches']) : '2',
1454 'labeltext' => esc_html__(
1455 'Limit per batches',
1456 'simple-tags'
1457 ),
1458 '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'),
1459 'min' => '1',
1460 'required' => true,
1461 ]);
1462
1463 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1464 echo $ui->get_number_input([
1465 'namearray' => 'taxopress_autoterm',
1466 'name' => 'existing_terms_sleep',
1467 'textvalue' => isset($current['existing_terms_sleep']) ? esc_attr($current['existing_terms_sleep']) : '10',
1468 'labeltext' => esc_html__('Batches wait time', 'simple-tags'),
1469 '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'),
1470 'min' => '0',
1471 'required' => true,
1472 ]);
1473
1474 $select = [
1475 'options' => [
1476 [
1477 'attr' => '1',
1478 'text' => esc_attr__('24 hours ago', 'simple-tags')
1479 ],
1480 [
1481 'attr' => '7',
1482 'text' => esc_attr__('7 days ago', 'simple-tags')
1483 ],
1484 [
1485 'attr' => '14',
1486 'text' => esc_attr__('2 weeks ago', 'simple-tags')
1487 ],
1488 [
1489 'attr' => '30',
1490 'text' => esc_attr__('1 month ago', 'simple-tags'),
1491 'default' => 'true'
1492 ],
1493 [
1494 'attr' => '180',
1495 'text' => esc_attr__('6 months ago', 'simple-tags')
1496 ],
1497 [
1498 'attr' => '365',
1499 'text' => esc_attr__('1 year ago', 'simple-tags')
1500 ],
1501 [
1502 'attr' => '0',
1503 'text' => esc_attr__('No limit', 'simple-tags')
1504 ],
1505 ],
1506 ];
1507
1508 if (isset($current) && is_array($current)) {
1509 $select = [
1510 'options' => [
1511 [
1512 'attr' => '1',
1513 'text' => esc_attr__('24 hours ago', 'simple-tags')
1514 ],
1515 [
1516 'attr' => '7',
1517 'text' => esc_attr__('7 days ago', 'simple-tags')
1518 ],
1519 [
1520 'attr' => '14',
1521 'text' => esc_attr__('2 weeks ago', 'simple-tags')
1522 ],
1523 [
1524 'attr' => '30',
1525 'text' => esc_attr__('1 month ago', 'simple-tags'),
1526 ],
1527 [
1528 'attr' => '180',
1529 'text' => esc_attr__('6 months ago', 'simple-tags')
1530 ],
1531 [
1532 'attr' => '365',
1533 'text' => esc_attr__('1 year ago', 'simple-tags')
1534 ],
1535 [
1536 'attr' => '0',
1537 'text' => esc_attr__('No limit', 'simple-tags'),
1538 'default' => 'true'
1539 ],
1540 ],
1541 ];
1542 }
1543
1544 $selected = (isset($current) && isset($current['limit_days'])) ? taxopress_disp_boolean($current['limit_days']) : '';
1545 $select['selected'] = !empty($selected) ? $current['limit_days'] : '';
1546 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1547 echo $ui->get_select_number_select([
1548 'namearray' => 'taxopress_autoterm',
1549 'name' => 'limit_days',
1550 'labeltext' => esc_html__(
1551 'Limit Auto Terms, based on published date',
1552 'simple-tags'
1553 ),
1554 'aftertext' => esc_html__('This setting allows you to add Auto Terms only to recent content.', 'simple-tags'),
1555 'selections' => $select,// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
1556 ]);
1557 ?>
1558
1559 <tr valign="top"><th scope="row"><label><?php echo esc_html__('Existing Content', 'simple-tags'); ?></label></th>
1560
1561 <td>
1562 <input type="submit" class="button taxopress-autoterm-all-content" value="<?php echo esc_attr(__('Add Auto Terms to existing content', 'simple-tags')); ?>">
1563 <span class="spinner taxopress-spinner"></span>
1564
1565 <p class="taxopress-field-description description">
1566 <?php echo esc_html__('Click the button to add Auto Terms to existing content.', 'simple-tags'); ?>
1567 </p>
1568
1569 <div class="auto-term-content-result-title"></div>
1570
1571 </div>
1572
1573 <ul class="auto-term-content-result"></ul>
1574 </td></tr>
1575
1576 </table>
1577
1578
1579 <table class="form-table taxopress-table autoterm_advanced"
1580 style="<?php echo $active_tab === 'autoterm_advanced' ? '' : 'display:none;'; ?>">
1581
1582 <?php do_action('taxopress_autoterms_after_autoterm_advanced', $current); ?>
1583
1584 </table>
1585
1586
1587 <table class="form-table taxopress-table autoterm_preview"
1588 style="<?php echo $active_tab === 'autoterm_preview' ? '' : 'display:none;'; ?>">
1589 <tr class="autoterm-description-tr">
1590 <td colspan="2">
1591 <p class="description" style="margin-bottom: 20px;"><?php echo esc_attr__('Save changes to the settings before using this feature.', 'simple-tags'); ?></p>
1592 <div class="taxopress-autoterm-fetch-wrap">
1593 <select class="preview-post-types-select"
1594 style="width: auto;max-width: 33%;display: none;">
1595 <?php foreach (TaxoPressAiUtilities::get_post_types_options() as $post_type => $post_type_object):
1596 if (!in_array($post_type, ['attachment'])) {
1597 if (empty($default_post_type)) {
1598 $default_post_type = $post_type;
1599 $posts = $posts = get_posts(['post_type' => $post_type, 'numberposts' => 1, 'post_status' => 'publish', 'orderby' => 'date', 'order' => 'DESC']);
1600 if (!empty($posts)) {
1601 $post = $posts[0];
1602 }
1603 }
1604 ?>
1605 <option value='<?php echo esc_attr($post_type); ?>'
1606 data-singular_label="<?php echo esc_html($post_type_object->labels->singular_name); ?>">
1607 <?php echo esc_html($post_type_object->labels->name); ?>
1608 </option>
1609 <?php
1610 }
1611 endforeach; ?>
1612 </select>
1613
1614 <select class="preview-post-select taxopress-post-search"
1615 style="max-width: 250px; width: 250px;"
1616 data-placeholder="<?php echo esc_attr__('Select...', 'simple-tags'); ?>"
1617 data-allow-clear="true"
1618 data-nonce="<?php echo esc_attr(wp_create_nonce('taxopress-post-search')); ?>">
1619 <?php if (is_object($post)) : ?>
1620 <option value='<?php echo esc_attr($post->ID); ?>'>
1621 <?php echo esc_html($post->post_title); ?>
1622 </option>
1623 <?php endif; ?>
1624 </select>
1625 <button class="button button-secondary preview-button">
1626 <div class="spinner"></div>
1627 <span class="btn-text"><?php echo esc_attr__('Preview', 'simple-tags'); ?></span>
1628 </button>
1629 </div>
1630
1631 <div class="taxopress-autoterm-result">
1632 <div class="output"></div>
1633 <div class="response"></div>
1634 </div>
1635 </td>
1636 </tr>
1637
1638 </table>
1639
1640
1641 </div>
1642
1643
1644 <?php }//end new fields
1645 ?>
1646
1647
1648 <div class="clear"></div>
1649
1650
1651 </div>
1652 </div>
1653 </div>
1654
1655
1656 <?php if ($autoterm_limit) { ?>
1657
1658 <div class="pp-version-notice-bold-purple" style="margin-left:0px;">
1659 <div class="pp-version-notice-bold-purple-message"><?php echo esc_html__('You\'re using TaxoPress Free.
1660 The Pro version has more features and support.', 'simple-tags'); ?>
1661 </div>
1662 <div class="pp-version-notice-bold-purple-button"><a
1663 href="https://taxopress.com/taxopress/" target="_blank"><?php echo esc_html__('Upgrade to Pro', 'simple-tags'); ?></a>
1664 </div>
1665 </div>
1666
1667 <?php } ?>
1668 <?php
1669 /**
1670 * Fires after the default fieldsets on the taxonomy screen.
1671 *
1672 * @param taxopress_admin_ui $ui Admin UI instance.
1673 */
1674 do_action('taxopress_taxonomy_after_fieldsets', $ui);
1675 ?>
1676
1677 </div>
1678 </div>
1679
1680
1681 </div>
1682
1683 <div class="taxopress-right-sidebar">
1684 <div class="taxopress-right-sidebar-wrapper" style="min-height: 205px;<?php echo ($autoterm_limit) ? 'display: none;' : ''; ?>">
1685
1686
1687 <?php
1688 if (!$autoterm_limit) { ?>
1689 <p class="submit">
1690
1691 <?php
1692 wp_nonce_field('taxopress_addedit_autoterm_nonce_action',
1693 'taxopress_addedit_autoterm_nonce_field');
1694 if (!empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action']) { ?>
1695 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-autoterm-submit"
1696 name="autoterm_submit"
1697 value="<?php echo esc_attr(esc_attr__('Save Auto Terms',
1698 'simple-tags')); ?>"/>
1699 <?php
1700 } else { ?>
1701 <input type="submit" class="button-primary taxopress-taxonomy-submit taxopress-autoterm-submit"
1702 name="autoterm_submit"
1703 value="<?php echo esc_attr(esc_attr__('Add Auto Terms',
1704 'simple-tags')); ?>"/>
1705 <?php } ?>
1706
1707
1708 <input type="hidden" name="cpt_tax_status" id="cpt_tax_status"
1709 value="<?php echo esc_attr($tab); ?>"/>
1710 </p>
1711
1712 <?php
1713 }
1714 ?>
1715
1716 </div>
1717
1718 <?php do_action('taxopress_admin_after_sidebar'); ?>
1719 <div class="taxopress-advertisement-right-sidebar">
1720 <div id="postbox-container-1" class="postbox-container">
1721 <div class="meta-box-sortables">
1722 <div class="advertisement-box-content postbox">
1723 <div class="postbox-header">
1724 <h3 class="advertisement-box-header hndle is-non-sortable">
1725 <span><?php echo esc_html__('TaxoPress and Languages', 'simple-tags'); ?></span>
1726 </h3>
1727 </div>
1728 <div class="inside">
1729 <p><?php echo sprintf(esc_html__('Please note that this is an automatic tool. It does have limitations around languages, types of content, and other factors. %1s Please read this documentation. %2s', 'simple-tags'), '<a href="https://taxopress.com/docs/characters/">', '</a>'); ?>
1730 </p>
1731 </div>
1732 </div>
1733 </div>
1734 </div>
1735 </div>
1736
1737
1738 </div>
1739
1740 <div class="clear"></div>
1741
1742
1743
1744 </form>
1745
1746 </div><!-- End .wrap -->
1747
1748 <div class="clear"></div>
1749
1750 <?php # Modal Windows;?>
1751 <div class="remodal" data-remodal-id="taxopress-modal-alert"
1752 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1753 <div class="" style="color:red;"><?php echo esc_html__('Please complete the following required fields to save your changes:', 'simple-tags'); ?></div>
1754 <div id="taxopress-modal-alert-content"></div>
1755 <br>
1756 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('Okay', 'simple-tags'); ?></button>
1757 </div>
1758
1759 <div class="remodal" data-remodal-id="taxopress-modal-confirm"
1760 data-remodal-options="hashTracking: false, closeOnOutsideClick: false">
1761 <div id="taxopress-modal-confirm-content"></div>
1762 <br>
1763 <button data-remodal-action="cancel" class="remodal-cancel"><?php echo esc_html__('No', 'simple-tags'); ?></button>
1764 <button data-remodal-action="confirm"
1765 class="remodal-confirm"><?php echo esc_html__('Yes', 'simple-tags'); ?></button>
1766 </div>
1767
1768 <?php
1769 }
1770
1771 }
1772