PluginProbe
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms / 3.50.0
Tag, Category, and Taxonomy Manager – Autotagger Automatically Add Terms v3.50.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.50.0, at inc/autoterms.php

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