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