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