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