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

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

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