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