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