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