| 1 |
<?php |
| 2 |
|
| 3 |
// phpcs:disable WordPress.Security.NonceVerification.Recommended -- Legacy TaxoPress file: keep behavior unchanged while documenting existing PHPCS exceptions. |
| 4 |
|
| 5 |
require_once STAGS_DIR . '/modules/taxopress-ai/classes/TaxoPressAiUtilities.php'; |
| 6 |
|
| 7 |
$current_screen = get_current_screen(); |
| 8 |
$is_fast_update = isset($_GET['page']) && $_GET['page'] === 'st_taxopress_ai'; |
| 9 |
|
| 10 |
$taxopress_ai_tabs = []; |
| 11 |
|
| 12 |
$taxopress_posts_terms_label = get_option( |
| 13 |
'taxopress_ai_post_terms_tab_label', |
| 14 |
SimpleTags_Plugin::get_option_value('taxopress_ai_post_terms_tab_label') |
| 15 |
); |
| 16 |
$taxopress_existing_terms_label = get_option( |
| 17 |
'taxopress_ai_existing_terms_tab_label', |
| 18 |
SimpleTags_Plugin::get_option_value('taxopress_ai_existing_terms_tab_label') |
| 19 |
); |
| 20 |
$taxopress_suggest_local_terms_label = get_option( |
| 21 |
'taxopress_ai_suggest_local_terms_tab_label', |
| 22 |
SimpleTags_Plugin::get_option_value('taxopress_ai_suggest_local_terms_tab_label') |
| 23 |
); |
| 24 |
$taxopress_create_terms_label = get_option( |
| 25 |
'taxopress_ai_create_terms_tab_label', |
| 26 |
SimpleTags_Plugin::get_option_value('taxopress_ai_create_terms_tab_label') |
| 27 |
); |
| 28 |
|
| 29 |
if (empty($taxopress_existing_terms_label)) { |
| 30 |
$taxopress_existing_terms_label = esc_html__('Show All Existing Terms', 'simple-tags'); |
| 31 |
} |
| 32 |
if (empty($taxopress_posts_terms_label)) { |
| 33 |
$taxopress_posts_terms_label = esc_html__('Manage Post Terms', 'simple-tags'); |
| 34 |
} |
| 35 |
if (empty($taxopress_suggest_local_terms_label)) { |
| 36 |
$taxopress_suggest_local_terms_label = esc_html__('Auto Terms', 'simple-tags'); |
| 37 |
} |
| 38 |
if (empty($taxopress_create_terms_label)) { |
| 39 |
$taxopress_create_terms_label = esc_html__('Create Terms', 'simple-tags'); |
| 40 |
} |
| 41 |
|
| 42 |
$taxopress_ai_tabs['existing_terms'] = $taxopress_existing_terms_label; |
| 43 |
$taxopress_ai_tabs['post_terms'] = $taxopress_posts_terms_label; |
| 44 |
$taxopress_ai_tabs['suggest_local_terms'] = $taxopress_suggest_local_terms_label; |
| 45 |
$taxopress_ai_tabs['create_terms'] = $taxopress_create_terms_label; |
| 46 |
|
| 47 |
$taxopress_ai_fields = []; |
| 48 |
$pt_index = 0; |
| 49 |
foreach (TaxoPressAiUtilities::get_post_types_options() as $post_type => $post_type_object) { |
| 50 |
$hidden_field = ($pt_index === 0) ? '' : 'st-hide-content'; |
| 51 |
|
| 52 |
$default_taxonomy_options = []; |
| 53 |
foreach (get_object_taxonomies($post_type, 'objects') as $tax_key => $tax_object) { |
| 54 |
if (!in_array($tax_key, ['post_format']) && (!empty($tax_object->show_ui) || !empty(SimpleTags_Plugin::get_option_value('taxopress_ai_' . $post_type . '_support_private_taxonomy')))) { |
| 55 |
$default_taxonomy_options[$tax_key] = $tax_object->labels->name . ' (' . $tax_object->name . ')'; |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
if (empty($default_taxonomy_options)) { |
| 60 |
// This feature only matter if a post has taxonomy |
| 61 |
$taxopress_ai_fields[] = array( |
| 62 |
'enable_taxopress_ai_' . $post_type . '_text', |
| 63 |
'', |
| 64 |
'helper', |
| 65 |
'1', |
| 66 |
esc_html__('This post type has no taxonomies.', 'simple-tags'), |
| 67 |
'taxopress-ai-tab-content taxopress-ai-' . $post_type . '-content ' . $hidden_field . '' |
| 68 |
); |
| 69 |
} else { |
| 70 |
$taxopress_ai_fields[] = array( |
| 71 |
'enable_taxopress_ai_' . $post_type . '_metabox', |
| 72 |
sprintf(esc_html__('%1s Metabox', 'simple-tags'), esc_html($post_type_object->labels->name)), |
| 73 |
'checkbox', |
| 74 |
'1', |
| 75 |
sprintf(esc_html__('Enable the metabox on the %1s screen.', 'simple-tags'), esc_html($post_type_object->labels->name)), |
| 76 |
'taxopress-ai-tab-content taxopress-ai-' . $post_type . '-content ' . $hidden_field . '' |
| 77 |
); |
| 78 |
|
| 79 |
// add feature tab |
| 80 |
$tab_field_options = []; |
| 81 |
foreach ($taxopress_ai_tabs as $taxopress_ai_tab => $taxopress_ai_tab_label) { |
| 82 |
$tab_field_options['enable_taxopress_ai_' . $post_type . '_' . $taxopress_ai_tab . '_tab'] = [ |
| 83 |
'label' => $taxopress_ai_tab_label |
| 84 |
]; |
| 85 |
} |
| 86 |
$taxopress_ai_fields[] = array( |
| 87 |
'enable_taxopress_ai_' . $post_type . '_tab', |
| 88 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_field st-subhide-content">' . esc_html__('Metabox Features', 'simple-tags') . '</div>', |
| 89 |
'sub_multiple_checkbox', |
| 90 |
$tab_field_options, |
| 91 |
'', |
| 92 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_field st-subhide-content' |
| 93 |
); |
| 94 |
|
| 95 |
$taxopress_ai_fields[] = array( |
| 96 |
'taxopress_ai_' . $post_type . '_support_private_taxonomy', |
| 97 |
sprintf(esc_html__('Show Private Taxonomies', 'simple-tags')), |
| 98 |
'checkbox', |
| 99 |
'1', |
| 100 |
sprintf(esc_html__('Add support for private taxonomies.', 'simple-tags')), |
| 101 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_post_terms_tab_field st-subhide-content' |
| 102 |
); |
| 103 |
|
| 104 |
// add taxonomy |
| 105 |
$taxopress_ai_fields[] = array( |
| 106 |
'taxopress_ai_' . $post_type . '_metabox_default_taxonomy', |
| 107 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_post_terms_tab_field st-subhide-content">' . esc_html__('Default Taxonomy', 'simple-tags') . '</div>', |
| 108 |
'select', |
| 109 |
$default_taxonomy_options, |
| 110 |
'', |
| 111 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_post_terms_tab_field st-subhide-content' |
| 112 |
); |
| 113 |
|
| 114 |
$taxopress_ai_fields[] = array( |
| 115 |
'taxopress_ai_' . $post_type . '_metabox_filters', |
| 116 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content">' . sprintf(esc_html__('%1s Metabox Filters', 'simple-tags'), esc_html($post_type_object->labels->name)) . '</div>', |
| 117 |
'checkbox', |
| 118 |
'1', |
| 119 |
sprintf(esc_html__('Enable filters in the %1s existing terms tab.', 'simple-tags'), esc_html($post_type_object->labels->name)), |
| 120 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content' |
| 121 |
); |
| 122 |
|
| 123 |
// add _metabox_orderby |
| 124 |
$taxopress_ai_fields[] = array( |
| 125 |
'taxopress_ai_' . $post_type . '_metabox_orderby', |
| 126 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content">' . esc_html__('Default Method for choosing terms', 'simple-tags') . '</div>', |
| 127 |
'select', |
| 128 |
TaxoPressAiUtilities::get_existing_terms_orderby(), |
| 129 |
'', |
| 130 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content' |
| 131 |
); |
| 132 |
|
| 133 |
// add _metabox_order |
| 134 |
$taxopress_ai_fields[] = array( |
| 135 |
'taxopress_ai_' . $post_type . '_metabox_order', |
| 136 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content">' . esc_html__('Default Ordering for choosing terms', 'simple-tags') . '</div>', |
| 137 |
'select', |
| 138 |
TaxoPressAiUtilities::get_existing_terms_order(), |
| 139 |
'', |
| 140 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content' |
| 141 |
); |
| 142 |
|
| 143 |
// add _metabox_maximum_terms |
| 144 |
$taxopress_ai_fields[] = array( |
| 145 |
'taxopress_ai_' . $post_type . '_metabox_maximum_terms', |
| 146 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content">' . esc_html__('Default maximum terms', 'simple-tags') . '</div>', |
| 147 |
'number', |
| 148 |
'', |
| 149 |
'', |
| 150 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_metabox_filters_field st-subhide-content', |
| 151 |
0 |
| 152 |
); |
| 153 |
|
| 154 |
// add _metabox_show_post_count |
| 155 |
$taxopress_ai_fields[] = array( |
| 156 |
'taxopress_ai_' . $post_type . '_metabox_show_post_count', |
| 157 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content">' . esc_html__('Metabox Show Term Post Count', 'simple-tags') . '</div>', |
| 158 |
'checkbox', |
| 159 |
'1', |
| 160 |
'', |
| 161 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content' |
| 162 |
); |
| 163 |
|
| 164 |
// add _metabox_show_term_slug |
| 165 |
$taxopress_ai_fields[] = array( |
| 166 |
'taxopress_ai_' . $post_type . '_metabox_show_term_slug', |
| 167 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content">' . esc_html__('Show Term Slug', 'simple-tags') . '</div>', |
| 168 |
'checkbox', |
| 169 |
'1', |
| 170 |
'', |
| 171 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_existing_terms_tab_field st-subhide-content' |
| 172 |
); |
| 173 |
|
| 174 |
//add minimum term length |
| 175 |
$taxopress_ai_fields[] = array( |
| 176 |
'taxopress_ai_' . $post_type . '_minimum_term_length', |
| 177 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content">' . esc_html__('Minimum term length', 'simple-tags') . '</div>', |
| 178 |
'number', |
| 179 |
'', |
| 180 |
'<p>' . esc_html__('Specify the minimum length for new terms when creating terms.', 'simple-tags') . '</p>', |
| 181 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content', |
| 182 |
1 |
| 183 |
); |
| 184 |
|
| 185 |
//add maximum term length |
| 186 |
$taxopress_ai_fields[] = array( |
| 187 |
'taxopress_ai_' . $post_type . '_maximum_term_length', |
| 188 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content">' . esc_html__('Maximum term length', 'simple-tags') . '</div>', |
| 189 |
'number', |
| 190 |
'', |
| 191 |
'<p>' . esc_html__('Specify the maximum length for new terms when creating terms.', 'simple-tags') . '</p>', |
| 192 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content', |
| 193 |
1 |
| 194 |
); |
| 195 |
|
| 196 |
$taxopress_ai_fields[] = array( |
| 197 |
'taxopress_ai_' . $post_type . '_exclusions', |
| 198 |
'<div class="taxopress-ai-tab-content-sub taxopress-settings-subtab-title taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content">' . esc_html__('Prohibited Characters', 'simple-tags') . '</div>', |
| 199 |
'textarea', |
| 200 |
'', |
| 201 |
'', |
| 202 |
'taxopress-ai-tab-content-sub taxopress-ai-' . $post_type . '-content-sub enable_taxopress_ai_' . $post_type . '_create_terms_tab_field st-subhide-content', |
| 203 |
'', |
| 204 |
array( |
| 205 |
'rows' => 6, |
| 206 |
'placeholder' => esc_attr__('Enter characters that will be blocked when users add new terms inside the "Create Terms" box. For example: !@#$%&*()', 'simple-tags'), |
| 207 |
'width' => '80%' |
| 208 |
) |
| 209 |
); |
| 210 |
// allow to taxopress ai field for each post type |
| 211 |
$taxopress_ai_fields = apply_filters('taxopress_settings_post_type_ai_fields', $taxopress_ai_fields, $post_type); |
| 212 |
} |
| 213 |
$pt_index++; |
| 214 |
} |
| 215 |
|
| 216 |
$all_taxonomies = get_taxonomies([], 'objects'); |
| 217 |
$all_taxonomy_options = []; |
| 218 |
foreach ($all_taxonomies as $tax) { |
| 219 |
if (in_array($tax->name, ['author', 'post_format', 'nav_menu', 'link_category', 'wp_theme', 'wp_template_part_area', 'wp_pattern_category'])) { |
| 220 |
continue; |
| 221 |
} |
| 222 |
$all_taxonomy_options[$tax->name] = $tax->label; |
| 223 |
} |
| 224 |
|
| 225 |
$metabox_taxonomy_options = []; |
| 226 |
foreach ($all_taxonomies as $tax) { |
| 227 |
if (!empty($tax->public) && !empty($tax->show_ui)) { |
| 228 |
$metabox_taxonomy_options[$tax->name] = $tax->label; |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
|
| 233 |
//metabox |
| 234 |
$metabox_fields = []; |
| 235 |
$pt_index = 0; |
| 236 |
foreach (taxopress_get_all_wp_roles() as $role_name => $role_info) { |
| 237 |
$hidden_field = ($pt_index === 0) ? '' : 'st-hide-content'; |
| 238 |
// add option to enable/disable access |
| 239 |
$metabox_fields[] = array( |
| 240 |
'enable_' . $role_name . '_metabox', |
| 241 |
esc_html__('Metabox Access', 'simple-tags'), |
| 242 |
'checkbox', |
| 243 |
'1', |
| 244 |
sprintf(esc_html__('Allow users in the %1s role to use the TaxoPress metabox.', 'simple-tags'), esc_html(translate_user_role($role_info['name']))), |
| 245 |
'metabox-tab-content metabox-' . $role_name . '-content ' . $hidden_field . '' |
| 246 |
); |
| 247 |
// add option to manage terms per user role |
| 248 |
$metabox_fields[] = array( |
| 249 |
'enable_restrict' . $role_name . '_metabox', |
| 250 |
esc_html__('Block Users from Creating New Terms', 'simple-tags'), |
| 251 |
'checkbox', |
| 252 |
'1', |
| 253 |
sprintf(esc_html__('Prevent users in the %1$s role from creating new terms in the TaxoPress metabox.', 'simple-tags'), esc_html(translate_user_role($role_info['name']))), |
| 254 |
'metabox-tab-content metabox-' . $role_name . '-content ' . $hidden_field . '' |
| 255 |
); |
| 256 |
// add metabox allowed taxonomies |
| 257 |
$metabox_fields[] = array( |
| 258 |
'enable_metabox_' . $role_name . '', |
| 259 |
'<div class="metabox-tab-content taxopress-settings-subtab-title metabox-' . $role_name . '-content enable_' . $role_name . '_metabox_field ' . $hidden_field . '">' . esc_html__('Taxonomies in Metabox', 'simple-tags') . '</div>', |
| 260 |
'multiselect_with_desc_top', |
| 261 |
$metabox_taxonomy_options, |
| 262 |
'<p class="metabox-tab-content taxopress-settings-description metabox-' . $role_name . '-content enable_' . $role_name . '_metabox_field description ' . $hidden_field . '">' . sprintf(esc_html__('Select the taxonomies that users in %1s role can manage in the TaxoPress metabox.', 'simple-tags'), esc_html(translate_user_role($role_info['name']))) . '</p>', |
| 263 |
'metabox-tab-content metabox-' . $role_name . '-content enable_' . $role_name . '_metabox_field ' . $hidden_field . '' |
| 264 |
); |
| 265 |
// add core removed taxonomies |
| 266 |
$metabox_fields[] = array( |
| 267 |
'remove_taxonomy_metabox_' . $role_name . '', |
| 268 |
'<div class="metabox-tab-content taxopress-settings-subtab-title metabox-' . $role_name . '-content ' . $hidden_field . '">' . esc_html__('Remove Default Metaboxes', 'simple-tags') . '</div>', |
| 269 |
'multiselect_with_desc_top', |
| 270 |
$all_taxonomy_options, |
| 271 |
'<p class="metabox-tab-content taxopress-settings-description metabox-' . $role_name . '-content description ' . $hidden_field . '">' . sprintf(esc_html__('Remove default taxonomy metaboxes for users in the %1s role.', 'simple-tags'), esc_html(translate_user_role($role_info['name']))) . '</p>', |
| 272 |
'metabox-tab-content metabox-' . $role_name . '-content ' . $hidden_field . '' |
| 273 |
); |
| 274 |
|
| 275 |
$pt_index++; |
| 276 |
} |
| 277 |
|
| 278 |
$options = array( |
| 279 |
// post tab |
| 280 |
'posts' => array( |
| 281 |
array( |
| 282 |
'post_tab_description', |
| 283 |
'', |
| 284 |
'helper', |
| 285 |
'', |
| 286 |
__('These settings control features on the Posts screen.', 'simple-tags'), |
| 287 |
'' |
| 288 |
), |
| 289 |
array( |
| 290 |
'post_terms_filter_format', |
| 291 |
__('Terms Filter display:', 'simple-tags'), |
| 292 |
'radio', |
| 293 |
array( |
| 294 |
'term_name' => __('Term Name', 'simple-tags'), |
| 295 |
'term_name_taxonomy_name' => __('Term Name + Taxonomy Name', 'simple-tags'), |
| 296 |
'term_name_taxonomy_slug' => __('Term Name + Taxonomy Slug', 'simple-tags'), |
| 297 |
), |
| 298 |
__('This controls the details that appear in the "Terms Filter" display and can help if you have terms with similar names.', 'simple-tags'), |
| 299 |
'' |
| 300 |
), |
| 301 |
array( |
| 302 |
'post_terms_taxonomy_type', |
| 303 |
__('Terms Filter taxonomy:', 'simple-tags'), |
| 304 |
'radio', |
| 305 |
array( |
| 306 |
'public' => __('Public Taxonomies', 'simple-tags'), |
| 307 |
'private' => __('Private Taxonomies', 'simple-tags'), |
| 308 |
'term_and_private' => __('Public Taxonomies and Private Taxonomies', 'simple-tags'), |
| 309 |
), |
| 310 |
__('This controls the taxonomy terms that appear on the "Posts" screen.', 'simple-tags'), |
| 311 |
'' |
| 312 |
), |
| 313 |
), |
| 314 |
|
| 315 |
|
| 316 |
// linked terms tab |
| 317 |
'linked_terms' => array( |
| 318 |
array( |
| 319 |
'linked_terms_description', |
| 320 |
'', |
| 321 |
'helper', |
| 322 |
'', |
| 323 |
__('This feature allows you to connect terms. When the primary or secondary term is added to a post, the other term can be added also.', 'simple-tags'), |
| 324 |
'' |
| 325 |
), |
| 326 |
array( |
| 327 |
'linked_terms_type', |
| 328 |
__('Linked Terms Type:', 'simple-tags'), |
| 329 |
'radio', |
| 330 |
array( |
| 331 |
'main' => __('2-way relationship. When the main term or secondary term are added to the post, other term will be added also.', 'simple-tags'), |
| 332 |
'primary' => __('Add the primary term, get the secondary term', 'simple-tags'), |
| 333 |
'secondary' => __('Add the secondary term, get the primary term.', 'simple-tags'), |
| 334 |
), |
| 335 |
'', |
| 336 |
'' |
| 337 |
), |
| 338 |
array( |
| 339 |
'linked_terms_taxonomies', |
| 340 |
__('Enable Taxonomies:', 'simple-tags'), |
| 341 |
'multiselect', |
| 342 |
$all_taxonomy_options, |
| 343 |
__('This controls which taxonomies are available for the Linked Terms feature.', 'simple-tags'), |
| 344 |
'' |
| 345 |
) |
| 346 |
), |
| 347 |
|
| 348 |
// term synonyms tab |
| 349 |
'synonyms' => array( |
| 350 |
array( |
| 351 |
'synonyms_description', |
| 352 |
'', |
| 353 |
'helper', |
| 354 |
'', |
| 355 |
__('This feature allows you to have multiple words associated with a single term. If TaxoPress scans your content and finds a synonym, it will act as if it has found the main term.', 'simple-tags'), |
| 356 |
'' |
| 357 |
), |
| 358 |
array( |
| 359 |
'synonyms_taxonomies', |
| 360 |
__('Enable Taxonomies:', 'simple-tags'), |
| 361 |
'multiselect', |
| 362 |
$all_taxonomy_options, |
| 363 |
__('This controls which taxonomies are available for the Term Synonyms feature.', 'simple-tags'), |
| 364 |
'' |
| 365 |
) |
| 366 |
), |
| 367 |
|
| 368 |
// hidden terms tab |
| 369 |
'hidden_terms' => array( |
| 370 |
array( |
| 371 |
'enable_hidden_terms', |
| 372 |
__('Enable Hidden Terms:', 'simple-tags'), |
| 373 |
'checkbox', |
| 374 |
'1', |
| 375 |
__('This feature will hide terms that are infrequently used. These terms will be visible inside the WordPress admin area, but not on the front of this site.', 'simple-tags'), |
| 376 |
'' |
| 377 |
), |
| 378 |
array( |
| 379 |
'hide-rarely', |
| 380 |
__('Minimum Usage for Hidden Terms:', 'simple-tags'), |
| 381 |
'number', |
| 382 |
'1', |
| 383 |
__('Set the minimum number of posts a term must be attached to. If you enter 5, any term used in fewer than 5 posts will be hidden across the site, and its archive page will redirect to the homepage.', 'simple-tags'), |
| 384 |
'', |
| 385 |
1 |
| 386 |
) |
| 387 |
), |
| 388 |
|
| 389 |
// frontend scripts tab |
| 390 |
'frontend_scripts' => array( |
| 391 |
array( |
| 392 |
'frontend_scripts_description', |
| 393 |
'', |
| 394 |
'helper', |
| 395 |
'', |
| 396 |
__('TaxoPress loads CSS and JavaScript files on the frontend for features like Terms Display, Related Posts, and Terms for Current Post. If you disable these scripts, those features may not display correctly.', 'simple-tags'), |
| 397 |
'' |
| 398 |
), |
| 399 |
array( |
| 400 |
'disable_frontend_scripts', |
| 401 |
__('Disable Frontend Scripts:', 'simple-tags'), |
| 402 |
'checkbox', |
| 403 |
'1', |
| 404 |
__('Check this to prevent TaxoPress from loading CSS and JavaScript files on the frontend of your site.', 'simple-tags'), |
| 405 |
'' |
| 406 |
), |
| 407 |
array( |
| 408 |
'disable_admin_frontend_scripts', |
| 409 |
__('Disable Admin Preview Scripts:', 'simple-tags'), |
| 410 |
'checkbox', |
| 411 |
'1', |
| 412 |
__('Check this to prevent TaxoPress from loading frontend CSS and JavaScript files in the WordPress admin area. This will break the preview functionality when editing Terms Display, Related Posts, and Terms for Current Post.', 'simple-tags'), |
| 413 |
'' |
| 414 |
) |
| 415 |
), |
| 416 |
|
| 417 |
'core_linked_terms' => array( |
| 418 |
array( |
| 419 |
'linked_terms_pro_notice', |
| 420 |
'', |
| 421 |
'core_terms_promo', |
| 422 |
'', |
| 423 |
apply_filters('taxopress_settings_linked_terms_pro_notice', ''), |
| 424 |
'' |
| 425 |
) |
| 426 |
), |
| 427 |
|
| 428 |
'core_synonyms_terms' => array( |
| 429 |
array( |
| 430 |
'synonyms_terms_pro_notice', |
| 431 |
'', |
| 432 |
'core_terms_promo', |
| 433 |
'', |
| 434 |
apply_filters('taxopress_settings_synonyms_terms_pro_notice', ''), |
| 435 |
'' |
| 436 |
) |
| 437 |
), |
| 438 |
|
| 439 |
// Manage terms tab |
| 440 |
'manage_terms' => array( |
| 441 |
array( |
| 442 |
'manage_terms_description', |
| 443 |
'', |
| 444 |
'helper', |
| 445 |
'', |
| 446 |
__('These settings control features on the Manage Terms screen.', 'simple-tags'), |
| 447 |
'' |
| 448 |
), |
| 449 |
array( |
| 450 |
'enable_add_terms_slug', |
| 451 |
__('Add Terms:', 'simple-tags'), |
| 452 |
'checkbox', |
| 453 |
'1', |
| 454 |
__('Enabling this will allow users to see the slug while adding terms', 'simple-tags'), |
| 455 |
'' |
| 456 |
), |
| 457 |
array( |
| 458 |
'enable_remove_terms_slug', |
| 459 |
__('Remove Terms:', 'simple-tags'), |
| 460 |
'checkbox', |
| 461 |
'1', |
| 462 |
__('Enabling this will allow users to see the slug while removing terms', 'simple-tags'), |
| 463 |
'' |
| 464 |
), |
| 465 |
array( |
| 466 |
'enable_rename_terms_slug', |
| 467 |
__('Rename Terms:', 'simple-tags'), |
| 468 |
'checkbox', |
| 469 |
'1', |
| 470 |
__('Enabling this will allow users to see the slug while Renaming terms', 'simple-tags'), |
| 471 |
'' |
| 472 |
), |
| 473 |
array( |
| 474 |
'enable_merge_terms_slug', |
| 475 |
__('Merge Terms:', 'simple-tags'), |
| 476 |
'checkbox', |
| 477 |
'1', |
| 478 |
__('Enabling this will allow users to see the slug while merging terms', 'simple-tags'), |
| 479 |
'' |
| 480 |
), |
| 481 |
), |
| 482 |
|
| 483 |
'mass_edit_terms' => array( |
| 484 |
array( |
| 485 |
'enable_mass-edit_terms_slug', |
| 486 |
__('Mass Edit Terms:', 'simple-tags'), |
| 487 |
'checkbox', |
| 488 |
'1', |
| 489 |
__('Enabling this will allow users to see the slug in the Mass Edit Terms screen', 'simple-tags'), |
| 490 |
'' |
| 491 |
), |
| 492 |
) |
| 493 |
|
| 494 |
); |
| 495 |
|
| 496 |
if ($is_fast_update) { |
| 497 |
$options['taxopress-ai'] = $taxopress_ai_fields; |
| 498 |
$options['metabox'] = $metabox_fields; |
| 499 |
} |
| 500 |
|
| 501 |
return apply_filters('taxopress_admin_options', $options); |
| 502 |
|