PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 9.0.2
Admin and Site Enhancements (ASE) v9.0.2
9.1.1 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 2 weeks ago class-admin-menu-organizer.php 2 weeks ago class-admin-menu-svg-icon-mask.php 2 weeks ago class-auto-publish-posts-with-missed-schedule.php 2 weeks ago class-avif-upload.php 2 weeks ago class-captcha-protection.php 2 weeks ago class-change-login-url.php 2 weeks ago class-cleanup-admin-bar.php 2 weeks ago class-common-methods.php 2 weeks ago class-content-duplication.php 2 weeks ago class-content-order.php 2 weeks ago class-custom-admin-footer-text.php 2 weeks ago class-custom-body-class.php 2 weeks ago class-custom-css.php 2 weeks ago class-custom-nav-menu-items-in-new-tab.php 2 weeks ago class-deactivation.php 2 weeks ago class-disable-author-archives.php 2 weeks ago class-disable-comments.php 2 weeks ago class-disable-dashboard-widgets.php 2 weeks ago class-disable-embeds.php 2 weeks ago class-disable-feeds.php 2 weeks ago class-disable-gutenberg.php 2 weeks ago class-disable-rest-api.php 2 weeks ago class-disable-smaller-components.php 2 weeks ago class-disable-updates.php 2 weeks ago class-disable-user-account.php 2 weeks ago class-disable-xml-rpc.php 2 weeks ago class-display-system-summary.php 2 weeks ago class-email-address-obfuscator.php 2 weeks ago class-email-delivery.php 2 weeks ago class-enhance-list-tables.php 2 weeks ago class-external-permalinks.php 2 weeks ago class-heartbeat-control.php 2 weeks ago class-hide-admin-bar.php 2 weeks ago class-hide-admin-notices.php 2 weeks ago class-image-sizes-panel.php 2 weeks ago class-image-upload-control.php 2 weeks ago class-insert-head-body-footer-code.php 2 weeks ago class-last-login-column.php 2 weeks ago class-limit-login-attempts.php 2 weeks ago class-login-id-type.php 2 weeks ago class-login-logout-menu.php 2 weeks ago class-maintenance-mode.php 2 weeks ago class-manage-ads-appads-txt.php 2 weeks ago class-manage-robots-txt.php 2 weeks ago class-media-files-visibility-control.php 2 weeks ago class-media-replacement.php 2 weeks ago class-multiple-user-roles.php 2 weeks ago class-navigation-menu-duplicator.php 2 weeks ago class-obfuscate-author-slugs.php 2 weeks ago class-open-external-links-in-new-tab.php 2 weeks ago class-password-protection.php 2 weeks ago class-redirect-after-login.php 2 weeks ago class-redirect-after-logout.php 2 weeks ago class-redirect-fourofour.php 2 weeks ago class-registration-date-column.php 2 weeks ago class-revisions-control.php 2 weeks ago class-search-engines-visibility.php 2 weeks ago class-settings-fields-render.php 2 weeks ago class-settings-sanitization.php 2 weeks ago class-settings-sections-fields.php 2 weeks ago class-show-custom-taxonomy-filters.php 2 weeks ago class-site-identity-on-login-page.php 2 weeks ago class-svg-upload.php 2 weeks ago class-third-party-compat.php 2 weeks ago class-various-admin-ui-enhancements.php 2 weeks ago class-view-admin-as-role.php 2 weeks ago class-wider-admin-menu.php 2 weeks ago class-wp-config-transformer.php 2 weeks ago
class-settings-sections-fields.php
4170 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 // Skip on admin-ajax: this registers every ASE settings field and is only needed on
20 // the Enhancements screen / options.php saves — not on third-party AJAX (e.g. Amelia).
21 if ( wp_doing_ajax() ) {
22 return;
23 }
24 add_settings_section(
25 'main-section',
26 '',
27 // Section title. Can be blank.
28 '',
29 // Callback function to output section intro. Can be blank.
30 ASENHA_SLUG
31 );
32 $common_methods = new Common_Methods();
33 $wp_config = new WP_Config_Transformer();
34 // Register main setttings
35 // Instantiate object for sanitization of settings fields values
36 $sanitization = new Settings_Sanitization();
37 // Instantiate object for rendering of settings fields for the admin page
38 $render_field = new Settings_Fields_Render();
39 register_setting(
40 ASENHA_ID,
41 // Option group or option_page
42 ASENHA_SLUG_U,
43 array(
44 'type' => 'array',
45 'description' => '',
46 'sanitize_callback' => [$sanitization, 'sanitize_for_options'],
47 'show_in_rest' => false,
48 'default' => array(),
49 )
50 );
51 // =================================================================
52 // Call WordPress globals and set new globals required for the fields
53 // =================================================================
54 global
55 $wp_version,
56 $wp_roles,
57 $wpdb,
58 $asenha_all_post_types,
59 $asenha_public_post_types,
60 $asenha_nonpublic_post_types,
61 $asenha_gutenberg_post_types,
62 $asenha_revisions_post_types,
63 $active_plugin_slugs,
64 $workable_nodes
65 ;
66 $options = get_option( ASENHA_SLUG_U, array() );
67 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
68 $roles = $wp_roles->get_names();
69 // Get array of slugs and plural labels for all post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
70 $asenha_all_post_types = array();
71 $all_post_type_names = get_post_types( array(), 'names' );
72 foreach ( $all_post_type_names as $post_type_name ) {
73 $post_type_object = get_post_type_object( $post_type_name );
74 $asenha_all_post_types[$post_type_name] = $post_type_object->label;
75 }
76 asort( $asenha_all_post_types );
77 // sort by value, ascending
78 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
79 $asenha_public_post_types = array();
80 $asenha_public_post_types = $common_methods->get_public_post_type_slugs();
81 // Get array of slugs and plural labels for non-public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
82 $asenha_nonpublic_post_types = array();
83 $nonpublic_post_type_names = get_post_types( array(
84 'public' => false,
85 ), 'names' );
86 foreach ( $nonpublic_post_type_names as $post_type_name ) {
87 $post_type_object = get_post_type_object( $post_type_name );
88 $asenha_nonpublic_post_types[$post_type_name] = $post_type_object->label;
89 }
90 asort( $asenha_nonpublic_post_types );
91 // sort by value, ascending
92 // 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' )
93 $asenha_gutenberg_post_types = array();
94 $gutenberg_not_applicable_types = array(
95 'attachment',
96 'revision',
97 'nav_menu_item',
98 'custom_css',
99 'customize_changeset',
100 'oembed_cache',
101 'user_request',
102 'wp_block',
103 'wp_template',
104 'wp_template_part',
105 'wp_global_styles',
106 'wp_navigation',
107 'wp_font_family',
108 'wp_font_face',
109 // ACF
110 'acf-post-type',
111 'acf-taxonomy',
112 'acf-field-group',
113 'acf-ui-options-page',
114 // Elementor
115 'e-landing-page',
116 'elementor_library',
117 'elementor_snippet',
118 'elementor_font',
119 'elementor_icons',
120 // Oxygen Classic
121 'ct_template',
122 'scheduled-action',
123 // Breakdance
124 'breakdance_template',
125 'breakdance_header',
126 'breakdance_footer',
127 'breakdance_popup',
128 'breakdance_block',
129 'breakdance_acf_block',
130 'breakdance_form_res',
131 // Bricks
132 'bricks_template',
133 'bricks_fonts',
134 );
135 $rest_api_enabled_post_type_names = get_post_types( array(
136 'show_in_rest' => true,
137 ), 'objects' );
138 foreach ( $rest_api_enabled_post_type_names as $post_type_slug => $post_type_info ) {
139 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
140 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
141 unset($asenha_gutenberg_post_types[$post_type_slug]);
142 }
143 }
144 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
145 $asenha_revisions_post_types = array();
146 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) {
147 // post type slug/name
148 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
149 $post_type_object = get_post_type_object( $post_type_slug );
150 if ( property_exists( $post_type_object, 'label' ) ) {
151 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
152 }
153 }
154 }
155 // Get array of active plugins slugs
156 $active_plugins = get_option( 'active_plugins', array() );
157 $active_plugin_slugs = array();
158 foreach ( $active_plugins as $active_plugin ) {
159 // e.g. debug-log-manager/debug-log-manager.php
160 $active_plugin = explode( "/", $active_plugin );
161 $active_plugin_slugs[] = $active_plugin[0];
162 }
163 $background_pattern_options = array();
164 // Enable Content Duplication
165 $content_duplication = new Content_Duplication();
166 $field_id = 'enable_duplication';
167 $field_slug = 'enable-duplication';
168 $field_title = __( 'Content Duplication', 'admin-site-enhancements' );
169 $field_description = __( 'Enable one-click duplication of pages, posts and public post types. The corresponding taxonomy terms and post meta will also be duplicated.', 'admin-site-enhancements' );
170 add_settings_field(
171 $field_id,
172 $field_title,
173 [$render_field, 'render_checkbox_toggle'],
174 ASENHA_SLUG,
175 'main-section',
176 array(
177 'option_name' => ASENHA_SLUG_U,
178 'field_id' => $field_id,
179 'field_slug' => $field_slug,
180 'field_title' => $field_title,
181 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
182 'field_description' => $field_description,
183 'field_options_wrapper' => true,
184 'field_options_moreless' => true,
185 'class' => 'asenha-toggle content-management ' . $field_slug,
186 )
187 );
188 $field_id = 'duplication_redirect_destination';
189 $field_slug = 'duplication-redirect-destination';
190 add_settings_field(
191 $field_id,
192 __( 'After duplication, redirect to:', 'admin-site-enhancements' ),
193 [$render_field, 'render_radio_buttons_subfield'],
194 ASENHA_SLUG,
195 'main-section',
196 array(
197 'option_name' => ASENHA_SLUG_U,
198 'field_id' => $field_id,
199 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
200 'field_radios' => array(
201 __( 'Edit screen', 'admin-site-enhancements' ) => 'edit',
202 __( 'List view', 'admin-site-enhancements' ) => 'list',
203 ),
204 'field_default' => 'edit',
205 'class' => 'asenha-radio-buttons shift-up content-management ' . $field_slug,
206 )
207 );
208 // Content Order
209 $field_id = 'content_order';
210 $field_slug = 'content-order';
211 $field_title = __( 'Content Order', 'admin-site-enhancements' );
212 add_settings_field(
213 $field_id,
214 $field_title,
215 [$render_field, 'render_checkbox_toggle'],
216 ASENHA_SLUG,
217 'main-section',
218 array(
219 'option_name' => ASENHA_SLUG_U,
220 'field_id' => $field_id,
221 'field_slug' => $field_slug,
222 'field_title' => $field_title,
223 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
224 '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' ),
225 'field_options_wrapper' => true,
226 'field_options_moreless' => true,
227 'class' => 'asenha-toggle content-management ' . $field_slug,
228 )
229 );
230 $field_id = 'content_order_for';
231 $field_slug = 'content-order-for';
232 if ( is_array( $asenha_all_post_types ) ) {
233 $inapplicable_post_types = array(
234 // 'asenha_code_snippet', // ASE code snippets
235 'asenha_redirect',
236 );
237 foreach ( $asenha_all_post_types as $post_type_slug => $post_type_label ) {
238 // e.g. $post_type_slug is post, $post_type_label is Posts
239 $is_hierarchical_label = ( is_post_type_hierarchical( $post_type_slug ) ? ' <span class="faded">- Hierarchical</span>' : '' );
240 if ( (post_type_supports( $post_type_slug, 'page-attributes' ) || is_post_type_hierarchical( $post_type_slug )) && !in_array( $post_type_slug, $inapplicable_post_types ) ) {
241 add_settings_field(
242 $field_id . '_' . $post_type_slug,
243 '',
244 [$render_field, 'render_checkbox_subfield'],
245 ASENHA_SLUG,
246 'main-section',
247 array(
248 'option_name' => ASENHA_SLUG_U,
249 'parent_field_id' => $field_id,
250 'field_id' => $post_type_slug,
251 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
252 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>' . $is_hierarchical_label,
253 'class' => 'asenha-checkbox asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
254 )
255 );
256 }
257 }
258 }
259 // Media Files Visibility Control
260 $field_id = 'media_files_visibility_control';
261 $field_slug = 'media-files-visibility-control';
262 $field_title = __( 'Media Files Visibility Control', 'admin-site-enhancements' );
263 $field_description = __( 'Limit media files visibility so only administrators can see all media files. Non-administrator users will only see media files they uploaded themselves in the media library and in the modal window to add/insert media.', 'admin-site-enhancements' );
264 $field_options_wrapper = false;
265 $field_options_moreless = false;
266 add_settings_field(
267 $field_id,
268 $field_title,
269 [$render_field, 'render_checkbox_toggle'],
270 ASENHA_SLUG,
271 'main-section',
272 array(
273 'option_name' => ASENHA_SLUG_U,
274 'field_id' => $field_id,
275 'field_slug' => $field_slug,
276 'field_title' => $field_title,
277 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
278 'field_description' => $field_description,
279 'field_options_wrapper' => $field_options_wrapper,
280 'field_options_moreless' => $field_options_moreless,
281 'class' => 'asenha-toggle content-management ' . $field_slug,
282 )
283 );
284 // Media Replacement
285 $field_id = 'enable_media_replacement';
286 $field_slug = 'enable-media-replacement';
287 $field_title = __( 'Media Replacement', 'admin-site-enhancements' );
288 add_settings_field(
289 $field_id,
290 $field_title,
291 [$render_field, 'render_checkbox_toggle'],
292 ASENHA_SLUG,
293 'main-section',
294 array(
295 'option_name' => ASENHA_SLUG_U,
296 'field_id' => $field_id,
297 'field_slug' => $field_slug,
298 'field_title' => $field_title,
299 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
300 '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' ),
301 'field_options_wrapper' => true,
302 'field_options_moreless' => true,
303 'class' => 'asenha-toggle content-management ' . $field_slug,
304 )
305 );
306 $field_id = 'disable_media_replacement_cache_busting';
307 $field_slug = 'disable-media-replacement-cache-busting';
308 add_settings_field(
309 $field_id,
310 '',
311 [$render_field, 'render_checkbox_plain'],
312 ASENHA_SLUG,
313 'main-section',
314 array(
315 'option_name' => ASENHA_SLUG_U,
316 'field_id' => $field_id,
317 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
318 'field_label' => __( 'Disable adding timestamp URL parameter on newly replaced images for busting the browser cache.', 'admin-site-enhancements' ),
319 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
320 )
321 );
322 // Enable SVG Upload
323 $field_id = 'enable_svg_upload';
324 $field_slug = 'enable-svg-upload';
325 $field_title = __( 'SVG Upload', 'admin-site-enhancements' );
326 add_settings_field(
327 $field_id,
328 $field_title,
329 [$render_field, 'render_checkbox_toggle'],
330 ASENHA_SLUG,
331 'main-section',
332 array(
333 'option_name' => ASENHA_SLUG_U,
334 'field_id' => $field_id,
335 'field_slug' => $field_slug,
336 'field_title' => $field_title,
337 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
338 'field_description' => __( 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', 'admin-site-enhancements' ),
339 'field_options_wrapper' => true,
340 'field_options_moreless' => true,
341 'class' => 'asenha-toggle content-management ' . $field_slug,
342 )
343 );
344 $field_id = 'enable_svg_upload_for';
345 $field_slug = 'enable-svg-upload-for';
346 if ( is_array( $roles ) ) {
347 foreach ( $roles as $role_slug => $role_label ) {
348 // e.g. $role_slug is administrator, $role_label is Administrator
349 add_settings_field(
350 $field_id . '_' . $role_slug,
351 '',
352 [$render_field, 'render_checkbox_subfield'],
353 ASENHA_SLUG,
354 'main-section',
355 array(
356 'option_name' => ASENHA_SLUG_U,
357 'parent_field_id' => $field_id,
358 'field_id' => $role_slug,
359 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
360 'field_label' => $role_label,
361 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
362 )
363 );
364 }
365 }
366 // Enable AVIF Upload
367 $field_id = 'enable_avif_upload';
368 $field_slug = 'enable-avif-upload';
369 $field_title = __( 'AVIF Upload', 'admin-site-enhancements' );
370 add_settings_field(
371 $field_id,
372 $field_title,
373 [$render_field, 'render_checkbox_toggle'],
374 ASENHA_SLUG,
375 'main-section',
376 array(
377 'option_name' => ASENHA_SLUG_U,
378 'field_id' => $field_id,
379 'field_slug' => $field_slug,
380 'field_title' => $field_title,
381 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
382 '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' ),
383 'field_options_wrapper' => true,
384 'field_options_moreless' => true,
385 'class' => 'asenha-toggle content-management ' . $field_slug,
386 )
387 );
388 $field_id = 'avif_support_status';
389 $field_slug = 'avif-support-status';
390 add_settings_field(
391 $field_id,
392 '',
393 [$render_field, 'render_avif_support_status'],
394 ASENHA_SLUG,
395 'main-section',
396 array(
397 'class' => 'asenha-toggle content-management ' . $field_slug,
398 )
399 );
400 // Enable External Permalinks
401 $field_id = 'enable_external_permalinks';
402 $field_slug = 'enable-external-permalinks';
403 $field_title = __( 'External Permalinks', 'admin-site-enhancements' );
404 add_settings_field(
405 $field_id,
406 $field_title,
407 [$render_field, 'render_checkbox_toggle'],
408 ASENHA_SLUG,
409 'main-section',
410 array(
411 'option_name' => ASENHA_SLUG_U,
412 'field_id' => $field_id,
413 'field_slug' => $field_slug,
414 'field_title' => $field_title,
415 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
416 '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' ),
417 'field_options_wrapper' => true,
418 'field_options_moreless' => true,
419 'class' => 'asenha-toggle content-management ' . $field_slug,
420 )
421 );
422 $field_id = 'enable_external_permalinks_for';
423 $field_slug = 'enable-external-permalinks-for';
424 if ( is_array( $asenha_public_post_types ) ) {
425 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
426 // e.g. $post_type_slug is post, $post_type_label is Posts
427 if ( 'attachment' != $post_type_slug ) {
428 add_settings_field(
429 $field_id . '_' . $post_type_slug,
430 '',
431 [$render_field, 'render_checkbox_subfield'],
432 ASENHA_SLUG,
433 'main-section',
434 array(
435 'option_name' => ASENHA_SLUG_U,
436 'parent_field_id' => $field_id,
437 'field_id' => $post_type_slug,
438 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
439 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
440 'class' => 'asenha-checkbox asenha-checkbox-item asenha-hide-th asenha-half content-management ' . $field_slug . ' ' . $post_type_slug,
441 )
442 );
443 }
444 }
445 }
446 // Open All External Links in New Tab
447 $field_id = 'external_links_new_tab';
448 $field_slug = 'external-links-new-tab';
449 $field_title = __( 'Open All External Links in New Tab', 'admin-site-enhancements' );
450 add_settings_field(
451 $field_id,
452 $field_title,
453 [$render_field, 'render_checkbox_toggle'],
454 ASENHA_SLUG,
455 'main-section',
456 array(
457 'option_name' => ASENHA_SLUG_U,
458 'field_id' => $field_id,
459 'field_slug' => $field_slug,
460 'field_title' => $field_title,
461 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
462 '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' ),
463 'field_options_wrapper' => true,
464 'field_options_moreless' => true,
465 'class' => 'asenha-toggle content-management ' . $field_slug,
466 )
467 );
468 // Allow Custom Nav Menu Items to Open in New Tab
469 $field_id = 'custom_nav_menu_items_new_tab';
470 $field_slug = 'custom-nav-menu-items-new-tab';
471 $field_title = __( 'Allow Custom Navigation Menu Items to Open in New Tab', 'admin-site-enhancements' );
472 add_settings_field(
473 $field_id,
474 $field_title,
475 [$render_field, 'render_checkbox_toggle'],
476 ASENHA_SLUG,
477 'main-section',
478 array(
479 'option_name' => ASENHA_SLUG_U,
480 'field_id' => $field_id,
481 'field_slug' => $field_slug,
482 'field_title' => $field_title,
483 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
484 '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' ),
485 'field_options_wrapper' => false,
486 'field_options_moreless' => false,
487 'class' => 'asenha-toggle content-management ' . $field_slug,
488 )
489 );
490 // Enable Auto-Publishing of Posts with Missed Schedules
491 $field_id = 'enable_missed_schedule_posts_auto_publish';
492 $field_slug = 'enable-missed-schedule-posts-auto-publish';
493 $field_title = __( 'Auto-Publish Posts with Missed Schedule', 'admin-site-enhancements' );
494 add_settings_field(
495 $field_id,
496 $field_title,
497 [$render_field, 'render_checkbox_toggle'],
498 ASENHA_SLUG,
499 'main-section',
500 array(
501 'option_name' => ASENHA_SLUG_U,
502 'field_id' => $field_id,
503 'field_slug' => $field_slug,
504 'field_title' => $field_title,
505 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
506 'field_description' => __( 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', 'admin-site-enhancements' ),
507 'class' => 'asenha-toggle content-management ' . $field_slug,
508 )
509 );
510 // =================================================================
511 // ADMIN INTERFACE
512 // =================================================================
513 // Hide or Modify Elements / Clean Up Admin Bar
514 $field_id = 'hide_modify_elements';
515 $field_slug = 'hide-modify-elements';
516 add_settings_field(
517 $field_id,
518 __( 'Clean Up Admin Bar', 'admin-site-enhancements' ),
519 [$render_field, 'render_checkbox_toggle'],
520 ASENHA_SLUG,
521 'main-section',
522 array(
523 'option_name' => ASENHA_SLUG_U,
524 'field_id' => $field_id,
525 'field_slug' => $field_slug,
526 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
527 'field_description' => __( 'Remove various elements from the admin bar.', 'admin-site-enhancements' ),
528 'field_options_wrapper' => true,
529 'field_options_moreless' => true,
530 'class' => 'asenha-toggle admin-interface ' . $field_slug,
531 )
532 );
533 $field_id = 'hide_ab_wp_logo_menu';
534 $field_slug = 'hide-ab-wp-logo-menu';
535 add_settings_field(
536 $field_id,
537 '',
538 [$render_field, 'render_checkbox_plain'],
539 ASENHA_SLUG,
540 'main-section',
541 array(
542 'option_name' => ASENHA_SLUG_U,
543 'field_id' => $field_id,
544 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
545 'field_label' => __( 'Remove WordPress logo/menu', 'admin-site-enhancements' ),
546 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
547 )
548 );
549 $field_id = 'hide_ab_site_menu';
550 $field_slug = 'hide-ab-site-menu';
551 add_settings_field(
552 $field_id,
553 '',
554 [$render_field, 'render_checkbox_plain'],
555 ASENHA_SLUG,
556 'main-section',
557 array(
558 'option_name' => ASENHA_SLUG_U,
559 'field_id' => $field_id,
560 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
561 'field_label' => __( 'Remove home icon and site name', 'admin-site-enhancements' ),
562 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
563 )
564 );
565 $field_id = 'hide_ab_customize_menu';
566 $field_slug = 'hide-ab-customize-menu';
567 add_settings_field(
568 $field_id,
569 '',
570 [$render_field, 'render_checkbox_plain'],
571 ASENHA_SLUG,
572 'main-section',
573 array(
574 'option_name' => ASENHA_SLUG_U,
575 'field_id' => $field_id,
576 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
577 'field_label' => __( 'Remove customize menu', 'admin-site-enhancements' ),
578 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
579 )
580 );
581 $field_id = 'hide_ab_updates_menu';
582 $field_slug = 'hide-ab-updates-menu';
583 add_settings_field(
584 $field_id,
585 '',
586 [$render_field, 'render_checkbox_plain'],
587 ASENHA_SLUG,
588 'main-section',
589 array(
590 'option_name' => ASENHA_SLUG_U,
591 'field_id' => $field_id,
592 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
593 'field_label' => __( 'Remove updates counter/link', 'admin-site-enhancements' ),
594 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
595 )
596 );
597 $field_id = 'hide_ab_comments_menu';
598 $field_slug = 'hide-ab-comments-menu';
599 $field_label = __( 'Remove comments counter/link', 'admin-site-enhancements' );
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' => $field_label,
611 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
612 )
613 );
614 $field_id = 'hide_ab_new_content_menu';
615 $field_slug = 'hide-ab-new-content-menu';
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 new content menu', 'admin-site-enhancements' ),
627 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
628 )
629 );
630 $field_id = 'hide_ab_howdy';
631 $field_slug = 'hide-ab-howdy';
632 add_settings_field(
633 $field_id,
634 '',
635 [$render_field, 'render_checkbox_plain'],
636 ASENHA_SLUG,
637 'main-section',
638 array(
639 'option_name' => ASENHA_SLUG_U,
640 'field_id' => $field_id,
641 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
642 'field_label' => __( 'Remove \'Howdy\'', 'admin-site-enhancements' ),
643 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
644 )
645 );
646 $field_id = 'hide_help_drawer';
647 $field_slug = 'hide-help-drawer';
648 add_settings_field(
649 $field_id,
650 '',
651 [$render_field, 'render_checkbox_plain'],
652 ASENHA_SLUG,
653 'main-section',
654 array(
655 'option_name' => ASENHA_SLUG_U,
656 'field_id' => $field_id,
657 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
658 'field_label' => __( 'Remove the Help tab and drawer', 'admin-site-enhancements' ),
659 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
660 )
661 );
662 // Hide Admin Notices
663 $field_id = 'hide_admin_notices';
664 $field_slug = 'hide-admin-notices';
665 $field_title = __( 'Hide Admin Notices', 'admin-site-enhancements' );
666 $field_options_wrapper = false;
667 $field_options_moreless = false;
668 add_settings_field(
669 $field_id,
670 $field_title,
671 [$render_field, 'render_checkbox_toggle'],
672 ASENHA_SLUG,
673 'main-section',
674 array(
675 'option_name' => ASENHA_SLUG_U,
676 'field_id' => $field_id,
677 'field_slug' => $field_slug,
678 'field_title' => $field_title,
679 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
680 'field_description' => __( 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', 'admin-site-enhancements' ),
681 'field_options_wrapper' => $field_options_wrapper,
682 'field_options_moreless' => $field_options_moreless,
683 'class' => 'asenha-toggle admin-interface ' . $field_slug,
684 )
685 );
686 // Disable Dashboard Widgets
687 $field_id = 'disable_dashboard_widgets';
688 $field_slug = 'disable-dashboard-widgets';
689 $field_title = __( 'Disable Dashboard Widgets', 'admin-site-enhancements' );
690 add_settings_field(
691 $field_id,
692 $field_title,
693 [$render_field, 'render_checkbox_toggle'],
694 ASENHA_SLUG,
695 'main-section',
696 array(
697 'option_name' => ASENHA_SLUG_U,
698 'field_id' => $field_id,
699 'field_slug' => $field_slug,
700 'field_title' => $field_title,
701 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
702 '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' ),
703 'field_options_wrapper' => true,
704 'field_options_moreless' => true,
705 'class' => 'asenha-toggle admin-interface ' . $field_slug,
706 )
707 );
708 $field_id = 'disable_welcome_panel_in_dashboard';
709 $field_slug = 'disable-welcome-panel-in-dashboard';
710 add_settings_field(
711 $field_id,
712 '',
713 [$render_field, 'render_checkbox_plain'],
714 ASENHA_SLUG,
715 'main-section',
716 array(
717 'option_name' => ASENHA_SLUG_U,
718 'field_id' => $field_id,
719 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
720 'field_label' => __( 'Welcome to WordPress', 'admin-site-enhancements' ),
721 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
722 )
723 );
724 $field_id = 'disabled_dashboard_widgets';
725 $field_slug = 'disabled-dashboard-widgets';
726 if ( array_key_exists( 'dashboard_widgets', $options_extra ) ) {
727 $dashboard_widgets = $options_extra['dashboard_widgets'];
728 } else {
729 $disable_dashboard_widgets = new Disable_Dashboard_Widgets();
730 $dashboard_widgets = $disable_dashboard_widgets->get_dashboard_widgets();
731 $options_extra['dashboard_widgets'] = $dashboard_widgets;
732 update_option( ASENHA_SLUG_U . '_extra', $options_extra, true );
733 }
734 foreach ( $dashboard_widgets as $widget ) {
735 add_settings_field(
736 $field_id . '_' . $widget['id'],
737 '',
738 [$render_field, 'render_checkbox_subfield'],
739 ASENHA_SLUG,
740 'main-section',
741 array(
742 'option_name' => ASENHA_SLUG_U,
743 'parent_field_id' => $field_id,
744 'field_id' => $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'],
745 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'] . ']',
746 'field_label' => $widget['title'] . ' <span class="faded">(' . $widget['id'] . ')</span>',
747 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug . ' ' . $widget['id'],
748 )
749 );
750 }
751 // Hide Admin Bar
752 $field_id = 'hide_admin_bar';
753 $field_slug = 'hide-admin-bar';
754 $field_title = __( 'Hide Admin Bar', 'admin-site-enhancements' );
755 $field_description = __( 'Hide admin bar on the frontend for all or some user roles.', 'admin-site-enhancements' );
756 add_settings_field(
757 $field_id,
758 $field_title,
759 [$render_field, 'render_checkbox_toggle'],
760 ASENHA_SLUG,
761 'main-section',
762 array(
763 'option_name' => ASENHA_SLUG_U,
764 'field_id' => $field_id,
765 'field_slug' => $field_slug,
766 'field_title' => $field_title,
767 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
768 'field_description' => $field_description,
769 'field_options_wrapper' => true,
770 'field_options_moreless' => true,
771 'class' => 'asenha-toggle admin-interface ' . $field_slug,
772 )
773 );
774 $field_id = 'hide_admin_bar_for';
775 $field_slug = 'hide-admin-bar-for';
776 if ( is_array( $roles ) ) {
777 foreach ( $roles as $role_slug => $role_label ) {
778 // e.g. $role_slug is administrator, $role_label is Administrator
779 add_settings_field(
780 $field_id . '_' . $role_slug,
781 '',
782 [$render_field, 'render_checkbox_subfield'],
783 ASENHA_SLUG,
784 'main-section',
785 array(
786 'option_name' => ASENHA_SLUG_U,
787 'parent_field_id' => $field_id,
788 'field_id' => $role_slug,
789 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
790 'field_label' => $role_label,
791 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug,
792 )
793 );
794 }
795 }
796 $field_id = 'hide_admin_bar_always_show_for_admins';
797 $field_slug = 'hide-admin-bar-always-show-for-admins';
798 add_settings_field(
799 $field_id,
800 '',
801 // Field title
802 [$render_field, 'render_checkbox_plain'],
803 ASENHA_SLUG,
804 'main-section',
805 array(
806 'option_name' => ASENHA_SLUG_U,
807 'field_id' => $field_id,
808 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
809 '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' ),
810 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top admin-interface ' . $field_slug,
811 )
812 );
813 $field_id = 'hide_admin_bar_description';
814 $field_slug = 'hide-admin-bar-description';
815 add_settings_field(
816 $field_id,
817 '',
818 [$render_field, 'render_description_subfield'],
819 ASENHA_SLUG,
820 'main-section',
821 array(
822 'option_name' => ASENHA_SLUG_U,
823 'field_description' => '<div class="asenha-warning">' . __( 'The settings above will override the \'Toolbar\' settings in the user profile edit screen.', 'admin-site-enhancements' ) . '</div>',
824 'class' => 'asenha-description login-logout ' . $field_slug,
825 )
826 );
827 // Wider Admin Menu
828 $field_id = 'wider_admin_menu';
829 $field_slug = 'wider-admin-menu';
830 $field_title = __( 'Wider Admin Menu', 'admin-site-enhancements' );
831 add_settings_field(
832 $field_id,
833 $field_title,
834 [$render_field, 'render_checkbox_toggle'],
835 ASENHA_SLUG,
836 'main-section',
837 array(
838 'option_name' => ASENHA_SLUG_U,
839 'field_id' => $field_id,
840 'field_slug' => $field_slug,
841 'field_title' => $field_title,
842 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
843 'field_description' => __( 'Give the admin menu more room to better accommodate wider items.', 'admin-site-enhancements' ),
844 'field_options_wrapper' => true,
845 'class' => 'asenha-toggle admin-interface ' . $field_slug,
846 )
847 );
848 $field_id = 'admin_menu_width';
849 $field_slug = 'admin-menu-width';
850 add_settings_field(
851 $field_id,
852 '',
853 [$render_field, 'render_select_subfield'],
854 ASENHA_SLUG,
855 'main-section',
856 array(
857 'option_name' => ASENHA_SLUG_U,
858 'field_id' => $field_id,
859 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
860 'field_type' => 'with-prefix-suffix',
861 'field_prefix' => __( 'Set width to', 'admin-site-enhancements' ),
862 'field_suffix' => '<span class="faded">' . __( '(Default is 160px)', 'admin-site-enhancements' ) . '</span>',
863 'field_select_options' => array(
864 '180px' => '180px',
865 '200px' => '200px',
866 '220px' => '220px',
867 '240px' => '240px',
868 '260px' => '260px',
869 '280px' => '280px',
870 '300px' => '300px',
871 ),
872 'field_select_default' => 200,
873 'field_intro' => '',
874 'field_description' => '',
875 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up admin-interface ' . $field_slug,
876 'display_none_on_load' => true,
877 )
878 );
879 // Admin Menu Organizer
880 $field_id = 'customize_admin_menu';
881 $field_slug = 'customize-admin-menu';
882 $field_title = __( 'Admin Menu Organizer', 'admin-site-enhancements' );
883 add_settings_field(
884 $field_id,
885 $field_title,
886 [$render_field, 'render_checkbox_toggle'],
887 ASENHA_SLUG,
888 'main-section',
889 array(
890 'field_id' => $field_id,
891 'field_slug' => $field_slug,
892 'field_title' => $field_title,
893 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
894 'field_description' => __( 'Customize the order of the admin menu and optionally change menu item title or hide some items.', 'admin-site-enhancements' ) . ' ' . sprintf(
895 /* translators: %s is URL to the Admin Menu Organizer settings page */
896 __( 'Once enabled, you can find the <a href="%s">Admin Menu</a> item under the Settings menu.', 'admin-site-enhancements' ),
897 admin_url( 'options-general.php?page=admin-menu-organizer' )
898 ),
899 'field_options_wrapper' => true,
900 'field_options_moreless' => true,
901 'class' => 'asenha-toggle admin-interface ' . $field_slug,
902 )
903 );
904 $field_id = 'admin_menu_organizer_sticky_collapse_menu';
905 $field_slug = 'admin-menu-organizer-sticky-collapse-menu';
906 add_settings_field(
907 $field_id,
908 '',
909 [$render_field, 'render_checkbox_plain'],
910 ASENHA_SLUG,
911 'main-section',
912 array(
913 'option_name' => ASENHA_SLUG_U,
914 'field_id' => $field_id,
915 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
916 'field_label' => __( 'Make "Collapse Menu" sticky at the bottom of the admin menu', 'admin-site-enhancements' ),
917 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug,
918 )
919 );
920 // Navigation Menu Duplicator
921 $field_id = 'enable_navigation_menu_duplicator';
922 $field_slug = 'navigation-menu-duplicator';
923 $field_title = __( 'Navigation Menu Duplicator', 'admin-site-enhancements' );
924 add_settings_field(
925 $field_id,
926 $field_title,
927 [$render_field, 'render_checkbox_toggle'],
928 ASENHA_SLUG,
929 'main-section',
930 array(
931 'option_name' => ASENHA_SLUG_U,
932 'field_id' => $field_id,
933 'field_slug' => $field_slug,
934 'field_title' => $field_title,
935 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
936 'field_description' => __( 'Duplicate a navigation menu with one click from Appearance → Menus. Duplicated menus remain on the site even if this module is later disabled.', 'admin-site-enhancements' ),
937 'field_options_wrapper' => false,
938 'field_options_moreless' => false,
939 'class' => 'asenha-toggle admin-interface ' . $field_slug,
940 )
941 );
942 // Show Custom Taxonomy Filters
943 $field_id = 'show_custom_taxonomy_filters';
944 $field_slug = 'show-custom-taxonomy-filters';
945 $field_title = __( 'Show Custom Taxonomy Filters', 'admin-site-enhancements' );
946 $field_options_wrapper = false;
947 $field_options_moreless = false;
948 add_settings_field(
949 $field_id,
950 $field_title,
951 [$render_field, 'render_checkbox_toggle'],
952 ASENHA_SLUG,
953 'main-section',
954 array(
955 'option_name' => ASENHA_SLUG_U,
956 'field_id' => $field_id,
957 'field_slug' => $field_slug,
958 'field_title' => $field_title,
959 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
960 'field_description' => __( 'Show additional filter(s) on list tables for hierarchical, custom taxonomies.', 'admin-site-enhancements' ),
961 'field_options_wrapper' => $field_options_wrapper,
962 'field_options_moreless' => $field_options_moreless,
963 'class' => 'asenha-toggle admin-interface ' . $field_slug,
964 )
965 );
966 // Enhance List Tables
967 $field_id = 'enhance_list_tables';
968 $field_slug = 'enhance-list-tables';
969 $field_title = __( 'Enhance List Tables', 'admin-site-enhancements' );
970 add_settings_field(
971 $field_id,
972 $field_title,
973 [$render_field, 'render_checkbox_toggle'],
974 ASENHA_SLUG,
975 'main-section',
976 array(
977 'option_name' => ASENHA_SLUG_U,
978 'field_id' => $field_id,
979 'field_slug' => $field_slug,
980 'field_title' => $field_title,
981 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
982 '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' ),
983 'field_options_wrapper' => true,
984 'field_options_moreless' => true,
985 'class' => 'asenha-toggle content-management ' . $field_slug,
986 )
987 );
988 // Show Featured Image Column
989 $field_id = 'show_featured_image_column';
990 $field_slug = 'show-featured-image-column';
991 add_settings_field(
992 $field_id,
993 '',
994 [$render_field, 'render_checkbox_plain'],
995 ASENHA_SLUG,
996 'main-section',
997 array(
998 'option_name' => ASENHA_SLUG_U,
999 'field_id' => $field_id,
1000 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1001 'field_label' => __( 'Show featured image column', 'admin-site-enhancements' ),
1002 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1003 )
1004 );
1005 // Show Excerpt Column
1006 $field_id = 'show_excerpt_column';
1007 $field_slug = 'show-excerpt-column';
1008 add_settings_field(
1009 $field_id,
1010 '',
1011 [$render_field, 'render_checkbox_plain'],
1012 ASENHA_SLUG,
1013 'main-section',
1014 array(
1015 'option_name' => ASENHA_SLUG_U,
1016 'field_id' => $field_id,
1017 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1018 'field_label' => __( 'Show excerpt column', 'admin-site-enhancements' ),
1019 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1020 )
1021 );
1022 // Show Last Modified Column
1023 $field_id = 'show_last_modified_column';
1024 $field_slug = 'show-last-modified-column';
1025 add_settings_field(
1026 $field_id,
1027 '',
1028 [$render_field, 'render_checkbox_plain'],
1029 ASENHA_SLUG,
1030 'main-section',
1031 array(
1032 'option_name' => ASENHA_SLUG_U,
1033 'field_id' => $field_id,
1034 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1035 'field_label' => __( 'Show last modified column', 'admin-site-enhancements' ),
1036 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1037 )
1038 );
1039 // Show ID Column
1040 $field_id = 'show_id_column';
1041 $field_slug = 'show-id-column';
1042 add_settings_field(
1043 $field_id,
1044 '',
1045 [$render_field, 'render_checkbox_plain'],
1046 ASENHA_SLUG,
1047 'main-section',
1048 array(
1049 'option_name' => ASENHA_SLUG_U,
1050 'field_id' => $field_id,
1051 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1052 'field_label' => __( 'Show ID column', 'admin-site-enhancements' ),
1053 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1054 )
1055 );
1056 // Show File Size Column in Media Library
1057 $field_id = 'show_file_size_column';
1058 $field_slug = 'show-file-size-column';
1059 add_settings_field(
1060 $field_id,
1061 '',
1062 [$render_field, 'render_checkbox_plain'],
1063 ASENHA_SLUG,
1064 'main-section',
1065 array(
1066 'option_name' => ASENHA_SLUG_U,
1067 'field_id' => $field_id,
1068 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1069 'field_label' => __( 'Show file size column in media library', 'admin-site-enhancements' ),
1070 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1071 )
1072 );
1073 // Show ID in Action Row
1074 $field_id = 'show_id_in_action_row';
1075 $field_slug = 'show-id-in-action_row';
1076 add_settings_field(
1077 $field_id,
1078 '',
1079 [$render_field, 'render_checkbox_plain'],
1080 ASENHA_SLUG,
1081 'main-section',
1082 array(
1083 'option_name' => ASENHA_SLUG_U,
1084 'field_id' => $field_id,
1085 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1086 'field_label' => __( 'Show ID in action rows along with links for Edit, View, etc.', 'admin-site-enhancements' ),
1087 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1088 )
1089 );
1090 // Hide Date Column
1091 $field_id = 'hide_date_column';
1092 $field_slug = 'hide-date-column';
1093 add_settings_field(
1094 $field_id,
1095 '',
1096 [$render_field, 'render_checkbox_plain'],
1097 ASENHA_SLUG,
1098 'main-section',
1099 array(
1100 'option_name' => ASENHA_SLUG_U,
1101 'field_id' => $field_id,
1102 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1103 'field_label' => __( 'Remove date column', 'admin-site-enhancements' ),
1104 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1105 )
1106 );
1107 // Hide Comments Column
1108 $field_id = 'hide_comments_column';
1109 $field_slug = 'hide-comments-column';
1110 add_settings_field(
1111 $field_id,
1112 '',
1113 [$render_field, 'render_checkbox_plain'],
1114 ASENHA_SLUG,
1115 'main-section',
1116 array(
1117 'option_name' => ASENHA_SLUG_U,
1118 'field_id' => $field_id,
1119 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1120 'field_label' => __( 'Remove comments column', 'admin-site-enhancements' ),
1121 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1122 )
1123 );
1124 // Hide Post Tags Column
1125 $field_id = 'hide_post_tags_column';
1126 $field_slug = 'hide-post-tags-column';
1127 add_settings_field(
1128 $field_id,
1129 '',
1130 [$render_field, 'render_checkbox_plain'],
1131 ASENHA_SLUG,
1132 'main-section',
1133 array(
1134 'option_name' => ASENHA_SLUG_U,
1135 'field_id' => $field_id,
1136 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1137 'field_label' => __( 'Remove tags column (for posts)', 'admin-site-enhancements' ),
1138 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug,
1139 )
1140 );
1141 // Various Admin UI Enhancements
1142 $field_id = 'various_admin_ui_enhancements';
1143 $field_slug = 'various-admin-ui-enhancements';
1144 $field_title = __( 'Various Admin UI Enhancements', 'admin-site-enhancements' );
1145 add_settings_field(
1146 $field_id,
1147 $field_title,
1148 [$render_field, 'render_checkbox_toggle'],
1149 ASENHA_SLUG,
1150 'main-section',
1151 array(
1152 'option_name' => ASENHA_SLUG_U,
1153 'field_id' => $field_id,
1154 'field_slug' => $field_slug,
1155 'field_title' => $field_title,
1156 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1157 'field_description' => __( 'Various, smaller enhancements for different parts of the admin interface.', 'admin-site-enhancements' ),
1158 'field_options_wrapper' => true,
1159 'field_options_moreless' => true,
1160 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1161 )
1162 );
1163 // Media Library Infinite Scrolling
1164 $field_id = 'media_library_infinite_scrolling';
1165 $field_slug = 'media-library-infinite-scrolling';
1166 add_settings_field(
1167 $field_id,
1168 '',
1169 [$render_field, 'render_checkbox_plain'],
1170 ASENHA_SLUG,
1171 'main-section',
1172 array(
1173 'option_name' => ASENHA_SLUG_U,
1174 'field_id' => $field_id,
1175 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1176 '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' ),
1177 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1178 )
1179 );
1180 // Display Active Plugins First
1181 $field_id = 'display_active_plugins_first';
1182 $field_slug = 'display-active-plugins-first';
1183 add_settings_field(
1184 $field_id,
1185 '',
1186 [$render_field, 'render_checkbox_plain'],
1187 ASENHA_SLUG,
1188 'main-section',
1189 array(
1190 'option_name' => ASENHA_SLUG_U,
1191 'field_id' => $field_id,
1192 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1193 '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' ),
1194 'class' => 'asenha-toggle admin-interface ' . $field_slug,
1195 )
1196 );
1197 // Custom Admin Footer Text
1198 $field_id = 'custom_admin_footer_text';
1199 $field_slug = 'custom-admin-footer-text';
1200 $field_title = __( 'Custom Admin Footer Text', 'admin-site-enhancements' );
1201 add_settings_field(
1202 $field_id,
1203 $field_title,
1204 [$render_field, 'render_checkbox_toggle'],
1205 ASENHA_SLUG,
1206 'main-section',
1207 array(
1208 'option_name' => ASENHA_SLUG_U,
1209 'field_id' => $field_id,
1210 'field_slug' => $field_slug,
1211 'field_title' => $field_title,
1212 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1213 'field_description' => __( 'Customize the text you see on the footer of wp-admin pages other than this ASE settings page.', 'admin-site-enhancements' ),
1214 'field_options_wrapper' => true,
1215 'field_options_moreless' => true,
1216 'class' => 'asenha-toggle utilities ' . $field_slug,
1217 )
1218 );
1219 $media_buttons = false;
1220 $quicktags = false;
1221 $toolbar1 = 'bold,italic,underline';
1222 $field_id = 'custom_admin_footer_left';
1223 $field_slug = 'custom-admin-footer-left';
1224 // https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/
1225 // https://www.tiny.cloud/docs/advanced/available-toolbar-buttons/
1226 $editor_settings = array(
1227 'media_buttons' => $media_buttons,
1228 'textarea_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1229 'textarea_rows' => 3,
1230 'tiny_mce' => true,
1231 'tinymce' => array(
1232 'toolbar1' => $toolbar1,
1233 'content_css' => ASENHA_URL . 'assets/css/settings-wpeditor.css',
1234 ),
1235 'editor_css' => '',
1236 'quicktags' => $quicktags,
1237 'default_editor' => 'tinymce',
1238 );
1239 add_settings_field(
1240 $field_id,
1241 __( 'Left Side', 'admin-site-enhancements' ),
1242 [$render_field, 'render_wpeditor_subfield'],
1243 ASENHA_SLUG,
1244 'main-section',
1245 array(
1246 'option_name' => ASENHA_SLUG_U,
1247 'field_id' => $field_id,
1248 'field_slug' => $field_slug,
1249 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1250 'field_type' => 'textarea',
1251 'field_intro' => '',
1252 'field_description' => __( 'Default text is: <em>Thank you for creating with <a href="https://wordpress.org/">WordPress</a></em>.', 'admin-site-enhancements' ),
1253 'field_placeholder' => '',
1254 'editor_settings' => $editor_settings,
1255 'class' => 'asenha-textarea admin-interface has-wpeditor ' . $field_slug,
1256 )
1257 );
1258 $field_id = 'custom_admin_footer_right';
1259 $field_slug = 'custom-admin-footer-right';
1260 // https://developer.wordpress.org/reference/classes/_wp_editors/parse_settings/
1261 // https://www.tiny.cloud/docs/advanced/available-toolbar-buttons/
1262 $editor_settings = array(
1263 'media_buttons' => $media_buttons,
1264 'textarea_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1265 'textarea_rows' => 3,
1266 'tiny_mce' => true,
1267 'tinymce' => array(
1268 'toolbar1' => $toolbar1,
1269 'content_css' => ASENHA_URL . 'assets/css/settings-wpeditor.css',
1270 ),
1271 'editor_css' => '',
1272 'quicktags' => $quicktags,
1273 'default_editor' => 'tinymce',
1274 );
1275 add_settings_field(
1276 $field_id,
1277 __( 'Right Side', 'admin-site-enhancements' ),
1278 [$render_field, 'render_wpeditor_subfield'],
1279 ASENHA_SLUG,
1280 'main-section',
1281 array(
1282 'option_name' => ASENHA_SLUG_U,
1283 'field_id' => $field_id,
1284 'field_slug' => $field_slug,
1285 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1286 'field_type' => 'textarea',
1287 'field_rows' => 1,
1288 'field_intro' => '',
1289 'field_description' => sprintf(
1290 /* translators: %s is the WordPress version number */
1291 __( 'Default text is: <em>Version %s</em>', 'admin-site-enhancements' ),
1292 $wp_version
1293 ),
1294 'field_placeholder' => '',
1295 'editor_settings' => $editor_settings,
1296 'class' => 'asenha-textarea admin-interface has-wpeditor ' . $field_slug,
1297 )
1298 );
1299 // =================================================================
1300 // LOG IN/OUT | REGISTER
1301 // =================================================================
1302 // Change Login URL
1303 $field_id = 'change_login_url';
1304 $field_slug = 'change-login-url';
1305 $field_title = __( 'Change Login URL', 'admin-site-enhancements' );
1306 add_settings_field(
1307 $field_id,
1308 $field_title,
1309 [$render_field, 'render_checkbox_toggle'],
1310 ASENHA_SLUG,
1311 'main-section',
1312 array(
1313 'option_name' => ASENHA_SLUG_U,
1314 'field_id' => $field_id,
1315 'field_slug' => $field_slug,
1316 'field_title' => $field_title,
1317 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1318 'field_description' => sprintf(
1319 /* translators: %s is the default login URL */
1320 __( 'Default is %s', 'admin-site-enhancements' ),
1321 site_url( '/wp-login.php' )
1322 ),
1323 'field_options_moreless' => true,
1324 'field_options_wrapper' => true,
1325 'class' => 'asenha-toggle login-logout ' . $field_slug,
1326 )
1327 );
1328 $field_id = 'custom_login_slug';
1329 $field_slug = 'custom-login-slug';
1330 add_settings_field(
1331 $field_id,
1332 __( 'New login URL:', 'admin-site-enhancements' ),
1333 [$render_field, 'render_text_subfield'],
1334 ASENHA_SLUG,
1335 'main-section',
1336 array(
1337 'option_name' => ASENHA_SLUG_U,
1338 'field_id' => $field_id,
1339 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1340 'field_type' => 'with-prefix-suffix',
1341 'field_prefix' => site_url() . '/',
1342 'field_suffix' => '/',
1343 'field_placeholder' => __( 'e.g. backend', 'admin-site-enhancements' ),
1344 'field_description' => '',
1345 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1346 )
1347 );
1348 $field_id = 'custom_login_whitelist';
1349 $field_slug = 'custom-login-whitelist';
1350 add_settings_field(
1351 $field_id,
1352 '<strong>' . __( 'Allow login from:', 'admin-site-enhancements' ) . '</strong> <span class="weight-normal">' . site_url() . '/</span>',
1353 [$render_field, 'render_textarea_subfield'],
1354 ASENHA_SLUG,
1355 'main-section',
1356 array(
1357 'option_name' => ASENHA_SLUG_U,
1358 'field_id' => $field_id,
1359 'field_slug' => $field_slug,
1360 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1361 'field_type' => 'textarea',
1362 'field_rows' => 3,
1363 'field_intro' => '',
1364 'field_description' => __( 'Enter one path per line', 'admin-site-enhancements' ),
1365 'field_placeholder' => __( 'e.g. dashboard', 'admin-site-enhancements' ),
1366 'class' => 'asenha-textarea margin-top-16 login-logout ' . $field_slug,
1367 )
1368 );
1369 $field_id = 'change_login_url_description';
1370 $field_slug = 'change-login-url-description';
1371 $field_description = '<div class="asenha-warning">' . __( '"New login URL" only works for/with the default WordPress login page.', 'admin-site-enhancements' ) . ' ' . __( 'Please use something other than \'login\' for the custom login slug.', 'admin-site-enhancements' ) . '<br /><br />' . __( '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.', 'admin-site-enhancements' ) . '<br /><br />' . __( 'If you need 2FA, the <a href="https://wordpress.org/plugins/two-factor/">Two Factor plugin</a> has been confirmed to be compatible.', 'admin-site-enhancements' ) . '</div>';
1372 add_settings_field(
1373 $field_id,
1374 '',
1375 [$render_field, 'render_description_subfield'],
1376 ASENHA_SLUG,
1377 'main-section',
1378 array(
1379 'option_name' => ASENHA_SLUG_U,
1380 'field_description' => $field_description,
1381 'class' => 'asenha-description login-logout ' . $field_slug,
1382 )
1383 );
1384 // Login ID Type
1385 $field_id = 'login_id_type_restriction';
1386 $field_slug = 'login-id-type-restriction';
1387 $field_title = __( 'Login ID Type', 'admin-site-enhancements' );
1388 add_settings_field(
1389 $field_id,
1390 $field_title,
1391 [$render_field, 'render_checkbox_toggle'],
1392 ASENHA_SLUG,
1393 'main-section',
1394 array(
1395 'option_name' => ASENHA_SLUG_U,
1396 'field_id' => $field_id,
1397 'field_slug' => $field_slug,
1398 'field_title' => $field_title,
1399 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1400 'field_description' => __( 'Restrict login ID to username or email address only.', 'admin-site-enhancements' ),
1401 'field_options_wrapper' => true,
1402 'class' => 'asenha-toggle login-logout ' . $field_slug,
1403 )
1404 );
1405 $field_id = 'login_id_type';
1406 $field_slug = 'login-id-type';
1407 add_settings_field(
1408 $field_id,
1409 '',
1410 [$render_field, 'render_radio_buttons_subfield'],
1411 ASENHA_SLUG,
1412 'main-section',
1413 array(
1414 'option_name' => ASENHA_SLUG_U,
1415 'field_id' => $field_id,
1416 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1417 'field_radios' => array(
1418 __( 'Username only', 'admin-site-enhancements' ) => 'username',
1419 __( 'Email address only', 'admin-site-enhancements' ) => 'email',
1420 ),
1421 'field_default' => 'username',
1422 'class' => 'asenha-radio-buttons shift-up login-logout ' . $field_slug,
1423 )
1424 );
1425 // Use Site Identity on the Login Page
1426 $field_id = 'site_identity_on_login';
1427 $field_slug = 'site-identity-on-login';
1428 $field_title = __( 'Site Identity on Login Page', 'admin-site-enhancements' );
1429 add_settings_field(
1430 $field_id,
1431 $field_title,
1432 [$render_field, 'render_checkbox_toggle'],
1433 ASENHA_SLUG,
1434 'main-section',
1435 array(
1436 'option_name' => ASENHA_SLUG_U,
1437 'field_id' => $field_id,
1438 'field_slug' => $field_slug,
1439 'field_title' => $field_title,
1440 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1441 'field_description' => sprintf(
1442 /* translators: %s is URL to the Customizer */
1443 __( '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' ),
1444 admin_url( 'options-general.php' ),
1445 admin_url( 'customize.php' )
1446 ),
1447 'field_options_wrapper' => true,
1448 'class' => 'asenha-toggle login-logout ' . $field_slug,
1449 )
1450 );
1451 // Enable Log In/Out Menu
1452 $field_id = 'enable_login_logout_menu';
1453 $field_slug = 'enable-login-logout-menu';
1454 $field_title = __( 'Log In/Out Menu', 'admin-site-enhancements' );
1455 add_settings_field(
1456 $field_id,
1457 $field_title,
1458 [$render_field, 'render_checkbox_toggle'],
1459 ASENHA_SLUG,
1460 'main-section',
1461 array(
1462 'option_name' => ASENHA_SLUG_U,
1463 'field_id' => $field_id,
1464 'field_slug' => $field_slug,
1465 'field_title' => $field_title,
1466 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1467 'field_description' => __( 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', 'admin-site-enhancements' ),
1468 'field_options_wrapper' => true,
1469 'field_options_moreless' => true,
1470 'class' => 'asenha-toggle login-logout ' . $field_slug,
1471 )
1472 );
1473 // Last Login Column
1474 $field_id = 'enable_last_login_column';
1475 $field_slug = 'enable-last-login-column';
1476 $field_title = __( 'Last Login Column', 'admin-site-enhancements' );
1477 add_settings_field(
1478 $field_id,
1479 $field_title,
1480 [$render_field, 'render_checkbox_toggle'],
1481 ASENHA_SLUG,
1482 'main-section',
1483 array(
1484 'option_name' => ASENHA_SLUG_U,
1485 'field_id' => $field_id,
1486 'field_slug' => $field_slug,
1487 'field_title' => $field_title,
1488 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1489 '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' ),
1490 'field_options_wrapper' => true,
1491 'field_options_moreless' => true,
1492 'class' => 'asenha-toggle login-logout ' . $field_slug,
1493 )
1494 );
1495 // Registration Date Column
1496 $field_id = 'registration_date_column';
1497 $field_slug = 'registration-date-column';
1498 $field_title = __( 'Registration Date Column', 'admin-site-enhancements' );
1499 add_settings_field(
1500 $field_id,
1501 $field_title,
1502 [$render_field, 'render_checkbox_toggle'],
1503 ASENHA_SLUG,
1504 'main-section',
1505 array(
1506 'option_name' => ASENHA_SLUG_U,
1507 'field_id' => $field_id,
1508 'field_slug' => $field_slug,
1509 'field_title' => $field_title,
1510 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1511 'field_description' => __( 'Display the registration date and time in the users list table.', 'admin-site-enhancements' ),
1512 'field_options_wrapper' => true,
1513 'field_options_moreless' => true,
1514 'class' => 'asenha-toggle login-logout ' . $field_slug,
1515 )
1516 );
1517 // Redirect After Login
1518 $field_id = 'redirect_after_login';
1519 $field_slug = 'redirect-after-login';
1520 $field_title = __( 'Redirect After Login', 'admin-site-enhancements' );
1521 add_settings_field(
1522 $field_id,
1523 $field_title,
1524 [$render_field, 'render_checkbox_toggle'],
1525 ASENHA_SLUG,
1526 'main-section',
1527 array(
1528 'option_name' => ASENHA_SLUG_U,
1529 'field_id' => $field_id,
1530 'field_slug' => $field_slug,
1531 'field_title' => $field_title,
1532 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1533 'field_description' => __( 'Set custom redirect URL for all or some user roles after login.', 'admin-site-enhancements' ),
1534 'field_options_wrapper' => true,
1535 'field_options_moreless' => true,
1536 'class' => 'asenha-toggle login-logout ' . $field_slug,
1537 )
1538 );
1539 $field_id = 'redirect_after_login_to_slug';
1540 $field_slug = 'redirect-after-login-to-slug';
1541 add_settings_field(
1542 $field_id,
1543 __( 'Redirect to:', 'admin-site-enhancements' ),
1544 [$render_field, 'render_text_subfield'],
1545 ASENHA_SLUG,
1546 'main-section',
1547 array(
1548 'option_name' => ASENHA_SLUG_U,
1549 'field_id' => $field_id,
1550 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1551 'field_type' => 'with-prefix-suffix',
1552 'field_prefix' => site_url() . '/',
1553 'field_suffix' => __( 'for:', 'admin-site-enhancements' ),
1554 'field_placeholder' => '',
1555 'field_description' => '',
1556 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1557 )
1558 );
1559 $field_id = 'redirect_after_login_for';
1560 $field_slug = 'redirect-after-login-for';
1561 if ( is_array( $roles ) ) {
1562 foreach ( $roles as $role_slug => $role_label ) {
1563 // e.g. $role_slug is administrator, $role_label is Administrator
1564 add_settings_field(
1565 $field_id . '_' . $role_slug,
1566 '',
1567 [$render_field, 'render_checkbox_subfield'],
1568 ASENHA_SLUG,
1569 'main-section',
1570 array(
1571 'option_name' => ASENHA_SLUG_U,
1572 'parent_field_id' => $field_id,
1573 'field_id' => $role_slug,
1574 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1575 'field_label' => $role_label,
1576 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1577 )
1578 );
1579 }
1580 }
1581 // Redirect After Logout
1582 $field_id = 'redirect_after_logout';
1583 $field_slug = 'redirect-after-logout';
1584 $field_title = __( 'Redirect After Logout', 'admin-site-enhancements' );
1585 add_settings_field(
1586 $field_id,
1587 $field_title,
1588 [$render_field, 'render_checkbox_toggle'],
1589 ASENHA_SLUG,
1590 'main-section',
1591 array(
1592 'option_name' => ASENHA_SLUG_U,
1593 'field_id' => $field_id,
1594 'field_slug' => $field_slug,
1595 'field_title' => $field_title,
1596 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1597 'field_description' => __( 'Set custom redirect URL for all or some user roles after logout.', 'admin-site-enhancements' ),
1598 'field_options_wrapper' => true,
1599 'field_options_moreless' => true,
1600 'class' => 'asenha-toggle login-logout ' . $field_slug,
1601 )
1602 );
1603 $field_id = 'redirect_after_logout_to_slug';
1604 $field_slug = 'redirect-after-logout-to-slug';
1605 add_settings_field(
1606 $field_id,
1607 __( 'Redirect to:', 'admin-site-enhancements' ),
1608 [$render_field, 'render_text_subfield'],
1609 ASENHA_SLUG,
1610 'main-section',
1611 array(
1612 'option_name' => ASENHA_SLUG_U,
1613 'field_id' => $field_id,
1614 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1615 'field_type' => 'with-prefix-suffix',
1616 'field_prefix' => site_url() . '/',
1617 'field_suffix' => __( 'for:', 'admin-site-enhancements' ),
1618 'field_description' => '',
1619 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug,
1620 )
1621 );
1622 $field_id = 'redirect_after_logout_for';
1623 $field_slug = 'redirect-after-logout-for';
1624 if ( is_array( $roles ) ) {
1625 foreach ( $roles as $role_slug => $role_label ) {
1626 // e.g. $role_slug is administrator, $role_label is Administrator
1627 add_settings_field(
1628 $field_id . '_' . $role_slug,
1629 '',
1630 [$render_field, 'render_checkbox_subfield'],
1631 ASENHA_SLUG,
1632 'main-section',
1633 array(
1634 'option_name' => ASENHA_SLUG_U,
1635 'parent_field_id' => $field_id,
1636 'field_id' => $role_slug,
1637 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $role_slug . ']',
1638 'field_label' => $role_label,
1639 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug,
1640 )
1641 );
1642 }
1643 }
1644 // Disable User Account
1645 $field_id = 'disable_user_account';
1646 $field_slug = 'disable-user-account';
1647 $field_title = __( 'Disable User Account', 'admin-site-enhancements' );
1648 add_settings_field(
1649 $field_id,
1650 $field_title,
1651 [$render_field, 'render_checkbox_toggle'],
1652 ASENHA_SLUG,
1653 'main-section',
1654 array(
1655 'option_name' => ASENHA_SLUG_U,
1656 'field_id' => $field_id,
1657 'field_slug' => $field_slug,
1658 'field_title' => $field_title,
1659 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1660 'field_description' => __( 'Allow administrators to disable login for individual users from the Users list and user profile, while preserving their content and display name.', 'admin-site-enhancements' ),
1661 'field_options_wrapper' => true,
1662 'field_options_moreless' => true,
1663 'class' => 'asenha-toggle login-logout ' . $field_slug,
1664 )
1665 );
1666 // Enable Custom Admin CSS
1667 $field_id = 'enable_custom_admin_css';
1668 $field_slug = 'enable-custom-admin-css';
1669 $field_title = __( 'Custom Admin CSS', 'admin-site-enhancements' );
1670 add_settings_field(
1671 $field_id,
1672 $field_title,
1673 [$render_field, 'render_checkbox_toggle'],
1674 ASENHA_SLUG,
1675 'main-section',
1676 array(
1677 'option_name' => ASENHA_SLUG_U,
1678 'field_id' => $field_id,
1679 'field_slug' => $field_slug,
1680 'field_title' => $field_title,
1681 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1682 'field_description' => __( 'Add custom CSS on all admin pages for all user roles.', 'admin-site-enhancements' ),
1683 'field_options_wrapper' => true,
1684 'field_options_moreless' => true,
1685 'class' => 'asenha-toggle custom-code ' . $field_slug,
1686 )
1687 );
1688 $field_id = 'custom_admin_css';
1689 $field_slug = 'custom-admin-css';
1690 add_settings_field(
1691 $field_id,
1692 '',
1693 [$render_field, 'render_textarea_subfield'],
1694 ASENHA_SLUG,
1695 'main-section',
1696 array(
1697 'option_name' => ASENHA_SLUG_U,
1698 'field_id' => $field_id,
1699 'field_slug' => $field_slug,
1700 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1701 'field_type' => 'textarea',
1702 'field_rows' => 30,
1703 'field_intro' => '',
1704 'field_description' => '',
1705 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1706 )
1707 );
1708 // Enable Custom Frontend CSS
1709 $field_id = 'enable_custom_frontend_css';
1710 $field_slug = 'enable-custom-frontend-css';
1711 $field_title = __( 'Custom Frontend CSS', 'admin-site-enhancements' );
1712 add_settings_field(
1713 $field_id,
1714 $field_title,
1715 [$render_field, 'render_checkbox_toggle'],
1716 ASENHA_SLUG,
1717 'main-section',
1718 array(
1719 'option_name' => ASENHA_SLUG_U,
1720 'field_id' => $field_id,
1721 'field_slug' => $field_slug,
1722 'field_title' => $field_title,
1723 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1724 'field_description' => __( 'Add custom CSS on all frontend pages for all user roles.', 'admin-site-enhancements' ),
1725 'field_options_wrapper' => true,
1726 'field_options_moreless' => true,
1727 'class' => 'asenha-toggle custom-code ' . $field_slug,
1728 )
1729 );
1730 $field_id = 'custom_frontend_css';
1731 $field_slug = 'custom-frontend-css';
1732 add_settings_field(
1733 $field_id,
1734 '',
1735 [$render_field, 'render_textarea_subfield'],
1736 ASENHA_SLUG,
1737 'main-section',
1738 array(
1739 'option_name' => ASENHA_SLUG_U,
1740 'field_id' => $field_id,
1741 'field_slug' => $field_slug,
1742 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1743 'field_type' => 'textarea',
1744 'field_rows' => 30,
1745 'field_intro' => '',
1746 'field_description' => '',
1747 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1748 )
1749 );
1750 // Insert <head>, <body> and <footer> code
1751 $field_id = 'insert_head_body_footer_code';
1752 $field_slug = 'insert-head-body-footer-code';
1753 $field_title = __( 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code', 'admin-site-enhancements' );
1754 add_settings_field(
1755 $field_id,
1756 /* translators: keep &lt;head&gt; &lt;body&gt; &lt;footer&gt; as is in the translation */
1757 $field_title,
1758 [$render_field, 'render_checkbox_toggle'],
1759 ASENHA_SLUG,
1760 'main-section',
1761 array(
1762 'option_name' => ASENHA_SLUG_U,
1763 'field_id' => $field_id,
1764 'field_slug' => $field_slug,
1765 'field_title' => $field_title,
1766 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1767 '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' ),
1768 'field_options_wrapper' => true,
1769 'field_options_moreless' => true,
1770 'class' => 'asenha-toggle custom-code ' . $field_slug,
1771 )
1772 );
1773 $field_id = 'disable_code_unslash';
1774 $field_slug = 'disable-code-unslash';
1775 add_settings_field(
1776 $field_id,
1777 '',
1778 [$render_field, 'render_checkbox_plain'],
1779 ASENHA_SLUG,
1780 'main-section',
1781 array(
1782 'option_name' => ASENHA_SLUG_U,
1783 'field_id' => $field_id,
1784 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1785 'field_label' => __( 'Do not remove backslashes from the code output on the frontend', 'admin-site-enhancements' ),
1786 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-bottom custom-code ' . $field_slug,
1787 )
1788 );
1789 $field_id = 'head_code_priority';
1790 $field_slug = 'head-code-priority';
1791 add_settings_field(
1792 $field_id,
1793 '',
1794 [$render_field, 'render_number_subfield'],
1795 ASENHA_SLUG,
1796 'main-section',
1797 array(
1798 'option_name' => ASENHA_SLUG_U,
1799 'field_id' => $field_id,
1800 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1801 'field_type' => 'with-prefix-suffix',
1802 'field_prefix' => __( '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1803 'field_suffix' => '',
1804 'field_intro' => '',
1805 'field_placeholder' => '10',
1806 'field_min' => 0,
1807 'field_max' => PHP_INT_MAX,
1808 'field_description' => __( 'Default is 10. Larger number insert code closer to &lt;/head&gt;', 'admin-site-enhancements' ),
1809 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1810 )
1811 );
1812 $field_id = 'head_code';
1813 $field_slug = 'head-code';
1814 add_settings_field(
1815 $field_id,
1816 '',
1817 [$render_field, 'render_textarea_subfield'],
1818 ASENHA_SLUG,
1819 'main-section',
1820 array(
1821 'option_name' => ASENHA_SLUG_U,
1822 'field_id' => $field_id,
1823 'field_slug' => $field_slug,
1824 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1825 'field_type' => 'textarea',
1826 'field_rows' => 15,
1827 'field_intro' => '',
1828 'field_description' => '',
1829 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1830 )
1831 );
1832 $field_id = 'body_code_priority';
1833 $field_slug = 'body-code-priority';
1834 add_settings_field(
1835 $field_id,
1836 '',
1837 [$render_field, 'render_number_subfield'],
1838 ASENHA_SLUG,
1839 'main-section',
1840 array(
1841 'option_name' => ASENHA_SLUG_U,
1842 'field_id' => $field_id,
1843 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1844 'field_type' => 'with-prefix-suffix',
1845 'field_prefix' => __( '<strong>Code to insert after &lt;body&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1846 'field_suffix' => '',
1847 'field_intro' => '',
1848 'field_placeholder' => '10',
1849 'field_min' => 0,
1850 'field_max' => PHP_INT_MAX,
1851 'field_description' => __( 'Default is 10. Smaller number insert code closer to &lt;body&gt;', 'admin-site-enhancements' ),
1852 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1853 )
1854 );
1855 $field_id = 'body_code';
1856 $field_slug = 'body-code';
1857 add_settings_field(
1858 $field_id,
1859 '',
1860 [$render_field, 'render_textarea_subfield'],
1861 ASENHA_SLUG,
1862 'main-section',
1863 array(
1864 'option_name' => ASENHA_SLUG_U,
1865 'field_id' => $field_id,
1866 'field_slug' => $field_slug,
1867 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1868 'field_type' => 'textarea',
1869 'field_rows' => 15,
1870 'field_intro' => '',
1871 'field_description' => '',
1872 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1873 )
1874 );
1875 $field_id = 'footer_code_priority';
1876 $field_slug = 'footer-code-priority';
1877 add_settings_field(
1878 $field_id,
1879 '',
1880 [$render_field, 'render_number_subfield'],
1881 ASENHA_SLUG,
1882 'main-section',
1883 array(
1884 'option_name' => ASENHA_SLUG_U,
1885 'field_id' => $field_id,
1886 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1887 'field_type' => 'with-prefix-suffix',
1888 'field_prefix' => __( '<strong>Code to insert in footer section before &lt;/body&gt; with the priority of</strong>', 'admin-site-enhancements' ),
1889 'field_suffix' => '',
1890 'field_intro' => '',
1891 'field_placeholder' => '10',
1892 'field_min' => 0,
1893 'field_max' => PHP_INT_MAX,
1894 'field_description' => __( 'Default is 10. Larger number insert code closer to &lt;/body&gt;', 'admin-site-enhancements' ),
1895 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug,
1896 )
1897 );
1898 $field_id = 'footer_code';
1899 $field_slug = 'footer-code';
1900 add_settings_field(
1901 $field_id,
1902 '',
1903 [$render_field, 'render_textarea_subfield'],
1904 ASENHA_SLUG,
1905 'main-section',
1906 array(
1907 'option_name' => ASENHA_SLUG_U,
1908 'field_id' => $field_id,
1909 'field_slug' => $field_slug,
1910 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1911 'field_type' => 'textarea',
1912 'field_rows' => 15,
1913 'field_intro' => '',
1914 'field_description' => '',
1915 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
1916 )
1917 );
1918 // Custom Body Class
1919 $field_id = 'enable_custom_body_class';
1920 $field_slug = 'enable-custom-body-class';
1921 $field_title = __( 'Custom Body Class', 'admin-site-enhancements' );
1922 add_settings_field(
1923 $field_id,
1924 $field_title,
1925 [$render_field, 'render_checkbox_toggle'],
1926 ASENHA_SLUG,
1927 'main-section',
1928 array(
1929 'option_name' => ASENHA_SLUG_U,
1930 'field_id' => $field_id,
1931 'field_slug' => $field_slug,
1932 'field_title' => $field_title,
1933 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1934 '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' ),
1935 'field_options_wrapper' => true,
1936 'field_options_moreless' => true,
1937 'class' => 'asenha-toggle custom-code ' . $field_slug,
1938 )
1939 );
1940 $field_id = 'enable_custom_body_class_for';
1941 $field_slug = 'enable-custom-body-class-for';
1942 if ( is_array( $asenha_public_post_types ) ) {
1943 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
1944 // e.g. $post_type_slug is post, $post_type_label is Posts
1945 if ( 'attachment' != $post_type_slug ) {
1946 add_settings_field(
1947 $field_id . '_' . $post_type_slug,
1948 '',
1949 [$render_field, 'render_checkbox_subfield'],
1950 ASENHA_SLUG,
1951 'main-section',
1952 array(
1953 'option_name' => ASENHA_SLUG_U,
1954 'parent_field_id' => $field_id,
1955 'field_id' => $post_type_slug,
1956 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
1957 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
1958 'class' => 'asenha-checkbox asenha-hide-th asenha-half custom-code ' . $field_slug . ' ' . $post_type_slug,
1959 )
1960 );
1961 }
1962 }
1963 }
1964 // Manage ads.txt and app-ads.txt
1965 $field_id = 'manage_ads_appads_txt';
1966 $field_slug = 'manage-ads-appads-txt';
1967 $field_title = __( 'Manage ads.txt and app-ads.txt', 'admin-site-enhancements' );
1968 add_settings_field(
1969 $field_id,
1970 $field_title,
1971 [$render_field, 'render_checkbox_toggle'],
1972 ASENHA_SLUG,
1973 'main-section',
1974 array(
1975 'option_name' => ASENHA_SLUG_U,
1976 'field_id' => $field_id,
1977 'field_slug' => $field_slug,
1978 'field_title' => $field_title,
1979 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
1980 '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' ),
1981 'field_options_wrapper' => true,
1982 'field_options_moreless' => true,
1983 'class' => 'asenha-toggle custom-code ' . $field_slug,
1984 )
1985 );
1986 $field_id = 'ads_txt_content';
1987 $field_slug = 'ads-txt-content';
1988 $ads_txt_url_urlencoded = urlencode( site_url( 'ads.txt' ) );
1989 $server_name = wp_parse_url( site_url(), PHP_URL_HOST );
1990 $ads_txt_str_replaced = str_replace( '.', '-', sanitize_text_field( (string) $server_name ) );
1991 add_settings_field(
1992 $field_id,
1993 '',
1994 [$render_field, 'render_textarea_subfield'],
1995 ASENHA_SLUG,
1996 'main-section',
1997 array(
1998 'option_name' => ASENHA_SLUG_U,
1999 'field_id' => $field_id,
2000 'field_slug' => $field_slug,
2001 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2002 'field_type' => 'textarea',
2003 'field_rows' => 15,
2004 'field_intro' => __( '<strong>Your ads.txt content:</strong>', 'admin-site-enhancements' ),
2005 '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>',
2006 'admin-site-enhancements',
2007 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
2008 )
2009 );
2010 $field_id = 'app_ads_txt_content';
2011 $field_slug = 'app-ads-txt-content';
2012 $appads_txt_url_urlencoded = urlencode( site_url( 'app-ads.txt' ) );
2013 add_settings_field(
2014 $field_id,
2015 '',
2016 [$render_field, 'render_textarea_subfield'],
2017 ASENHA_SLUG,
2018 'main-section',
2019 array(
2020 'option_name' => ASENHA_SLUG_U,
2021 'field_id' => $field_id,
2022 'field_slug' => $field_slug,
2023 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2024 'field_type' => 'textarea',
2025 'field_rows' => 15,
2026 'field_intro' => __( '<strong>Your app-ads.txt content:</strong>', 'admin-site-enhancements' ),
2027 'field_description' => __( 'Validate with:', 'admin-site-enhancements' ) . ' <a href="https://adstxt.guru/validator/url/?url=' . $appads_txt_url_urlencoded . '" target="_blank">adstxt.guru</a>',
2028 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
2029 )
2030 );
2031 // Manage robots.txt
2032 $field_id = 'manage_robots_txt';
2033 $field_slug = 'manage-robots-txt';
2034 $field_title = __( 'Manage robots.txt', 'admin-site-enhancements' );
2035 add_settings_field(
2036 $field_id,
2037 $field_title,
2038 [$render_field, 'render_checkbox_toggle'],
2039 ASENHA_SLUG,
2040 'main-section',
2041 array(
2042 'option_name' => ASENHA_SLUG_U,
2043 'field_id' => $field_id,
2044 'field_slug' => $field_slug,
2045 'field_title' => $field_title,
2046 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2047 'field_description' => __( 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.', 'admin-site-enhancements' ),
2048 'field_options_wrapper' => true,
2049 'field_options_moreless' => true,
2050 'class' => 'asenha-toggle custom-code ' . $field_slug,
2051 )
2052 );
2053 $field_id = 'robots_txt_content';
2054 $field_slug = 'robots-txt-content';
2055 $robots_txt_url_urlencoded = urlencode( site_url( 'robots.txt' ) );
2056 add_settings_field(
2057 $field_id,
2058 '',
2059 [$render_field, 'render_textarea_subfield'],
2060 ASENHA_SLUG,
2061 'main-section',
2062 array(
2063 'option_name' => ASENHA_SLUG_U,
2064 'field_id' => $field_id,
2065 'field_slug' => $field_slug,
2066 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2067 'field_type' => 'textarea',
2068 'field_rows' => 20,
2069 'field_intro' => '',
2070 '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>',
2071 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug,
2072 )
2073 );
2074 // =================================================================
2075 // DISABLE COMPONENTS
2076 // =================================================================
2077 // Disable Gutenberg
2078 $field_id = 'disable_gutenberg';
2079 $field_slug = 'disable-gutenberg';
2080 $field_title = __( 'Disable Gutenberg', 'admin-site-enhancements' );
2081 add_settings_field(
2082 $field_id,
2083 $field_title,
2084 [$render_field, 'render_checkbox_toggle'],
2085 ASENHA_SLUG,
2086 'main-section',
2087 array(
2088 'option_name' => ASENHA_SLUG_U,
2089 'field_id' => $field_id,
2090 'field_slug' => $field_slug,
2091 'field_title' => $field_title,
2092 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2093 'field_description' => __( 'Disable the Gutenberg block editor for some or all applicable post types.', 'admin-site-enhancements' ),
2094 'field_options_wrapper' => true,
2095 'field_options_moreless' => true,
2096 'class' => 'asenha-toggle disable-components ' . $field_slug,
2097 )
2098 );
2099 $field_id = 'disable_gutenberg_for';
2100 $field_slug = 'disable-gutenberg-for';
2101 if ( is_array( $asenha_gutenberg_post_types ) ) {
2102 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) {
2103 // e.g. $post_type_slug is post, $post_type_label is Posts
2104 add_settings_field(
2105 $field_id . '_' . $post_type_slug,
2106 '',
2107 [$render_field, 'render_checkbox_subfield'],
2108 ASENHA_SLUG,
2109 'main-section',
2110 array(
2111 'option_name' => ASENHA_SLUG_U,
2112 'parent_field_id' => $field_id,
2113 'field_id' => $post_type_slug,
2114 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2115 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2116 'class' => 'asenha-checkbox asenha-checkbox-item asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2117 )
2118 );
2119 }
2120 }
2121 $field_id = 'disable_gutenberg_frontend_styles';
2122 $field_slug = 'disable-gutenberg-frontend-styles';
2123 add_settings_field(
2124 $field_id,
2125 '',
2126 [$render_field, 'render_checkbox_plain'],
2127 ASENHA_SLUG,
2128 'main-section',
2129 array(
2130 'option_name' => ASENHA_SLUG_U,
2131 'field_id' => $field_id,
2132 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2133 'field_label' => __( 'Also disable frontend block styles / CSS files for the selected post types.', 'admin-site-enhancements' ),
2134 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug,
2135 )
2136 );
2137 // Disable Comments
2138 $field_id = 'disable_comments';
2139 $field_slug = 'disable-comments';
2140 $field_title = __( 'Disable Comments', 'admin-site-enhancements' );
2141 add_settings_field(
2142 $field_id,
2143 $field_title,
2144 [$render_field, 'render_checkbox_toggle'],
2145 ASENHA_SLUG,
2146 'main-section',
2147 array(
2148 'option_name' => ASENHA_SLUG_U,
2149 'field_id' => $field_id,
2150 'field_slug' => $field_slug,
2151 'field_title' => $field_title,
2152 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2153 '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' ),
2154 'field_options_wrapper' => true,
2155 'field_options_moreless' => true,
2156 'class' => 'asenha-toggle disable-components ' . $field_slug,
2157 )
2158 );
2159 $field_id = 'disable_comments_for';
2160 $field_slug = 'disable-comments-for';
2161 if ( is_array( $asenha_public_post_types ) ) {
2162 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
2163 // e.g. $post_type_slug is post, $post_type_label is Posts
2164 if ( post_type_supports( $post_type_slug, 'comments' ) && 'kt_gallery' != $post_type_slug ) {
2165 add_settings_field(
2166 $field_id . '_' . $post_type_slug,
2167 '',
2168 [$render_field, 'render_checkbox_subfield'],
2169 ASENHA_SLUG,
2170 'main-section',
2171 array(
2172 'option_name' => ASENHA_SLUG_U,
2173 'parent_field_id' => $field_id,
2174 'field_id' => $post_type_slug,
2175 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2176 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2177 'class' => 'asenha-checkbox asenha-checkbox-item asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug,
2178 )
2179 );
2180 }
2181 }
2182 }
2183 // Disable REST API
2184 $field_id = 'disable_rest_api';
2185 $field_slug = 'disable-rest-api';
2186 $field_title = __( 'Disable REST API', 'admin-site-enhancements' );
2187 add_settings_field(
2188 $field_id,
2189 $field_title,
2190 [$render_field, 'render_checkbox_toggle'],
2191 ASENHA_SLUG,
2192 'main-section',
2193 array(
2194 'option_name' => ASENHA_SLUG_U,
2195 'field_id' => $field_id,
2196 'field_slug' => $field_slug,
2197 'field_title' => $field_title,
2198 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2199 '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' ),
2200 'field_options_wrapper' => true,
2201 'field_options_moreless' => true,
2202 'class' => 'asenha-toggle disable-components ' . $field_slug,
2203 )
2204 );
2205 // Disable Feeds
2206 $field_id = 'disable_feeds';
2207 $field_slug = 'disable-feeds';
2208 $field_title = __( 'Disable Feeds', 'admin-site-enhancements' );
2209 add_settings_field(
2210 $field_id,
2211 $field_title,
2212 [$render_field, 'render_checkbox_toggle'],
2213 ASENHA_SLUG,
2214 'main-section',
2215 array(
2216 'option_name' => ASENHA_SLUG_U,
2217 'field_id' => $field_id,
2218 'field_slug' => $field_slug,
2219 'field_title' => $field_title,
2220 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2221 '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' ),
2222 'field_options_wrapper' => true,
2223 'field_options_moreless' => true,
2224 'class' => 'asenha-toggle disable-components ' . $field_slug,
2225 )
2226 );
2227 // Disable Embeds
2228 $field_id = 'disable_embeds';
2229 $field_slug = 'disable-embeds';
2230 $field_title = __( 'Disable Embeds', 'admin-site-enhancements' );
2231 $oembed_providers_doc = 'https://developer.wordpress.org/advanced-administration/wordpress/oembed/#does-this-work-with-any-url';
2232 add_settings_field(
2233 $field_id,
2234 $field_title,
2235 [$render_field, 'render_checkbox_toggle'],
2236 ASENHA_SLUG,
2237 'main-section',
2238 array(
2239 'option_name' => ASENHA_SLUG_U,
2240 'field_id' => $field_id,
2241 'field_slug' => $field_slug,
2242 'field_title' => $field_title,
2243 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2244 'field_description' => __( 'Prevent your site content from being embedded on other sites.', 'admin-site-enhancements' ) . ' ' . sprintf(
2245 /* translators: %s is URL of WP Dev Resource page */
2246 __( 'Prevent embedding of non-<a href="%s" target="_blank">whitelisted</a> sites in your site.', 'admin-site-enhancements' ),
2247 $oembed_providers_doc
2248 ) . ' ' . __( 'Disable all, related JavaScript.', 'admin-site-enhancements' ) . ' ' . __( 'Removes support for the embed block.', 'admin-site-enhancements' ),
2249 'field_options_wrapper' => true,
2250 'field_options_moreless' => true,
2251 'class' => 'asenha-toggle disable-components ' . $field_slug,
2252 )
2253 );
2254 // Disable Auto Updates
2255 $field_id = 'disable_all_updates';
2256 $field_slug = 'disable-all-updates';
2257 $field_title = __( 'Disable All Updates', 'admin-site-enhancements' );
2258 add_settings_field(
2259 $field_id,
2260 $field_title,
2261 [$render_field, 'render_checkbox_toggle'],
2262 ASENHA_SLUG,
2263 'main-section',
2264 array(
2265 'option_name' => ASENHA_SLUG_U,
2266 'field_id' => $field_id,
2267 'field_slug' => $field_slug,
2268 'field_title' => $field_title,
2269 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2270 'field_description' => __( 'Completely disable core, theme and plugin updates and auto-updates. Will also disable update checks, notices and emails.', 'admin-site-enhancements' ),
2271 'field_options_wrapper' => true,
2272 'field_options_moreless' => true,
2273 'class' => 'asenha-toggle disable-components ' . $field_slug,
2274 )
2275 );
2276 // Disable Author Archives
2277 $field_id = 'disable_author_archives';
2278 $field_slug = 'disable-author-archives';
2279 $field_title = __( 'Disable Author Archives', 'admin-site-enhancements' );
2280 add_settings_field(
2281 $field_id,
2282 $field_title,
2283 [$render_field, 'render_checkbox_toggle'],
2284 ASENHA_SLUG,
2285 'main-section',
2286 array(
2287 'option_name' => ASENHA_SLUG_U,
2288 'field_id' => $field_id,
2289 'field_slug' => $field_slug,
2290 'field_title' => $field_title,
2291 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2292 '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' ),
2293 'field_options_wrapper' => true,
2294 'field_options_moreless' => true,
2295 'class' => 'asenha-toggle disable-components ' . $field_slug,
2296 )
2297 );
2298 // Disable Smaller Components
2299 $field_id = 'disable_smaller_components';
2300 $field_slug = 'disable-smaller-components';
2301 $field_title = __( 'Disable Smaller Components', 'admin-site-enhancements' );
2302 add_settings_field(
2303 $field_id,
2304 $field_title,
2305 [$render_field, 'render_checkbox_toggle'],
2306 ASENHA_SLUG,
2307 'main-section',
2308 array(
2309 'option_name' => ASENHA_SLUG_U,
2310 'field_id' => $field_id,
2311 'field_slug' => $field_slug,
2312 'field_title' => $field_title,
2313 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2314 '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' ),
2315 'field_options_wrapper' => true,
2316 'field_options_moreless' => true,
2317 'class' => 'asenha-toggle disable-components ' . $field_slug,
2318 )
2319 );
2320 $field_id = 'disable_head_generator_tag';
2321 $field_slug = 'disable-head-generator-tag';
2322 add_settings_field(
2323 $field_id,
2324 '',
2325 [$render_field, 'render_checkbox_plain'],
2326 ASENHA_SLUG,
2327 'main-section',
2328 array(
2329 'option_name' => ASENHA_SLUG_U,
2330 'field_id' => $field_id,
2331 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2332 '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' ),
2333 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2334 )
2335 );
2336 $field_id = 'disable_feed_generator_tag';
2337 $field_slug = 'disable-feed-generator-tag';
2338 add_settings_field(
2339 $field_id,
2340 '',
2341 [$render_field, 'render_checkbox_plain'],
2342 ASENHA_SLUG,
2343 'main-section',
2344 array(
2345 'option_name' => ASENHA_SLUG_U,
2346 'field_id' => $field_id,
2347 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2348 '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' ),
2349 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2350 )
2351 );
2352 $field_id = 'disable_resource_version_number';
2353 $field_slug = 'disable-resource-version-number';
2354 add_settings_field(
2355 $field_id,
2356 '',
2357 [$render_field, 'render_checkbox_plain'],
2358 ASENHA_SLUG,
2359 'main-section',
2360 array(
2361 'option_name' => ASENHA_SLUG_U,
2362 'field_id' => $field_id,
2363 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2364 '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' ),
2365 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2366 )
2367 );
2368 $field_id = 'disable_head_wlwmanifest_tag';
2369 $field_slug = 'disable-head-wlwmanifest-tag';
2370 add_settings_field(
2371 $field_id,
2372 '',
2373 [$render_field, 'render_checkbox_plain'],
2374 ASENHA_SLUG,
2375 'main-section',
2376 array(
2377 'option_name' => ASENHA_SLUG_U,
2378 'field_id' => $field_id,
2379 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2380 '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' ),
2381 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2382 )
2383 );
2384 $field_id = 'disable_head_rsd_tag';
2385 $field_slug = 'disable-head-rsd-tag';
2386 add_settings_field(
2387 $field_id,
2388 '',
2389 [$render_field, 'render_checkbox_plain'],
2390 ASENHA_SLUG,
2391 'main-section',
2392 array(
2393 'option_name' => ASENHA_SLUG_U,
2394 'field_id' => $field_id,
2395 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2396 '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' ),
2397 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2398 )
2399 );
2400 $field_id = 'disable_head_shortlink_tag';
2401 $field_slug = 'disable-head-shortlink-tag';
2402 add_settings_field(
2403 $field_id,
2404 '',
2405 [$render_field, 'render_checkbox_plain'],
2406 ASENHA_SLUG,
2407 'main-section',
2408 array(
2409 'option_name' => ASENHA_SLUG_U,
2410 'field_id' => $field_id,
2411 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2412 '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' ),
2413 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2414 )
2415 );
2416 $field_id = 'disable_frontend_dashicons';
2417 $field_slug = 'disable-frontend-dashicons';
2418 add_settings_field(
2419 $field_id,
2420 '',
2421 [$render_field, 'render_checkbox_plain'],
2422 ASENHA_SLUG,
2423 'main-section',
2424 array(
2425 'option_name' => ASENHA_SLUG_U,
2426 'field_id' => $field_id,
2427 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2428 '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' ),
2429 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2430 )
2431 );
2432 $field_id = 'disable_emoji_support';
2433 $field_slug = 'disable-emoji-support';
2434 add_settings_field(
2435 $field_id,
2436 '',
2437 [$render_field, 'render_checkbox_plain'],
2438 ASENHA_SLUG,
2439 'main-section',
2440 array(
2441 'option_name' => ASENHA_SLUG_U,
2442 'field_id' => $field_id,
2443 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2444 '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' ),
2445 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2446 )
2447 );
2448 $field_id = 'disable_jquery_migrate';
2449 $field_slug = 'disable-jquery-migrate';
2450 add_settings_field(
2451 $field_id,
2452 '',
2453 [$render_field, 'render_checkbox_plain'],
2454 ASENHA_SLUG,
2455 'main-section',
2456 array(
2457 'option_name' => ASENHA_SLUG_U,
2458 'field_id' => $field_id,
2459 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2460 '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' ),
2461 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2462 )
2463 );
2464 $field_id = 'disable_block_widgets';
2465 $field_slug = 'disable-block-widgets';
2466 add_settings_field(
2467 $field_id,
2468 '',
2469 [$render_field, 'render_checkbox_plain'],
2470 ASENHA_SLUG,
2471 'main-section',
2472 array(
2473 'option_name' => ASENHA_SLUG_U,
2474 'field_id' => $field_id,
2475 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2476 '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' ),
2477 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2478 )
2479 );
2480 $field_id = 'disable_lazy_load';
2481 $field_slug = 'disable-lazy-load';
2482 add_settings_field(
2483 $field_id,
2484 '',
2485 [$render_field, 'render_checkbox_plain'],
2486 ASENHA_SLUG,
2487 'main-section',
2488 array(
2489 'option_name' => ASENHA_SLUG_U,
2490 'field_id' => $field_id,
2491 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2492 'field_label' => __( 'Disable <strong>lazy loading of images</strong> that was natively added since WordPress v5.5.', 'admin-site-enhancements' ),
2493 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2494 )
2495 );
2496 $field_id = 'disable_application_passwords';
2497 $field_slug = 'disable-application-passwords';
2498 add_settings_field(
2499 $field_id,
2500 '',
2501 [$render_field, 'render_checkbox_plain'],
2502 ASENHA_SLUG,
2503 'main-section',
2504 array(
2505 'option_name' => ASENHA_SLUG_U,
2506 'field_id' => $field_id,
2507 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2508 'field_label' => __( 'Disable <strong>application passwords</strong> that was added since WordPress v5.6.', 'admin-site-enhancements' ),
2509 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2510 )
2511 );
2512 $field_id = 'disable_site_admin_email_verification_screen';
2513 $field_slug = 'disable-site-admin-email-verification-screen';
2514 add_settings_field(
2515 $field_id,
2516 '',
2517 [$render_field, 'render_checkbox_plain'],
2518 ASENHA_SLUG,
2519 'main-section',
2520 array(
2521 'option_name' => ASENHA_SLUG_U,
2522 'field_id' => $field_id,
2523 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2524 'field_label' => __( 'Disable <strong>site admin email verification screen</strong> that was added since WordPress v5.3.', 'admin-site-enhancements' ),
2525 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2526 )
2527 );
2528 $field_id = 'disable_user_email_notification_after_password_change';
2529 $field_slug = 'disable-user-email-notification-after-password-change';
2530 add_settings_field(
2531 $field_id,
2532 '',
2533 [$render_field, 'render_checkbox_plain'],
2534 ASENHA_SLUG,
2535 'main-section',
2536 array(
2537 'option_name' => ASENHA_SLUG_U,
2538 'field_id' => $field_id,
2539 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2540 'field_label' => __( 'Disable <strong>user email notification</strong> after password change.', 'admin-site-enhancements' ),
2541 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2542 )
2543 );
2544 $field_id = 'disable_admin_email_notification_after_password_change';
2545 $field_slug = 'disable-admin-email-notification-after-password-change';
2546 add_settings_field(
2547 $field_id,
2548 '',
2549 [$render_field, 'render_checkbox_plain'],
2550 ASENHA_SLUG,
2551 'main-section',
2552 array(
2553 'option_name' => ASENHA_SLUG_U,
2554 'field_id' => $field_id,
2555 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2556 'field_label' => __( 'Disable <strong>admin email notification</strong> after password change by a user.', 'admin-site-enhancements' ),
2557 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2558 )
2559 );
2560 $field_id = 'disable_plugin_theme_editor';
2561 $field_slug = 'disable-plugin-theme-editor';
2562 $is_wpconfig_writeable = $wp_config->wpconfig_file( 'writeability' );
2563 $disallow_file_edit_exists = $wp_config->exists( 'constant', 'DISALLOW_FILE_EDIT' );
2564 $disallow_file_edit_value = ( $disallow_file_edit_exists ? $wp_config->get_value( 'constant', 'DISALLOW_FILE_EDIT' ) : '' );
2565 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
2566 $disallow_file_edit_managed_by_ase = !empty( $options_extra['disallow_file_edit_managed_by_ase'] );
2567 $disallow_file_mods_true = $wp_config->exists( 'constant', 'DISALLOW_FILE_MODS' ) && 'true' === $wp_config->get_value( 'constant', 'DISALLOW_FILE_MODS' );
2568 $field_disabled = false;
2569 if ( $disallow_file_mods_true ) {
2570 $field_disabled = true;
2571 } elseif ( !$is_wpconfig_writeable ) {
2572 $field_disabled = true;
2573 } elseif ( $disallow_file_edit_exists && 'true' === $disallow_file_edit_value && !$disallow_file_edit_managed_by_ase ) {
2574 $field_disabled = true;
2575 }
2576 if ( $disallow_file_mods_true ) {
2577 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that <code>DISALLOW_FILE_MODS</code> is set to <code>true</code> in wp-config.php, which already blocks plugin and theme file editing. This setting is unavailable until that is changed.</span>', 'admin-site-enhancements' );
2578 } elseif ( $disallow_file_edit_exists && 'true' === $disallow_file_edit_value ) {
2579 if ( $disallow_file_edit_managed_by_ase ) {
2580 if ( $is_wpconfig_writeable ) {
2581 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that ASE set <code>DISALLOW_FILE_EDIT</code> to <code>true</code> in wp-config.php. Unchecking this setting will set it to <code>false</code>.</span>', 'admin-site-enhancements' );
2582 } else {
2583 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that ASE set <code>DISALLOW_FILE_EDIT</code> to <code>true</code> in wp-config.php, but the file is not writeable. This setting is locked until wp-config.php is writeable.</span>', 'admin-site-enhancements' );
2584 }
2585 } else {
2586 if ( $is_wpconfig_writeable ) {
2587 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that <code>DISALLOW_FILE_EDIT</code> is already set to <code>true</code> in wp-config.php (not by ASE). This setting is unavailable; manage that value manually there.</span>', 'admin-site-enhancements' );
2588 } else {
2589 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>. <span class="warning-text">Note that wp-config.php is not writeable and <code>DISALLOW_FILE_EDIT</code> is already set to <code>true</code> there (not by ASE). This setting is unavailable; manage that value manually.</span>', 'admin-site-enhancements' );
2590 }
2591 }
2592 } elseif ( !$is_wpconfig_writeable ) {
2593 $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. This setting is unavailable until the file is writeable.</span>', 'admin-site-enhancements' );
2594 } else {
2595 $field_label = __( 'Disable the <strong>plugin and theme editor</strong>.', 'admin-site-enhancements' );
2596 }
2597 add_settings_field(
2598 $field_id,
2599 '',
2600 [$render_field, 'render_checkbox_plain'],
2601 ASENHA_SLUG,
2602 'main-section',
2603 array(
2604 'option_name' => ASENHA_SLUG_U,
2605 'field_id' => $field_id,
2606 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2607 'field_label' => $field_label,
2608 'field_disabled' => $field_disabled,
2609 'class' => 'asenha-checkbox asenha-hide-th disable-components ' . $field_slug,
2610 )
2611 );
2612 // =================================================================
2613 // SECURITY
2614 // =================================================================
2615 // Limit Login Attempts
2616 $field_id = 'limit_login_attempts';
2617 $field_slug = 'limit-login-attempts';
2618 $field_title = __( 'Limit Login Attempts', 'admin-site-enhancements' );
2619 add_settings_field(
2620 $field_id,
2621 $field_title,
2622 [$render_field, 'render_checkbox_toggle'],
2623 ASENHA_SLUG,
2624 'main-section',
2625 array(
2626 'option_name' => ASENHA_SLUG_U,
2627 'field_id' => $field_id,
2628 'field_slug' => $field_slug,
2629 'field_title' => $field_title,
2630 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2631 'field_description' => __( 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', 'admin-site-enhancements' ),
2632 'field_options_wrapper' => true,
2633 'field_options_moreless' => true,
2634 'class' => 'asenha-toggle security ' . $field_slug,
2635 )
2636 );
2637 $field_id = 'login_fails_allowed';
2638 $field_slug = 'login-fails-allowed';
2639 add_settings_field(
2640 $field_id,
2641 '',
2642 [$render_field, 'render_number_subfield'],
2643 ASENHA_SLUG,
2644 'main-section',
2645 array(
2646 'option_name' => ASENHA_SLUG_U,
2647 'field_id' => $field_id,
2648 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2649 'field_type' => 'with-prefix-suffix',
2650 'field_prefix' => '',
2651 'field_suffix' => __( 'failed login attempts allowed before 15 minutes lockout', 'admin-site-enhancements' ),
2652 'field_intro' => '',
2653 'field_placeholder' => '3',
2654 'field_min' => 1,
2655 'field_max' => 10,
2656 'field_description' => '',
2657 'class' => 'asenha-text with-prefix-suffix extra-narrow no-margin security ' . $field_slug,
2658 )
2659 );
2660 $field_id = 'login_lockout_maxcount';
2661 $field_slug = 'login-lockout-maxcount';
2662 add_settings_field(
2663 $field_id,
2664 '',
2665 [$render_field, 'render_number_subfield'],
2666 ASENHA_SLUG,
2667 'main-section',
2668 array(
2669 'option_name' => ASENHA_SLUG_U,
2670 'field_id' => $field_id,
2671 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2672 'field_type' => 'with-prefix-suffix',
2673 'field_prefix' => '',
2674 'field_suffix' => __( 'lockout(s) will block further login attempts for 24 hours', 'admin-site-enhancements' ),
2675 'field_intro' => '',
2676 'field_placeholder' => '3',
2677 'field_min' => 1,
2678 'field_max' => 10,
2679 'field_description' => '',
2680 'class' => 'asenha-text with-prefix-suffix extra-narrow no-margin security ' . $field_slug,
2681 )
2682 );
2683 $field_id = 'limit_login_attempts_header_override';
2684 $field_slug = 'limit-login-attempts-header-override';
2685 add_settings_field(
2686 $field_id,
2687 __( '<span class="field-sublabel sublabel-wide">Detect IP address from the following header first:</span>', 'admin-site-enhancements' ),
2688 [$render_field, 'render_text_subfield'],
2689 ASENHA_SLUG,
2690 'main-section',
2691 array(
2692 'option_name' => ASENHA_SLUG_U,
2693 'field_id' => $field_id,
2694 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2695 'field_type' => '',
2696 'field_prefix' => '',
2697 'field_suffix' => '',
2698 'field_description' => '',
2699 'class' => 'asenha-text with-prefix-suffix full-width flex-column security ' . $field_slug,
2700 )
2701 );
2702 $field_id = 'limit_login_attempts_header_override_description';
2703 $field_slug = 'limit-login-attempts-header-override-description';
2704 add_settings_field(
2705 $field_id,
2706 '',
2707 [$render_field, 'render_description_subfield'],
2708 ASENHA_SLUG,
2709 'main-section',
2710 array(
2711 'option_name' => ASENHA_SLUG_U,
2712 '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.' ),
2713 'class' => 'asenha-description security ' . $field_slug,
2714 )
2715 );
2716 $field_id = 'login_attempts_log_table';
2717 $field_slug = 'login-attempts-log-table';
2718 add_settings_field(
2719 $field_id,
2720 __( 'Failed login attempts:', 'admin-site-enhancements' ),
2721 [$render_field, 'render_datatable'],
2722 ASENHA_SLUG,
2723 'main-section',
2724 array(
2725 'option_name' => ASENHA_SLUG_U,
2726 'field_id' => $field_id,
2727 'field_slug' => $field_slug,
2728 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2729 'field_type' => 'datatable',
2730 'field_description' => __( 'Only the latest 1,000 entries are kept in the database.', 'admin-site-enhancements' ),
2731 'class' => 'asenha-text datatable margin-top-16 security ' . $field_slug,
2732 'table_title' => __( 'Failed Login Attempts Log', 'admin-site-enhancements' ),
2733 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
2734 )
2735 );
2736 // Obfuscate Author Slugs
2737 $field_id = 'obfuscate_author_slugs';
2738 $field_slug = 'obfuscate-author-slugs';
2739 $field_title = __( 'Obfuscate Author Slugs', 'admin-site-enhancements' );
2740 add_settings_field(
2741 $field_id,
2742 $field_title,
2743 [$render_field, 'render_checkbox_toggle'],
2744 ASENHA_SLUG,
2745 'main-section',
2746 array(
2747 'option_name' => ASENHA_SLUG_U,
2748 'field_id' => $field_id,
2749 'field_slug' => $field_slug,
2750 'field_title' => $field_title,
2751 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2752 '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' ),
2753 'field_options_wrapper' => false,
2754 'class' => 'asenha-toggle security ' . $field_slug,
2755 )
2756 );
2757 // Obfuscate Email Address
2758 $field_id = 'obfuscate_email_address';
2759 $field_slug = 'obfuscate-email-address';
2760 $field_title = __( 'Email Address Obfuscator', 'admin-site-enhancements' );
2761 add_settings_field(
2762 $field_id,
2763 $field_title,
2764 [$render_field, 'render_checkbox_toggle'],
2765 ASENHA_SLUG,
2766 'main-section',
2767 array(
2768 'option_name' => ASENHA_SLUG_U,
2769 'field_id' => $field_id,
2770 'field_slug' => $field_slug,
2771 'field_title' => $field_title,
2772 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2773 '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' ),
2774 'field_options_wrapper' => true,
2775 'field_options_moreless' => true,
2776 'class' => 'asenha-toggle security ' . $field_slug,
2777 )
2778 );
2779 $field_id = 'obfuscate_email_address_description';
2780 $field_slug = 'obfuscate-email-address-description';
2781 $field_description = __( 'Use a shortcode like the following examples to display an email address on the frontend of your site:
2782 <ul>
2783 <li><strong>[obfuscate email="john@example.com"]</strong> to display the email on it\'s own line</li>
2784 <li><strong>[obfuscate email="john@example.com" display="inline"]</strong> to show the email inline</li>
2785 </ul>', 'admin-site-enhancements' );
2786 add_settings_field(
2787 $field_id,
2788 '',
2789 [$render_field, 'render_description_subfield'],
2790 ASENHA_SLUG,
2791 'main-section',
2792 array(
2793 'option_name' => ASENHA_SLUG_U,
2794 'field_description' => $field_description,
2795 'class' => 'asenha-description security ' . $field_slug,
2796 )
2797 );
2798 $field_id = 'obfuscate_email_address_builder_safe_mode';
2799 $field_slug = 'obfuscate-email-address-builder-safe-mode';
2800 $obfuscate_email_builder_safe_row_class = 'asenha-checkbox asenha-hide-th asenha-th-border-top security ' . $field_slug;
2801 add_settings_field(
2802 $field_id,
2803 '',
2804 [$render_field, 'render_checkbox_plain'],
2805 ASENHA_SLUG,
2806 'main-section',
2807 array(
2808 'option_name' => ASENHA_SLUG_U,
2809 'field_id' => $field_id,
2810 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2811 'field_label' => __( 'Use high-compatibility mode to fix rendering issues.', 'admin-site-enhancements' ),
2812 'class' => $obfuscate_email_builder_safe_row_class,
2813 )
2814 );
2815 // Disable XML-RPC
2816 $field_id = 'disable_xmlrpc';
2817 $field_slug = 'disable-xmlrpc';
2818 $field_title = __( 'Disable XML-RPC', 'admin-site-enhancements' );
2819 add_settings_field(
2820 $field_id,
2821 $field_title,
2822 [$render_field, 'render_checkbox_toggle'],
2823 ASENHA_SLUG,
2824 'main-section',
2825 array(
2826 'option_name' => ASENHA_SLUG_U,
2827 'field_id' => $field_id,
2828 'field_slug' => $field_slug,
2829 'field_title' => $field_title,
2830 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2831 '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' ),
2832 'field_options_wrapper' => false,
2833 'class' => 'asenha-toggle security ' . $field_slug,
2834 )
2835 );
2836 // =================================================================
2837 // OPTIMIZATIONS
2838 // =================================================================
2839 // Image Upload Control
2840 $field_id = 'image_upload_control';
2841 $field_slug = 'image-upload-control';
2842 $field_title = __( 'Image Upload Control', 'admin-site-enhancements' );
2843 add_settings_field(
2844 $field_id,
2845 $field_title,
2846 [$render_field, 'render_checkbox_toggle'],
2847 ASENHA_SLUG,
2848 'main-section',
2849 array(
2850 'option_name' => ASENHA_SLUG_U,
2851 'field_id' => $field_id,
2852 'field_slug' => $field_slug,
2853 'field_title' => $field_title,
2854 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2855 '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' ),
2856 'field_options_wrapper' => true,
2857 'field_options_moreless' => true,
2858 'class' => 'asenha-toggle optimizations ' . $field_slug,
2859 )
2860 );
2861 $field_id = 'image_max_width';
2862 $field_slug = 'image-max-width';
2863 add_settings_field(
2864 $field_id,
2865 '',
2866 [$render_field, 'render_number_subfield'],
2867 ASENHA_SLUG,
2868 'main-section',
2869 array(
2870 'option_name' => ASENHA_SLUG_U,
2871 'field_id' => $field_id,
2872 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2873 'field_type' => 'with-prefix-suffix',
2874 'field_prefix' => '<span class="subfield-prefix">' . __( 'Max width:', 'admin-site-enhancements' ) . '</span>',
2875 'field_suffix' => __( 'pixels. <span class="faded">(Default is 1920 pixels)</span>', 'admin-site-enhancements' ),
2876 'field_intro' => '',
2877 'field_placeholder' => '1920',
2878 'field_min' => 100,
2879 'field_max' => 3840,
2880 'field_description' => '',
2881 'class' => 'asenha-number asenha-hide-th narrow optimizations ' . $field_slug,
2882 )
2883 );
2884 $field_id = 'image_max_height';
2885 $field_slug = 'image-max-height';
2886 add_settings_field(
2887 $field_id,
2888 '',
2889 [$render_field, 'render_number_subfield'],
2890 ASENHA_SLUG,
2891 'main-section',
2892 array(
2893 'option_name' => ASENHA_SLUG_U,
2894 'field_id' => $field_id,
2895 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2896 'field_type' => 'with-prefix-suffix',
2897 'field_prefix' => '<span class="subfield-prefix">' . __( 'Max height:', 'admin-site-enhancements' ) . '</span>',
2898 'field_suffix' => __( 'pixels <span class="faded">(Default is 1920 pixels)</span>', 'admin-site-enhancements' ),
2899 'field_intro' => '',
2900 'field_placeholder' => '1920',
2901 'field_min' => 100,
2902 'field_max' => 10000,
2903 'class' => 'asenha-number asenha-hide-th narrow margin-bottom-4 optimizations ' . $field_slug,
2904 )
2905 );
2906 $field_id = 'image_upload_control_description';
2907 $field_slug = 'image-upload-control-description';
2908 $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' );
2909 add_settings_field(
2910 $field_id,
2911 '',
2912 [$render_field, 'render_description_subfield'],
2913 ASENHA_SLUG,
2914 'main-section',
2915 array(
2916 'option_name' => ASENHA_SLUG_U,
2917 'field_description' => $field_description,
2918 'class' => 'asenha-description top-border optimizations ' . $field_slug,
2919 )
2920 );
2921 // Enable Revisions Control
2922 $field_id = 'enable_revisions_control';
2923 $field_slug = 'enable-revisions-control';
2924 $field_title = __( 'Revisions Control', 'admin-site-enhancements' );
2925 add_settings_field(
2926 $field_id,
2927 $field_title,
2928 [$render_field, 'render_checkbox_toggle'],
2929 ASENHA_SLUG,
2930 'main-section',
2931 array(
2932 'option_name' => ASENHA_SLUG_U,
2933 'field_id' => $field_id,
2934 'field_slug' => $field_slug,
2935 'field_title' => $field_title,
2936 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2937 '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' ),
2938 'field_options_wrapper' => true,
2939 'field_options_moreless' => true,
2940 'class' => 'asenha-toggle optimizations ' . $field_slug,
2941 )
2942 );
2943 $field_id = 'revisions_max_number';
2944 $field_slug = 'revisions-max-number';
2945 $field_suffix = __( 'revisions for:', 'admin-site-enhancements' );
2946 add_settings_field(
2947 $field_id,
2948 '',
2949 [$render_field, 'render_number_subfield'],
2950 ASENHA_SLUG,
2951 'main-section',
2952 array(
2953 'option_name' => ASENHA_SLUG_U,
2954 'field_id' => $field_id,
2955 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
2956 'field_type' => 'with-prefix-suffix',
2957 'field_prefix' => __( 'Limit to', 'admin-site-enhancements' ),
2958 'field_suffix' => $field_suffix,
2959 'field_intro' => '',
2960 'field_placeholder' => '10',
2961 'field_min' => 1,
2962 'field_max' => 100,
2963 'field_description' => '',
2964 'class' => 'asenha-number asenha-hide-th extra-narrow optimizations ' . $field_slug,
2965 )
2966 );
2967 $field_id = 'enable_revisions_control_for';
2968 $field_slug = 'enable-revisions-control-for';
2969 if ( is_array( $asenha_revisions_post_types ) ) {
2970 // Exclude Bricks builder template CPT as revisions are handled via a constant
2971 // Ref: https://academy.bricksbuilder.io/article/revisions/
2972 unset($asenha_revisions_post_types['bricks_template']);
2973 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) {
2974 // e.g. $post_type_slug is post, $post_type_label is Posts
2975 add_settings_field(
2976 $field_id . '_' . $post_type_slug,
2977 '',
2978 [$render_field, 'render_checkbox_subfield'],
2979 ASENHA_SLUG,
2980 'main-section',
2981 array(
2982 'option_name' => ASENHA_SLUG_U,
2983 'parent_field_id' => $field_id,
2984 'field_id' => $post_type_slug,
2985 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $post_type_slug . ']',
2986 'field_label' => $post_type_label . ' <span class="faded">(' . $post_type_slug . ')</span>',
2987 'class' => 'asenha-checkbox asenha-hide-th asenha-half optimizations ' . $field_slug . ' ' . $post_type_slug,
2988 )
2989 );
2990 }
2991 }
2992 // Enable Heartbeat Control
2993 $field_id = 'enable_heartbeat_control';
2994 $field_slug = 'enable-heartbeat-control';
2995 $field_title = __( 'Heartbeat Control', 'admin-site-enhancements' );
2996 add_settings_field(
2997 $field_id,
2998 $field_title,
2999 [$render_field, 'render_checkbox_toggle'],
3000 ASENHA_SLUG,
3001 'main-section',
3002 array(
3003 'option_name' => ASENHA_SLUG_U,
3004 'field_id' => $field_id,
3005 'field_slug' => $field_slug,
3006 'field_title' => $field_title,
3007 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3008 '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' ),
3009 'field_options_wrapper' => true,
3010 'field_options_moreless' => true,
3011 'class' => 'asenha-toggle optimizations ' . $field_slug,
3012 )
3013 );
3014 $field_id = 'heartbeat_control_for_admin_pages';
3015 $field_slug = 'heartbeat-control-for-admin-pages';
3016 add_settings_field(
3017 $field_id,
3018 __( 'On admin pages', 'admin-site-enhancements' ),
3019 [$render_field, 'render_radio_buttons_subfield'],
3020 ASENHA_SLUG,
3021 'main-section',
3022 array(
3023 'option_name' => ASENHA_SLUG_U,
3024 'field_id' => $field_id,
3025 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3026 'field_radios' => array(
3027 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
3028 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
3029 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
3030 ),
3031 'field_default' => 'default',
3032 'class' => 'asenha-radio-buttons optimizations ' . $field_slug,
3033 )
3034 );
3035 $field_id = 'heartbeat_interval_for_admin_pages';
3036 $field_slug = 'heartbeat-interval-for-admin-pages';
3037 add_settings_field(
3038 $field_id,
3039 '',
3040 [$render_field, 'render_select_subfield'],
3041 ASENHA_SLUG,
3042 'main-section',
3043 array(
3044 'option_name' => ASENHA_SLUG_U,
3045 'field_id' => $field_id,
3046 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3047 'field_type' => 'with-prefix-suffix',
3048 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
3049 'field_suffix' => __( '<span class="faded">(Default is 1 minute)</span>', 'admin-site-enhancements' ),
3050 'field_select_options' => array(
3051 __( '15 seconds', 'admin-site-enhancements' ) => 15,
3052 __( '30 seconds', 'admin-site-enhancements' ) => 30,
3053 __( '1 minute', 'admin-site-enhancements' ) => 60,
3054 __( '2 minutes', 'admin-site-enhancements' ) => 120,
3055 __( '3 minutes', 'admin-site-enhancements' ) => 180,
3056 __( '5 minutes', 'admin-site-enhancements' ) => 300,
3057 __( '10 minutes', 'admin-site-enhancements' ) => 600,
3058 ),
3059 'field_select_default' => 60,
3060 'field_intro' => '',
3061 'field_description' => '',
3062 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
3063 'display_none_on_load' => true,
3064 )
3065 );
3066 $field_id = 'heartbeat_control_for_post_edit';
3067 $field_slug = 'heartbeat-control-for-post-edit';
3068 add_settings_field(
3069 $field_id,
3070 __( 'On post creation and edit screens', 'admin-site-enhancements' ),
3071 [$render_field, 'render_radio_buttons_subfield'],
3072 ASENHA_SLUG,
3073 'main-section',
3074 array(
3075 'option_name' => ASENHA_SLUG_U,
3076 'field_id' => $field_id,
3077 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3078 'field_radios' => array(
3079 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
3080 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
3081 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
3082 ),
3083 'field_default' => 'default',
3084 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
3085 )
3086 );
3087 $field_id = 'heartbeat_interval_for_post_edit';
3088 $field_slug = 'heartbeat-interval-for-post-edit';
3089 add_settings_field(
3090 $field_id,
3091 '',
3092 [$render_field, 'render_select_subfield'],
3093 ASENHA_SLUG,
3094 'main-section',
3095 array(
3096 'option_name' => ASENHA_SLUG_U,
3097 'field_id' => $field_id,
3098 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3099 'field_type' => 'with-prefix-suffix',
3100 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
3101 'field_suffix' => __( '<span class="faded">(Default is 15 seconds)</span>', 'admin-site-enhancements' ),
3102 'field_select_options' => array(
3103 __( '15 seconds', 'admin-site-enhancements' ) => 15,
3104 __( '30 seconds', 'admin-site-enhancements' ) => 30,
3105 __( '45 seconds', 'admin-site-enhancements' ) => 45,
3106 __( '60 seconds', 'admin-site-enhancements' ) => 60,
3107 __( '90 seconds', 'admin-site-enhancements' ) => 90,
3108 __( '120 seconds', 'admin-site-enhancements' ) => 120,
3109 ),
3110 'field_select_default' => 15,
3111 'field_intro' => '',
3112 'field_description' => '',
3113 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
3114 'display_none_on_load' => true,
3115 )
3116 );
3117 $field_id = 'heartbeat_control_for_frontend';
3118 $field_slug = 'heartbeat-control-for-frontend';
3119 add_settings_field(
3120 $field_id,
3121 __( 'On the frontend', 'admin-site-enhancements' ),
3122 [$render_field, 'render_radio_buttons_subfield'],
3123 ASENHA_SLUG,
3124 'main-section',
3125 array(
3126 'option_name' => ASENHA_SLUG_U,
3127 'field_id' => $field_id,
3128 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3129 'field_radios' => array(
3130 __( 'Keep as is', 'admin-site-enhancements' ) => 'default',
3131 __( 'Modify', 'admin-site-enhancements' ) => 'modify',
3132 __( 'Disable', 'admin-site-enhancements' ) => 'disable',
3133 ),
3134 'field_default' => 'default',
3135 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug,
3136 )
3137 );
3138 $field_id = 'heartbeat_interval_for_frontend';
3139 $field_slug = 'heartbeat-interval-for-frontend';
3140 add_settings_field(
3141 $field_id,
3142 '',
3143 [$render_field, 'render_select_subfield'],
3144 ASENHA_SLUG,
3145 'main-section',
3146 array(
3147 'option_name' => ASENHA_SLUG_U,
3148 'field_id' => $field_id,
3149 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3150 'field_type' => 'with-prefix-suffix',
3151 'field_prefix' => __( 'Set interval to once every', 'admin-site-enhancements' ),
3152 'field_suffix' => '',
3153 'field_select_options' => array(
3154 __( '15 seconds', 'admin-site-enhancements' ) => 15,
3155 __( '30 seconds', 'admin-site-enhancements' ) => 30,
3156 __( '1 minute', 'admin-site-enhancements' ) => 60,
3157 __( '2 minutes', 'admin-site-enhancements' ) => 120,
3158 __( '3 minutes', 'admin-site-enhancements' ) => 180,
3159 __( '5 minutes', 'admin-site-enhancements' ) => 300,
3160 __( '10 minutes', 'admin-site-enhancements' ) => 600,
3161 ),
3162 'field_select_default' => 60,
3163 'field_intro' => '',
3164 'field_description' => '',
3165 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug,
3166 'display_none_on_load' => true,
3167 )
3168 );
3169 // SMTP Email Delivery
3170 $field_id = 'smtp_email_delivery';
3171 $field_slug = 'smtp-email-delivery';
3172 $field_title = __( 'Email Delivery', 'admin-site-enhancements' );
3173 add_settings_field(
3174 $field_id,
3175 $field_title,
3176 [$render_field, 'render_checkbox_toggle'],
3177 ASENHA_SLUG,
3178 'main-section',
3179 array(
3180 'option_name' => ASENHA_SLUG_U,
3181 'field_id' => $field_id,
3182 'field_slug' => $field_slug,
3183 'field_title' => $field_title,
3184 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3185 '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' ),
3186 'field_options_wrapper' => true,
3187 'field_options_moreless' => true,
3188 'class' => 'asenha-toggle utilities ' . $field_slug,
3189 )
3190 );
3191 $field_id = 'smtp_default_from_description';
3192 $field_slug = 'smtp-default-from-description';
3193 add_settings_field(
3194 $field_id,
3195 '',
3196 [$render_field, 'render_description_subfield'],
3197 ASENHA_SLUG,
3198 'main-section',
3199 array(
3200 'option_name' => ASENHA_SLUG_U,
3201 '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' ),
3202 'class' => 'asenha-description utilities ' . $field_slug,
3203 )
3204 );
3205 $field_id = 'smtp_default_from_name';
3206 $field_slug = 'smtp-default-from-name';
3207 add_settings_field(
3208 $field_id,
3209 __( '<span class="field-sublabel sublabel-wide">Sender name</span>', 'admin-site-enhancements' ),
3210 [$render_field, 'render_text_subfield'],
3211 ASENHA_SLUG,
3212 'main-section',
3213 array(
3214 'option_name' => ASENHA_SLUG_U,
3215 'field_id' => $field_id,
3216 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3217 'field_type' => '',
3218 'field_prefix' => '',
3219 'field_suffix' => '',
3220 'field_description' => '',
3221 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3222 )
3223 );
3224 $field_id = 'smtp_default_from_email';
3225 $field_slug = 'smtp-default-from-email';
3226 add_settings_field(
3227 $field_id,
3228 __( '<span class="field-sublabel sublabel-wide">Sender email</span>', 'admin-site-enhancements' ),
3229 [$render_field, 'render_text_subfield'],
3230 ASENHA_SLUG,
3231 'main-section',
3232 array(
3233 'option_name' => ASENHA_SLUG_U,
3234 'field_id' => $field_id,
3235 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3236 'field_type' => '',
3237 'field_prefix' => '',
3238 'field_suffix' => '',
3239 'field_description' => '',
3240 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3241 )
3242 );
3243 $field_id = 'smtp_force_from';
3244 $field_slug = 'smtp-force-from';
3245 add_settings_field(
3246 $field_id,
3247 '',
3248 [$render_field, 'render_checkbox_plain'],
3249 ASENHA_SLUG,
3250 'main-section',
3251 array(
3252 'option_name' => ASENHA_SLUG_U,
3253 'field_id' => $field_id,
3254 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3255 'field_label' => __( 'Force the usage of the sender name/email defined above. It will override those set by other plugins.', 'admin-site-enhancements' ),
3256 'class' => 'asenha-checkbox asenha-hide-th utilities ' . $field_slug,
3257 )
3258 );
3259 $field_id = 'smtp_description';
3260 $field_slug = 'smtp--description';
3261 add_settings_field(
3262 $field_id,
3263 '',
3264 [$render_field, 'render_description_subfield'],
3265 ASENHA_SLUG,
3266 'main-section',
3267 array(
3268 'option_name' => ASENHA_SLUG_U,
3269 'field_description' => __( 'If set, the following SMTP service/account wil be used to deliver your emails.', 'admin-site-enhancements' ),
3270 'class' => 'asenha-description top-border utilities ' . $field_slug,
3271 )
3272 );
3273 $field_id = 'smtp_host';
3274 $field_slug = 'smtp-host';
3275 add_settings_field(
3276 $field_id,
3277 __( '<span class="field-sublabel sublabel-wide">Host</span>', 'admin-site-enhancements' ),
3278 [$render_field, 'render_text_subfield'],
3279 ASENHA_SLUG,
3280 'main-section',
3281 array(
3282 'option_name' => ASENHA_SLUG_U,
3283 'field_id' => $field_id,
3284 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3285 'field_type' => '',
3286 'field_prefix' => '',
3287 'field_suffix' => '',
3288 'field_description' => '',
3289 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3290 )
3291 );
3292 $field_id = 'smtp_port';
3293 $field_slug = 'smtp-port';
3294 add_settings_field(
3295 $field_id,
3296 __( '<span class="field-sublabel sublabel-wide">Port</span>', 'admin-site-enhancements' ),
3297 [$render_field, 'render_number_subfield'],
3298 ASENHA_SLUG,
3299 'main-section',
3300 array(
3301 'option_name' => ASENHA_SLUG_U,
3302 'field_id' => $field_id,
3303 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3304 'field_type' => '',
3305 'field_prefix' => '',
3306 'field_suffix' => '',
3307 'field_intro' => '',
3308 'field_description' => '',
3309 'field_min' => 1,
3310 'field_max' => 100000,
3311 'class' => 'asenha-text with-prefix-suffix narrow utilities ' . $field_slug,
3312 )
3313 );
3314 $field_id = 'smtp_security';
3315 $field_slug = 'smtp-security';
3316 add_settings_field(
3317 $field_id,
3318 __( '<span class="field-sublabel sublabel-wide">Security</span>', 'admin-site-enhancements' ),
3319 [$render_field, 'render_radio_buttons_subfield'],
3320 ASENHA_SLUG,
3321 'main-section',
3322 array(
3323 'option_name' => ASENHA_SLUG_U,
3324 'field_id' => $field_id,
3325 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3326 'field_radios' => array(
3327 __( 'None', 'admin-site-enhancements' ) => 'none',
3328 __( 'SSL', 'admin-site-enhancements' ) => 'ssl',
3329 __( 'TLS', 'admin-site-enhancements' ) => 'tls',
3330 ),
3331 'field_default' => 'default',
3332 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3333 )
3334 );
3335 $field_id = 'smtp_username';
3336 $field_slug = 'smtp-username';
3337 add_settings_field(
3338 $field_id,
3339 __( '<span class="field-sublabel sublabel-wide">Username</span>', 'admin-site-enhancements' ),
3340 [$render_field, 'render_text_subfield'],
3341 ASENHA_SLUG,
3342 'main-section',
3343 array(
3344 'option_name' => ASENHA_SLUG_U,
3345 'field_id' => $field_id,
3346 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3347 'field_type' => '',
3348 'field_prefix' => '',
3349 'field_suffix' => '',
3350 'field_description' => '',
3351 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3352 )
3353 );
3354 $field_id = 'smtp_password';
3355 $field_slug = 'smtp-password';
3356 add_settings_field(
3357 $field_id,
3358 __( '<span class="field-sublabel sublabel-wide">Password</span>', 'admin-site-enhancements' ),
3359 [$render_field, 'render_smtp_password_subfield'],
3360 ASENHA_SLUG,
3361 'main-section',
3362 array(
3363 'option_name' => ASENHA_SLUG_U,
3364 'field_id' => $field_id,
3365 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3366 'field_placeholder' => '',
3367 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug,
3368 )
3369 );
3370 $field_id = 'smtp_bypass_ssl_verification';
3371 $field_slug = 'smtp-bypass-ssl-verification';
3372 add_settings_field(
3373 $field_id,
3374 '',
3375 [$render_field, 'render_checkbox_plain'],
3376 ASENHA_SLUG,
3377 'main-section',
3378 array(
3379 'option_name' => ASENHA_SLUG_U,
3380 'field_id' => $field_id,
3381 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3382 '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' ),
3383 'class' => 'asenha-checkbox asenha-hide-th margin-top-8 utilities ' . $field_slug,
3384 )
3385 );
3386 $field_id = 'smtp_debug';
3387 $field_slug = 'smtp-debug';
3388 add_settings_field(
3389 $field_id,
3390 '',
3391 [$render_field, 'render_checkbox_plain'],
3392 ASENHA_SLUG,
3393 'main-section',
3394 array(
3395 'option_name' => ASENHA_SLUG_U,
3396 'field_id' => $field_id,
3397 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3398 'field_label' => __( 'Enable debug mode and output the debug info into WordPress debug.log file.', 'admin-site-enhancements' ),
3399 'class' => 'asenha-checkbox asenha-hide-th bottom-border utilities ' . $field_slug,
3400 )
3401 );
3402 $field_id = 'smtp_send_test_email_description';
3403 $field_slug = 'smtp-send-test-email-description';
3404 add_settings_field(
3405 $field_id,
3406 '',
3407 [$render_field, 'render_description_subfield'],
3408 ASENHA_SLUG,
3409 'main-section',
3410 array(
3411 'option_name' => ASENHA_SLUG_U,
3412 'field_description' => __( 'After saving the settings above, check if everything is configured properly below.', 'admin-site-enhancements' ),
3413 'class' => 'asenha-description utilities ' . $field_slug,
3414 )
3415 );
3416 $field_id = 'smtp_send_test_email_to';
3417 $field_slug = 'smtp-send-test-email-to';
3418 add_settings_field(
3419 $field_id,
3420 __( '<span class="field-sublabel sublabel-wide">Send a test email to</span>', 'admin-site-enhancements' ),
3421 [$render_field, 'render_custom_html'],
3422 ASENHA_SLUG,
3423 'main-section',
3424 array(
3425 '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>',
3426 'class' => 'asenha-html wide utilities ' . $field_slug,
3427 )
3428 );
3429 $field_id = 'smtp_send_test_email_result';
3430 $field_slug = 'smtp-send-test-email-result';
3431 add_settings_field(
3432 $field_id,
3433 '',
3434 [$render_field, 'render_description_subfield'],
3435 ASENHA_SLUG,
3436 'main-section',
3437 array(
3438 'option_name' => ASENHA_SLUG_U,
3439 'field_description' => '<div id="ajax-result" class="ajax-result-div" style="display:none;">
3440 <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>
3441 <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>
3442 <div id="test-email-failed" class="test-email-failed" style="display:none;"><span class="dashicons dashicons-no-alt"></span> <span id="test-email-failed-message">' . __( 'Oops, something went wrong. Please double check your settings and the destination email address.', 'admin-site-enhancements' ) . '</span></div></div>',
3443 'class' => 'asenha-description utilities ' . $field_slug,
3444 )
3445 );
3446 // Contact Form
3447 $field_id = 'contact_form';
3448 $field_slug = 'contact-form';
3449 $field_title = __( 'Contact Form', 'admin-site-enhancements' );
3450 $contact_form_description = sprintf(
3451 /* translators: %s: link to the Contact Form Submissions admin page */
3452 __( 'Add a lightweight contact form via shortcode or block, with built-in anti-spam to block bots and junk submissions. Submissions are stored in the database and can be managed from the %s page under the Dashboard menu.', 'admin-site-enhancements' ),
3453 '<a href="' . esc_url( admin_url( 'admin.php?page=asenha-contact-form-submissions' ) ) . '">' . esc_html__( 'Contact Form Submissions', 'admin-site-enhancements' ) . '</a>'
3454 );
3455 add_settings_field(
3456 $field_id,
3457 $field_title,
3458 [$render_field, 'render_checkbox_toggle'],
3459 ASENHA_SLUG,
3460 'main-section',
3461 array(
3462 'option_name' => ASENHA_SLUG_U,
3463 'field_id' => $field_id,
3464 'field_slug' => $field_slug,
3465 'field_title' => $field_title,
3466 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3467 'field_description' => $contact_form_description,
3468 'field_options_wrapper' => true,
3469 'field_options_moreless' => true,
3470 'class' => 'asenha-toggle utilities ' . $field_slug,
3471 )
3472 );
3473 $field_id = 'contact_form_shortcode';
3474 $field_slug = 'contact-form-shortcode';
3475 $contact_form_shortcode = '[asenha_contact_form]';
3476 $contact_form_shortcode_html = '<div class="asenha-contact-form-shortcode-wrapper">';
3477 $contact_form_shortcode_html .= '<code class="asenha-contact-form-shortcode-text">' . esc_html( $contact_form_shortcode ) . '</code>';
3478 $contact_form_shortcode_html .= '<button type="button" class="button-link asenha-contact-form-copy-shortcode" data-clipboard-text="' . esc_attr( $contact_form_shortcode ) . '" aria-label="' . esc_attr__( 'Copy shortcode', 'admin-site-enhancements' ) . '">';
3479 $contact_form_shortcode_html .= '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><g fill="none" stroke="#8C8F94" stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5"><path d="M16 3H4v13"/><path d="M8 7h12v12a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2z"/></g></svg>';
3480 $contact_form_shortcode_html .= '</button>';
3481 $contact_form_shortcode_html .= '<span class="asenha-contact-form-shortcode-copied" hidden>' . esc_html__( 'Shortcode copied!', 'admin-site-enhancements' ) . '</span>';
3482 $contact_form_shortcode_html .= '</div>';
3483 $contact_form_shortcode_html .= '<p class="description">' . esc_html__( 'Also available as the "Contact Form" block in the block editor.', 'admin-site-enhancements' ) . '</p>';
3484 add_settings_field(
3485 $field_id,
3486 __( '<span class="field-sublabel sublabel-wide">Shortcode</span>', 'admin-site-enhancements' ),
3487 [$render_field, 'render_custom_html'],
3488 ASENHA_SLUG,
3489 'main-section',
3490 array(
3491 'html' => $contact_form_shortcode_html,
3492 'class' => 'asenha-html wide utilities flex-column full-width ' . $field_slug,
3493 )
3494 );
3495 $field_id = 'contact_form_notification_email';
3496 $field_slug = 'contact-form-notification-email';
3497 add_settings_field(
3498 $field_id,
3499 __( '<span class="field-sublabel sublabel-wide">Notification email</span>', 'admin-site-enhancements' ),
3500 [$render_field, 'render_text_subfield'],
3501 ASENHA_SLUG,
3502 'main-section',
3503 array(
3504 'option_name' => ASENHA_SLUG_U,
3505 'field_id' => $field_id,
3506 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3507 'field_type' => '',
3508 'field_prefix' => '',
3509 'field_suffix' => '',
3510 'field_placeholder' => get_option( 'admin_email' ),
3511 'field_description' => __( 'Separate with comma for multiple emails', 'admin-site-enhancements' ),
3512 'class' => 'asenha-text with-prefix-suffix with-description full-width flex-column margin-top-8 margin-bottom-8 utilities ' . $field_slug,
3513 )
3514 );
3515 // Style heading
3516 $field_id = 'heading_for_contact_form_style';
3517 $field_slug = 'heading-for-contact-form-style';
3518 add_settings_field(
3519 $field_id,
3520 '',
3521 [$render_field, 'render_subfields_heading'],
3522 ASENHA_SLUG,
3523 'main-section',
3524 array(
3525 'subfields_heading' => __( 'Form style', 'admin-site-enhancements' ),
3526 'class' => 'asenha-heading margin-top-8 margin-bottom-8 utilities ' . $field_slug,
3527 )
3528 );
3529 $field_id = 'contact_form_layout';
3530 $field_slug = 'contact-form-layout';
3531 add_settings_field(
3532 $field_id,
3533 __( '<span class="field-sublabel sublabel-wide">Layout</span>', 'admin-site-enhancements' ),
3534 [$render_field, 'render_radio_buttons_subfield'],
3535 ASENHA_SLUG,
3536 'main-section',
3537 array(
3538 'option_name' => ASENHA_SLUG_U,
3539 'field_id' => $field_id,
3540 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3541 'field_radios' => array(
3542 __( 'Default', 'admin-site-enhancements' ) => 'default',
3543 __( 'Stacked', 'admin-site-enhancements' ) => 'stacked',
3544 ),
3545 'field_default' => 'default',
3546 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3547 )
3548 );
3549 $field_id = 'contact_form_label_position';
3550 $field_slug = 'contact-form-label-position';
3551 add_settings_field(
3552 $field_id,
3553 __( '<span class="field-sublabel sublabel-wide">Label position</span>', 'admin-site-enhancements' ),
3554 [$render_field, 'render_radio_buttons_subfield'],
3555 ASENHA_SLUG,
3556 'main-section',
3557 array(
3558 'option_name' => ASENHA_SLUG_U,
3559 'field_id' => $field_id,
3560 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3561 'field_radios' => array(
3562 __( 'Left', 'admin-site-enhancements' ) => 'left',
3563 __( 'Right', 'admin-site-enhancements' ) => 'right',
3564 ),
3565 'field_default' => 'left',
3566 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3567 )
3568 );
3569 $field_id = 'contact_form_button_position';
3570 $field_slug = 'contact-form-button-position';
3571 add_settings_field(
3572 $field_id,
3573 __( '<span class="field-sublabel sublabel-wide">Button position</span>', 'admin-site-enhancements' ),
3574 [$render_field, 'render_radio_buttons_subfield'],
3575 ASENHA_SLUG,
3576 'main-section',
3577 array(
3578 'option_name' => ASENHA_SLUG_U,
3579 'field_id' => $field_id,
3580 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3581 'field_radios' => array(
3582 __( 'Left', 'admin-site-enhancements' ) => 'left',
3583 __( 'Right', 'admin-site-enhancements' ) => 'right',
3584 ),
3585 'field_default' => 'left',
3586 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3587 )
3588 );
3589 $field_id = 'contact_form_field_style';
3590 $field_slug = 'contact-form-field-style';
3591 add_settings_field(
3592 $field_id,
3593 __( '<span class="field-sublabel sublabel-wide">Field style</span>', 'admin-site-enhancements' ),
3594 [$render_field, 'render_radio_buttons_subfield'],
3595 ASENHA_SLUG,
3596 'main-section',
3597 array(
3598 'option_name' => ASENHA_SLUG_U,
3599 'field_id' => $field_id,
3600 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3601 'field_radios' => array(
3602 __( 'Box', 'admin-site-enhancements' ) => 'box',
3603 __( 'Underline', 'admin-site-enhancements' ) => 'underline',
3604 ),
3605 'field_default' => 'box',
3606 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3607 )
3608 );
3609 $field_id = 'contact_form_corner_style';
3610 $field_slug = 'contact-form-corner-style';
3611 add_settings_field(
3612 $field_id,
3613 __( '<span class="field-sublabel sublabel-wide">Corner style</span>', 'admin-site-enhancements' ),
3614 [$render_field, 'render_radio_buttons_subfield'],
3615 ASENHA_SLUG,
3616 'main-section',
3617 array(
3618 'option_name' => ASENHA_SLUG_U,
3619 'field_id' => $field_id,
3620 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3621 'field_radios' => array(
3622 __( 'Rounded', 'admin-site-enhancements' ) => 'rounded',
3623 __( 'Sharp', 'admin-site-enhancements' ) => 'sharp',
3624 ),
3625 'field_default' => 'rounded',
3626 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3627 )
3628 );
3629 $field_id = 'contact_form_color_scheme';
3630 $field_slug = 'contact-form-color-scheme';
3631 add_settings_field(
3632 $field_id,
3633 __( '<span class="field-sublabel sublabel-wide">Color scheme</span>', 'admin-site-enhancements' ),
3634 [$render_field, 'render_radio_buttons_subfield'],
3635 ASENHA_SLUG,
3636 'main-section',
3637 array(
3638 'option_name' => ASENHA_SLUG_U,
3639 'field_id' => $field_id,
3640 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3641 'field_radios' => array(
3642 __( 'Dark', 'admin-site-enhancements' ) => 'dark',
3643 __( 'Light', 'admin-site-enhancements' ) => 'light',
3644 ),
3645 'field_default' => 'dark',
3646 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3647 )
3648 );
3649 $field_id = 'contact_form_submit_button_style';
3650 $field_slug = 'contact-form-submit-button-style';
3651 add_settings_field(
3652 $field_id,
3653 __( '<span class="field-sublabel sublabel-wide">Button style</span>', 'admin-site-enhancements' ),
3654 [$render_field, 'render_radio_buttons_subfield'],
3655 ASENHA_SLUG,
3656 'main-section',
3657 array(
3658 'option_name' => ASENHA_SLUG_U,
3659 'field_id' => $field_id,
3660 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3661 'field_radios' => array(
3662 __( 'Solid', 'admin-site-enhancements' ) => 'solid',
3663 __( 'Outline', 'admin-site-enhancements' ) => 'outline',
3664 ),
3665 'field_default' => 'solid',
3666 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug,
3667 )
3668 );
3669 $field_id = 'contact_form_submit_button_color';
3670 $field_slug = 'contact-form-submit-button-color';
3671 add_settings_field(
3672 $field_id,
3673 __( '<span class="field-sublabel sublabel-wide">Button color</span>', 'admin-site-enhancements' ),
3674 [$render_field, 'render_color_picker_subfield'],
3675 ASENHA_SLUG,
3676 'main-section',
3677 array(
3678 'option_name' => ASENHA_SLUG_U,
3679 'field_id' => $field_id,
3680 'field_slug' => $field_slug,
3681 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3682 'field_intro' => '',
3683 'field_description' => '',
3684 'field_default_value' => '',
3685 'class' => 'asenha-color-picker with-prefix-suffix utilities ' . $field_slug,
3686 )
3687 );
3688 $field_id = 'contact_form_use_theme_styles';
3689 $field_slug = 'contact-form-use-theme-styles';
3690 add_settings_field(
3691 $field_id,
3692 '',
3693 [$render_field, 'render_checkbox_plain'],
3694 ASENHA_SLUG,
3695 'main-section',
3696 array(
3697 'option_name' => ASENHA_SLUG_U,
3698 'field_id' => $field_id,
3699 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3700 'field_label' => __( 'Use styling from the active theme or page builder', 'admin-site-enhancements' ) . ' <span class="faded">(' . esc_html__( 'Disables ASE built-in form styles.', 'admin-site-enhancements' ) . ')</span>',
3701 'class' => 'asenha-checkbox asenha-hide-th margin-top-8 utilities ' . $field_slug,
3702 )
3703 );
3704 $field_id = 'contact_form_advanced_toggler';
3705 $field_slug = 'contact-form-advanced-toggler';
3706 add_settings_field(
3707 $field_id,
3708 '',
3709 [$render_field, 'render_content_toggler'],
3710 ASENHA_SLUG,
3711 'main-section',
3712 array(
3713 'field_id' => $field_id,
3714 'field_slug' => $field_slug,
3715 'show_text' => __( 'Advanced Options', 'admin-site-enhancements' ),
3716 'hide_text' => __( 'Advanced Options', 'admin-site-enhancements' ),
3717 'content_selector' => '.contact-form-advanced-wrapper',
3718 )
3719 );
3720 $field_id = 'contact_form_advanced_wrapper';
3721 $field_slug = 'contact-form-advanced-wrapper';
3722 add_settings_field(
3723 $field_id,
3724 '',
3725 [$render_field, 'render_custom_html'],
3726 ASENHA_SLUG,
3727 'main-section',
3728 array(
3729 'html' => '<div class="subfields-container subfields-in-column full-width-div contact-form-advanced-wrapper" style="display: none;"></div>',
3730 )
3731 );
3732 $field_id = 'heading_for_contact_form_form_labels';
3733 $field_slug = 'heading-for-contact-form-form-labels';
3734 add_settings_field(
3735 $field_id,
3736 '',
3737 [$render_field, 'render_subfields_heading'],
3738 ASENHA_SLUG,
3739 'main-section',
3740 array(
3741 'subfields_heading' => __( 'Form labels', 'admin-site-enhancements' ),
3742 'class' => 'asenha-heading margin-bottom-8 utilities ' . $field_slug,
3743 )
3744 );
3745 $contact_form_label_fields = array(
3746 'contact_form_label_subject' => array(
3747 'slug' => 'contact-form-label-subject',
3748 'label' => __( 'Subject', 'admin-site-enhancements' ),
3749 'default' => __( 'Subject', 'admin-site-enhancements' ),
3750 ),
3751 'contact_form_label_message' => array(
3752 'slug' => 'contact-form-label-message',
3753 'label' => __( 'Message', 'admin-site-enhancements' ),
3754 'default' => __( 'Message', 'admin-site-enhancements' ),
3755 ),
3756 'contact_form_label_name' => array(
3757 'slug' => 'contact-form-label-name',
3758 'label' => __( 'Name', 'admin-site-enhancements' ),
3759 'default' => __( 'Name', 'admin-site-enhancements' ),
3760 ),
3761 'contact_form_label_email' => array(
3762 'slug' => 'contact-form-label-email',
3763 'label' => __( 'Email', 'admin-site-enhancements' ),
3764 'default' => __( 'Email', 'admin-site-enhancements' ),
3765 ),
3766 'contact_form_submit_button_label' => array(
3767 'slug' => 'contact-form-submit-button-label',
3768 'label' => __( 'Submit button', 'admin-site-enhancements' ),
3769 'default' => __( 'Send Message', 'admin-site-enhancements' ),
3770 ),
3771 'contact_form_success_message' => array(
3772 'slug' => 'contact-form-success-message',
3773 'label' => __( 'Success message', 'admin-site-enhancements' ),
3774 'default' => __( 'Thank you. Your message has been sent.', 'admin-site-enhancements' ),
3775 ),
3776 'contact_form_error_message' => array(
3777 'slug' => 'contact-form-error-message',
3778 'label' => __( 'Error message', 'admin-site-enhancements' ),
3779 'default' => __( 'Unable to send your message. Please try again later.', 'admin-site-enhancements' ),
3780 ),
3781 );
3782 foreach ( $contact_form_label_fields as $field_id => $field_config ) {
3783 add_settings_field(
3784 $field_id,
3785 '<span class="field-sublabel sublabel-wide">' . esc_html( $field_config['label'] ) . '</span>',
3786 [$render_field, 'render_text_subfield'],
3787 ASENHA_SLUG,
3788 'main-section',
3789 array(
3790 'option_name' => ASENHA_SLUG_U,
3791 'field_id' => $field_id,
3792 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3793 'field_type' => '',
3794 'field_prefix' => '',
3795 'field_suffix' => '',
3796 'field_placeholder' => '',
3797 'field_description' => '<span class="faded">' . esc_html( sprintf(
3798 /* translators: %s: default label text */
3799 __( 'Default: %s', 'admin-site-enhancements' ),
3800 $field_config['default']
3801 ) ) . '</span>',
3802 'class' => 'asenha-text with-prefix-suffix with-description wide utilities ' . $field_config['slug'],
3803 )
3804 );
3805 }
3806 $field_id = 'heading_for_contact_form_test_mode';
3807 $field_slug = 'heading-for-contact-form-test-mode';
3808 add_settings_field(
3809 $field_id,
3810 '',
3811 [$render_field, 'render_subfields_heading'],
3812 ASENHA_SLUG,
3813 'main-section',
3814 array(
3815 'subfields_heading' => __( 'Test Mode', 'admin-site-enhancements' ),
3816 'class' => 'asenha-heading utilities ' . $field_slug,
3817 )
3818 );
3819 $field_id = 'contact_form_disable_antispam';
3820 $field_slug = 'contact-form-disable-antispam';
3821 add_settings_field(
3822 $field_id,
3823 '',
3824 [$render_field, 'render_checkbox_plain'],
3825 ASENHA_SLUG,
3826 'main-section',
3827 array(
3828 'option_name' => ASENHA_SLUG_U,
3829 'field_id' => $field_id,
3830 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3831 'field_label' => __( 'Disable anti-spam measures to perform submission tests', 'admin-site-enhancements' ),
3832 'class' => 'asenha-checkbox asenha-hide-th utilities ' . $field_slug,
3833 )
3834 );
3835 $field_id = 'contact_form_test_mode_description';
3836 $field_slug = 'contact-form-test-mode-description';
3837 add_settings_field(
3838 $field_id,
3839 '',
3840 [$render_field, 'render_description_subfield'],
3841 ASENHA_SLUG,
3842 'main-section',
3843 array(
3844 'field_description' => '<div class="asenha-warning">' . __( 'Only enable this while testing. Disable it on production sites to restore spam protection.', 'admin-site-enhancements' ) . '</div>',
3845 'class' => 'asenha-description margin-top-m8 margin-bottom-4 utilities ' . $field_slug,
3846 )
3847 );
3848 // Multiple User Roles
3849 $field_id = 'multiple_user_roles';
3850 $field_slug = 'multiple-user-roles';
3851 $field_title = __( 'Multiple User Roles', 'admin-site-enhancements' );
3852 add_settings_field(
3853 $field_id,
3854 $field_title,
3855 [$render_field, 'render_checkbox_toggle'],
3856 ASENHA_SLUG,
3857 'main-section',
3858 array(
3859 'option_name' => ASENHA_SLUG_U,
3860 'field_id' => $field_id,
3861 'field_slug' => $field_slug,
3862 'field_title' => $field_title,
3863 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3864 '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' ),
3865 'field_options_wrapper' => true,
3866 'class' => 'asenha-toggle utilities ' . $field_slug,
3867 )
3868 );
3869 // Image Sizes Panel
3870 $field_id = 'image_sizes_panel';
3871 $field_slug = 'image-sizes-panel';
3872 $field_title = __( 'Image Sizes Panel', 'admin-site-enhancements' );
3873 add_settings_field(
3874 $field_id,
3875 $field_title,
3876 [$render_field, 'render_checkbox_toggle'],
3877 ASENHA_SLUG,
3878 'main-section',
3879 array(
3880 'option_name' => ASENHA_SLUG_U,
3881 'field_id' => $field_id,
3882 'field_slug' => $field_slug,
3883 'field_title' => $field_title,
3884 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3885 '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' ),
3886 'field_options_wrapper' => true,
3887 'class' => 'asenha-toggle utilities ' . $field_slug,
3888 )
3889 );
3890 // View Admin as Role
3891 $field_id = 'view_admin_as_role';
3892 $field_slug = 'view-admin-as-role';
3893 $field_title = __( 'View Admin as Role', 'admin-site-enhancements' );
3894 add_settings_field(
3895 $field_id,
3896 $field_title,
3897 [$render_field, 'render_checkbox_toggle'],
3898 ASENHA_SLUG,
3899 'main-section',
3900 array(
3901 'option_name' => ASENHA_SLUG_U,
3902 'field_id' => $field_id,
3903 'field_slug' => $field_slug,
3904 'field_title' => $field_title,
3905 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3906 'field_description' => __( 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', 'admin-site-enhancements' ),
3907 'field_options_moreless' => true,
3908 'field_options_wrapper' => true,
3909 'class' => 'asenha-toggle utilities ' . $field_slug,
3910 )
3911 );
3912 $field_id = 'view_admin_as_role_description';
3913 $field_slug = 'view-admin-as-role-description';
3914 add_settings_field(
3915 $field_id,
3916 '',
3917 [$render_field, 'render_view_admin_as_role_recovery_description'],
3918 ASENHA_SLUG,
3919 'main-section',
3920 array(
3921 'option_name' => ASENHA_SLUG_U,
3922 'class' => 'asenha-description utilities ' . $field_slug,
3923 )
3924 );
3925 // Enable Password Protection
3926 $field_id = 'enable_password_protection';
3927 $field_slug = 'enable-password-protection';
3928 $field_title = __( 'Password Protection', 'admin-site-enhancements' );
3929 add_settings_field(
3930 $field_id,
3931 $field_title,
3932 [$render_field, 'render_checkbox_toggle'],
3933 ASENHA_SLUG,
3934 'main-section',
3935 array(
3936 'option_name' => ASENHA_SLUG_U,
3937 'field_id' => $field_id,
3938 'field_slug' => $field_slug,
3939 'field_title' => $field_title,
3940 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3941 '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' ),
3942 'field_options_moreless' => true,
3943 'field_options_wrapper' => true,
3944 'class' => 'asenha-toggle utilities ' . $field_slug,
3945 )
3946 );
3947 $field_id = 'password_protection_password';
3948 $field_slug = 'password-protection-password';
3949 add_settings_field(
3950 $field_id,
3951 __( 'Set the password:', 'admin-site-enhancements' ),
3952 [$render_field, 'render_password_subfield'],
3953 ASENHA_SLUG,
3954 'main-section',
3955 array(
3956 'option_name' => ASENHA_SLUG_U,
3957 'field_id' => $field_id,
3958 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
3959 'field_type' => 'with-prefix-suffix',
3960 'field_prefix' => '',
3961 'field_suffix' => '<span class="faded">' . __( '(Default is \'secret\')', 'admin-site-enhancements' ) . '</span>',
3962 'field_description' => '',
3963 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug,
3964 )
3965 );
3966 $field_id = 'password_protection_notes';
3967 $field_slug = 'password-protection-notes';
3968 add_settings_field(
3969 $field_id,
3970 '',
3971 [$render_field, 'render_description_subfield'],
3972 ASENHA_SLUG,
3973 'main-section',
3974 array(
3975 'option_name' => ASENHA_SLUG_U,
3976 'field_description' => sprintf(
3977 /* translators: %s is URL to the documentation for nocache_headers() */
3978 __( '<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' ),
3979 'https://developer.wordpress.org/reference/functions/nocache_headers/'
3980 ),
3981 'class' => 'asenha-description login-logout ' . $field_slug,
3982 )
3983 );
3984 // Maintenance Mode
3985 $field_id = 'maintenance_mode';
3986 $field_slug = 'maintenance-mode';
3987 $field_title = __( 'Maintenance Mode', 'admin-site-enhancements' );
3988 add_settings_field(
3989 $field_id,
3990 $field_title,
3991 [$render_field, 'render_checkbox_toggle'],
3992 ASENHA_SLUG,
3993 'main-section',
3994 array(
3995 'option_name' => ASENHA_SLUG_U,
3996 'field_id' => $field_id,
3997 'field_slug' => $field_slug,
3998 'field_title' => $field_title,
3999 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4000 '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' ),
4001 'field_options_wrapper' => true,
4002 'field_options_moreless' => true,
4003 'class' => 'asenha-toggle utilities ' . $field_slug,
4004 )
4005 );
4006 $field_id = 'maintenance_page_type_custom';
4007 $field_slug = 'maintenance-page-type-custom';
4008 add_settings_field(
4009 $field_id,
4010 '',
4011 [$render_field, 'render_custom_html'],
4012 ASENHA_SLUG,
4013 'main-section',
4014 array(
4015 'html' => '<div class="subfields-container subfields-in-column maintenance-page-type-custom"></div>',
4016 )
4017 );
4018 $field_id = 'maintenance_page_heading';
4019 $field_slug = 'maintenance-page-heading';
4020 add_settings_field(
4021 $field_id,
4022 __( 'Heading', 'admin-site-enhancements' ),
4023 [$render_field, 'render_text_subfield'],
4024 ASENHA_SLUG,
4025 'main-section',
4026 array(
4027 'option_name' => ASENHA_SLUG_U,
4028 'field_id' => $field_id,
4029 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4030 'field_type' => '',
4031 'field_prefix' => '',
4032 'field_suffix' => '',
4033 'field_description' => '',
4034 'field_placeholder' => __( 'We\'ll be back soon.', 'admin-site-enhancements' ),
4035 'class' => 'asenha-text utilities full-width margin-bottom-20 ' . $field_slug,
4036 )
4037 );
4038 $field_id = 'maintenance_page_description';
4039 $field_slug = 'maintenance-page-description';
4040 add_settings_field(
4041 $field_id,
4042 __( 'Description', 'admin-site-enhancements' ),
4043 [$render_field, 'render_textarea_subfield'],
4044 ASENHA_SLUG,
4045 'main-section',
4046 array(
4047 'option_name' => ASENHA_SLUG_U,
4048 'field_id' => $field_id,
4049 'field_slug' => $field_slug,
4050 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4051 'field_type' => 'textarea',
4052 'field_rows' => 5,
4053 'field_intro' => '',
4054 'field_description' => '',
4055 'field_placeholder' => __( 'This site is undergoing maintenance for an extended period today. Thanks for your patience.', 'admin-site-enhancements' ),
4056 'class' => 'asenha-textarea utilities ' . $field_slug,
4057 )
4058 );
4059 $field_id = 'maintenance_page_background';
4060 $field_slug = 'maintenance-page-background';
4061 $field_radios = array(
4062 __( 'Stripes', 'admin-site-enhancements' ) => 'stripes',
4063 __( 'Curves', 'admin-site-enhancements' ) => 'curves',
4064 __( 'Lines', 'admin-site-enhancements' ) => 'lines',
4065 );
4066 add_settings_field(
4067 $field_id,
4068 __( 'Background', 'admin-site-enhancements' ),
4069 [$render_field, 'render_radio_buttons_subfield'],
4070 ASENHA_SLUG,
4071 'main-section',
4072 array(
4073 'option_name' => ASENHA_SLUG_U,
4074 'field_id' => $field_id,
4075 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4076 'field_radios' => $field_radios,
4077 'field_default' => 'default',
4078 'class' => 'asenha-radio-buttons margin-top-12 utilities ' . $field_slug,
4079 )
4080 );
4081 $field_id = 'maintenance_mode_description';
4082 $field_slug = 'maintenance-mode-description';
4083 add_settings_field(
4084 $field_id,
4085 '',
4086 [$render_field, 'render_description_subfield'],
4087 ASENHA_SLUG,
4088 'main-section',
4089 array(
4090 'option_name' => ASENHA_SLUG_U,
4091 '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>',
4092 'class' => 'asenha-description utilities ' . $field_slug,
4093 )
4094 );
4095 // Redirect 404 to Homepage
4096 $field_id = 'redirect_404_to_homepage';
4097 $field_slug = 'redirect-404-to-homepage';
4098 $module_title = __( 'Redirect 404 to Homepage', 'admin-site-enhancements' );
4099 $module_description = __( 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', 'admin-site-enhancements' );
4100 $field_options_wrapper = false;
4101 $field_options_moreless = false;
4102 $field_title = $module_title;
4103 add_settings_field(
4104 $field_id,
4105 $field_title,
4106 [$render_field, 'render_checkbox_toggle'],
4107 ASENHA_SLUG,
4108 'main-section',
4109 array(
4110 'option_name' => ASENHA_SLUG_U,
4111 'field_id' => $field_id,
4112 'field_slug' => $field_slug,
4113 'field_title' => $field_title,
4114 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4115 'field_description' => $module_description,
4116 'field_options_wrapper' => $field_options_wrapper,
4117 'field_options_moreless' => $field_options_moreless,
4118 'class' => 'asenha-toggle utilities ' . $field_slug,
4119 )
4120 );
4121 // Display System Summary
4122 $field_id = 'display_system_summary';
4123 $field_slug = 'display-system-summary';
4124 $field_title = __( 'Display System Summary', 'admin-site-enhancements' );
4125 $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' );
4126 add_settings_field(
4127 $field_id,
4128 $field_title,
4129 [$render_field, 'render_checkbox_toggle'],
4130 ASENHA_SLUG,
4131 'main-section',
4132 array(
4133 'option_name' => ASENHA_SLUG_U,
4134 'field_id' => $field_id,
4135 'field_slug' => $field_slug,
4136 'field_title' => $field_title,
4137 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4138 'field_description' => $module_description,
4139 'field_options_wrapper' => true,
4140 'class' => 'asenha-toggle utilities ' . $field_slug,
4141 )
4142 );
4143 // Search Engines Visibility Status
4144 $field_id = 'search_engine_visibility_status';
4145 $field_slug = 'search-engine-visibility-status';
4146 $field_title = __( 'Search Engines Visibility Status', 'admin-site-enhancements' );
4147 $field_options_moreless = false;
4148 $field_options_wrapper = false;
4149 add_settings_field(
4150 $field_id,
4151 $field_title,
4152 [$render_field, 'render_checkbox_toggle'],
4153 ASENHA_SLUG,
4154 'main-section',
4155 array(
4156 'option_name' => ASENHA_SLUG_U,
4157 'field_id' => $field_id,
4158 'field_slug' => $field_slug,
4159 'field_title' => $field_title,
4160 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']',
4161 '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' ),
4162 'field_options_moreless' => $field_options_moreless,
4163 'field_options_wrapper' => $field_options_wrapper,
4164 'class' => 'asenha-toggle utilities ' . $field_slug,
4165 )
4166 );
4167 }
4168
4169 }
4170