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