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