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