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