PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 8.2.2
Admin and Site Enhancements (ASE) v8.2.2
9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 8.3.2 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0 8.6.1 8.6.2 8.7.0 5.0.1 5.0.2 5.0.2.1 5.0.2.2 5.0.2.3 5.0.2.4 5.1.0 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.8.0 5.8.1 6.0.0 6.0.3 6.0.4 6.0.5 6.0.5.1 6.0.6 6.0.7 6.0.8.1 6.1.0 6.1.3 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.3.0 6.3.1 6.3.2 6.4.0 6.5.0 6.5.1 6.6.0 6.7.0 6.8.0 6.8.2 6.8.3 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13.1 6.9.13.2 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.2 7.0.2.1 7.0.2.2 7.0.2.3 7.0.3 7.1.0 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2.0 7.2.1 7.3.0 7.3.1 7.3.2 7.3.3 7.4.0 7.4.2 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.6.0 7.6.1 7.6.1.1 7.6.10 7.6.11 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.7.1 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / classes / class-settings-sections-fields.php
admin-site-enhancements / classes Last commit date
class-activation.php 7 months ago class-admin-menu-organizer.php 7 months ago class-admin-menu-svg-icon-mask.php 7 months ago class-auto-publish-posts-with-missed-schedule.php 7 months ago class-avif-upload.php 7 months ago class-captcha-protection.php 7 months ago class-change-login-url.php 7 months ago class-cleanup-admin-bar.php 7 months ago class-common-methods.php 7 months ago class-content-duplication.php 7 months ago class-content-order.php 7 months ago class-custom-admin-footer-text.php 7 months ago class-custom-body-class.php 7 months ago class-custom-css.php 7 months ago class-custom-nav-menu-items-in-new-tab.php 7 months ago class-deactivation.php 7 months ago class-disable-author-archives.php 7 months ago class-disable-comments.php 7 months ago class-disable-dashboard-widgets.php 7 months ago class-disable-embeds.php 7 months ago class-disable-feeds.php 7 months ago class-disable-gutenberg.php 7 months ago class-disable-rest-api.php 7 months ago class-disable-smaller-components.php 7 months ago class-disable-updates.php 7 months ago class-disable-xml-rpc.php 7 months ago class-display-system-summary.php 7 months ago class-email-address-obfuscator.php 7 months ago class-email-delivery.php 7 months ago class-enhance-list-tables.php 7 months ago class-external-permalinks.php 7 months ago class-heartbeat-control.php 7 months ago class-hide-admin-bar.php 7 months ago class-hide-admin-notices.php 7 months ago class-image-sizes-panel.php 7 months ago class-image-upload-control.php 7 months ago class-insert-head-body-footer-code.php 7 months ago class-last-login-column.php 7 months ago class-limit-login-attempts.php 7 months ago class-login-id-type.php 7 months ago class-login-logout-menu.php 7 months ago class-maintenance-mode.php 7 months ago class-manage-ads-appads-txt.php 7 months ago class-manage-robots-txt.php 7 months ago class-media-replacement.php 7 months ago class-multiple-user-roles.php 7 months ago class-obfuscate-author-slugs.php 7 months ago class-open-external-links-in-new-tab.php 7 months ago class-password-protection.php 7 months ago class-redirect-after-login.php 7 months ago class-redirect-after-logout.php 7 months ago class-redirect-fourofour.php 7 months ago class-registration-date-column.php 7 months ago class-revisions-control.php 7 months ago class-search-engines-visibility.php 7 months ago class-settings-fields-render.php 7 months ago class-settings-sanitization.php 7 months ago class-settings-sections-fields.php 7 months ago class-show-custom-taxonomy-filters.php 7 months ago class-site-identity-on-login-page.php 7 months ago class-svg-upload.php 7 months ago class-various-admin-ui-enhancements.php 7 months ago class-view-admin-as-role.php 7 months ago class-wider-admin-menu.php 7 months ago class-wp-config-transformer.php 7 months ago
class-settings-sections-fields.php
3597 lines
1 <?php
2
3 namespace ASENHA\Classes;
4
5 /**
6 * Class related to registration of settings fields
7 *
8 * @since 2.2.0
9 */
10 class Settings_Sections_Fields {
11 /**
12 * Register plugin settings and the corresponding fields
13 *
14 * @link https://wpshout.com/making-an-admin-options-page-with-the-wordpress-settings-api/
15 * @link https://rudrastyh.com/wordpress/creating-options-pages.html
16 * @since 1.0.0
17 */
18 function register_sections_fields() {
19 add_settings_section(
20 'main-section',
21 '',
22 // Section title. Can be blank.
23 '',
24 // Callback function to output section intro. Can be blank.
25 ASENHA_SLUG
26 );
27 $common_methods = new Common_Methods();
28 $wp_config = new WP_Config_Transformer();
29 // Register main setttings
30 // Instantiate object for sanitization of settings fields values
31 $sanitization = new Settings_Sanitization();
32 // Instantiate object for rendering of settings fields for the admin page
33 $render_field = new Settings_Fields_Render();
34 register_setting(
35 ASENHA_ID,
36 // Option group or option_page
37 ASENHA_SLUG_U,
38 array(
39 'type' => 'array',
40 'description' => '',
41 'sanitize_callback' => [$sanitization, 'sanitize_for_options'],
42 'show_in_rest' => false,
43 'default' => array(),
44 )
45 );
46 // =================================================================
47 // Call WordPress globals and set new globals required for the fields
48 // =================================================================
49 global
50 $wp_version,
51 $wp_roles,
52 $wpdb,
53 $asenha_all_post_types,
54 $asenha_public_post_types,
55 $asenha_nonpublic_post_types,
56 $asenha_gutenberg_post_types,
57 $asenha_revisions_post_types,
58 $active_plugin_slugs,
59 $workable_nodes
60 ;
61 $options = get_option( ASENHA_SLUG_U, array() );
62 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
63 $roles = $wp_roles->get_names();
64 // Get array of slugs and plural labels for all post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
65 $asenha_all_post_types = array();
66 $all_post_type_names = get_post_types( array(), 'names' );
67 foreach ( $all_post_type_names as $post_type_name ) {
68 $post_type_object = get_post_type_object( $post_type_name );
69 $asenha_all_post_types[$post_type_name] = $post_type_object->label;
70 }
71 asort( $asenha_all_post_types );
72 // sort by value, ascending
73 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
74 $asenha_public_post_types = array();
75 $asenha_public_post_types = $common_methods->get_public_post_type_slugs();
76 // Get array of slugs and plural labels for non-public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
77 $asenha_nonpublic_post_types = array();
78 $nonpublic_post_type_names = get_post_types( array(
79 'public' => false,
80 ), 'names' );
81 foreach ( $nonpublic_post_type_names as $post_type_name ) {
82 $post_type_object = get_post_type_object( $post_type_name );
83 $asenha_nonpublic_post_types[$post_type_name] = $post_type_object->label;
84 }
85 asort( $asenha_nonpublic_post_types );
86 // sort by value, ascending
87 // Get array of slugs and plural labels for post types that can be edited with the Gutenberg block editor, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
88 $asenha_gutenberg_post_types = array();
89 $gutenberg_not_applicable_types = array(
90 'attachment',
91 'revision',
92 'nav_menu_item',
93 'custom_css',
94 'customize_changeset',
95 'oembed_cache',
96 'user_request',
97 'wp_block',
98 'wp_template',
99 'wp_template_part',
100 'wp_global_styles',
101 'wp_navigation',
102 'wp_font_family',
103 'wp_font_face',
104 // ACF
105 'acf-post-type',
106 'acf-taxonomy',
107 'acf-field-group',
108 'acf-ui-options-page',
109 // Elementor
110 'e-landing-page',
111 'elementor_library',
112 'elementor_snippet',
113 'elementor_font',
114 'elementor_icons',
115 // Oxygen Classic
116 'ct_template',
117 'scheduled-action',
118 // Breakdance
119 'breakdance_template',
120 'breakdance_header',
121 'breakdance_footer',
122 'breakdance_popup',
123 'breakdance_block',
124 'breakdance_acf_block',
125 'breakdance_form_res',
126 // Bricks
127 'bricks_template',
128 'bricks_fonts',
129 );
130 $rest_api_enabled_post_type_names = get_post_types( array(
131 'show_in_rest' => true,
132 ), 'objects' );
133 foreach ( $rest_api_enabled_post_type_names as $post_type_slug => $post_type_info ) {
134 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
135 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
136 unset($asenha_gutenberg_post_types[$post_type_slug]);
137 }
138 }
139 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
140 $asenha_revisions_post_types = array();
141 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) {
142 // post type slug/name
143 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
144 $post_type_object = get_post_type_object( $post_type_slug );
145 if ( property_exists( $post_type_object, 'label' ) ) {
146 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
147 }
148 }
149 }
150 // Get array of active plugins slugs
151 $active_plugins = get_option( 'active_plugins', array() );
152 $active_plugin_slugs = array();
153 foreach ( $active_plugins as $active_plugin ) {
154 // e.g. debug-log-manager/debug-log-manager.php
155 $active_plugin = explode( "/", $active_plugin );
156 $active_plugin_slugs[] = $active_plugin[0];
157 }
158 $background_pattern_options = array();
159 // Enable Content Duplication
160 $content_duplication = new Content_Duplication();
161 $field_id = 'enable_duplication';
162 $field_slug = 'enable-duplication';
163 $field_title = __( 'Content Duplication', 'admin-site-enhancements' );
164 add_settings_field(
165 $field_id,
166 $field_title,
167 [$render_field, 'render_checkbox_toggle'],
168 ASENHA_SLUG,
169 'main-section',
170 array(
171 'option_name' => ASENHA_SLUG_U,
172 'field_id' => $field_id,
173 'field_slug' => $field_slug,
174 'field_title' => $field_title,
175 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
176 'field_description' => __( 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', 'admin-site-enhancements' ),
177 'field_options_wrapper' => true,
178 'field_options_moreless' => true,
179 'class' => 'asenha-toggle content-management ' . $field_slug,
180 )
181 );
182 $field_id = 'duplication_redirect_destination';
183 $field_slug = 'duplication-redirect-destination';
184 add_settings_field(
185 $field_id,
186 __( 'After duplication, redirect to:', 'admin-site-enhancements' ),
187 [$render_field, 'render_radio_buttons_subfield'],
188 ASENHA_SLUG,
189 'main-section',
190 array(
191 'option_name' => ASENHA_SLUG_U,
192 'field_id' => $field_id,
193 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
194 'field_radios' => array(
195 __( 'Edit screen', 'admin-site-enhancements' ) => 'edit',
196 __( 'List view', 'admin-site-enhancements' ) => 'list',
197 ),
198 'field_default' => 'edit',
199 'class' => 'asenha-radio-buttons shift-up content-management ' . $field_slug,
200 )
201 );
202 // Content Order
203 $field_id = 'content_order';
204 $field_slug = 'content-order';
205 $field_title = __( 'Content Order', 'admin-site-enhancements' );
206 add_settings_field(
207 $field_id,
208 $field_title,
209 [$render_field, 'render_checkbox_toggle'],
210 ASENHA_SLUG,
211 'main-section',
212 array(
213 'option_name' => ASENHA_SLUG_U,
214 'field_id' => $field_id,
215 'field_slug' => $field_slug,
216 'field_title' => $field_title,
217 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
218 'field_description' => __( 'Enable custom ordering of various "hierarchical" content types or those supporting "page attributes". A new \'Order\' sub-menu will appear for enabled content type(s). The "All {Posts}" list page for enabled post types in wp-admin will automatically use the custom order.', 'admin-site-enhancements' ),
219 'field_options_wrapper' => true,
220 'field_options_moreless' => true,
221 'class' => 'asenha-toggle content-management ' . $field_slug,
222 )
223 );
224 $field_id = 'content_order_for';
225 $field_slug = 'content-order-for';
226 if ( is_array( $asenha_all_post_types ) ) {
227 $inapplicable_post_types = array(
228 // 'asenha_code_snippet', // ASE code snippets
229 'asenha_redirect',
230 );
231 foreach ( $asenha_all_post_types as $post_type_slug => $post_type_label ) {
232 // e.g. $post_type_slug is post, $post_type_label is Posts
233 $is_hierarchical_label = ( is_post_type_hierarchical( $post_type_slug ) ? ' <span class="faded">- Hierarchical</span>' : '' );
234 if ( (post_type_supports( $post_type_slug, 'page-attributes' ) || is_post_type_hierarchical( $post_type_slug )) && !in_array( $post_type_slug, $inapplicable_post_types ) ) {
235 add_settings_field(
236 $field_id . '_' . $post_type_slug,
237 '',
238 [$render_field, 'render_checkbox_subfield'],
239 ASENHA_SLUG,
240 'main-section',
241 array(
242 'option_name' => ASENHA_SLUG_U,
243 'parent_field_id' => $field_id,
244 'field_id' => $post_type_slug,
245 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
246 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>' . $is_hierarchical_label,
247 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
248 )
249 );
250 }
251 }
252 }
253 // Media Replacement
254 $field_id = 'enable_media_replacement';
255 $field_slug = 'enable-media-replacement';
256 $field_title = __( 'Media Replacement', 'admin-site-enhancements' );
257 add_settings_field(
258 $field_id,
259 $field_title,
260 [$render_field, 'render_checkbox_toggle'],
261 ASENHA_SLUG,
262 'main-section',
263 array(
264 'option_name' => ASENHA_SLUG_U,
265 'field_id' => $field_id,
266 'field_slug' => $field_slug,
267 'field_title' => $field_title,
268 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
269 'field_description' => __( 'Easily replace any type of media file with a new one while retaining the existing media ID, publish date and file name. So, no existing links will break.', 'admin-site-enhancements' ),
270 'field_options_wrapper' => true,
271 'field_options_moreless' => true,
272 'class' => 'asenha-toggle content-management ' . $field_slug,
273 )
274 );
275 $field_id = 'disable_media_replacement_cache_busting';
276 $field_slug = 'disable-media-replacement-cache-busting';
277 add_settings_field(
278 $field_id,
279 '',
280 [$render_field, 'render_checkbox_plain'],
281 ASENHA_SLUG,
282 'main-section',
283 array(
284 'option_name' => ASENHA_SLUG_U,
285 'field_id' => $field_id,
286 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
287 'field_label' => __( 'Disable adding timestamp URL parameter on newly replaced images for busting the browser cache.', 'admin-site-enhancements' ),
288 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
289 )
290 );
291 // Enable SVG Upload
292 $field_id = 'enable_svg_upload';
293 $field_slug = 'enable-svg-upload';
294 $field_title = __( 'SVG Upload', 'admin-site-enhancements' );
295 add_settings_field(
296 $field_id,
297 $field_title,
298 [$render_field, 'render_checkbox_toggle'],
299 ASENHA_SLUG,
300 'main-section',
301 array(
302 'option_name' => ASENHA_SLUG_U,
303 'field_id' => $field_id,
304 'field_slug' => $field_slug,
305 'field_title' => $field_title,
306 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
307 'field_description' => __( 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', 'admin-site-enhancements' ),
308 'field_options_wrapper' => true,
309 'field_options_moreless' => true,
310 'class' => 'asenha-toggle content-management ' . $field_slug,
311 )
312 );
313 $field_id = 'enable_svg_upload_for';
314 $field_slug = 'enable-svg-upload-for';
315 if ( is_array( $roles ) ) {
316 foreach ( $roles as $role_slug => $role_label ) {
317 // e.g. $role_slug is administrator, $role_label is Administrator
318 add_settings_field(
319 $field_id . '_' . $role_slug,
320 '',
321 [$render_field, 'render_checkbox_subfield'],
322 ASENHA_SLUG,
323 'main-section',
324 array(
325 'option_name' => ASENHA_SLUG_U,
326 'parent_field_id' => $field_id,
327 'field_id' => $role_slug,
328 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
329 'field_label' => $role_label,
330 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
331 )
332 );
333 }
334 }
335 // Enable AVIF Upload
336 $field_id = 'enable_avif_upload';
337 $field_slug = 'enable-avif-upload';
338 $field_title = __( 'AVIF Upload', 'admin-site-enhancements' );
339 add_settings_field(
340 $field_id,
341 $field_title,
342 [$render_field, 'render_checkbox_toggle'],
343 ASENHA_SLUG,
344 'main-section',
345 array(
346 'option_name' => ASENHA_SLUG_U,
347 'field_id' => $field_id,
348 'field_slug' => $field_slug,
349 'field_title' => $field_title,
350 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
351 'field_description' => __( 'Enable uploading <a href="https://www.smashingmagazine.com/2021/09/modern-image-formats-avif-webp/" target="_blank">AVIF</a> files in the Media Library. You can convert your existing PNG, JPG and GIF files using a tool like <a href="https://squoosh.app/" target="_blank">Squoosh</a>.', 'admin-site-enhancements' ),
352 'field_options_wrapper' => true,
353 'field_options_moreless' => true,
354 'class' => 'asenha-toggle content-management ' . $field_slug,
355 )
356 );
357 $field_id = 'avif_support_status';
358 $field_slug = 'avif-support-status';
359 add_settings_field(
360 $field_id,
361 '',
362 [$render_field, 'render_avif_support_status'],
363 ASENHA_SLUG,
364 'main-section',
365 array(
366 'class' => 'asenha-toggle content-management ' . $field_slug,
367 )
368 );
369 // Enable External Permalinks
370 $field_id = 'enable_external_permalinks';
371 $field_slug = 'enable-external-permalinks';
372 $field_title = __( 'External Permalinks', 'admin-site-enhancements' );
373 add_settings_field(
374 $field_id,
375 $field_title,
376 [$render_field, 'render_checkbox_toggle'],
377 ASENHA_SLUG,
378 'main-section',
379 array(
380 'option_name' => ASENHA_SLUG_U,
381 'field_id' => $field_id,
382 'field_slug' => $field_slug,
383 'field_title' => $field_title,
384 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
385 'field_description' => __( 'Enable pages, posts and/or custom post types to have permalinks that point to external URLs. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits. Compatible with links added using <a href="https://wordpress.org/plugins/page-links-to/" target="_blank">Page Links To</a>.', 'admin-site-enhancements' ),
386 'field_options_wrapper' => true,
387 'field_options_moreless' => true,
388 'class' => 'asenha-toggle content-management ' . $field_slug,
389 )
390 );
391 $field_id = 'enable_external_permalinks_for';
392 $field_slug = 'enable-external-permalinks-for';
393 if ( is_array( $asenha_public_post_types ) ) {
394 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
395 // e.g. $post_type_slug is post, $post_type_label is Posts
396 if ( 'attachment' != $post_type_slug ) {
397 add_settings_field(
398 $field_id . '_' . $post_type_slug,
399 '',
400 [$render_field, 'render_checkbox_subfield'],
401 ASENHA_SLUG,
402 'main-section',
403 array(
404 'option_name' => ASENHA_SLUG_U,
405 'parent_field_id' => $field_id,
406 'field_id' => $post_type_slug,
407 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
408 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
409 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
410 )
411 );
412 }
413 }
414 }
415 // Open All External Links in New Tab
416 $field_id = 'external_links_new_tab';
417 $field_slug = 'external-links-new-tab';
418 $field_title = __( 'Open All External Links in New Tab', 'admin-site-enhancements' );
419 add_settings_field(
420 $field_id,
421 $field_title,
422 [$render_field, 'render_checkbox_toggle'],
423 ASENHA_SLUG,
424 'main-section',
425 array(
426 'option_name' => ASENHA_SLUG_U,
427 'field_id' => $field_id,
428 'field_slug' => $field_slug,
429 'field_title' => $field_title,
430 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
431 'field_description' => __( 'Force all links to external sites in post content, where <a href="https://developer.wordpress.org/reference/hooks/the_content/" target="_blank">the_content</a> hook is used, to open in new browser tab via target="_blank" attribute. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits.', 'admin-site-enhancements' ),
432 'field_options_wrapper' => false,
433 'field_options_moreless' => false,
434 'class' => 'asenha-toggle content-management ' . $field_slug,
435 )
436 );
437 // Allow Custom Nav Menu Items to Open in New Tab
438 $field_id = 'custom_nav_menu_items_new_tab';
439 $field_slug = 'custom-nav-menu-items-new-tab';
440 $field_title = __( 'Allow Custom Navigation Menu Items to Open in New Tab', 'admin-site-enhancements' );
441 add_settings_field(
442 $field_id,
443 $field_title,
444 [$render_field, 'render_checkbox_toggle'],
445 ASENHA_SLUG,
446 'main-section',
447 array(
448 'option_name' => ASENHA_SLUG_U,
449 'field_id' => $field_id,
450 'field_slug' => $field_slug,
451 'field_title' => $field_title,
452 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
453 'field_description' => __( 'Allow custom navigation menu items to have links that open in new browser tab via target="_blank" attribute. The rel="noopener noreferrer nofollow" attribute will also be added for enhanced security and SEO benefits.', 'admin-site-enhancements' ),
454 'field_options_wrapper' => false,
455 'field_options_moreless' => false,
456 'class' => 'asenha-toggle content-management ' . $field_slug,
457 )
458 );
459 // Enable Auto-Publishing of Posts with Missed Schedules
460 $field_id = 'enable_missed_schedule_posts_auto_publish';
461 $field_slug = 'enable-missed-schedule-posts-auto-publish';
462 $field_title = __( 'Auto-Publish Posts with Missed Schedule', 'admin-site-enhancements' );
463 add_settings_field(
464 $field_id,
465 $field_title,
466 [$render_field, 'render_checkbox_toggle'],
467 ASENHA_SLUG,
468 'main-section',
469 array(
470 'option_name' => ASENHA_SLUG_U,
471 'field_id' => $field_id,
472 'field_slug' => $field_slug,
473 'field_title' => $field_title,
474 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
475 'field_description' => __( 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', 'admin-site-enhancements' ),
476 'class' => 'asenha-toggle content-management ' . $field_slug,
477 )
478 );
479 // =================================================================
480 // ADMIN INTERFACE
481 // =================================================================
482 // Hide or Modify Elements / Clean Up Admin Bar
483 $field_id = 'hide_modify_elements';
484 $field_slug = 'hide-modify-elements';
485 add_settings_field(
486 $field_id,
487 __( 'Clean Up Admin Bar', 'admin-site-enhancements' ),
488 [$render_field, 'render_checkbox_toggle'],
489 ASENHA_SLUG,
490 'main-section',
491 array(
492 'option_name' => ASENHA_SLUG_U,
493 'field_id' => $field_id,
494 'field_slug' => $field_slug,
495 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
496 'field_description' => __( 'Remove various elements from the admin bar.', 'admin-site-enhancements' ),
497 'field_options_wrapper' => true,
498 'field_options_moreless' => true,
499 'class' => 'asenha-toggle admin-interface ' . $field_slug,
500 )
501 );
502 $field_id = 'hide_ab_wp_logo_menu';
503 $field_slug = 'hide-ab-wp-logo-menu';
504 add_settings_field(
505 $field_id,
506 '',
507 [$render_field, 'render_checkbox_plain'],
508 ASENHA_SLUG,
509 'main-section',
510 array(
511 'option_name' => ASENHA_SLUG_U,
512 'field_id' => $field_id,
513 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
514 'field_label' => __( 'Remove WordPress logo/menu', 'admin-site-enhancements' ),
515 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
516 )
517 );
518 $field_id = 'hide_ab_site_menu';
519 $field_slug = 'hide-ab-site-menu';
520 add_settings_field(
521 $field_id,
522 '',
523 [$render_field, 'render_checkbox_plain'],
524 ASENHA_SLUG,
525 'main-section',
526 array(
527 'option_name' => ASENHA_SLUG_U,
528 'field_id' => $field_id,
529 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
530 'field_label' => __( 'Remove home icon and site name', 'admin-site-enhancements' ),
531 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
532 )
533 );
534 $field_id = 'hide_ab_customize_menu';
535 $field_slug = 'hide-ab-customize-menu';
536 add_settings_field(
537 $field_id,
538 '',
539 [$render_field, 'render_checkbox_plain'],
540 ASENHA_SLUG,
541 'main-section',
542 array(
543 'option_name' => ASENHA_SLUG_U,
544 'field_id' => $field_id,
545 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
546 'field_label' => __( 'Remove customize menu', 'admin-site-enhancements' ),
547 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
548 )
549 );
550 $field_id = 'hide_ab_updates_menu';
551 $field_slug = 'hide-ab-updates-menu';
552 add_settings_field(
553 $field_id,
554 '',
555 [$render_field, 'render_checkbox_plain'],
556 ASENHA_SLUG,
557 'main-section',
558 array(
559 'option_name' => ASENHA_SLUG_U,
560 'field_id' => $field_id,
561 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
562 'field_label' => __( 'Remove updates counter/link', 'admin-site-enhancements' ),
563 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
564 )
565 );
566 $field_id = 'hide_ab_comments_menu';
567 $field_slug = 'hide-ab-comments-menu';
568 add_settings_field(
569 $field_id,
570 '',
571 [$render_field, 'render_checkbox_plain'],
572 ASENHA_SLUG,
573 'main-section',
574 array(
575 'option_name' => ASENHA_SLUG_U,
576 'field_id' => $field_id,
577 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
578 'field_label' => __( 'Remove comments counter/link', 'admin-site-enhancements' ),
579 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
580 )
581 );
582 $field_id = 'hide_ab_new_content_menu';
583 $field_slug = 'hide-ab-new-content-menu';
584 add_settings_field(
585 $field_id,
586 '',
587 [$render_field, 'render_checkbox_plain'],
588 ASENHA_SLUG,
589 'main-section',
590 array(
591 'option_name' => ASENHA_SLUG_U,
592 'field_id' => $field_id,
593 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
594 'field_label' => __( 'Remove new content menu', 'admin-site-enhancements' ),
595 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
596 )
597 );
598 $field_id = 'hide_ab_howdy';
599 $field_slug = 'hide-ab-howdy';
600 add_settings_field(
601 $field_id,
602 '',
603 [$render_field, 'render_checkbox_plain'],
604 ASENHA_SLUG,
605 'main-section',
606 array(
607 'option_name' => ASENHA_SLUG_U,
608 'field_id' => $field_id,
609 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
610 'field_label' => __( 'Remove \'Howdy\'', 'admin-site-enhancements' ),
611 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
612 )
613 );
614 $field_id = 'hide_help_drawer';
615 $field_slug = 'hide-help-drawer';
616 add_settings_field(
617 $field_id,
618 '',
619 [$render_field, 'render_checkbox_plain'],
620 ASENHA_SLUG,
621 'main-section',
622 array(
623 'option_name' => ASENHA_SLUG_U,
624 'field_id' => $field_id,
625 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
626 'field_label' => __( 'Remove the Help tab and drawer', 'admin-site-enhancements' ),
627 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
628 )
629 );
630 // Hide Admin Notices
631 $field_id = 'hide_admin_notices';
632 $field_slug = 'hide-admin-notices';
633 $field_title = __( 'Hide Admin Notices', 'admin-site-enhancements' );
634 $field_options_wrapper = false;
635 $field_options_moreless = false;
636 add_settings_field(
637 $field_id,
638 $field_title,
639 [$render_field, 'render_checkbox_toggle'],
640 ASENHA_SLUG,
641 'main-section',
642 array(
643 'option_name' => ASENHA_SLUG_U,
644 'field_id' => $field_id,
645 'field_slug' => $field_slug,
646 'field_title' => $field_title,
647 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
648 'field_description' => __( 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', 'admin-site-enhancements' ),
649 'field_options_wrapper' => $field_options_wrapper,
650 'field_options_moreless' => $field_options_moreless,
651 'class' => 'asenha-toggle admin-interface ' . $field_slug,
652 )
653 );
654 // Disable Dashboard Widgets
655 $field_id = 'disable_dashboard_widgets';
656 $field_slug = 'disable-dashboard-widgets';
657 $field_title = __( 'Disable Dashboard Widgets', 'admin-site-enhancements' );
658 add_settings_field(
659 $field_id,
660 $field_title,
661 [$render_field, 'render_checkbox_toggle'],
662 ASENHA_SLUG,
663 'main-section',
664 array(
665 'option_name' => ASENHA_SLUG_U,
666 'field_id' => $field_id,
667 'field_slug' => $field_slug,
668 'field_title' => $field_title,
669 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
670 'field_description' => __( 'Clean up and speed up the dashboard by completely disabling some or all widgets. Disabled widgets won\'t load any assets nor show up under Screen Options.', 'admin-site-enhancements' ),
671 'field_options_wrapper' => true,
672 'field_options_moreless' => true,
673 'class' => 'asenha-toggle admin-interface ' . $field_slug,
674 )
675 );
676 $field_id = 'disable_welcome_panel_in_dashboard';
677 $field_slug = 'disable-welcome-panel-in-dashboard';
678 add_settings_field(
679 $field_id,
680 '',
681 [$render_field, 'render_checkbox_plain'],
682 ASENHA_SLUG,
683 'main-section',
684 array(
685 'option_name' => ASENHA_SLUG_U,
686 'field_id' => $field_id,
687 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
688 'field_label' => __( 'Welcome to WordPress', 'admin-site-enhancements' ),
689 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
690 )
691 );
692 $field_id = 'disabled_dashboard_widgets';
693 $field_slug = 'disabled-dashboard-widgets';
694 if ( array_key_exists( 'dashboard_widgets', $options_extra ) ) {
695 $dashboard_widgets = $options_extra['dashboard_widgets'];
696 } else {
697 $disable_dashboard_widgets = new Disable_Dashboard_Widgets();
698 $dashboard_widgets = $disable_dashboard_widgets->get_dashboard_widgets();
699 $options_extra['dashboard_widgets'] = $dashboard_widgets;
700 update_option( ASENHA_SLUG_U . '_extra', $options_extra, true );
701 }
702 foreach ( $dashboard_widgets as $widget ) {
703 add_settings_field(
704 $field_id . '_' . $widget['id'],
705 '',
706 [$render_field, 'render_checkbox_subfield'],
707 ASENHA_SLUG,
708 'main-section',
709 array(
710 'option_name' => ASENHA_SLUG_U,
711 'parent_field_id' => $field_id,
712 'field_id' => $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'],
713 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'] . ']',
714 'field_label' => $widget['title'] . ' <span class="faded">(' . $widget['id'] . ')</span>',
715 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug . ' ' . $widget['id'],
716 )
717 );
718 }
719 // Hide Admin Bar
720 $field_id = 'hide_admin_bar';
721 $field_slug = 'hide-admin-bar';
722 $field_title = __( 'Hide Admin Bar', 'admin-site-enhancements' );
723 $field_description = __( 'Hide admin bar on the frontend for all or some user roles.', 'admin-site-enhancements' );
724 add_settings_field(
725 $field_id,
726 $field_title,
727 [$render_field, 'render_checkbox_toggle'],
728 ASENHA_SLUG,
729 'main-section',
730 array(
731 'option_name' => ASENHA_SLUG_U,
732 'field_id' => $field_id,
733 'field_slug' => $field_slug,
734 'field_title' => $field_title,
735 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
736 'field_description' => $field_description,
737 'field_options_wrapper' => true,
738 'field_options_moreless' => true,
739 'class' => 'asenha-toggle admin-interface ' . $field_slug,
740 )
741 );
742 $field_id = 'hide_admin_bar_for';
743 $field_slug = 'hide-admin-bar-for';
744 if ( is_array( $roles ) ) {
745 foreach ( $roles as $role_slug => $role_label ) {
746 // e.g. $role_slug is administrator, $role_label is Administrator
747 add_settings_field(
748 $field_id . '_' . $role_slug,
749 '',
750 [$render_field, 'render_checkbox_subfield'],
751 ASENHA_SLUG,
752 'main-section',
753 array(
754 'option_name' => ASENHA_SLUG_U,
755 'parent_field_id' => $field_id,
756 'field_id' => $role_slug,
757 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
758 'field_label' => $role_label,
759 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
760 )
761 );
762 }
763 }
764 $field_id = 'hide_admin_bar_always_show_for_admins';
765 $field_slug = 'hide-admin-bar-always-show-for-admins';
766 add_settings_field(
767 $field_id,
768 '',
769 // Field title
770 [$render_field, 'render_checkbox_plain'],
771 ASENHA_SLUG,
772 'main-section',
773 array(
774 'option_name' => ASENHA_SLUG_U,
775 'field_id' => $field_id,
776 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
777 'field_label' => __( 'Always show the admin bar for administrators on the frontend. Useful for when an administrator has multiple user roles, and the admin bar is set to be hidden for the other user role(s).', 'admin-site-enhancements' ),
778 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top admin-interface ' . $field_slug,
779 )
780 );
781 $field_id = 'hide_admin_bar_description';
782 $field_slug = 'hide-admin-bar-description';
783 add_settings_field(
784 $field_id,
785 '',
786 [$render_field, 'render_description_subfield'],
787 ASENHA_SLUG,
788 'main-section',
789 array(
790 'option_name' => ASENHA_SLUG_U,
791 'field_description' => '<div class="asenha-warning">' . __( 'The settings above will override the \'Toolbar\' settings in the user profile edit screen.', 'admin-site-enhancements' ) . '</div>',
792 'class' => 'asenha-description login-logout ' . $field_slug,
793 )
794 );
795 // Wider Admin Menu
796 $field_id = 'wider_admin_menu';
797 $field_slug = 'wider-admin-menu';
798 $field_title = __( 'Wider Admin Menu', 'admin-site-enhancements' );
799 add_settings_field(
800 $field_id,
801 $field_title,
802 [$render_field, 'render_checkbox_toggle'],
803 ASENHA_SLUG,
804 'main-section',
805 array(
806 'option_name' => ASENHA_SLUG_U,
807 'field_id' => $field_id,
808 'field_slug' => $field_slug,
809 'field_title' => $field_title,
810 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
811 'field_description' => __( 'Give the admin menu more room to better accommodate wider items.', 'admin-site-enhancements' ),
812 'field_options_wrapper' => true,
813 'class' => 'asenha-toggle admin-interface ' . $field_slug,
814 )
815 );
816 $field_id = 'admin_menu_width';
817 $field_slug = 'admin-menu-width';
818 add_settings_field(
819 $field_id,
820 '',
821 [$render_field, 'render_select_subfield'],
822 ASENHA_SLUG,
823 'main-section',
824 array(
825 'option_name' => ASENHA_SLUG_U,
826 'field_id' => $field_id,
827 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
828 'field_type' => 'with-prefix-suffix',
829 'field_prefix' => __( 'Set width to', 'admin-site-enhancements' ),
830 'field_suffix' => '<span class="faded">' . __( '(Default is 160px)', 'admin-site-enhancements' ) . '</span>',
831 'field_select_options' => array(
832 '180px' => '180px',
833 '200px' => '200px',
834 '220px' => '220px',
835 '240px' => '240px',
836 '260px' => '260px',
837 '280px' => '280px',
838 '300px' => '300px',
839 ),
840 'field_select_default' => 200,
841 'field_intro' => '',
842 'field_description' => '',
843 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up admin-interface ' . $field_slug,
844 'display_none_on_load' => true,
845 )
846 );
847 // Admin Menu Organizer
848 $field_id = 'customize_admin_menu';
849 $field_slug = 'customize-admin-menu';
850 $field_title = __( 'Admin Menu Organizer', 'admin-site-enhancements' );
851 add_settings_field(
852 $field_id,
853 $field_title,
854 [$render_field, 'render_checkbox_toggle'],
855 ASENHA_SLUG,
856 'main-section',
857 array(
858 'field_id' => $field_id,
859 'field_slug' => $field_slug,
860 'field_title' => $field_title,
861 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
862 'field_description' => __( 'Customize the order of the admin menu and optionally change menu item title or hide some items.', 'admin-site-enhancements' ) . ' ' . sprintf(
863 /* translators: %s is URL to the Admin Menu Organizer settings page */
864 __( 'Once enabled, you can find the <a href="%s">Admin Menu</a> item under the Settings menu.', 'admin-site-enhancements' ),
865 admin_url( 'options-general.php?page=admin-menu-organizer' )
866 ),
867 'field_options_wrapper' => false,
868 'field_options_moreless' => false,
869 'class' => 'asenha-toggle admin-interface ' . $field_slug,
870 )
871 );
872 // Show Custom Taxonomy Filters
873 $field_id = 'show_custom_taxonomy_filters';
874 $field_slug = 'show-custom-taxonomy-filters';
875 $field_title = __( 'Show Custom Taxonomy Filters', 'admin-site-enhancements' );
876 $field_options_wrapper = false;
877 $field_options_moreless = false;
878 add_settings_field(
879 $field_id,
880 $field_title,
881 [$render_field, 'render_checkbox_toggle'],
882 ASENHA_SLUG,
883 'main-section',
884 array(
885 'option_name' => ASENHA_SLUG_U,
886 'field_id' => $field_id,
887 'field_slug' => $field_slug,
888 'field_title' => $field_title,
889 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
890 'field_description' => __( 'Show additional filter(s) on list tables for hierarchical, custom taxonomies.', 'admin-site-enhancements' ),
891 'field_options_wrapper' => $field_options_wrapper,
892 'field_options_moreless' => $field_options_moreless,
893 'class' => 'asenha-toggle admin-interface ' . $field_slug,
894 )
895 );
896 // Enhance List Tables
897 $field_id = 'enhance_list_tables';
898 $field_slug = 'enhance-list-tables';
899 $field_title = __( 'Enhance List Tables', 'admin-site-enhancements' );
900 add_settings_field(
901 $field_id,
902 $field_title,
903 [$render_field, 'render_checkbox_toggle'],
904 ASENHA_SLUG,
905 'main-section',
906 array(
907 'option_name' => ASENHA_SLUG_U,
908 'field_id' => $field_id,
909 'field_slug' => $field_slug,
910 'field_title' => $field_title,
911 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
912 'field_description' => __( 'Improve the usefulness of listing pages for various post types and taxonomies, media, comments and users by adding / removing columns and elements.', 'admin-site-enhancements' ),
913 'field_options_wrapper' => true,
914 'field_options_moreless' => true,
915 'class' => 'asenha-toggle content-management ' . $field_slug,
916 )
917 );
918 // Show Featured Image Column
919 $field_id = 'show_featured_image_column';
920 $field_slug = 'show-featured-image-column';
921 add_settings_field(
922 $field_id,
923 '',
924 [$render_field, 'render_checkbox_plain'],
925 ASENHA_SLUG,
926 'main-section',
927 array(
928 'option_name' => ASENHA_SLUG_U,
929 'field_id' => $field_id,
930 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
931 'field_label' => __( 'Show featured image column', 'admin-site-enhancements' ),
932 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
933 )
934 );
935 // Show Excerpt Column
936 $field_id = 'show_excerpt_column';
937 $field_slug = 'show-excerpt-column';
938 add_settings_field(
939 $field_id,
940 '',
941 [$render_field, 'render_checkbox_plain'],
942 ASENHA_SLUG,
943 'main-section',
944 array(
945 'option_name' => ASENHA_SLUG_U,
946 'field_id' => $field_id,
947 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
948 'field_label' => __( 'Show excerpt column', 'admin-site-enhancements' ),
949 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
950 )
951 );
952 // Show Last Modified Column
953 $field_id = 'show_last_modified_column';
954 $field_slug = 'show-last-modified-column';
955 add_settings_field(
956 $field_id,
957 '',
958 [$render_field, 'render_checkbox_plain'],
959 ASENHA_SLUG,
960 'main-section',
961 array(
962 'option_name' => ASENHA_SLUG_U,
963 'field_id' => $field_id,
964 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
965 'field_label' => __( 'Show last modified column', 'admin-site-enhancements' ),
966 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
967 )
968 );
969 // Show ID Column
970 $field_id = 'show_id_column';
971 $field_slug = 'show-id-column';
972 add_settings_field(
973 $field_id,
974 '',
975 [$render_field, 'render_checkbox_plain'],
976 ASENHA_SLUG,
977 'main-section',
978 array(
979 'option_name' => ASENHA_SLUG_U,
980 'field_id' => $field_id,
981 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
982 'field_label' => __( 'Show ID column', 'admin-site-enhancements' ),
983 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
984 )
985 );
986 // Show File Size Column in Media Library
987 $field_id = 'show_file_size_column';
988 $field_slug = 'show-file-size-column';
989 add_settings_field(
990 $field_id,
991 '',
992 [$render_field, 'render_checkbox_plain'],
993 ASENHA_SLUG,
994 'main-section',
995 array(
996 'option_name' => ASENHA_SLUG_U,
997 'field_id' => $field_id,
998 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
999 'field_label' => __( 'Show file size column in media library', 'admin-site-enhancements' ),
1000 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1001 )
1002 );
1003 // Show ID in Action Row
1004 $field_id = 'show_id_in_action_row';
1005 $field_slug = 'show-id-in-action_row';
1006 add_settings_field(
1007 $field_id,
1008 '',
1009 [$render_field, 'render_checkbox_plain'],
1010 ASENHA_SLUG,
1011 'main-section',
1012 array(
1013 'option_name' => ASENHA_SLUG_U,
1014 'field_id' => $field_id,
1015 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1016 'field_label' => __( 'Show ID in action rows along with links for Edit, View, etc.', 'admin-site-enhancements' ),
1017 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1018 )
1019 );
1020 // Hide Date Column
1021 $field_id = 'hide_date_column';
1022 $field_slug = 'hide-date-column';
1023 add_settings_field(
1024 $field_id,
1025 '',
1026 [$render_field, 'render_checkbox_plain'],
1027 ASENHA_SLUG,
1028 'main-section',
1029 array(
1030 'option_name' => ASENHA_SLUG_U,
1031 'field_id' => $field_id,
1032 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1033 'field_label' => __( 'Remove date column', 'admin-site-enhancements' ),
1034 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1035 )
1036 );
1037 // Hide Comments Column
1038 $field_id = 'hide_comments_column';
1039 $field_slug = 'hide-comments-column';
1040 add_settings_field(
1041 $field_id,
1042 '',
1043 [$render_field, 'render_checkbox_plain'],
1044 ASENHA_SLUG,
1045 'main-section',
1046 array(
1047 'option_name' => ASENHA_SLUG_U,
1048 'field_id' => $field_id,
1049 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1050 'field_label' => __( 'Remove comments column', 'admin-site-enhancements' ),
1051 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1052 )
1053 );
1054 // Hide Post Tags Column
1055 $field_id = 'hide_post_tags_column';
1056 $field_slug = 'hide-post-tags-column';
1057 add_settings_field(
1058 $field_id,
1059 '',
1060 [$render_field, 'render_checkbox_plain'],
1061 ASENHA_SLUG,
1062 'main-section',
1063 array(
1064 'option_name' => ASENHA_SLUG_U,
1065 'field_id' => $field_id,
1066 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1067 'field_label' => __( 'Remove tags column (for posts)', 'admin-site-enhancements' ),
1068 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1069 )
1070 );
1071 // Various Admin UI Enhancements
1072 $field_id = 'various_admin_ui_enhancements';
1073 $field_slug = 'various-admin-ui-enhancements';
1074 $field_title = __( 'Various Admin UI Enhancements', 'admin-site-enhancements' );
1075 add_settings_field(
1076 $field_id,
1077 $field_title,
1078 [$render_field, 'render_checkbox_toggle'],
1079 ASENHA_SLUG,
1080 'main-section',
1081 array(
1082 'option_name' => ASENHA_SLUG_U,
1083 'field_id' => $field_id,
1084 'field_slug' => $field_slug,
1085 'field_title' => $field_title,
1086 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1087 'field_description' => __( 'Various, smaller enhancements for different parts of the admin interface.', 'admin-site-enhancements' ),
1088 'field_options_wrapper' => true,
1089 'field_options_moreless' => true,
1090 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1091 )
1092 );
1093 // Media Library Infinite Scrolling
1094 $field_id = 'media_library_infinite_scrolling';
1095 $field_slug = 'media-library-infinite-scrolling';
1096 add_settings_field(
1097 $field_id,
1098 '',
1099 [$render_field, 'render_checkbox_plain'],
1100 ASENHA_SLUG,
1101 'main-section',
1102 array(
1103 'option_name' => ASENHA_SLUG_U,
1104 'field_id' => $field_id,
1105 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1106 'field_label' => '<strong>' . __( 'Media Library Infinite Scrolling', 'admin-site-enhancements' ) . '</strong><br />' . __( 'Re-enable infinite scrolling in the grid view of the media library. Useful for scrolling through a large library.', 'admin-site-enhancements' ),
1107 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1108 )
1109 );
1110 // Display Active Plugins First
1111 $field_id = 'display_active_plugins_first';
1112 $field_slug = 'display-active-plugins-first';
1113 add_settings_field(
1114 $field_id,
1115 '',
1116 [$render_field, 'render_checkbox_plain'],
1117 ASENHA_SLUG,
1118 'main-section',
1119 array(
1120 'option_name' => ASENHA_SLUG_U,
1121 'field_id' => $field_id,
1122 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1123 'field_label' => '<strong>' . __( 'Display Active Plugins First', 'admin-site-enhancements' ) . '</strong><br />' . __( 'Display active / activated plugins at the top of the Installed Plugins list. Useful when your site has many deactivated plugins for testing or development purposes.', 'admin-site-enhancements' ),
1124 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1125 )
1126 );
1127 // Custom Admin Footer Text
1128 $field_id = 'custom_admin_footer_text';
1129 $field_slug = 'custom-admin-footer-text';
1130 $field_title = __( 'Custom Admin Footer Text', 'admin-site-enhancements' );
1131 add_settings_field(
1132 $field_id,
1133 $field_title,
1134 [$render_field, 'render_checkbox_toggle'],
1135 ASENHA_SLUG,
1136 'main-section',
1137 array(
1138 'option_name' => ASENHA_SLUG_U,
1139 'field_id' => $field_id,
1140 'field_slug' => $field_slug,
1141 'field_title' => $field_title,
1142 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1143 'field_description' => __( 'Customize the text you see on the footer of wp-admin pages other than this ASE settings page.', 'admin-site-enhancements' ),
1144 'field_options_wrapper' => true,
1145 'field_options_moreless' => true,
1146 'class' => 'asenha-toggle utilities ' . $field_slug,
1147 )
1148 );
1149 $media_buttons = false;
1150 $quicktags = false;
1151 $toolbar1 = 'bold,italic,underline';
1152 $field_id = 'custom_admin_footer_left';
1153 $field_slug = 'custom-admin-footer-left';
1154 // https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/
1155 // https://www.tiny.cloud/docs/advanced/available-toolbar-buttons/
1156 $editor_settings = array(
1157 'media_buttons' => $media_buttons,
1158 'textarea_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1159 'textarea_rows' => 3,
1160 'tiny_mce' => true,
1161 'tinymce' => array(
1162 'toolbar1' => $toolbar1,
1163 'content_css' => ASENHA_URL . 'assets/css/settings-wpeditor.css',
1164 ),
1165 'editor_css' => '',
1166 'quicktags' => $quicktags,
1167 'default_editor' => 'tinymce',
1168 );
1169 add_settings_field(
1170 $field_id,
1171 __( 'Left Side', 'admin-site-enhancements' ),
1172 [$render_field, 'render_wpeditor_subfield'],
1173 ASENHA_SLUG,
1174 'main-section',
1175 array(
1176 'option_name' => ASENHA_SLUG_U,
1177 'field_id' => $field_id,
1178 'field_slug' => $field_slug,
1179 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1180 'field_type' => 'textarea',
1181 'field_intro' => '',
1182 'field_description' => __( 'Default text is: <em>Thank you for creating with <a href="https://wordpress.org/">WordPress</a></em>.', 'admin-site-enhancements' ),
1183 'field_placeholder' => '',
1184 'editor_settings' => $editor_settings,
1185 'class' => 'asenha-textarea admin-interface has-wpeditor ' . $field_slug,
1186 )
1187 );
1188 $field_id = 'custom_admin_footer_right';
1189 $field_slug = 'custom-admin-footer-right';
1190 // https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/
1191 // https://www.tiny.cloud/docs/advanced/available-toolbar-buttons/
1192 $editor_settings = array(
1193 'media_buttons' => $media_buttons,
1194 'textarea_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1195 'textarea_rows' => 3,
1196 'tiny_mce' => true,
1197 'tinymce' => array(
1198 'toolbar1' => $toolbar1,
1199 'content_css' => ASENHA_URL . 'assets/css/settings-wpeditor.css',
1200 ),
1201 'editor_css' => '',
1202 'quicktags' => $quicktags,
1203 'default_editor' => 'tinymce',
1204 );
1205 add_settings_field(
1206 $field_id,
1207 __( 'Right Side', 'admin-site-enhancements' ),
1208 [$render_field, 'render_wpeditor_subfield'],
1209 ASENHA_SLUG,
1210 'main-section',
1211 array(
1212 'option_name' => ASENHA_SLUG_U,
1213 'field_id' => $field_id,
1214 'field_slug' => $field_slug,
1215 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1216 'field_type' => 'textarea',
1217 'field_rows' => 1,
1218 'field_intro' => '',
1219 'field_description' => sprintf(
1220 /* translators: %s is the WordPress version number */
1221 __( 'Default text is: <em>Version %s</em>', 'admin-site-enhancements' ),
1222 $wp_version
1223 ),
1224 'field_placeholder' => '',
1225 'editor_settings' => $editor_settings,
1226 'class' => 'asenha-textarea admin-interface has-wpeditor ' . $field_slug,
1227 )
1228 );
1229 // =================================================================
1230 // LOG IN/OUT | REGISTER
1231 // =================================================================
1232 // Change Login URL
1233 $field_id = 'change_login_url';
1234 $field_slug = 'change-login-url';
1235 $field_title = __( 'Change Login URL', 'admin-site-enhancements' );
1236 add_settings_field(
1237 $field_id,
1238 $field_title,
1239 [$render_field, 'render_checkbox_toggle'],
1240 ASENHA_SLUG,
1241 'main-section',
1242 array(
1243 'option_name' => ASENHA_SLUG_U,
1244 'field_id' => $field_id,
1245 'field_slug' => $field_slug,
1246 'field_title' => $field_title,
1247 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1248 'field_description' => sprintf(
1249 /* translators: %s is the default login URL */
1250 __( 'Default is %s', 'admin-site-enhancements' ),
1251 site_url( '/wp-login.php' )
1252 ),
1253 'field_options_moreless' => true,
1254 'field_options_wrapper' => true,
1255 'class' => 'asenha-toggle login-logout ' . $field_slug,
1256 )
1257 );
1258 $field_id = 'custom_login_slug';
1259 $field_slug = 'custom-login-slug';
1260 add_settings_field(
1261 $field_id,
1262 __( 'New login URL:', 'admin-site-enhancements' ),
1263 [$render_field, 'render_text_subfield'],
1264 ASENHA_SLUG,
1265 'main-section',
1266 array(
1267 'option_name' => ASENHA_SLUG_U,
1268 'field_id' => $field_id,
1269 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1270 'field_type' => 'with-prefix-suffix',
1271 'field_prefix' => site_url() . '/',
1272 'field_suffix' => '/',
1273 'field_placeholder' => __( 'e.g. backend', 'admin-site-enhancements' ),
1274 'field_description' => '',
1275 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1276 )
1277 );
1278 $field_id = 'custom_login_whitelist';
1279 $field_slug = 'custom-login-whitelist';
1280 add_settings_field(
1281 $field_id,
1282 '<strong>' . __( 'Allow login from:', 'admin-site-enhancements' ) . '</strong> <span class="weight-normal">' . site_url() . '/</span>',
1283 [$render_field, 'render_textarea_subfield'],
1284 ASENHA_SLUG,
1285 'main-section',
1286 array(
1287 'option_name' => ASENHA_SLUG_U,
1288 'field_id' => $field_id,
1289 'field_slug' => $field_slug,
1290 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1291 'field_type' => 'textarea',
1292 'field_rows' => 3,
1293 'field_intro' => '',
1294 'field_description' => __( 'Enter one path per line', 'admin-site-enhancements' ),
1295 'field_placeholder' => __( 'e.g. dashboard', 'admin-site-enhancements' ),
1296 'class' => 'asenha-textarea margin-top-16 login-logout ' . $field_slug,
1297 )
1298 );
1299 $field_id = 'change_login_url_description';
1300 $field_slug = 'change-login-url-description';
1301 add_settings_field(
1302 $field_id,
1303 '',
1304 [$render_field, 'render_description_subfield'],
1305 ASENHA_SLUG,
1306 'main-section',
1307 array(
1308 'option_name' => ASENHA_SLUG_U,
1309 'field_description' => __( '<div class="asenha-warning">"New login URL" <strong>only works for/with the default WordPress login page</strong>. If you have a login page you manually created with a page builder or with another plugin, please add them to the "Allow login from" section.<br /><br />This module is <strong>not yet compatible with two-factor authentication (2FA) methods</strong>. If you use a 2FA plugin, please use the change login URL feature bundled in that plugin, or use another plugin that is compatible with it.<br /><br />And obviously, to improve security, please <strong>use something other than \'login\'</strong> for the custom login slug.</div>', 'admin-site-enhancements' ),
1310 'class' => 'asenha-description login-logout ' . $field_slug,
1311 )
1312 );
1313 // Login ID Type
1314 $field_id = 'login_id_type_restriction';
1315 $field_slug = 'login-id-type-restriction';
1316 $field_title = __( 'Login ID Type', 'admin-site-enhancements' );
1317 add_settings_field(
1318 $field_id,
1319 $field_title,
1320 [$render_field, 'render_checkbox_toggle'],
1321 ASENHA_SLUG,
1322 'main-section',
1323 array(
1324 'option_name' => ASENHA_SLUG_U,
1325 'field_id' => $field_id,
1326 'field_slug' => $field_slug,
1327 'field_title' => $field_title,
1328 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1329 'field_description' => __( 'Restrict login ID to username or email address only.', 'admin-site-enhancements' ),
1330 'field_options_wrapper' => true,
1331 'class' => 'asenha-toggle login-logout ' . $field_slug,
1332 )
1333 );
1334 $field_id = 'login_id_type';
1335 $field_slug = 'login-id-type';
1336 add_settings_field(
1337 $field_id,
1338 '',
1339 [$render_field, 'render_radio_buttons_subfield'],
1340 ASENHA_SLUG,
1341 'main-section',
1342 array(
1343 'option_name' => ASENHA_SLUG_U,
1344 'field_id' => $field_id,
1345 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1346 'field_radios' => array(
1347 __( 'Username only', 'admin-site-enhancements' ) => 'username',
1348 __( 'Email address only', 'admin-site-enhancements' ) => 'email',
1349 ),
1350 'field_default' => 'username',
1351 'class' => 'asenha-radio-buttons shift-up login-logout ' . $field_slug,
1352 )
1353 );
1354 // Use Site Identity on the Login Page
1355 $field_id = 'site_identity_on_login';
1356 $field_slug = 'site-identity-on-login';
1357 $field_title = __( 'Site Identity on Login Page', 'admin-site-enhancements' );
1358 add_settings_field(
1359 $field_id,
1360 $field_title,
1361 [$render_field, 'render_checkbox_toggle'],
1362 ASENHA_SLUG,
1363 'main-section',
1364 array(
1365 'option_name' => ASENHA_SLUG_U,
1366 'field_id' => $field_id,
1367 'field_slug' => $field_slug,
1368 'field_title' => $field_title,
1369 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1370 'field_description' => sprintf(
1371 /* translators: %s is URL to the Customizer */
1372 __( 'Use the site icon and URL to replace the default WordPress logo with link to wordpress.org on the login page. Go to <a href="%1$s">General Settings</a> or the <a href="%2$s">Customizer</a> to set or change your site icon.', 'admin-site-enhancements' ),
1373 admin_url( 'options-general.php' ),
1374 admin_url( 'customize.php' )
1375 ),
1376 'field_options_wrapper' => true,
1377 'class' => 'asenha-toggle login-logout ' . $field_slug,
1378 )
1379 );
1380 // Enable Log In/Out Menu
1381 $field_id = 'enable_login_logout_menu';
1382 $field_slug = 'enable-login-logout-menu';
1383 $field_title = __( 'Log In/Out Menu', 'admin-site-enhancements' );
1384 add_settings_field(
1385 $field_id,
1386 $field_title,
1387 [$render_field, 'render_checkbox_toggle'],
1388 ASENHA_SLUG,
1389 'main-section',
1390 array(
1391 'option_name' => ASENHA_SLUG_U,
1392 'field_id' => $field_id,
1393 'field_slug' => $field_slug,
1394 'field_title' => $field_title,
1395 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1396 'field_description' => __( 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', 'admin-site-enhancements' ),
1397 'field_options_wrapper' => true,
1398 'field_options_moreless' => true,
1399 'class' => 'asenha-toggle login-logout ' . $field_slug,
1400 )
1401 );
1402 // Last Login Column
1403 $field_id = 'enable_last_login_column';
1404 $field_slug = 'enable-last-login-column';
1405 $field_title = __( 'Last Login Column', 'admin-site-enhancements' );
1406 add_settings_field(
1407 $field_id,
1408 $field_title,
1409 [$render_field, 'render_checkbox_toggle'],
1410 ASENHA_SLUG,
1411 'main-section',
1412 array(
1413 'option_name' => ASENHA_SLUG_U,
1414 'field_id' => $field_id,
1415 'field_slug' => $field_slug,
1416 'field_title' => $field_title,
1417 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1418 'field_description' => __( 'Log when users on the site last logged in and display the date and time in the users list table.', 'admin-site-enhancements' ),
1419 'field_options_wrapper' => true,
1420 'field_options_moreless' => true,
1421 'class' => 'asenha-toggle login-logout ' . $field_slug,
1422 )
1423 );
1424 // Registration Date Column
1425 $field_id = 'registration_date_column';
1426 $field_slug = 'registration-date-column';
1427 $field_title = __( 'Registration Date Column', 'admin-site-enhancements' );
1428 add_settings_field(
1429 $field_id,
1430 $field_title,
1431 [$render_field, 'render_checkbox_toggle'],
1432 ASENHA_SLUG,
1433 'main-section',
1434 array(
1435 'option_name' => ASENHA_SLUG_U,
1436 'field_id' => $field_id,
1437 'field_slug' => $field_slug,
1438 'field_title' => $field_title,
1439 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1440 'field_description' => __( 'Display the registration date and time in the users list table.', 'admin-site-enhancements' ),
1441 'field_options_wrapper' => true,
1442 'field_options_moreless' => true,
1443 'class' => 'asenha-toggle login-logout ' . $field_slug,
1444 )
1445 );
1446 // Redirect After Login
1447 $field_id = 'redirect_after_login';
1448 $field_slug = 'redirect-after-login';
1449 $field_title = __( 'Redirect After Login', 'admin-site-enhancements' );
1450 add_settings_field(
1451 $field_id,
1452 $field_title,
1453 [$render_field, 'render_checkbox_toggle'],
1454 ASENHA_SLUG,
1455 'main-section',
1456 array(
1457 'option_name' => ASENHA_SLUG_U,
1458 'field_id' => $field_id,
1459 'field_slug' => $field_slug,
1460 'field_title' => $field_title,
1461 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1462 'field_description' => __( 'Set custom redirect URL for all or some user roles after login.', 'admin-site-enhancements' ),
1463 'field_options_wrapper' => true,
1464 'field_options_moreless' => true,
1465 'class' => 'asenha-toggle login-logout ' . $field_slug,
1466 )
1467 );
1468 $field_id = 'redirect_after_login_to_slug';
1469 $field_slug = 'redirect-after-login-to-slug';
1470 add_settings_field(
1471 $field_id,
1472 __( 'Redirect to:', 'admin-site-enhancements' ),
1473 [$render_field, 'render_text_subfield'],
1474 ASENHA_SLUG,
1475 'main-section',
1476 array(
1477 'option_name' => ASENHA_SLUG_U,
1478 'field_id' => $field_id,
1479 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1480 'field_type' => 'with-prefix-suffix',
1481 'field_prefix' => site_url() . '/',
1482 'field_suffix' => __( 'for:', 'admin-site-enhancements' ),
1483 'field_placeholder' => '',
1484 'field_description' => '',
1485 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1486 )
1487 );
1488 $field_id = 'redirect_after_login_for';
1489 $field_slug = 'redirect-after-login-for';
1490 if ( is_array( $roles ) ) {
1491 foreach ( $roles as $role_slug => $role_label ) {
1492 // e.g. $role_slug is administrator, $role_label is Administrator
1493 add_settings_field(
1494 $field_id . '_' . $role_slug,
1495 '',
1496 [$render_field, 'render_checkbox_subfield'],
1497 ASENHA_SLUG,
1498 'main-section',
1499 array(
1500 'option_name' => ASENHA_SLUG_U,
1501 'parent_field_id' => $field_id,
1502 'field_id' => $role_slug,
1503 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1504 'field_label' => $role_label,
1505 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1506 )
1507 );
1508 }
1509 }
1510 // Redirect After Logout
1511 $field_id = 'redirect_after_logout';
1512 $field_slug = 'redirect-after-logout';
1513 $field_title = __( 'Redirect After Logout', 'admin-site-enhancements' );
1514 add_settings_field(
1515 $field_id,
1516 $field_title,
1517 [$render_field, 'render_checkbox_toggle'],
1518 ASENHA_SLUG,
1519 'main-section',
1520 array(
1521 'option_name' => ASENHA_SLUG_U,
1522 'field_id' => $field_id,
1523 'field_slug' => $field_slug,
1524 'field_title' => $field_title,
1525 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1526 'field_description' => __( 'Set custom redirect URL for all or some user roles after logout.', 'admin-site-enhancements' ),
1527 'field_options_wrapper' => true,
1528 'field_options_moreless' => true,
1529 'class' => 'asenha-toggle login-logout ' . $field_slug,
1530 )
1531 );
1532 $field_id = 'redirect_after_logout_to_slug';
1533 $field_slug = 'redirect-after-logout-to-slug';
1534 add_settings_field(
1535 $field_id,
1536 __( 'Redirect to:', 'admin-site-enhancements' ),
1537 [$render_field, 'render_text_subfield'],
1538 ASENHA_SLUG,
1539 'main-section',
1540 array(
1541 'option_name' => ASENHA_SLUG_U,
1542 'field_id' => $field_id,
1543 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1544 'field_type' => 'with-prefix-suffix',
1545 'field_prefix' => site_url() . '/',
1546 'field_suffix' => __( 'for:', 'admin-site-enhancements' ),
1547 'field_description' => '',
1548 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1549 )
1550 );
1551 $field_id = 'redirect_after_logout_for';
1552 $field_slug = 'redirect-after-logout-for';
1553 if ( is_array( $roles ) ) {
1554 foreach ( $roles as $role_slug => $role_label ) {
1555 // e.g. $role_slug is administrator, $role_label is Administrator
1556 add_settings_field(
1557 $field_id . '_' . $role_slug,
1558 '',
1559 [$render_field, 'render_checkbox_subfield'],
1560 ASENHA_SLUG,
1561 'main-section',
1562 array(
1563 'option_name' => ASENHA_SLUG_U,
1564 'parent_field_id' => $field_id,
1565 'field_id' => $role_slug,
1566 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1567 'field_label' => $role_label,
1568 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1569 )
1570 );
1571 }
1572 }
1573 // Enable Custom Admin CSS
1574 $field_id = 'enable_custom_admin_css';
1575 $field_slug = 'enable-custom-admin-css';
1576 $field_title = __( 'Custom Admin CSS', 'admin-site-enhancements' );
1577 add_settings_field(
1578 $field_id,
1579 $field_title,
1580 [$render_field, 'render_checkbox_toggle'],
1581 ASENHA_SLUG,
1582 'main-section',
1583 array(
1584 'option_name' => ASENHA_SLUG_U,
1585 'field_id' => $field_id,
1586 'field_slug' => $field_slug,
1587 'field_title' => $field_title,
1588 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1589 'field_description' => __( 'Add custom CSS on all admin pages for all user roles.', 'admin-site-enhancements' ),
1590 'field_options_wrapper' => true,
1591 'field_options_moreless' => true,
1592 'class' => 'asenha-toggle custom-code ' . $field_slug,
1593 )
1594 );
1595 $field_id = 'custom_admin_css';
1596 $field_slug = 'custom-admin-css';
1597 add_settings_field(
1598 $field_id,
1599 '',
1600 [$render_field, 'render_textarea_subfield'],
1601 ASENHA_SLUG,
1602 'main-section',
1603 array(
1604 'option_name' => ASENHA_SLUG_U,
1605 'field_id' => $field_id,
1606 'field_slug' => $field_slug,
1607 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1608 'field_type' => 'textarea',
1609 'field_rows' => 30,
1610 'field_intro' => '',
1611 'field_description' => '',
1612 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1613 )
1614 );
1615 // Enable Custom Frontend CSS
1616 $field_id = 'enable_custom_frontend_css';
1617 $field_slug = 'enable-custom-frontend-css';
1618 $field_title = __( 'Custom Frontend CSS', 'admin-site-enhancements' );
1619 add_settings_field(
1620 $field_id,
1621 $field_title,
1622 [$render_field, 'render_checkbox_toggle'],
1623 ASENHA_SLUG,
1624 'main-section',
1625 array(
1626 'option_name' => ASENHA_SLUG_U,
1627 'field_id' => $field_id,
1628 'field_slug' => $field_slug,
1629 'field_title' => $field_title,
1630 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1631 'field_description' => __( 'Add custom CSS on all frontend pages for all user roles.', 'admin-site-enhancements' ),
1632 'field_options_wrapper' => true,
1633 'field_options_moreless' => true,
1634 'class' => 'asenha-toggle custom-code ' . $field_slug,
1635 )
1636 );
1637 $field_id = 'custom_frontend_css';
1638 $field_slug = 'custom-frontend-css';
1639 add_settings_field(
1640 $field_id,
1641 '',
1642 [$render_field, 'render_textarea_subfield'],
1643 ASENHA_SLUG,
1644 'main-section',
1645 array(
1646 'option_name' => ASENHA_SLUG_U,
1647 'field_id' => $field_id,
1648 'field_slug' => $field_slug,
1649 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1650 'field_type' => 'textarea',
1651 'field_rows' => 30,
1652 'field_intro' => '',
1653 'field_description' => '',
1654 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1655 )
1656 );
1657 // Insert <head>, <body> and <footer> code
1658 $field_id = 'insert_head_body_footer_code';
1659 $field_slug = 'insert-head-body-footer-code';
1660 $field_title = __( 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code', 'admin-site-enhancements' );
1661 add_settings_field(
1662 $field_id,
1663 /* translators: keep &lt;head&gt; &lt;body&gt; &lt;footer&gt; as is in the translation */
1664 $field_title,
1665 [$render_field, 'render_checkbox_toggle'],
1666 ASENHA_SLUG,
1667 'main-section',
1668 array(
1669 'option_name' => ASENHA_SLUG_U,
1670 'field_id' => $field_id,
1671 'field_slug' => $field_slug,
1672 'field_title' => $field_title,
1673 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1674 'field_description' => __( 'Easily insert &lt;meta&gt;, &lt;link&gt;, &lt;script&gt; and &lt;style&gt; tags, Google Analytics, Tag Manager, AdSense, Ads Conversion and Optimize code, Facebook, TikTok and Twitter pixels, etc.', 'admin-site-enhancements' ),
1675 'field_options_wrapper' => true,
1676 'field_options_moreless' => true,
1677 'class' => 'asenha-toggle custom-code ' . $field_slug,
1678 )
1679 );
1680 $field_id = 'disable_code_unslash';
1681 $field_slug = 'disable-code-unslash';
1682 add_settings_field(
1683 $field_id,
1684 '',
1685 [$render_field, 'render_checkbox_plain'],
1686 ASENHA_SLUG,
1687 'main-section',
1688 array(
1689 'option_name' => ASENHA_SLUG_U,
1690 'field_id' => $field_id,
1691 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1692 'field_label' => __( 'Do not remove backslashes from the code output on the frontend', 'admin-site-enhancements' ),
1693 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-bottom custom-code ' . $field_slug,
1694 )
1695 );
1696 $field_id = 'head_code_priority';
1697 $field_slug = 'head-code-priority';
1698 add_settings_field(
1699 $field_id,
1700 '',
1701 [$render_field, 'render_number_subfield'],
1702 ASENHA_SLUG,
1703 'main-section',
1704 array(
1705 'option_name' => ASENHA_SLUG_U,
1706 'field_id' => $field_id,
1707 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1708 'field_type' => 'with-prefix-suffix',
1709 'field_prefix' => __( '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1710 'field_suffix' => '',
1711 'field_intro' => '',
1712 'field_placeholder' => '10',
1713 'field_min' => 0,
1714 'field_max' => PHP_INT_MAX,
1715 'field_description' => __( 'Default is 10. Larger number insert code closer to &lt;/head&gt;', 'admin-site-enhancements' ),
1716 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1717 )
1718 );
1719 $field_id = 'head_code';
1720 $field_slug = 'head-code';
1721 add_settings_field(
1722 $field_id,
1723 '',
1724 [$render_field, 'render_textarea_subfield'],
1725 ASENHA_SLUG,
1726 'main-section',
1727 array(
1728 'option_name' => ASENHA_SLUG_U,
1729 'field_id' => $field_id,
1730 'field_slug' => $field_slug,
1731 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1732 'field_type' => 'textarea',
1733 'field_rows' => 15,
1734 'field_intro' => '',
1735 'field_description' => '',
1736 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1737 )
1738 );
1739 $field_id = 'body_code_priority';
1740 $field_slug = 'body-code-priority';
1741 add_settings_field(
1742 $field_id,
1743 '',
1744 [$render_field, 'render_number_subfield'],
1745 ASENHA_SLUG,
1746 'main-section',
1747 array(
1748 'option_name' => ASENHA_SLUG_U,
1749 'field_id' => $field_id,
1750 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1751 'field_type' => 'with-prefix-suffix',
1752 'field_prefix' => __( '<strong>Code to insert after &lt;body&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1753 'field_suffix' => '',
1754 'field_intro' => '',
1755 'field_placeholder' => '10',
1756 'field_min' => 0,
1757 'field_max' => PHP_INT_MAX,
1758 'field_description' => __( 'Default is 10. Smaller number insert code closer to &lt;body&gt;', 'admin-site-enhancements' ),
1759 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1760 )
1761 );
1762 $field_id = 'body_code';
1763 $field_slug = 'body-code';
1764 add_settings_field(
1765 $field_id,
1766 '',
1767 [$render_field, 'render_textarea_subfield'],
1768 ASENHA_SLUG,
1769 'main-section',
1770 array(
1771 'option_name' => ASENHA_SLUG_U,
1772 'field_id' => $field_id,
1773 'field_slug' => $field_slug,
1774 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1775 'field_type' => 'textarea',
1776 'field_rows' => 15,
1777 'field_intro' => '',
1778 'field_description' => '',
1779 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1780 )
1781 );
1782 $field_id = 'footer_code_priority';
1783 $field_slug = 'footer-code-priority';
1784 add_settings_field(
1785 $field_id,
1786 '',
1787 [$render_field, 'render_number_subfield'],
1788 ASENHA_SLUG,
1789 'main-section',
1790 array(
1791 'option_name' => ASENHA_SLUG_U,
1792 'field_id' => $field_id,
1793 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1794 'field_type' => 'with-prefix-suffix',
1795 'field_prefix' => __( '<strong>Code to insert in footer section before &lt;/body&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1796 'field_suffix' => '',
1797 'field_intro' => '',
1798 'field_placeholder' => '10',
1799 'field_min' => 0,
1800 'field_max' => PHP_INT_MAX,
1801 'field_description' => __( 'Default is 10. Larger number insert code closer to &lt;/body&gt;', 'admin-site-enhancements' ),
1802 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1803 )
1804 );
1805 $field_id = 'footer_code';
1806 $field_slug = 'footer-code';
1807 add_settings_field(
1808 $field_id,
1809 '',
1810 [$render_field, 'render_textarea_subfield'],
1811 ASENHA_SLUG,
1812 'main-section',
1813 array(
1814 'option_name' => ASENHA_SLUG_U,
1815 'field_id' => $field_id,
1816 'field_slug' => $field_slug,
1817 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1818 'field_type' => 'textarea',
1819 'field_rows' => 15,
1820 'field_intro' => '',
1821 'field_description' => '',
1822 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1823 )
1824 );
1825 // Custom Body Class
1826 $field_id = 'enable_custom_body_class';
1827 $field_slug = 'enable-custom-body-class';
1828 $field_title = __( 'Custom Body Class', 'admin-site-enhancements' );
1829 add_settings_field(
1830 $field_id,
1831 $field_title,
1832 [$render_field, 'render_checkbox_toggle'],
1833 ASENHA_SLUG,
1834 'main-section',
1835 array(
1836 'option_name' => ASENHA_SLUG_U,
1837 'field_id' => $field_id,
1838 'field_slug' => $field_slug,
1839 'field_title' => $field_title,
1840 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1841 'field_description' => __( 'Add custom &lt;body&gt; class(es) on the singular view of some or all public post types. Compatible with classes already added using <a href="https://wordpress.org/plugins/wp-custom-body-class" target="_blank">Custom Body Class plugin</a>.', 'admin-site-enhancements' ),
1842 'field_options_wrapper' => true,
1843 'field_options_moreless' => true,
1844 'class' => 'asenha-toggle custom-code ' . $field_slug,
1845 )
1846 );
1847 $field_id = 'enable_custom_body_class_for';
1848 $field_slug = 'enable-custom-body-class-for';
1849 if ( is_array( $asenha_public_post_types ) ) {
1850 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
1851 // e.g. $post_type_slug is post, $post_type_label is Posts
1852 if ( 'attachment' != $post_type_slug ) {
1853 add_settings_field(
1854 $field_id . '_' . $post_type_slug,
1855 '',
1856 [$render_field, 'render_checkbox_subfield'],
1857 ASENHA_SLUG,
1858 'main-section',
1859 array(
1860 'option_name' => ASENHA_SLUG_U,
1861 'parent_field_id' => $field_id,
1862 'field_id' => $post_type_slug,
1863 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
1864 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
1865 'class' => 'asenha-checkbox asenha-hide-th asenha-half custom-code ' . $field_slug . ' ' . $post_type_slug,
1866 )
1867 );
1868 }
1869 }
1870 }
1871 // Manage ads.txt and app-ads.txt
1872 $field_id = 'manage_ads_appads_txt';
1873 $field_slug = 'manage-ads-appads-txt';
1874 $field_title = __( 'Manage ads.txt and app-ads.txt', 'admin-site-enhancements' );
1875 add_settings_field(
1876 $field_id,
1877 $field_title,
1878 [$render_field, 'render_checkbox_toggle'],
1879 ASENHA_SLUG,
1880 'main-section',
1881 array(
1882 'option_name' => ASENHA_SLUG_U,
1883 'field_id' => $field_id,
1884 'field_slug' => $field_slug,
1885 'field_title' => $field_title,
1886 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1887 'field_description' => __( 'Easily edit and validate your <a href="/ads.txt" target="_blank">ads.txt</a> and <a href="/app-ads.txt" target="_blank">app-ads.txt</a> content.', 'admin-site-enhancements' ),
1888 'field_options_wrapper' => true,
1889 'field_options_moreless' => true,
1890 'class' => 'asenha-toggle custom-code ' . $field_slug,
1891 )
1892 );
1893 $field_id = 'ads_txt_content';
1894 $field_slug = 'ads-txt-content';
1895 $ads_txt_url_urlencoded = urlencode( site_url( 'ads.txt' ) );
1896 $ads_txt_str_replaced = str_replace( '.', '-', sanitize_text_field( $_SERVER['SERVER_NAME'] ) );
1897 add_settings_field(
1898 $field_id,
1899 '',
1900 [$render_field, 'render_textarea_subfield'],
1901 ASENHA_SLUG,
1902 'main-section',
1903 array(
1904 'option_name' => ASENHA_SLUG_U,
1905 'field_id' => $field_id,
1906 'field_slug' => $field_slug,
1907 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1908 'field_type' => 'textarea',
1909 'field_rows' => 15,
1910 'field_intro' => __( '<strong>Your ads.txt content:</strong>', 'admin-site-enhancements' ),
1911 'field_description' => __( 'Validate with:', 'admin-site-enhancements' ) . ' <a href="https://adstxt.guru/validator/url/?url=' . $ads_txt_url_urlencoded . '" target="_blank">adstxt.guru</a> | <a href="https://www.adstxtvalidator.com/ads_txt/' . $ads_txt_str_replaced . '" target="_blank">adstxtvalidator.com</a><div class="vspacer"></div>',
1912 'admin-site-enhancements',
1913 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1914 )
1915 );
1916 $field_id = 'app_ads_txt_content';
1917 $field_slug = 'app-ads-txt-content';
1918 $appads_txt_url_urlencoded = urlencode( site_url( 'app-ads.txt' ) );
1919 add_settings_field(
1920 $field_id,
1921 '',
1922 [$render_field, 'render_textarea_subfield'],
1923 ASENHA_SLUG,
1924 'main-section',
1925 array(
1926 'option_name' => ASENHA_SLUG_U,
1927 'field_id' => $field_id,
1928 'field_slug' => $field_slug,
1929 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1930 'field_type' => 'textarea',
1931 'field_rows' => 15,
1932 'field_intro' => __( '<strong>Your app-ads.txt content:</strong>', 'admin-site-enhancements' ),
1933 'field_description' => __( 'Validate with:', 'admin-site-enhancements' ) . ' <a href="https://adstxt.guru/validator/url/?url=' . $appads_txt_url_urlencoded . '" target="_blank">adstxt.guru</a>',
1934 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1935 )
1936 );
1937 // Manage robots.txt
1938 $field_id = 'manage_robots_txt';
1939 $field_slug = 'manage-robots-txt';
1940 $field_title = __( 'Manage robots.txt', 'admin-site-enhancements' );
1941 add_settings_field(
1942 $field_id,
1943 $field_title,
1944 [$render_field, 'render_checkbox_toggle'],
1945 ASENHA_SLUG,
1946 'main-section',
1947 array(
1948 'option_name' => ASENHA_SLUG_U,
1949 'field_id' => $field_id,
1950 'field_slug' => $field_slug,
1951 'field_title' => $field_title,
1952 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1953 'field_description' => __( 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.', 'admin-site-enhancements' ),
1954 'field_options_wrapper' => true,
1955 'field_options_moreless' => true,
1956 'class' => 'asenha-toggle custom-code ' . $field_slug,
1957 )
1958 );
1959 $field_id = 'robots_txt_content';
1960 $field_slug = 'robots-txt-content';
1961 $robots_txt_url_urlencoded = urlencode( site_url( 'robots.txt' ) );
1962 add_settings_field(
1963 $field_id,
1964 '',
1965 [$render_field, 'render_textarea_subfield'],
1966 ASENHA_SLUG,
1967 'main-section',
1968 array(
1969 'option_name' => ASENHA_SLUG_U,
1970 'field_id' => $field_id,
1971 'field_slug' => $field_slug,
1972 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1973 'field_type' => 'textarea',
1974 'field_rows' => 20,
1975 'field_intro' => '',
1976 'field_description' => __( 'Validate with:', 'admin-site-enhancements' ) . ' <a href="https://www.websiteplanet.com/webtools/robots-txt/?url=' . $robots_txt_url_urlencoded . '" target="_blank">websiteplanet.com</a> | <a href="https://seositecheckup.com/tools/robotstxt-test" target="_blank">seositecheckup.tools</a><div class="vspacer"></div>',
1977 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1978 )
1979 );
1980 // =================================================================
1981 // DISABLE COMPONENTS
1982 // =================================================================
1983 // Disable Gutenberg
1984 $field_id = 'disable_gutenberg';
1985 $field_slug = 'disable-gutenberg';
1986 $field_title = __( 'Disable Gutenberg', 'admin-site-enhancements' );
1987 add_settings_field(
1988 $field_id,
1989 $field_title,
1990 [$render_field, 'render_checkbox_toggle'],
1991 ASENHA_SLUG,
1992 'main-section',
1993 array(
1994 'option_name' => ASENHA_SLUG_U,
1995 'field_id' => $field_id,
1996 'field_slug' => $field_slug,
1997 'field_title' => $field_title,
1998 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1999 'field_description' => __( 'Disable the Gutenberg block editor for some or all applicable post types.', 'admin-site-enhancements' ),
2000 'field_options_wrapper' => true,
2001 'field_options_moreless' => true,
2002 'class' => 'asenha-toggle disable-components ' . $field_slug,
2003 )
2004 );
2005 $field_id = 'disable_gutenberg_for';
2006 $field_slug = 'disable-gutenberg-for';
2007 if ( is_array( $asenha_gutenberg_post_types ) ) {
2008 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) {
2009 // e.g. $post_type_slug is post, $post_type_label is Posts
2010 add_settings_field(
2011 $field_id . '_' . $post_type_slug,
2012 '',
2013 [$render_field, 'render_checkbox_subfield'],
2014 ASENHA_SLUG,
2015 'main-section',
2016 array(
2017 'option_name' => ASENHA_SLUG_U,
2018 'parent_field_id' => $field_id,
2019 'field_id' => $post_type_slug,
2020 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2021 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2022 'class' => 'asenha-checkbox asenha-checkbox-item asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2023 )
2024 );
2025 }
2026 }
2027 $field_id = 'disable_gutenberg_frontend_styles';
2028 $field_slug = 'disable-gutenberg-frontend-styles';
2029 add_settings_field(
2030 $field_id,
2031 '',
2032 [$render_field, 'render_checkbox_plain'],
2033 ASENHA_SLUG,
2034 'main-section',
2035 array(
2036 'option_name' => ASENHA_SLUG_U,
2037 'field_id' => $field_id,
2038 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2039 'field_label' => __( 'Also disable frontend block styles / CSS files for the selected post types.', 'admin-site-enhancements' ),
2040 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug,
2041 )
2042 );
2043 // Disable Comments
2044 $field_id = 'disable_comments';
2045 $field_slug = 'disable-comments';
2046 $field_title = __( 'Disable Comments', 'admin-site-enhancements' );
2047 add_settings_field(
2048 $field_id,
2049 $field_title,
2050 [$render_field, 'render_checkbox_toggle'],
2051 ASENHA_SLUG,
2052 'main-section',
2053 array(
2054 'option_name' => ASENHA_SLUG_U,
2055 'field_id' => $field_id,
2056 'field_slug' => $field_slug,
2057 'field_title' => $field_title,
2058 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2059 'field_description' => __( 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.', 'admin-site-enhancements' ),
2060 'field_options_wrapper' => true,
2061 'field_options_moreless' => true,
2062 'class' => 'asenha-toggle disable-components ' . $field_slug,
2063 )
2064 );
2065 $field_id = 'disable_comments_for';
2066 $field_slug = 'disable-comments-for';
2067 if ( is_array( $asenha_public_post_types ) ) {
2068 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
2069 // e.g. $post_type_slug is post, $post_type_label is Posts
2070 if ( post_type_supports( $post_type_slug, 'comments' ) ) {
2071 add_settings_field(
2072 $field_id . '_' . $post_type_slug,
2073 '',
2074 [$render_field, 'render_checkbox_subfield'],
2075 ASENHA_SLUG,
2076 'main-section',
2077 array(
2078 'option_name' => ASENHA_SLUG_U,
2079 'parent_field_id' => $field_id,
2080 'field_id' => $post_type_slug,
2081 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2082 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2083 'class' => 'asenha-checkbox asenha-checkbox-item asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2084 )
2085 );
2086 }
2087 }
2088 }
2089 // Disable REST API
2090 $field_id = 'disable_rest_api';
2091 $field_slug = 'disable-rest-api';
2092 $field_title = __( 'Disable REST API', 'admin-site-enhancements' );
2093 add_settings_field(
2094 $field_id,
2095 $field_title,
2096 [$render_field, 'render_checkbox_toggle'],
2097 ASENHA_SLUG,
2098 'main-section',
2099 array(
2100 'option_name' => ASENHA_SLUG_U,
2101 'field_id' => $field_id,
2102 'field_slug' => $field_slug,
2103 'field_title' => $field_title,
2104 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2105 'field_description' => __( 'Disable REST API access for non-authenticated users and remove URL traces from &lt;head&gt;, HTTP headers and WP RSD endpoint.', 'admin-site-enhancements' ),
2106 'field_options_wrapper' => true,
2107 'field_options_moreless' => true,
2108 'class' => 'asenha-toggle disable-components ' . $field_slug,
2109 )
2110 );
2111 // Disable Feeds
2112 $field_id = 'disable_feeds';
2113 $field_slug = 'disable-feeds';
2114 $field_title = __( 'Disable Feeds', 'admin-site-enhancements' );
2115 add_settings_field(
2116 $field_id,
2117 $field_title,
2118 [$render_field, 'render_checkbox_toggle'],
2119 ASENHA_SLUG,
2120 'main-section',
2121 array(
2122 'option_name' => ASENHA_SLUG_U,
2123 'field_id' => $field_id,
2124 'field_slug' => $field_slug,
2125 'field_title' => $field_title,
2126 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2127 'field_description' => __( 'Disable all RSS, Atom and RDF feeds. This includes feeds for posts, categories, tags, comments, authors and search. Also removes traces of feed URLs from &lt;head&gt;.', 'admin-site-enhancements' ),
2128 'field_options_wrapper' => true,
2129 'field_options_moreless' => true,
2130 'class' => 'asenha-toggle disable-components ' . $field_slug,
2131 )
2132 );
2133 // Disable Embeds
2134 $field_id = 'disable_embeds';
2135 $field_slug = 'disable-embeds';
2136 $field_title = __( 'Disable Embeds', 'admin-site-enhancements' );
2137 $oembed_providers_doc = 'https://developer.wordpress.org/advanced-administration/wordpress/oembed/#does-this-work-with-any-url';
2138 add_settings_field(
2139 $field_id,
2140 $field_title,
2141 [$render_field, 'render_checkbox_toggle'],
2142 ASENHA_SLUG,
2143 'main-section',
2144 array(
2145 'option_name' => ASENHA_SLUG_U,
2146 'field_id' => $field_id,
2147 'field_slug' => $field_slug,
2148 'field_title' => $field_title,
2149 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2150 'field_description' => __( 'Prevent your site content from being embedded on other sites.', 'admin-site-enhancements' ) . ' ' . sprintf(
2151 /* translators: %s is URL of WP Dev Resource page */
2152 __( 'Prevent embedding of non-<a href="%s" target="_blank">whitelisted</a> sites in your site.', 'admin-site-enhancements' ),
2153 $oembed_providers_doc
2154 ) . ' ' . __( 'Disable all, related JavaScript.', 'admin-site-enhancements' ) . ' ' . __( 'Removes support for the embed block.', 'admin-site-enhancements' ),
2155 'field_options_wrapper' => true,
2156 'field_options_moreless' => true,
2157 'class' => 'asenha-toggle disable-components ' . $field_slug,
2158 )
2159 );
2160 // Disable Auto Updates
2161 $field_id = 'disable_all_updates';
2162 $field_slug = 'disable-all-updates';
2163 $field_title = __( 'Disable All Updates', 'admin-site-enhancements' );
2164 add_settings_field(
2165 $field_id,
2166 $field_title,
2167 [$render_field, 'render_checkbox_toggle'],
2168 ASENHA_SLUG,
2169 'main-section',
2170 array(
2171 'option_name' => ASENHA_SLUG_U,
2172 'field_id' => $field_id,
2173 'field_slug' => $field_slug,
2174 'field_title' => $field_title,
2175 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2176 'field_description' => __( 'Completely disable core, theme and plugin updates and auto-updates. Will also disable update checks, notices and emails.', 'admin-site-enhancements' ),
2177 'field_options_wrapper' => true,
2178 'field_options_moreless' => true,
2179 'class' => 'asenha-toggle disable-components ' . $field_slug,
2180 )
2181 );
2182 // Disable Author Archives
2183 $field_id = 'disable_author_archives';
2184 $field_slug = 'disable-author-archives';
2185 $field_title = __( 'Disable Author Archives', 'admin-site-enhancements' );
2186 add_settings_field(
2187 $field_id,
2188 $field_title,
2189 [$render_field, 'render_checkbox_toggle'],
2190 ASENHA_SLUG,
2191 'main-section',
2192 array(
2193 'option_name' => ASENHA_SLUG_U,
2194 'field_id' => $field_id,
2195 'field_slug' => $field_slug,
2196 'field_title' => $field_title,
2197 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2198 'field_description' => __( 'Return 404 (Not Found) error when trying to load author archives. Remove or disable links to author archives. Remove authors archives from the sitemap.', 'admin-site-enhancements' ),
2199 'field_options_wrapper' => true,
2200 'field_options_moreless' => true,
2201 'class' => 'asenha-toggle disable-components ' . $field_slug,
2202 )
2203 );
2204 // Disable Smaller Components
2205 $field_id = 'disable_smaller_components';
2206 $field_slug = 'disable-smaller-components';
2207 $field_title = __( 'Disable Smaller Components', 'admin-site-enhancements' );
2208 add_settings_field(
2209 $field_id,
2210 $field_title,
2211 [$render_field, 'render_checkbox_toggle'],
2212 ASENHA_SLUG,
2213 'main-section',
2214 array(
2215 'option_name' => ASENHA_SLUG_U,
2216 'field_id' => $field_id,
2217 'field_slug' => $field_slug,
2218 'field_title' => $field_title,
2219 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2220 'field_description' => __( 'Prevent smaller components from running or loading. Make the site more secure, load slightly faster and be more optimized for crawling by search engines.', 'admin-site-enhancements' ),
2221 'field_options_wrapper' => true,
2222 'field_options_moreless' => true,
2223 'class' => 'asenha-toggle disable-components ' . $field_slug,
2224 )
2225 );
2226 $field_id = 'disable_head_generator_tag';
2227 $field_slug = 'disable-head-generator-tag';
2228 add_settings_field(
2229 $field_id,
2230 '',
2231 [$render_field, 'render_checkbox_plain'],
2232 ASENHA_SLUG,
2233 'main-section',
2234 array(
2235 'option_name' => ASENHA_SLUG_U,
2236 'field_id' => $field_id,
2237 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2238 'field_label' => __( 'Disable the <strong>generator &lt;meta&gt; tag</strong> in &lt;head&gt;, which discloses the WordPress version number. Older versions(s) might contain unpatched security loophole(s).', 'admin-site-enhancements' ),
2239 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2240 )
2241 );
2242 $field_id = 'disable_feed_generator_tag';
2243 $field_slug = 'disable-feed-generator-tag';
2244 add_settings_field(
2245 $field_id,
2246 '',
2247 [$render_field, 'render_checkbox_plain'],
2248 ASENHA_SLUG,
2249 'main-section',
2250 array(
2251 'option_name' => ASENHA_SLUG_U,
2252 'field_id' => $field_id,
2253 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2254 'field_label' => __( 'Disable the <strong>&lt;generator&gt; tag</strong> in RSS feed &lt;channel&gt;, which discloses the WordPress version number. Older versions(s) might contain unpatched security loophole(s).', 'admin-site-enhancements' ),
2255 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2256 )
2257 );
2258 $field_id = 'disable_resource_version_number';
2259 $field_slug = 'disable-resource-version-number';
2260 add_settings_field(
2261 $field_id,
2262 '',
2263 [$render_field, 'render_checkbox_plain'],
2264 ASENHA_SLUG,
2265 'main-section',
2266 array(
2267 'option_name' => ASENHA_SLUG_U,
2268 'field_id' => $field_id,
2269 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2270 'field_label' => __( 'Disable <strong>version number</strong> on static resource URLs referenced in &lt;head&gt;, which can disclose WordPress version number. Older versions(s) might contain unpatched security loophole(s). Applies to non-logged-in view of pages. This will also increase cacheability of static assets, but may have unintended consequences. Make sure you know what you are doing.', 'admin-site-enhancements' ),
2271 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2272 )
2273 );
2274 $field_id = 'disable_head_wlwmanifest_tag';
2275 $field_slug = 'disable-head-wlwmanifest-tag';
2276 add_settings_field(
2277 $field_id,
2278 '',
2279 [$render_field, 'render_checkbox_plain'],
2280 ASENHA_SLUG,
2281 'main-section',
2282 array(
2283 'option_name' => ASENHA_SLUG_U,
2284 'field_id' => $field_id,
2285 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2286 'field_label' => __( 'Disable the <strong>Windows Live Writer (WLW) manifest &lt;link&gt; tag</strong> in &lt;head&gt;. The WLW app was discontinued in 2017.', 'admin-site-enhancements' ),
2287 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2288 )
2289 );
2290 $field_id = 'disable_head_rsd_tag';
2291 $field_slug = 'disable-head-rsd-tag';
2292 add_settings_field(
2293 $field_id,
2294 '',
2295 [$render_field, 'render_checkbox_plain'],
2296 ASENHA_SLUG,
2297 'main-section',
2298 array(
2299 'option_name' => ASENHA_SLUG_U,
2300 'field_id' => $field_id,
2301 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2302 'field_label' => __( 'Disable the <strong>Really Simple Discovery (RSD) &lt;link&gt; tag</strong> in &lt;head&gt;. It\'s not needed if your site is not using pingback or remote (XML-RPC) client to manage posts.', 'admin-site-enhancements' ),
2303 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2304 )
2305 );
2306 $field_id = 'disable_head_shortlink_tag';
2307 $field_slug = 'disable-head-shortlink-tag';
2308 add_settings_field(
2309 $field_id,
2310 '',
2311 [$render_field, 'render_checkbox_plain'],
2312 ASENHA_SLUG,
2313 'main-section',
2314 array(
2315 'option_name' => ASENHA_SLUG_U,
2316 'field_id' => $field_id,
2317 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2318 'field_label' => __( 'Disable the default <strong>WordPress shortlink &lt;link&gt; tag</strong> in &lt;head&gt;. Ignored by search engines and has minimal practical use case. Usually, a dedicated shortlink plugin or service is preferred that allows for nice names in the short links and tracking of clicks when sharing the link on social media.', 'admin-site-enhancements' ),
2319 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2320 )
2321 );
2322 $field_id = 'disable_frontend_dashicons';
2323 $field_slug = 'disable-frontend-dashicons';
2324 add_settings_field(
2325 $field_id,
2326 '',
2327 [$render_field, 'render_checkbox_plain'],
2328 ASENHA_SLUG,
2329 'main-section',
2330 array(
2331 'option_name' => ASENHA_SLUG_U,
2332 'field_id' => $field_id,
2333 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2334 'field_label' => __( 'Disable loading of <strong>Dashicons CSS and JS files</strong> on the front-end for public site visitors. This might break the layout or design of custom forms, including custom login forms, if they depend on Dashicons. Make sure to check those forms after disabling.', 'admin-site-enhancements' ),
2335 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2336 )
2337 );
2338 $field_id = 'disable_emoji_support';
2339 $field_slug = 'disable-emoji-support';
2340 add_settings_field(
2341 $field_id,
2342 '',
2343 [$render_field, 'render_checkbox_plain'],
2344 ASENHA_SLUG,
2345 'main-section',
2346 array(
2347 'option_name' => ASENHA_SLUG_U,
2348 'field_id' => $field_id,
2349 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2350 'field_label' => __( 'Disable <strong>emoji support for pages, posts and custom post types</strong> on the admin and frontend. The support is primarily useful for older browsers that do not have native support for it. Most modern browsers across different OSes and devices now have native support for it.', 'admin-site-enhancements' ),
2351 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2352 )
2353 );
2354 $field_id = 'disable_jquery_migrate';
2355 $field_slug = 'disable-jquery-migrate';
2356 add_settings_field(
2357 $field_id,
2358 '',
2359 [$render_field, 'render_checkbox_plain'],
2360 ASENHA_SLUG,
2361 'main-section',
2362 array(
2363 'option_name' => ASENHA_SLUG_U,
2364 'field_id' => $field_id,
2365 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2366 'field_label' => __( 'Disable <strong>jQuery Migrate</strong> script on the frontend, which should no longer be needed if your site uses modern theme and plugins.', 'admin-site-enhancements' ),
2367 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2368 )
2369 );
2370 $field_id = 'disable_block_widgets';
2371 $field_slug = 'disable-block-widgets';
2372 add_settings_field(
2373 $field_id,
2374 '',
2375 [$render_field, 'render_checkbox_plain'],
2376 ASENHA_SLUG,
2377 'main-section',
2378 array(
2379 'option_name' => ASENHA_SLUG_U,
2380 'field_id' => $field_id,
2381 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2382 'field_label' => __( 'Disable <strong>block-based widgets settings screen</strong>. Restores the classic widgets settings screen when using a classic (non-block) theme. This has no effect on block themes.', 'admin-site-enhancements' ),
2383 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2384 )
2385 );
2386 $field_id = 'disable_lazy_load';
2387 $field_slug = 'disable-lazy-load';
2388 add_settings_field(
2389 $field_id,
2390 '',
2391 [$render_field, 'render_checkbox_plain'],
2392 ASENHA_SLUG,
2393 'main-section',
2394 array(
2395 'option_name' => ASENHA_SLUG_U,
2396 'field_id' => $field_id,
2397 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2398 'field_label' => __( 'Disable <strong>lazy loading of images</strong> that was natively added since WordPress v5.5.', 'admin-site-enhancements' ),
2399 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2400 )
2401 );
2402 $field_id = 'disable_application_passwords';
2403 $field_slug = 'disable-application-passwords';
2404 add_settings_field(
2405 $field_id,
2406 '',
2407 [$render_field, 'render_checkbox_plain'],
2408 ASENHA_SLUG,
2409 'main-section',
2410 array(
2411 'option_name' => ASENHA_SLUG_U,
2412 'field_id' => $field_id,
2413 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2414 'field_label' => __( 'Disable <strong>application passwords</strong> that was added since WordPress v5.6.', 'admin-site-enhancements' ),
2415 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2416 )
2417 );
2418 $field_id = 'disable_plugin_theme_editor';
2419 $field_slug = 'disable-plugin-theme-editor';
2420 $is_wpconfig_writeable = $wp_config->wpconfig_file( 'writeability' );
2421 $disallow_file_edit_exists = $wp_config->exists( 'constant', 'DISALLOW_FILE_EDIT' );
2422 if ( $is_wpconfig_writeable ) {
2423 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>.', 'admin-site-enhancements' );
2424 } else {
2425 if ( $disallow_file_edit_exists ) {
2426 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that wp-config.php in this site is not writeable and <code>DISALLOW_FILE_EDIT</code> constant is already defined there. You either need to make it writeable to make this setting functional, or, you need to manually change the value of <code>DISALLOW_FILE_EDIT</code> there.</span>', 'admin-site-enhancements' );
2427 } else {
2428 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>.', 'admin-site-enhancements' );
2429 }
2430 }
2431 add_settings_field(
2432 $field_id,
2433 '',
2434 [$render_field, 'render_checkbox_plain'],
2435 ASENHA_SLUG,
2436 'main-section',
2437 array(
2438 'option_name' => ASENHA_SLUG_U,
2439 'field_id' => $field_id,
2440 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2441 'field_label' => $field_label,
2442 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2443 )
2444 );
2445 // =================================================================
2446 // SECURITY
2447 // =================================================================
2448 // Limit Login Attempts
2449 $field_id = 'limit_login_attempts';
2450 $field_slug = 'limit-login-attempts';
2451 $field_title = __( 'Limit Login Attempts', 'admin-site-enhancements' );
2452 add_settings_field(
2453 $field_id,
2454 $field_title,
2455 [$render_field, 'render_checkbox_toggle'],
2456 ASENHA_SLUG,
2457 'main-section',
2458 array(
2459 'option_name' => ASENHA_SLUG_U,
2460 'field_id' => $field_id,
2461 'field_slug' => $field_slug,
2462 'field_title' => $field_title,
2463 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2464 'field_description' => __( 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', 'admin-site-enhancements' ),
2465 'field_options_wrapper' => true,
2466 'field_options_moreless' => true,
2467 'class' => 'asenha-toggle security ' . $field_slug,
2468 )
2469 );
2470 $field_id = 'login_fails_allowed';
2471 $field_slug = 'login-fails-allowed';
2472 add_settings_field(
2473 $field_id,
2474 '',
2475 [$render_field, 'render_number_subfield'],
2476 ASENHA_SLUG,
2477 'main-section',
2478 array(
2479 'option_name' => ASENHA_SLUG_U,
2480 'field_id' => $field_id,
2481 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2482 'field_type' => 'with-prefix-suffix',
2483 'field_prefix' => '',
2484 'field_suffix' => __( 'failed login attempts allowed before 15 minutes lockout', 'admin-site-enhancements' ),
2485 'field_intro' => '',
2486 'field_placeholder' => '3',
2487 'field_min' => 1,
2488 'field_max' => 10,
2489 'field_description' => '',
2490 'class' => 'asenha-text with-prefix-suffix extra-narrow no-margin security ' . $field_slug,
2491 )
2492 );
2493 $field_id = 'login_lockout_maxcount';
2494 $field_slug = 'login-lockout-maxcount';
2495 add_settings_field(
2496 $field_id,
2497 '',
2498 [$render_field, 'render_number_subfield'],
2499 ASENHA_SLUG,
2500 'main-section',
2501 array(
2502 'option_name' => ASENHA_SLUG_U,
2503 'field_id' => $field_id,
2504 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2505 'field_type' => 'with-prefix-suffix',
2506 'field_prefix' => '',
2507 'field_suffix' => __( 'lockout(s) will block further login attempts for 24 hours', 'admin-site-enhancements' ),
2508 'field_intro' => '',
2509 'field_placeholder' => '3',
2510 'field_min' => 1,
2511 'field_max' => 10,
2512 'field_description' => '',
2513 'class' => 'asenha-text with-prefix-suffix extra-narrow no-margin security ' . $field_slug,
2514 )
2515 );
2516 $field_id = 'limit_login_attempts_header_override';
2517 $field_slug = 'limit-login-attempts-header-override';
2518 add_settings_field(
2519 $field_id,
2520 __( '<span class="field-sublabel sublabel-wide">Detect IP address from the following header first:</span>', 'admin-site-enhancements' ),
2521 [$render_field, 'render_text_subfield'],
2522 ASENHA_SLUG,
2523 'main-section',
2524 array(
2525 'option_name' => ASENHA_SLUG_U,
2526 'field_id' => $field_id,
2527 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2528 'field_type' => '',
2529 'field_prefix' => '',
2530 'field_suffix' => '',
2531 'field_description' => '',
2532 'class' => 'asenha-text with-prefix-suffix full-width flex-column security ' . $field_slug,
2533 )
2534 );
2535 $field_id = 'limit_login_attempts_header_override_description';
2536 $field_slug = 'limit-login-attempts-header-override-description';
2537 add_settings_field(
2538 $field_id,
2539 '',
2540 [$render_field, 'render_description_subfield'],
2541 ASENHA_SLUG,
2542 'main-section',
2543 array(
2544 'option_name' => ASENHA_SLUG_U,
2545 'field_description' => __( 'For example, if your site is behind a trusted proxy, it\'s a good idea to use the <code>HTTP_X_FORWARDED_FOR</code> header. Leave empty to use the default detection method.' ),
2546 'class' => 'asenha-description security ' . $field_slug,
2547 )
2548 );
2549 $field_id = 'login_attempts_log_table';
2550 $field_slug = 'login-attempts-log-table';
2551 add_settings_field(
2552 $field_id,
2553 __( 'Failed login attempts:', 'admin-site-enhancements' ),
2554 [$render_field, 'render_datatable'],
2555 ASENHA_SLUG,
2556 'main-section',
2557 array(
2558 'option_name' => ASENHA_SLUG_U,
2559 'field_id' => $field_id,
2560 'field_slug' => $field_slug,
2561 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2562 'field_type' => 'datatable',
2563 'field_description' => __( 'Only the latest 1,000 entries are kept in the database.', 'admin-site-enhancements' ),
2564 'class' => 'asenha-text datatable margin-top-16 security ' . $field_slug,
2565 'table_title' => __( 'Failed Login Attempts Log', 'admin-site-enhancements' ),
2566 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
2567 )
2568 );
2569 // Obfuscate Author Slugs
2570 $field_id = 'obfuscate_author_slugs';
2571 $field_slug = 'obfuscate-author-slugs';
2572 $field_title = __( 'Obfuscate Author Slugs', 'admin-site-enhancements' );
2573 add_settings_field(
2574 $field_id,
2575 $field_title,
2576 [$render_field, 'render_checkbox_toggle'],
2577 ASENHA_SLUG,
2578 'main-section',
2579 array(
2580 'option_name' => ASENHA_SLUG_U,
2581 'field_id' => $field_id,
2582 'field_slug' => $field_slug,
2583 'field_title' => $field_title,
2584 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2585 'field_description' => __( 'Obfuscate publicly exposed author page URLs that shows the user slugs / usernames, e.g. <em>sitename.com/author/username1/</em> into <em>sitename.com/author/a6r5b8ytu9gp34bv/</em>, and output 404 errors for the original URLs. Also obfuscates in /wp-json/wp/v2/users/ REST API endpoint.', 'admin-site-enhancements' ),
2586 'field_options_wrapper' => false,
2587 'class' => 'asenha-toggle security ' . $field_slug,
2588 )
2589 );
2590 // Obfuscate Email Address
2591 $field_id = 'obfuscate_email_address';
2592 $field_slug = 'obfuscate-email-address';
2593 $field_title = __( 'Email Address Obfuscator', 'admin-site-enhancements' );
2594 add_settings_field(
2595 $field_id,
2596 $field_title,
2597 [$render_field, 'render_checkbox_toggle'],
2598 ASENHA_SLUG,
2599 'main-section',
2600 array(
2601 'option_name' => ASENHA_SLUG_U,
2602 'field_id' => $field_id,
2603 'field_slug' => $field_slug,
2604 'field_title' => $field_title,
2605 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2606 'field_description' => __( 'Obfuscate email address to prevent spam bots from harvesting them, but make it readable like a regular email address for human visitors.', 'admin-site-enhancements' ),
2607 'field_options_wrapper' => true,
2608 'field_options_moreless' => true,
2609 'class' => 'asenha-toggle security ' . $field_slug,
2610 )
2611 );
2612 $field_id = 'obfuscate_email_address_description';
2613 $field_slug = 'obfuscate-email-address-description';
2614 $field_description = __( 'Use a shortcode like the following examples to display an email address on the frontend of your site:
2615 <ul>
2616 <li><strong>[obfuscate email="john@example.com"]</strong> to display the email on it\'s own line</li>
2617 <li><strong>[obfuscate email="john@example.com" display="inline"]</strong> to show the email inline</li>
2618 </ul>', 'admin-site-enhancements' );
2619 add_settings_field(
2620 $field_id,
2621 '',
2622 [$render_field, 'render_description_subfield'],
2623 ASENHA_SLUG,
2624 'main-section',
2625 array(
2626 'option_name' => ASENHA_SLUG_U,
2627 'field_description' => $field_description,
2628 'class' => 'asenha-description security ' . $field_slug,
2629 )
2630 );
2631 // Disable XML-RPC
2632 $field_id = 'disable_xmlrpc';
2633 $field_slug = 'disable-xmlrpc';
2634 $field_title = __( 'Disable XML-RPC', 'admin-site-enhancements' );
2635 add_settings_field(
2636 $field_id,
2637 $field_title,
2638 [$render_field, 'render_checkbox_toggle'],
2639 ASENHA_SLUG,
2640 'main-section',
2641 array(
2642 'option_name' => ASENHA_SLUG_U,
2643 'field_id' => $field_id,
2644 'field_slug' => $field_slug,
2645 'field_title' => $field_title,
2646 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2647 'field_description' => __( 'Protect your site from brute force, DOS and DDOS attacks via <a href="https://kinsta.com/blog/xmlrpc-php/#what-is-xmlrpcphp" target="_blank">XML-RPC</a>. Also disables trackbacks and pingbacks.', 'admin-site-enhancements' ),
2648 'field_options_wrapper' => false,
2649 'class' => 'asenha-toggle security ' . $field_slug,
2650 )
2651 );
2652 // =================================================================
2653 // OPTIMIZATIONS
2654 // =================================================================
2655 // Image Upload Control
2656 $field_id = 'image_upload_control';
2657 $field_slug = 'image-upload-control';
2658 $field_title = __( 'Image Upload Control', 'admin-site-enhancements' );
2659 add_settings_field(
2660 $field_id,
2661 $field_title,
2662 [$render_field, 'render_checkbox_toggle'],
2663 ASENHA_SLUG,
2664 'main-section',
2665 array(
2666 'option_name' => ASENHA_SLUG_U,
2667 'field_id' => $field_id,
2668 'field_slug' => $field_slug,
2669 'field_title' => $field_title,
2670 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2671 'field_description' => __( 'Resize newly uploaded, large images to a smaller dimension and delete originally uploaded files. BMPs and non-transparent PNGs will be converted to JPGs and resized.', 'admin-site-enhancements' ),
2672 'field_options_wrapper' => true,
2673 'field_options_moreless' => true,
2674 'class' => 'asenha-toggle optimizations ' . $field_slug,
2675 )
2676 );
2677 $field_id = 'image_max_width';
2678 $field_slug = 'image-max-width';
2679 add_settings_field(
2680 $field_id,
2681 '',
2682 [$render_field, 'render_number_subfield'],
2683 ASENHA_SLUG,
2684 'main-section',
2685 array(
2686 'option_name' => ASENHA_SLUG_U,
2687 'field_id' => $field_id,
2688 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2689 'field_type' => 'with-prefix-suffix',
2690 'field_prefix' => '<span class="subfield-prefix">' . __( 'Max width:', 'admin-site-enhancements' ) . '</span>',
2691 'field_suffix' => __( 'pixels. <span class="faded">(Default is 1920 pixels)</span>', 'admin-site-enhancements' ),
2692 'field_intro' => '',
2693 'field_placeholder' => '1920',
2694 'field_min' => 100,
2695 'field_max' => 3840,
2696 'field_description' => '',
2697 'class' => 'asenha-number asenha-hide-th narrow optimizations ' . $field_slug,
2698 )
2699 );
2700 $field_id = 'image_max_height';
2701 $field_slug = 'image-max-height';
2702 add_settings_field(
2703 $field_id,
2704 '',
2705 [$render_field, 'render_number_subfield'],
2706 ASENHA_SLUG,
2707 'main-section',
2708 array(
2709 'option_name' => ASENHA_SLUG_U,
2710 'field_id' => $field_id,
2711 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2712 'field_type' => 'with-prefix-suffix',
2713 'field_prefix' => '<span class="subfield-prefix">' . __( 'Max height:', 'admin-site-enhancements' ) . '</span>',
2714 'field_suffix' => __( 'pixels <span class="faded">(Default is 1920 pixels)</span>', 'admin-site-enhancements' ),
2715 'field_intro' => '',
2716 'field_placeholder' => '1920',
2717 'field_min' => 100,
2718 'field_max' => 10000,
2719 'class' => 'asenha-number asenha-hide-th narrow margin-bottom-4 optimizations ' . $field_slug,
2720 )
2721 );
2722 $field_id = 'image_upload_control_description';
2723 $field_slug = 'image-upload-control-description';
2724 $field_description = __( 'To exclude an image from conversion and resizing, append \'-nr\' suffix to the file name, e.g. bird-photo-4k-nr.jpg', 'admin-site-enhancements' );
2725 add_settings_field(
2726 $field_id,
2727 '',
2728 [$render_field, 'render_description_subfield'],
2729 ASENHA_SLUG,
2730 'main-section',
2731 array(
2732 'option_name' => ASENHA_SLUG_U,
2733 'field_description' => $field_description,
2734 'class' => 'asenha-description top-border optimizations ' . $field_slug,
2735 )
2736 );
2737 // Enable Revisions Control
2738 $field_id = 'enable_revisions_control';
2739 $field_slug = 'enable-revisions-control';
2740 $field_title = __( 'Revisions Control', 'admin-site-enhancements' );
2741 add_settings_field(
2742 $field_id,
2743 $field_title,
2744 [$render_field, 'render_checkbox_toggle'],
2745 ASENHA_SLUG,
2746 'main-section',
2747 array(
2748 'option_name' => ASENHA_SLUG_U,
2749 'field_id' => $field_id,
2750 'field_slug' => $field_slug,
2751 'field_title' => $field_title,
2752 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2753 'field_description' => __( 'Prevent bloating the database by limiting the number of revisions to keep for some or all post types supporting revisions.', 'admin-site-enhancements' ),
2754 'field_options_wrapper' => true,
2755 'field_options_moreless' => true,
2756 'class' => 'asenha-toggle optimizations ' . $field_slug,
2757 )
2758 );
2759 $field_id = 'revisions_max_number';
2760 $field_slug = 'revisions-max-number';
2761 add_settings_field(
2762 $field_id,
2763 '',
2764 [$render_field, 'render_number_subfield'],
2765 ASENHA_SLUG,
2766 'main-section',
2767 array(
2768 'option_name' => ASENHA_SLUG_U,
2769 'field_id' => $field_id,
2770 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2771 'field_type' => 'with-prefix-suffix',
2772 'field_prefix' => __( 'Limit to', 'admin-site-enhancements' ),
2773 'field_suffix' => __( 'revisions for:', 'admin-site-enhancements' ),
2774 'field_intro' => '',
2775 'field_placeholder' => '10',
2776 'field_min' => 1,
2777 'field_max' => 100,
2778 'field_description' => '',
2779 'class' => 'asenha-number asenha-hide-th extra-narrow optimizations ' . $field_slug,
2780 )
2781 );
2782 $field_id = 'enable_revisions_control_for';
2783 $field_slug = 'enable-revisions-control-for';
2784 if ( is_array( $asenha_revisions_post_types ) ) {
2785 // Exclude Bricks builder template CPT as revisions are handled via a constant
2786 // Ref: https://academy.bricksbuilder.io/article/revisions/
2787 unset($asenha_revisions_post_types['bricks_template']);
2788 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) {
2789 // e.g. $post_type_slug is post, $post_type_label is Posts
2790 add_settings_field(
2791 $field_id . '_' . $post_type_slug,
2792 '',
2793 [$render_field, 'render_checkbox_subfield'],
2794 ASENHA_SLUG,
2795 'main-section',
2796 array(
2797 'option_name' => ASENHA_SLUG_U,
2798 'parent_field_id' => $field_id,
2799 'field_id' => $post_type_slug,
2800 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2801 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2802 'class' => 'asenha-checkbox asenha-hide-th asenha-half optimizations ' . $field_slug . ' ' . $post_type_slug,
2803 )
2804 );
2805 }
2806 }
2807 // Enable Heartbeat Control
2808 $field_id = 'enable_heartbeat_control';
2809 $field_slug = 'enable-heartbeat-control';
2810 $field_title = __( 'Heartbeat Control', 'admin-site-enhancements' );
2811 add_settings_field(
2812 $field_id,
2813 $field_title,
2814 [$render_field, 'render_checkbox_toggle'],
2815 ASENHA_SLUG,
2816 'main-section',
2817 array(
2818 'option_name' => ASENHA_SLUG_U,
2819 'field_id' => $field_id,
2820 'field_slug' => $field_slug,
2821 'field_title' => $field_title,
2822 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2823 'field_description' => __( 'Modify the interval of the WordPress heartbeat API or disable it on admin pages, post creation/edit screens and/or the frontend. This will help reduce CPU load on the server.', 'admin-site-enhancements' ),
2824 'field_options_wrapper' => true,
2825 'field_options_moreless' => true,
2826 'class' => 'asenha-toggle optimizations ' . $field_slug,
2827 )
2828 );
2829 $field_id = 'heartbeat_control_for_admin_pages';
2830 $field_slug = 'heartbeat-control-for-admin-pages';
2831 add_settings_field(
2832 $field_id,
2833 __( 'On admin pages', 'admin-site-enhancements' ),
2834 [$render_field, 'render_radio_buttons_subfield'],
2835 ASENHA_SLUG,
2836 'main-section',
2837 array(
2838 'option_name' => ASENHA_SLUG_U,
2839 'field_id' => $field_id,
2840 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2841 'field_radios' => array(
2842 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
2843 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
2844 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
2845 ),
2846 'field_default' => 'default',
2847 'class' => 'asenha-radio-buttons optimizations ' . $field_slug,
2848 )
2849 );
2850 $field_id = 'heartbeat_interval_for_admin_pages';
2851 $field_slug = 'heartbeat-interval-for-admin-pages';
2852 add_settings_field(
2853 $field_id,
2854 '',
2855 [$render_field, 'render_select_subfield'],
2856 ASENHA_SLUG,
2857 'main-section',
2858 array(
2859 'option_name' => ASENHA_SLUG_U,
2860 'field_id' => $field_id,
2861 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2862 'field_type' => 'with-prefix-suffix',
2863 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
2864 'field_suffix' => __( '<span class="faded">(Default is 1 minute)</span>', 'admin-site-enhancements' ),
2865 'field_select_options' => array(
2866 __( '15 seconds', 'admin-site-enhancements' ) => 15,
2867 __( '30 seconds', 'admin-site-enhancements' ) => 30,
2868 __( '1 minute', 'admin-site-enhancements' ) => 60,
2869 __( '2 minutes', 'admin-site-enhancements' ) => 120,
2870 __( '3 minutes', 'admin-site-enhancements' ) => 180,
2871 __( '5 minutes', 'admin-site-enhancements' ) => 300,
2872 __( '10 minutes', 'admin-site-enhancements' ) => 600,
2873 ),
2874 'field_select_default' => 60,
2875 'field_intro' => '',
2876 'field_description' => '',
2877 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2878 'display_none_on_load' => true,
2879 )
2880 );
2881 $field_id = 'heartbeat_control_for_post_edit';
2882 $field_slug = 'heartbeat-control-for-post-edit';
2883 add_settings_field(
2884 $field_id,
2885 __( 'On post creation and edit screens', 'admin-site-enhancements' ),
2886 [$render_field, 'render_radio_buttons_subfield'],
2887 ASENHA_SLUG,
2888 'main-section',
2889 array(
2890 'option_name' => ASENHA_SLUG_U,
2891 'field_id' => $field_id,
2892 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2893 'field_radios' => array(
2894 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
2895 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
2896 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
2897 ),
2898 'field_default' => 'default',
2899 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
2900 )
2901 );
2902 $field_id = 'heartbeat_interval_for_post_edit';
2903 $field_slug = 'heartbeat-interval-for-post-edit';
2904 add_settings_field(
2905 $field_id,
2906 '',
2907 [$render_field, 'render_select_subfield'],
2908 ASENHA_SLUG,
2909 'main-section',
2910 array(
2911 'option_name' => ASENHA_SLUG_U,
2912 'field_id' => $field_id,
2913 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2914 'field_type' => 'with-prefix-suffix',
2915 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
2916 'field_suffix' => __( '<span class="faded">(Default is 15 seconds)</span>', 'admin-site-enhancements' ),
2917 'field_select_options' => array(
2918 __( '15 seconds', 'admin-site-enhancements' ) => 15,
2919 __( '30 seconds', 'admin-site-enhancements' ) => 30,
2920 __( '45 seconds', 'admin-site-enhancements' ) => 45,
2921 __( '60 seconds', 'admin-site-enhancements' ) => 60,
2922 __( '90 seconds', 'admin-site-enhancements' ) => 90,
2923 __( '120 seconds', 'admin-site-enhancements' ) => 120,
2924 ),
2925 'field_select_default' => 15,
2926 'field_intro' => '',
2927 'field_description' => '',
2928 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2929 'display_none_on_load' => true,
2930 )
2931 );
2932 $field_id = 'heartbeat_control_for_frontend';
2933 $field_slug = 'heartbeat-control-for-frontend';
2934 add_settings_field(
2935 $field_id,
2936 __( 'On the frontend', 'admin-site-enhancements' ),
2937 [$render_field, 'render_radio_buttons_subfield'],
2938 ASENHA_SLUG,
2939 'main-section',
2940 array(
2941 'option_name' => ASENHA_SLUG_U,
2942 'field_id' => $field_id,
2943 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2944 'field_radios' => array(
2945 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
2946 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
2947 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
2948 ),
2949 'field_default' => 'default',
2950 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
2951 )
2952 );
2953 $field_id = 'heartbeat_interval_for_frontend';
2954 $field_slug = 'heartbeat-interval-for-frontend';
2955 add_settings_field(
2956 $field_id,
2957 '',
2958 [$render_field, 'render_select_subfield'],
2959 ASENHA_SLUG,
2960 'main-section',
2961 array(
2962 'option_name' => ASENHA_SLUG_U,
2963 'field_id' => $field_id,
2964 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2965 'field_type' => 'with-prefix-suffix',
2966 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
2967 'field_suffix' => '',
2968 'field_select_options' => array(
2969 __( '15 seconds', 'admin-site-enhancements' ) => 15,
2970 __( '30 seconds', 'admin-site-enhancements' ) => 30,
2971 __( '1 minute', 'admin-site-enhancements' ) => 60,
2972 __( '2 minutes', 'admin-site-enhancements' ) => 120,
2973 __( '3 minutes', 'admin-site-enhancements' ) => 180,
2974 __( '5 minutes', 'admin-site-enhancements' ) => 300,
2975 __( '10 minutes', 'admin-site-enhancements' ) => 600,
2976 ),
2977 'field_select_default' => 60,
2978 'field_intro' => '',
2979 'field_description' => '',
2980 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
2981 'display_none_on_load' => true,
2982 )
2983 );
2984 // =================================================================
2985 // UTILITIES
2986 // =================================================================
2987 // SMTP Email Delivery
2988 $field_id = 'smtp_email_delivery';
2989 $field_slug = 'smtp-email-delivery';
2990 $field_title = __( 'Email Delivery', 'admin-site-enhancements' );
2991 add_settings_field(
2992 $field_id,
2993 $field_title,
2994 [$render_field, 'render_checkbox_toggle'],
2995 ASENHA_SLUG,
2996 'main-section',
2997 array(
2998 'option_name' => ASENHA_SLUG_U,
2999 'field_id' => $field_id,
3000 'field_slug' => $field_slug,
3001 'field_title' => $field_title,
3002 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3003 'field_description' => __( 'Set custom sender name and email. Optionally use external SMTP service to ensure notification and transactional emails from your site are being delivered to inboxes.', 'admin-site-enhancements' ),
3004 'field_options_wrapper' => true,
3005 'field_options_moreless' => true,
3006 'class' => 'asenha-toggle utilities ' . $field_slug,
3007 )
3008 );
3009 $field_id = 'smtp_default_from_description';
3010 $field_slug = 'smtp-default-from-description';
3011 add_settings_field(
3012 $field_id,
3013 '',
3014 [$render_field, 'render_description_subfield'],
3015 ASENHA_SLUG,
3016 'main-section',
3017 array(
3018 'option_name' => ASENHA_SLUG_U,
3019 'field_description' => __( 'If set, the following sender name/email overrides WordPress core defaults but can still be overridden by other plugins that enables custom sender name/email, e.g. form plugins.', 'admin-site-enhancements' ),
3020 'class' => 'asenha-description utilities ' . $field_slug,
3021 )
3022 );
3023 $field_id = 'smtp_default_from_name';
3024 $field_slug = 'smtp-default-from-name';
3025 add_settings_field(
3026 $field_id,
3027 __( '<span class="field-sublabel sublabel-wide">Sender name</span>', 'admin-site-enhancements' ),
3028 [$render_field, 'render_text_subfield'],
3029 ASENHA_SLUG,
3030 'main-section',
3031 array(
3032 'option_name' => ASENHA_SLUG_U,
3033 'field_id' => $field_id,
3034 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3035 'field_type' => '',
3036 'field_prefix' => '',
3037 'field_suffix' => '',
3038 'field_description' => '',
3039 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3040 )
3041 );
3042 $field_id = 'smtp_default_from_email';
3043 $field_slug = 'smtp-default-from-email';
3044 add_settings_field(
3045 $field_id,
3046 __( '<span class="field-sublabel sublabel-wide">Sender email</span>', 'admin-site-enhancements' ),
3047 [$render_field, 'render_text_subfield'],
3048 ASENHA_SLUG,
3049 'main-section',
3050 array(
3051 'option_name' => ASENHA_SLUG_U,
3052 'field_id' => $field_id,
3053 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3054 'field_type' => '',
3055 'field_prefix' => '',
3056 'field_suffix' => '',
3057 'field_description' => '',
3058 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3059 )
3060 );
3061 $field_id = 'smtp_force_from';
3062 $field_slug = 'smtp-force-from';
3063 add_settings_field(
3064 $field_id,
3065 '',
3066 [$render_field, 'render_checkbox_plain'],
3067 ASENHA_SLUG,
3068 'main-section',
3069 array(
3070 'option_name' => ASENHA_SLUG_U,
3071 'field_id' => $field_id,
3072 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3073 'field_label' => __( 'Force the usage of the sender name/email defined above. It will override those set by other plugins.', 'admin-site-enhancements' ),
3074 'class' => 'asenha-checkbox asenha-hide-th utilities ' . $field_slug,
3075 )
3076 );
3077 $field_id = 'smtp_description';
3078 $field_slug = 'smtp--description';
3079 add_settings_field(
3080 $field_id,
3081 '',
3082 [$render_field, 'render_description_subfield'],
3083 ASENHA_SLUG,
3084 'main-section',
3085 array(
3086 'option_name' => ASENHA_SLUG_U,
3087 'field_description' => __( 'If set, the following SMTP service/account wil be used to deliver your emails.', 'admin-site-enhancements' ),
3088 'class' => 'asenha-description top-border utilities ' . $field_slug,
3089 )
3090 );
3091 $field_id = 'smtp_host';
3092 $field_slug = 'smtp-host';
3093 add_settings_field(
3094 $field_id,
3095 __( '<span class="field-sublabel sublabel-wide">Host</span>', 'admin-site-enhancements' ),
3096 [$render_field, 'render_text_subfield'],
3097 ASENHA_SLUG,
3098 'main-section',
3099 array(
3100 'option_name' => ASENHA_SLUG_U,
3101 'field_id' => $field_id,
3102 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3103 'field_type' => '',
3104 'field_prefix' => '',
3105 'field_suffix' => '',
3106 'field_description' => '',
3107 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3108 )
3109 );
3110 $field_id = 'smtp_port';
3111 $field_slug = 'smtp-port';
3112 add_settings_field(
3113 $field_id,
3114 __( '<span class="field-sublabel sublabel-wide">Port</span>', 'admin-site-enhancements' ),
3115 [$render_field, 'render_number_subfield'],
3116 ASENHA_SLUG,
3117 'main-section',
3118 array(
3119 'option_name' => ASENHA_SLUG_U,
3120 'field_id' => $field_id,
3121 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3122 'field_type' => '',
3123 'field_prefix' => '',
3124 'field_suffix' => '',
3125 'field_intro' => '',
3126 'field_description' => '',
3127 'field_min' => 1,
3128 'field_max' => 100000,
3129 'class' => 'asenha-text with-prefix-suffix narrow utilities ' . $field_slug,
3130 )
3131 );
3132 $field_id = 'smtp_security';
3133 $field_slug = 'smtp-security';
3134 add_settings_field(
3135 $field_id,
3136 __( '<span class="field-sublabel sublabel-wide">Security</span>', 'admin-site-enhancements' ),
3137 [$render_field, 'render_radio_buttons_subfield'],
3138 ASENHA_SLUG,
3139 'main-section',
3140 array(
3141 'option_name' => ASENHA_SLUG_U,
3142 'field_id' => $field_id,
3143 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3144 'field_radios' => array(
3145 __( 'None', 'admin-site-enhancements' ) => 'none',
3146 __( 'SSL', 'admin-site-enhancements' ) => 'ssl',
3147 __( 'TLS', 'admin-site-enhancements' ) => 'tls',
3148 ),
3149 'field_default' => 'default',
3150 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3151 )
3152 );
3153 $field_id = 'smtp_username';
3154 $field_slug = 'smtp-username';
3155 add_settings_field(
3156 $field_id,
3157 __( '<span class="field-sublabel sublabel-wide">Username</span>', 'admin-site-enhancements' ),
3158 [$render_field, 'render_text_subfield'],
3159 ASENHA_SLUG,
3160 'main-section',
3161 array(
3162 'option_name' => ASENHA_SLUG_U,
3163 'field_id' => $field_id,
3164 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3165 'field_type' => '',
3166 'field_prefix' => '',
3167 'field_suffix' => '',
3168 'field_description' => '',
3169 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3170 )
3171 );
3172 $field_id = 'smtp_password';
3173 $field_slug = 'smtp-password';
3174 add_settings_field(
3175 $field_id,
3176 __( '<span class="field-sublabel sublabel-wide">Password</span>', 'admin-site-enhancements' ),
3177 [$render_field, 'render_password_subfield'],
3178 ASENHA_SLUG,
3179 'main-section',
3180 array(
3181 'option_name' => ASENHA_SLUG_U,
3182 'field_id' => $field_id,
3183 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3184 'field_type' => '',
3185 'field_prefix' => '',
3186 'field_suffix' => '',
3187 'field_description' => '',
3188 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3189 )
3190 );
3191 $field_id = 'smtp_bypass_ssl_verification';
3192 $field_slug = 'smtp-bypass-ssl-verification';
3193 add_settings_field(
3194 $field_id,
3195 '',
3196 [$render_field, 'render_checkbox_plain'],
3197 ASENHA_SLUG,
3198 'main-section',
3199 array(
3200 'option_name' => ASENHA_SLUG_U,
3201 'field_id' => $field_id,
3202 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3203 'field_label' => __( 'Bypass verification of SSL certificate. This would be insecure if mail is delivered across the internet but could help in certain local and/or containerized WordPress scenarios.', 'admin-site-enhancements' ),
3204 'class' => 'asenha-checkbox asenha-hide-th margin-top-8 utilities ' . $field_slug,
3205 )
3206 );
3207 $field_id = 'smtp_debug';
3208 $field_slug = 'smtp-debug';
3209 add_settings_field(
3210 $field_id,
3211 '',
3212 [$render_field, 'render_checkbox_plain'],
3213 ASENHA_SLUG,
3214 'main-section',
3215 array(
3216 'option_name' => ASENHA_SLUG_U,
3217 'field_id' => $field_id,
3218 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3219 'field_label' => __( 'Enable debug mode and output the debug info into WordPress debug.log file.', 'admin-site-enhancements' ),
3220 'class' => 'asenha-checkbox asenha-hide-th bottom-border utilities ' . $field_slug,
3221 )
3222 );
3223 $field_id = 'smtp_send_test_email_description';
3224 $field_slug = 'smtp-send-test-email-description';
3225 add_settings_field(
3226 $field_id,
3227 '',
3228 [$render_field, 'render_description_subfield'],
3229 ASENHA_SLUG,
3230 'main-section',
3231 array(
3232 'option_name' => ASENHA_SLUG_U,
3233 'field_description' => __( 'After saving the settings above, check if everything is configured properly below.', 'admin-site-enhancements' ),
3234 'class' => 'asenha-description utilities ' . $field_slug,
3235 )
3236 );
3237 $field_id = 'smtp_send_test_email_to';
3238 $field_slug = 'smtp-send-test-email-to';
3239 add_settings_field(
3240 $field_id,
3241 __( '<span class="field-sublabel sublabel-wide">Send a test email to</span>', 'admin-site-enhancements' ),
3242 [$render_field, 'render_custom_html'],
3243 ASENHA_SLUG,
3244 'main-section',
3245 array(
3246 'html' => '<input type="text" id="test-email-to" class="asenha-subfield-text" name="" placeholder="" value=""><a id="send-test-email" class="button send-test-email">' . __( 'Send Now', 'admin-site-enhancements' ) . '</a>',
3247 'class' => 'asenha-html wide utilities ' . $field_slug,
3248 )
3249 );
3250 $field_id = 'smtp_send_test_email_result';
3251 $field_slug = 'smtp-send-test-email-result';
3252 add_settings_field(
3253 $field_id,
3254 '',
3255 [$render_field, 'render_description_subfield'],
3256 ASENHA_SLUG,
3257 'main-section',
3258 array(
3259 'option_name' => ASENHA_SLUG_U,
3260 'field_description' => '<div id="ajax-result" class="ajax-result-div" style="display:none;">
3261 <div class="sending-test-email"><img src="' . ASENHA_URL . 'assets/img/oval.svg" id="sending-test-email-spinner" class="spinner-img">' . __( 'Sending test email...', 'admin-site-enhancements' ) . '</div>
3262 <div id="test-email-success" class="test-email-success" style="display:none;"><span class="dashicons dashicons-yes"></span> <span>' . __( 'Test email was successfully processed</span>.<br />Please check the destination email\'s inbox to verify successful delivery.', 'admin-site-enhancements' ) . '</div>
3263 <div id="test-email-failed" class="test-email-failed" style="display:none;"><span class="dashicons dashicons-no-alt"></span> <span>' . __( 'Oops, something went wrong</span>.<br />Please double check your settings and the destination email address.', 'admin-site-enhancements' ) . '</div></div>',
3264 'class' => 'asenha-description utilities ' . $field_slug,
3265 )
3266 );
3267 // Multiple User Roles
3268 $field_id = 'multiple_user_roles';
3269 $field_slug = 'multiple-user-roles';
3270 $field_title = __( 'Multiple User Roles', 'admin-site-enhancements' );
3271 add_settings_field(
3272 $field_id,
3273 $field_title,
3274 [$render_field, 'render_checkbox_toggle'],
3275 ASENHA_SLUG,
3276 'main-section',
3277 array(
3278 'option_name' => ASENHA_SLUG_U,
3279 'field_id' => $field_id,
3280 'field_slug' => $field_slug,
3281 'field_title' => $field_title,
3282 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3283 'field_description' => __( 'Enable assignment of multiple roles during user account creation and editing. This maybe useful for working with roles not defined in WordPress core, e.g. from e-commerce or LMS plugins.', 'admin-site-enhancements' ),
3284 'field_options_wrapper' => true,
3285 'class' => 'asenha-toggle utilities ' . $field_slug,
3286 )
3287 );
3288 // Image Sizes Panel
3289 $field_id = 'image_sizes_panel';
3290 $field_slug = 'image-sizes-panel';
3291 $field_title = __( 'Image Sizes Panel', 'admin-site-enhancements' );
3292 add_settings_field(
3293 $field_id,
3294 $field_title,
3295 [$render_field, 'render_checkbox_toggle'],
3296 ASENHA_SLUG,
3297 'main-section',
3298 array(
3299 'option_name' => ASENHA_SLUG_U,
3300 'field_id' => $field_id,
3301 'field_slug' => $field_slug,
3302 'field_title' => $field_title,
3303 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3304 'field_description' => __( 'Display a panel showing and linking to all available sizes when viewing an image in the media library. Especially useful to quickly get the URL of a particular image size.', 'admin-site-enhancements' ),
3305 'field_options_wrapper' => true,
3306 'class' => 'asenha-toggle utilities ' . $field_slug,
3307 )
3308 );
3309 // View Admin as Role
3310 $field_id = 'view_admin_as_role';
3311 $field_slug = 'view-admin-as-role';
3312 $field_title = __( 'View Admin as Role', 'admin-site-enhancements' );
3313 add_settings_field(
3314 $field_id,
3315 $field_title,
3316 [$render_field, 'render_checkbox_toggle'],
3317 ASENHA_SLUG,
3318 'main-section',
3319 array(
3320 'option_name' => ASENHA_SLUG_U,
3321 'field_id' => $field_id,
3322 'field_slug' => $field_slug,
3323 'field_title' => $field_title,
3324 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3325 'field_description' => __( 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', 'admin-site-enhancements' ),
3326 'field_options_moreless' => true,
3327 'field_options_wrapper' => true,
3328 'class' => 'asenha-toggle utilities ' . $field_slug,
3329 )
3330 );
3331 $current_user = wp_get_current_user();
3332 $current_user_username = $current_user->user_login;
3333 $field_id = 'view_admin_as_role_description';
3334 $field_slug = 'view-admin-as-role-description';
3335 $role_reset_link = site_url( '/?reset-for=' ) . $current_user_username;
3336 add_settings_field(
3337 $field_id,
3338 '',
3339 [$render_field, 'render_description_subfield'],
3340 ASENHA_SLUG,
3341 'main-section',
3342 array(
3343 'option_name' => ASENHA_SLUG_U,
3344 'field_description' => '<div class="asenha-warning"><strong>' . sprintf(
3345 /* translators: %s is URL of the role reset link */
3346 __( 'If something goes wrong</strong> and you need to regain access to your account as an administrator, please visit the following URL: <br /><strong>%s</strong><br /><br />If you use <strong>Ninja Firewall</strong>, please uncheck "Block attempts to gain administrative privileges" in the Firewall Policies settings before you try to view as a non-admin user role to <strong>prevent being locked out</strong> of your admin account.', 'admin-site-enhancements' ),
3347 $role_reset_link
3348 ) . '<br /><br />' . __( 'In any case, please also <strong>create at least one backup admin user</strong> as a last resort should your primary admin user fails to properly login as admin. With this second admin user, you can also restore the admin role for your primary admin user.', 'admin-site-enhancements' ) . '</div>',
3349 'class' => 'asenha-description utilities ' . $field_slug,
3350 )
3351 );
3352 // Enable Password Protection
3353 $field_id = 'enable_password_protection';
3354 $field_slug = 'enable-password-protection';
3355 $field_title = __( 'Password Protection', 'admin-site-enhancements' );
3356 add_settings_field(
3357 $field_id,
3358 $field_title,
3359 [$render_field, 'render_checkbox_toggle'],
3360 ASENHA_SLUG,
3361 'main-section',
3362 array(
3363 'option_name' => ASENHA_SLUG_U,
3364 'field_id' => $field_id,
3365 'field_slug' => $field_slug,
3366 'field_title' => $field_title,
3367 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3368 'field_description' => __( 'Password-protect the entire site to hide the content from public view and search engine bots / crawlers. Logged-in administrators can still access the site as usual.', 'admin-site-enhancements' ),
3369 'field_options_moreless' => true,
3370 'field_options_wrapper' => true,
3371 'class' => 'asenha-toggle utilities ' . $field_slug,
3372 )
3373 );
3374 $field_id = 'password_protection_password';
3375 $field_slug = 'password-protection-password';
3376 add_settings_field(
3377 $field_id,
3378 __( 'Set the password:', 'admin-site-enhancements' ),
3379 [$render_field, 'render_password_subfield'],
3380 ASENHA_SLUG,
3381 'main-section',
3382 array(
3383 'option_name' => ASENHA_SLUG_U,
3384 'field_id' => $field_id,
3385 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3386 'field_type' => 'with-prefix-suffix',
3387 'field_prefix' => '',
3388 'field_suffix' => '<span class="faded">' . __( '(Default is \'secret\')', 'admin-site-enhancements' ) . '</span>',
3389 'field_description' => '',
3390 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug,
3391 )
3392 );
3393 $field_id = 'password_protection_notes';
3394 $field_slug = 'password-protection-notes';
3395 add_settings_field(
3396 $field_id,
3397 '',
3398 [$render_field, 'render_description_subfield'],
3399 ASENHA_SLUG,
3400 'main-section',
3401 array(
3402 'option_name' => ASENHA_SLUG_U,
3403 'field_description' => sprintf(
3404 /* translators: %s is URL to the documentation for nocache_headers() */
3405 __( '<div class="asenha-warning">When password protection is enabled and the password input form is displayed, caching is disabled using <a href="%s"><code>nocache_headers()</code></a>. Caching remains disabled after submitting the valid password and seeing the actual page content.</div>', 'admin-site-enhancements' ),
3406 'https://developer.wordpress.org/reference/functions/nocache_headers/'
3407 ),
3408 'class' => 'asenha-description login-logout ' . $field_slug,
3409 )
3410 );
3411 // Maintenance Mode
3412 $field_id = 'maintenance_mode';
3413 $field_slug = 'maintenance-mode';
3414 $field_title = __( 'Maintenance Mode', 'admin-site-enhancements' );
3415 add_settings_field(
3416 $field_id,
3417 $field_title,
3418 [$render_field, 'render_checkbox_toggle'],
3419 ASENHA_SLUG,
3420 'main-section',
3421 array(
3422 'option_name' => ASENHA_SLUG_U,
3423 'field_id' => $field_id,
3424 'field_slug' => $field_slug,
3425 'field_title' => $field_title,
3426 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3427 'field_description' => __( 'Show a customizable maintenance page on the frontend while performing a brief maintenance to your site. Logged-in administrators can still view the site as usual.', 'admin-site-enhancements' ),
3428 'field_options_wrapper' => true,
3429 'field_options_moreless' => true,
3430 'class' => 'asenha-toggle utilities ' . $field_slug,
3431 )
3432 );
3433 $field_id = 'maintenance_page_type_custom';
3434 $field_slug = 'maintenance-page-type-custom';
3435 add_settings_field(
3436 $field_id,
3437 '',
3438 [$render_field, 'render_custom_html'],
3439 ASENHA_SLUG,
3440 'main-section',
3441 array(
3442 'html' => '<div class="subfields-container subfields-in-column maintenance-page-type-custom"></div>',
3443 )
3444 );
3445 $field_id = 'maintenance_page_heading';
3446 $field_slug = 'maintenance-page-heading';
3447 add_settings_field(
3448 $field_id,
3449 __( 'Heading', 'admin-site-enhancements' ),
3450 [$render_field, 'render_text_subfield'],
3451 ASENHA_SLUG,
3452 'main-section',
3453 array(
3454 'option_name' => ASENHA_SLUG_U,
3455 'field_id' => $field_id,
3456 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3457 'field_type' => '',
3458 'field_prefix' => '',
3459 'field_suffix' => '',
3460 'field_description' => '',
3461 'field_placeholder' => __( 'We\'ll be back soon.', 'admin-site-enhancements' ),
3462 'class' => 'asenha-text utilities full-width margin-bottom-20 ' . $field_slug,
3463 )
3464 );
3465 $field_id = 'maintenance_page_description';
3466 $field_slug = 'maintenance-page-description';
3467 add_settings_field(
3468 $field_id,
3469 __( 'Description', 'admin-site-enhancements' ),
3470 [$render_field, 'render_textarea_subfield'],
3471 ASENHA_SLUG,
3472 'main-section',
3473 array(
3474 'option_name' => ASENHA_SLUG_U,
3475 'field_id' => $field_id,
3476 'field_slug' => $field_slug,
3477 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3478 'field_type' => 'textarea',
3479 'field_rows' => 5,
3480 'field_intro' => '',
3481 'field_description' => '',
3482 'field_placeholder' => __( 'This site is undergoing maintenance for an extended period today. Thanks for your patience.', 'admin-site-enhancements' ),
3483 'class' => 'asenha-textarea utilities ' . $field_slug,
3484 )
3485 );
3486 $field_id = 'maintenance_page_background';
3487 $field_slug = 'maintenance-page-background';
3488 $field_radios = array(
3489 __( 'Stripes', 'admin-site-enhancements' ) => 'stripes',
3490 __( 'Curves', 'admin-site-enhancements' ) => 'curves',
3491 __( 'Lines', 'admin-site-enhancements' ) => 'lines',
3492 );
3493 add_settings_field(
3494 $field_id,
3495 __( 'Background', 'admin-site-enhancements' ),
3496 [$render_field, 'render_radio_buttons_subfield'],
3497 ASENHA_SLUG,
3498 'main-section',
3499 array(
3500 'option_name' => ASENHA_SLUG_U,
3501 'field_id' => $field_id,
3502 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3503 'field_radios' => $field_radios,
3504 'field_default' => 'default',
3505 'class' => 'asenha-radio-buttons margin-top-12 utilities ' . $field_slug,
3506 )
3507 );
3508 $field_id = 'maintenance_mode_description';
3509 $field_slug = 'maintenance-mode-description';
3510 add_settings_field(
3511 $field_id,
3512 '',
3513 [$render_field, 'render_description_subfield'],
3514 ASENHA_SLUG,
3515 'main-section',
3516 array(
3517 'option_name' => ASENHA_SLUG_U,
3518 'field_description' => '<div class="asenha-warning"><strong>' . __( 'Please clear your cache</strong> after enabling or disabling maintenance mode. This ensures site visitors see either the maintenance page or the actual content of each page.', 'admin-site-enhancements' ) . '</div>',
3519 'class' => 'asenha-description utilities ' . $field_slug,
3520 )
3521 );
3522 // Redirect 404 to Homepage
3523 $field_id = 'redirect_404_to_homepage';
3524 $field_slug = 'redirect-404-to-homepage';
3525 $module_title = __( 'Redirect 404 to Homepage', 'admin-site-enhancements' );
3526 $module_description = __( 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', 'admin-site-enhancements' );
3527 $field_options_wrapper = false;
3528 $field_options_moreless = false;
3529 $field_title = $module_title;
3530 add_settings_field(
3531 $field_id,
3532 $field_title,
3533 [$render_field, 'render_checkbox_toggle'],
3534 ASENHA_SLUG,
3535 'main-section',
3536 array(
3537 'option_name' => ASENHA_SLUG_U,
3538 'field_id' => $field_id,
3539 'field_slug' => $field_slug,
3540 'field_title' => $field_title,
3541 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3542 'field_description' => $module_description,
3543 'field_options_wrapper' => $field_options_wrapper,
3544 'field_options_moreless' => $field_options_moreless,
3545 'class' => 'asenha-toggle utilities ' . $field_slug,
3546 )
3547 );
3548 // Display System Summary
3549 $field_id = 'display_system_summary';
3550 $field_slug = 'display-system-summary';
3551 $field_title = __( 'Display System Summary', 'admin-site-enhancements' );
3552 $module_description = __( 'Show quick summary of the system the site is running on to admins, in the "At a Glance" dashboard widget. This includes the web server software, the PHP version, the database software and server IP address.', 'admin-site-enhancements' );
3553 add_settings_field(
3554 $field_id,
3555 $field_title,
3556 [$render_field, 'render_checkbox_toggle'],
3557 ASENHA_SLUG,
3558 'main-section',
3559 array(
3560 'option_name' => ASENHA_SLUG_U,
3561 'field_id' => $field_id,
3562 'field_slug' => $field_slug,
3563 'field_title' => $field_title,
3564 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3565 'field_description' => $module_description,
3566 'field_options_wrapper' => true,
3567 'class' => 'asenha-toggle utilities ' . $field_slug,
3568 )
3569 );
3570 // Search Engines Visibility Status
3571 $field_id = 'search_engine_visibility_status';
3572 $field_slug = 'search-engine-visibility-status';
3573 $field_title = __( 'Search Engines Visibility Status', 'admin-site-enhancements' );
3574 $field_options_moreless = false;
3575 $field_options_wrapper = false;
3576 add_settings_field(
3577 $field_id,
3578 $field_title,
3579 [$render_field, 'render_checkbox_toggle'],
3580 ASENHA_SLUG,
3581 'main-section',
3582 array(
3583 'option_name' => ASENHA_SLUG_U,
3584 'field_id' => $field_id,
3585 'field_slug' => $field_slug,
3586 'field_title' => $field_title,
3587 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3588 'field_description' => __( 'Show admin bar status when search engines are set to be discouraged from indexing the site. This is set through a "Search engine visibility" checkbox in Settings >> Reading.', 'admin-site-enhancements' ),
3589 'field_options_moreless' => $field_options_moreless,
3590 'field_options_wrapper' => $field_options_wrapper,
3591 'class' => 'asenha-toggle utilities ' . $field_slug,
3592 )
3593 );
3594 }
3595
3596 }
3597