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