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