PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 4.7.3
Admin and Site Enhancements (ASE) v4.7.3
9.1.0 9.0.2 9.0.1 9.0.0 8.9.2 8.9.1 8.9.0 8.8.8 8.8.7 8.8.6 8.8.5 8.8.4 8.8.3 8.8.2 8.8.1 8.8.0 8.7.3 8.7.2 8.7.1 8.2.1 8.2.2 8.2.3 8.3.0 8.3.1 8.3.2 8.4.0 8.4.1 8.4.2 8.5.0 8.5.1 8.5.2 8.6.0 8.6.1 8.6.2 8.7.0 5.0.1 5.0.2 5.0.2.1 5.0.2.2 5.0.2.3 5.0.2.4 5.1.0 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1 5.5.0 5.5.1 5.5.2 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.8.0 5.8.1 6.0.0 6.0.3 6.0.4 6.0.5 6.0.5.1 6.0.6 6.0.7 6.0.8.1 6.1.0 6.1.3 6.2.0 6.2.1 6.2.2 6.2.3 6.2.4 6.2.5 6.2.6 6.2.7 6.3.0 6.3.1 6.3.2 6.4.0 6.5.0 6.5.1 6.6.0 6.7.0 6.8.0 6.8.2 6.8.3 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13.1 6.9.13.2 6.9.2 6.9.3 6.9.4 6.9.5 6.9.6 6.9.7 6.9.8 6.9.9 7.0.0 7.0.2 7.0.2.1 7.0.2.2 7.0.2.3 7.0.3 7.1.0 7.1.1 7.1.2 7.1.3 7.1.4 7.1.5 7.2.0 7.2.1 7.3.0 7.3.1 7.3.2 7.3.3 7.4.0 7.4.2 7.4.4 7.4.5 7.4.6 7.4.7 7.4.8 7.5.0 7.5.1 7.5.2 7.5.3 7.5.4 7.6.0 7.6.1 7.6.1.1 7.6.10 7.6.11 7.6.2 7.6.3 7.6.4 7.6.5 7.6.6 7.6.7 7.6.7.1 7.6.8 7.6.9 7.7.0 7.8.0 7.8.1 7.8.10 7.8.11 7.8.12 7.8.13 7.8.14 7.8.15 7.8.16 7.8.17 7.8.18 7.8.2 7.8.3 7.8.4 7.8.5 7.8.5.1 7.8.6 7.8.7 7.8.8 7.8.9 7.9.0 7.9.1 7.9.10 7.9.11 7.9.2 7.9.3 7.9.4 7.9.5 7.9.6 7.9.7 7.9.8 7.9.9 8.0.0 8.0.1 8.0.2 8.0.3 8.0.4 8.0.5 8.0.6 8.0.7 8.0.8 8.1.0 8.1.1 8.1.2 8.1.3 8.1.4 8.2.0 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.4.0 1.5.0 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.5.0 2.6.0 2.7.0 2.8.0 2.8.1 2.8.2 2.8.3 2.9.0 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.2.0 3.3.0 3.4.0 3.5.0 3.6.1 3.7.0 3.8.0 3.9.0 3.9.1 3.9.2 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.9.0 4.9.1 4.9.2 4.9.3 5.0.0
admin-site-enhancements / classes / class-settings-sections-fields.php
admin-site-enhancements / classes Last commit date
class-activation.php 3 years ago class-admin-interface.php 3 years ago class-common-methods.php 3 years ago class-content-management.php 3 years ago class-custom-code.php 3 years ago class-deactivation.php 3 years ago class-disable-components.php 3 years ago class-login-logout.php 3 years ago class-optimizations.php 3 years ago class-security.php 3 years ago class-settings-fields-render.php 3 years ago class-settings-sanitization.php 3 years ago class-settings-sections-fields.php 3 years ago class-utilities.php 3 years ago
class-settings-sections-fields.php
2431 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', // Section ID
23 '', // Section title. Can be blank.
24 '', // Callback function to output section intro. Can be blank.
25 ASENHA_SLUG // Settings page slug
26 );
27
28 // Register main setttings
29
30 // Instantiate object for sanitization of settings fields values
31 $sanitization = new Settings_Sanitization;
32
33 // Instantiate object for rendering of settings fields for the admin page
34 $render_field = new Settings_Fields_Render;
35
36 register_setting(
37 ASENHA_ID, // Option group or option_page
38 ASENHA_SLUG_U, // Option name in wp_options table
39 array(
40 'type' => 'array', // 'string', 'boolean', 'integer', 'number', 'array', or 'object'
41 'description' => '', // A description of the data attached to this setting.
42 'sanitize_callback' => [ $sanitization, 'sanitize_for_options' ],
43 'show_in_rest' => false,
44 'default' => array(), // When calling get_option()
45 )
46 );
47
48 // =================================================================
49 // Call WordPress globals and set new globals required for the fields
50 // =================================================================
51
52 global $wp_roles, $wpdb, $asenha_public_post_types, $asenha_gutenberg_post_types, $asenha_revisions_post_types;
53
54 $roles = $wp_roles->get_names();
55
56 // Get array of slugs and plural labels for public post types, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
57 $asenha_public_post_types = array();
58 $public_post_type_names = get_post_types( array( 'public' => true ), 'names' );
59 foreach( $public_post_type_names as $post_type_name ) {
60 $post_type_object = get_post_type_object( $post_type_name );
61 $asenha_public_post_types[$post_type_name] = $post_type_object->label;
62 }
63
64 // 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' )
65 $asenha_gutenberg_post_types = array();
66 $gutenberg_not_applicable_types = array( 'attachment', 'revision', 'nav_menu_item', 'custom_css', 'customize_changeset', 'oembed_cache', 'user_request', 'wp_block' );
67 $all_post_types = get_post_types( array(), 'objects' );
68 foreach ( $all_post_types as $post_type_slug => $post_type_info ) {
69 $asenha_gutenberg_post_types[$post_type_slug] = $post_type_info->label;
70 if ( in_array( $post_type_slug, $gutenberg_not_applicable_types ) ) {
71 unset( $asenha_gutenberg_post_types[$post_type_slug] );
72 }
73 }
74
75 // Get array of slugs and plural labels for post types supporting revisions, e.g. array( 'post' => 'Posts', 'page' => 'Pages' )
76 $asenha_revisions_post_types = array();
77 foreach ( get_post_types( array(), 'names' ) as $post_type_slug ) { // post type slug/name
78 if ( post_type_supports( $post_type_slug, 'revisions' ) ) {
79 $post_type_object = get_post_type_object( $post_type_slug );
80 if ( property_exists( $post_type_object, 'label' ) ) {
81 $asenha_revisions_post_types[$post_type_slug] = $post_type_object->label;
82 }
83 }
84 }
85
86 // =================================================================
87 // CONTENT MANAGEMENT
88 // =================================================================
89
90 // Enable Page and Post Duplication
91
92 $field_id = 'enable_duplication';
93 $field_slug = 'enable-duplication';
94
95 add_settings_field(
96 $field_id, // Field ID
97 'Page and Post Duplication', // Field title
98 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
99 ASENHA_SLUG, // Settings page slug
100 'main-section', // Section ID
101 array(
102 'field_id' => $field_id, // Custom argument
103 'field_slug' => $field_slug, // Custom argument
104 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
105 'field_description' => 'Enable one-click duplication of pages, posts and custom posts. The corresponding taxonomy terms and post meta will also be duplicated.', // Custom argument
106 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
107 )
108 );
109
110 // Enable Media Replacement
111
112 $field_id = 'enable_media_replacement';
113 $field_slug = 'enable-media-replacement';
114
115 add_settings_field(
116 $field_id, // Field ID
117 'Media Replacement', // Field title
118 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
119 ASENHA_SLUG, // Settings page slug
120 'main-section', // Section ID
121 array(
122 'field_id' => $field_id, // Custom argument
123 'field_slug' => $field_slug, // Custom argument
124 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
125 '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.', // Custom argument
126 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
127 )
128 );
129
130 // Enable SVG Upload
131
132 $field_id = 'enable_svg_upload';
133 $field_slug = 'enable-svg-upload';
134
135 add_settings_field(
136 $field_id, // Field ID
137 'SVG Upload', // Field title
138 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
139 ASENHA_SLUG, // Settings page slug
140 'main-section', // Section ID
141 array(
142 'field_id' => $field_id, // Custom argument
143 'field_slug' => $field_slug, // Custom argument
144 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
145 'field_description' => 'Allow some or all user roles to upload SVG files, which will then be sanitized to keep things secure.', // Custom argument
146 'field_options_wrapper' => true, // Custom argument. Add container for additional options
147 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
148 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
149 )
150 );
151
152 $field_id = 'enable_svg_upload_for';
153 $field_slug = 'enable-svg-upload-for';
154
155 if ( is_array( $roles ) ) {
156 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
157
158 add_settings_field(
159 $field_id . '_' . $role_slug, // Field ID
160 '', // Field title
161 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
162 ASENHA_SLUG, // Settings page slug
163 'main-section', // Section ID
164 array(
165 'parent_field_id' => $field_id, // Custom argument
166 'field_id' => $role_slug, // Custom argument
167 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
168 'field_label' => $role_label, // Custom argument
169 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
170 )
171 );
172
173 }
174 }
175
176 // Enable External Permalinks
177
178 $field_id = 'enable_external_permalinks';
179 $field_slug = 'enable-external-permalinks';
180
181 add_settings_field(
182 $field_id, // Field ID
183 'External Permalinks', // Field title
184 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
185 ASENHA_SLUG, // Settings page slug
186 'main-section', // Section ID
187 array(
188 'field_id' => $field_id, // Custom argument
189 'field_slug' => $field_slug, // Custom argument
190 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
191 'field_description' => 'Enable pages, posts and/or custom post types to have permalinks that point to external URLs. Compatible with links added using <a href="https://wordpress.org/plugins/page-links-to/" target="_blank">Page Links To</a>.', // Custom argument
192 'field_options_wrapper' => true, // Custom argument. Add container for additional options
193 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
194 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
195 )
196 );
197
198 $field_id = 'enable_external_permalinks_for';
199 $field_slug = 'enable-external-permalinks-for';
200
201 if ( is_array( $asenha_public_post_types ) ) {
202 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
203 if ( 'attachment' != $post_type_slug ) {
204 add_settings_field(
205 $field_id . '_' . $post_type_slug, // Field ID
206 '', // Field title
207 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
208 ASENHA_SLUG, // Settings page slug
209 'main-section', // Section ID
210 array(
211 'parent_field_id' => $field_id, // Custom argument
212 'field_id' => $post_type_slug, // Custom argument
213 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
214 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
215 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
216 )
217 );
218 }
219 }
220 }
221
222 // Enable Auto-Publishing of Posts with Missed Schedules
223
224 $field_id = 'enable_missed_schedule_posts_auto_publish';
225 $field_slug = 'enable-missed-schedule-posts-auto-publish';
226
227 add_settings_field(
228 $field_id, // Field ID
229 'Auto-Publish Posts with Missed Schedule', // Field title
230 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
231 ASENHA_SLUG, // Settings page slug
232 'main-section', // Section ID
233 array(
234 'field_id' => $field_id, // Custom argument
235 'field_slug' => $field_slug, // Custom argument
236 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
237 'field_description' => 'Trigger publishing of scheduled posts of all types marked with "missed schedule", anytime the site is visited.', // Custom argument
238 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
239 )
240 );
241
242
243 // Enhance List Tables
244
245 $field_id = 'enhance_list_tables';
246 $field_slug = 'enhance-list-tables';
247
248 add_settings_field(
249 $field_id, // Field ID
250 'Enhance List Tables', // Field title
251 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
252 ASENHA_SLUG, // Settings page slug
253 'main-section', // Section ID
254 array(
255 'field_id' => $field_id, // Custom argument
256 'field_slug' => $field_slug, // Custom argument
257 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
258 'field_description' => 'Improve the usefulness of listing pages of various post types by adding / removing columns and elements.', // Custom argument
259 'field_options_wrapper' => true, // Custom argument. Add container for additional options
260 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
261 'class' => 'asenha-toggle content-management ' . $field_slug, // Custom class for the <tr> element
262 )
263 );
264
265 // Show Featured Image Column
266
267 $field_id = 'show_featured_image_column';
268 $field_slug = 'show-featured-image-column';
269
270 add_settings_field(
271 $field_id, // Field ID
272 '', // Field title
273 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
274 ASENHA_SLUG, // Settings page slug
275 'main-section', // Section ID
276 array(
277 'field_id' => $field_id, // Custom argument
278 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
279 'field_label' => 'Show featured image column.', // Custom argument
280 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
281 )
282 );
283
284 // Show Excerpt Column
285
286 $field_id = 'show_excerpt_column';
287 $field_slug = 'show-excerpt-column';
288
289 add_settings_field(
290 $field_id, // Field ID
291 '', // Field title
292 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
293 ASENHA_SLUG, // Settings page slug
294 'main-section', // Section ID
295 array(
296 'field_id' => $field_id, // Custom argument
297 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
298 'field_label' => 'Show excerpt column.', // Custom argument
299 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
300 )
301 );
302
303 // Show ID Column
304
305 $field_id = 'show_id_column';
306 $field_slug = 'show-id-column';
307
308 add_settings_field(
309 $field_id, // Field ID
310 '', // Field title
311 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
312 ASENHA_SLUG, // Settings page slug
313 'main-section', // Section ID
314 array(
315 'field_id' => $field_id, // Custom argument
316 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
317 'field_label' => 'Show ID column.', // Custom argument
318 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
319 )
320 );
321
322 // Hide Comments Column
323
324 $field_id = 'hide_comments_column';
325 $field_slug = 'hide-comments-column';
326
327 add_settings_field(
328 $field_id, // Field ID
329 '', // Field title
330 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
331 ASENHA_SLUG, // Settings page slug
332 'main-section', // Section ID
333 array(
334 'field_id' => $field_id, // Custom argument
335 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
336 'field_label' => 'Remove comments column.', // Custom argument
337 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
338 )
339 );
340
341 // Hide Post Tags Column
342
343 $field_id = 'hide_post_tags_column';
344 $field_slug = 'hide-post-tags-column';
345
346 add_settings_field(
347 $field_id, // Field ID
348 '', // Field title
349 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
350 ASENHA_SLUG, // Settings page slug
351 'main-section', // Section ID
352 array(
353 'field_id' => $field_id, // Custom argument
354 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
355 'field_label' => 'Remove tags column (for posts).', // Custom argument
356 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
357 )
358 );
359
360 // Show Custom Taxonomy Filters
361
362 $field_id = 'show_custom_taxonomy_filters';
363 $field_slug = 'show-custom-taxonomy-filters';
364
365 add_settings_field(
366 $field_id, // Field ID
367 '', // Field title
368 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
369 ASENHA_SLUG, // Settings page slug
370 'main-section', // Section ID
371 array(
372 'field_id' => $field_id, // Custom argument
373 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
374 'field_label' => 'Show additional filter(s) for hierarchical, custom taxonomies.', // Custom argument
375 'class' => 'asenha-checkbox asenha-hide-th content-management ' . $field_slug, // Custom class for the <tr> element
376 )
377 );
378
379 // =================================================================
380 // ADMIN INTERFACE
381 // =================================================================
382
383 // Hide Admin Notices
384
385 $field_id = 'hide_admin_notices';
386 $field_slug = 'hide-admin-notices';
387
388 add_settings_field(
389 $field_id, // Field ID
390 'Hide Admin Notices', // Field title
391 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
392 ASENHA_SLUG, // Settings page slug
393 'main-section', // Section ID
394 array(
395 'field_id' => $field_id, // Custom argument
396 'field_slug' => $field_slug, // Custom argument
397 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
398 'field_description' => 'Clean up admin pages by moving notices into a separate panel easily accessible via the admin bar.', // Custom argument
399 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
400 )
401 );
402
403 // Disable Dashboard Widgets
404
405 $field_id = 'disable_dashboard_widgets';
406 $field_slug = 'disable-dashboard-widgets';
407
408 add_settings_field(
409 $field_id, // Field ID
410 'Disable Dashboard Widgets', // Field title
411 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
412 ASENHA_SLUG, // Settings page slug
413 'main-section', // Section ID
414 array(
415 'field_id' => $field_id, // Custom argument
416 'field_slug' => $field_slug, // Custom argument
417 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
418 '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. ', // Custom argument
419 'field_options_wrapper' => true, // Custom argument. Add container for additional options
420 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
421 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
422 )
423 );
424
425 $field_id = 'disabled_dashboard_widgets';
426 $field_slug = 'disabled-dashboard-widgets';
427
428 $extra_options = get_option( 'admin_site_enhancements_extra', array() );
429 if ( array_key_exists( 'dashboard_widgets', $extra_options ) ) {
430 $dashboard_widgets = $extra_options['dashboard_widgets'];
431 } else {
432 $admin_interface = new Admin_Interface;
433 $dashboard_widgets = $admin_interface->get_dashboard_widgets();
434 $extra_options['dashboard_widgets'] = $dashboard_widgets;
435 update_option( 'admin_site_enhancements_extra', $extra_options );
436 }
437
438 foreach ( $dashboard_widgets as $widget ) {
439 add_settings_field(
440 $field_id . '_' . $widget['id'], // Field ID
441 '', // Field title
442 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
443 ASENHA_SLUG, // Settings page slug
444 'main-section', // Section ID
445 array(
446 'parent_field_id' => $field_id, // Custom argument
447 'field_id' => $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'], // Custom argument
448 'field_name' => ASENHA_SLUG_U . '[' . $field_id . '][' . $widget['id'] . '__' . $widget['context'] . '__' . $widget['priority'] . ']', // Custom argument
449 'field_label' => $widget['title'] . ' <span class="faded">(' . $widget['id'] . ')</span>', // Custom argument
450 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug . ' ' . $widget['id'], // Custom class for the <tr> element
451 )
452 );
453 }
454
455 // Hide or Modify Elements
456
457 $field_id = 'hide_modify_elements';
458 $field_slug = 'hide-modify-elements';
459
460 add_settings_field(
461 $field_id, // Field ID
462 'Clean Up Admin Bar', // Field title
463 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
464 ASENHA_SLUG, // Settings page slug
465 'main-section', // Section ID
466 array(
467 'field_id' => $field_id, // Custom argument
468 'field_slug' => $field_slug, // Custom argument
469 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
470 'field_description' => 'Remove various elements from the admin bar.', // Custom argument
471 'field_options_wrapper' => true, // Custom argument. Add container for additional options
472 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
473 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
474 )
475 );
476
477 $field_id = 'hide_ab_wp_logo_menu';
478 $field_slug = 'hide-ab-wp-logo-menu';
479
480 add_settings_field(
481 $field_id, // Field ID
482 '', // Field title
483 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
484 ASENHA_SLUG, // Settings page slug
485 'main-section', // Section ID
486 array(
487 'field_id' => $field_id, // Custom argument
488 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
489 'field_label' => 'Remove WordPress logo/menu', // Custom argument
490 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
491 )
492 );
493
494 $field_id = 'hide_ab_customize_menu';
495 $field_slug = 'hide-ab-customize-menu';
496
497 add_settings_field(
498 $field_id, // Field ID
499 '', // Field title
500 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
501 ASENHA_SLUG, // Settings page slug
502 'main-section', // Section ID
503 array(
504 'field_id' => $field_id, // Custom argument
505 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
506 'field_label' => 'Remove customize menu', // Custom argument
507 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
508 )
509 );
510
511 $field_id = 'hide_ab_updates_menu';
512 $field_slug = 'hide-ab-updates-menu';
513
514 add_settings_field(
515 $field_id, // Field ID
516 '', // Field title
517 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
518 ASENHA_SLUG, // Settings page slug
519 'main-section', // Section ID
520 array(
521 'field_id' => $field_id, // Custom argument
522 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
523 'field_label' => 'Remove updates counter/link', // Custom argument
524 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
525 )
526 );
527
528 $field_id = 'hide_ab_comments_menu';
529 $field_slug = 'hide-ab-comments-menu';
530
531 add_settings_field(
532 $field_id, // Field ID
533 '', // Field title
534 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
535 ASENHA_SLUG, // Settings page slug
536 'main-section', // Section ID
537 array(
538 'field_id' => $field_id, // Custom argument
539 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
540 'field_label' => 'Remove comments counter/link', // Custom argument
541 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
542 )
543 );
544
545 $field_id = 'hide_ab_new_content_menu';
546 $field_slug = 'hide-ab-new-content-menu';
547
548 add_settings_field(
549 $field_id, // Field ID
550 '', // Field title
551 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
552 ASENHA_SLUG, // Settings page slug
553 'main-section', // Section ID
554 array(
555 'field_id' => $field_id, // Custom argument
556 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
557 'field_label' => 'Remove new content menu', // Custom argument
558 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
559 )
560 );
561
562 $field_id = 'hide_ab_howdy';
563 $field_slug = 'hide-ab-howdy';
564
565 add_settings_field(
566 $field_id, // Field ID
567 '', // Field title
568 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
569 ASENHA_SLUG, // Settings page slug
570 'main-section', // Section ID
571 array(
572 'field_id' => $field_id, // Custom argument
573 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
574 'field_label' => 'Remove \'Howdy\'', // Custom argument
575 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
576 )
577 );
578
579 $field_id = 'hide_help_drawer';
580 $field_slug = 'hide-help-drawer';
581
582 add_settings_field(
583 $field_id, // Field ID
584 '', // Field title
585 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
586 ASENHA_SLUG, // Settings page slug
587 'main-section', // Section ID
588 array(
589 'field_id' => $field_id, // Custom argument
590 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
591 'field_label' => 'Remove the Help tab and drawer', // Custom argument
592 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
593 )
594 );
595
596 // Hide Admin Bar
597
598 $field_id = 'hide_admin_bar';
599 $field_slug = 'hide-admin-bar';
600
601 add_settings_field(
602 $field_id, // Field ID
603 'Hide Admin Bar', // Field title
604 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
605 ASENHA_SLUG, // Settings page slug
606 'main-section', // Section ID
607 array(
608 'field_id' => $field_id, // Custom argument
609 'field_slug' => $field_slug, // Custom argument
610 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
611 'field_description' => 'Hide admin bar on the front end for all or some user roles.', // Custom argument
612 'field_options_wrapper' => true, // Custom argument. Add container for additional options
613 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
614 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
615 )
616 );
617
618 $field_id = 'hide_admin_bar_for';
619 $field_slug = 'hide-admin-bar-for';
620
621 if ( is_array( $roles ) ) {
622 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
623
624 add_settings_field(
625 $field_id . '_' . $role_slug, // Field ID
626 '', // Field title
627 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
628 ASENHA_SLUG, // Settings page slug
629 'main-section', // Section ID
630 array(
631 'parent_field_id' => $field_id, // Custom argument
632 'field_id' => $role_slug, // Custom argument
633 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
634 'field_label' => $role_label, // Custom argument
635 'class' => 'asenha-checkbox asenha-hide-th asenha-half admin-interface ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
636 )
637 );
638
639 }
640 }
641
642 // Customize Admin Menu
643
644 $field_id = 'customize_admin_menu';
645 $field_slug = 'customize-admin-menu';
646
647 add_settings_field(
648 $field_id, // Field ID
649 'Admin Menu Organizer', // Field title
650 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
651 ASENHA_SLUG, // Settings page slug
652 'main-section', // Section ID
653 array(
654 'field_id' => $field_id, // Custom argument
655 'field_slug' => $field_slug, // Custom argument
656 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
657 'field_description' => 'Customize the order of the admin menu and optionally change menu item title or hide some items.', // Custom argument
658 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
659 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
660 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
661 )
662 );
663
664 $field_id = 'custom_menu_order';
665 $field_slug = 'custom-menu-order';
666
667 add_settings_field(
668 $field_id, // Field ID
669 '', // Field title
670 [ $render_field, 'render_sortable_menu' ], // Callback to render field with custom arguments in the array below
671 ASENHA_SLUG, // Settings page slug
672 'main-section', // Section ID
673 array(
674 'field_id' => $field_id, // Custom argument
675 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
676 'field_type' => 'sortable-menu', // Custom argument
677 'field_description' => '', // Custom argument
678 'class' => 'asenha-sortable asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
679 )
680 );
681
682 // =================================================================
683 // LOG IN | LOG OUT
684 // =================================================================
685
686 // Change Login URL
687
688 $field_id = 'change_login_url';
689 $field_slug = 'change-login-url';
690
691 add_settings_field(
692 $field_id, // Field ID
693 'Change Login URL', // Field title
694 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
695 ASENHA_SLUG, // Settings page slug
696 'main-section', // Section ID
697 array(
698 'field_id' => $field_id, // Custom argument
699 'field_slug' => $field_slug, // Custom argument
700 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
701 'field_description' => 'Default is ' . get_site_url() . '/wp-admin/', // Custom argument
702 'field_options_wrapper' => true, // Custom argument. Add container for additional options
703 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
704 )
705 );
706
707 $field_id = 'custom_login_slug';
708 $field_slug = 'custom-login-slug';
709
710 add_settings_field(
711 $field_id, // Field ID
712 'New URL:', // Field title
713 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
714 ASENHA_SLUG, // Settings page slug
715 'main-section', // Section ID
716 array(
717 'field_id' => $field_id, // Custom argument
718 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
719 'field_type' => 'with-prefix-suffix', // Custom argument
720 'field_prefix' => get_site_url() . '/', // Custom argument
721 'field_suffix' => '/', // Custom argument
722 'field_description' => '', // Custom argument
723 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
724 )
725 );
726
727 // Enable Log In/Out Menu
728
729 $field_id = 'enable_login_logout_menu';
730 $field_slug = 'enable-login-logout-menu';
731
732 add_settings_field(
733 $field_id, // Field ID
734 'Log In/Out Menu', // Field title
735 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
736 ASENHA_SLUG, // Settings page slug
737 'main-section', // Section ID
738 array(
739 'field_id' => $field_id, // Custom argument
740 'field_slug' => $field_slug, // Custom argument
741 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
742 'field_description' => 'Enable log in, log out and dynamic log in/out menu item for addition to any menu.', // Custom argument
743 'field_options_wrapper' => true, // Custom argument. Add container for additional options
744 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
745 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
746 )
747 );
748
749 // Enable Last Login Column
750
751 $field_id = 'enable_last_login_column';
752 $field_slug = 'enable-last-login-column';
753
754 add_settings_field(
755 $field_id, // Field ID
756 'Last Login Column', // Field title
757 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
758 ASENHA_SLUG, // Settings page slug
759 'main-section', // Section ID
760 array(
761 'field_id' => $field_id, // Custom argument
762 'field_slug' => $field_slug, // Custom argument
763 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
764 'field_description' => 'Log when users on the site last logged in and display the date and time in the users list table.', // Custom argument
765 'field_options_wrapper' => true, // Custom argument. Add container for additional options
766 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
767 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
768 )
769 );
770
771 // Redirect After Login
772
773 $field_id = 'redirect_after_login';
774 $field_slug = 'redirect-after-login';
775
776 add_settings_field(
777 $field_id, // Field ID
778 'Redirect After Login', // Field title
779 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
780 ASENHA_SLUG, // Settings page slug
781 'main-section', // Section ID
782 array(
783 'field_id' => $field_id, // Custom argument
784 'field_slug' => $field_slug, // Custom argument
785 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
786 'field_description' => 'Set custom redirect URL for all or some user roles after login.', // Custom argument
787 'field_options_wrapper' => true, // Custom argument. Add container for additional options
788 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
789 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
790 )
791 );
792
793 $field_id = 'redirect_after_login_to_slug';
794 $field_slug = 'redirect-after-login-to-slug';
795
796 add_settings_field(
797 $field_id, // Field ID
798 'Redirect to:', // Field title
799 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
800 ASENHA_SLUG, // Settings page slug
801 'main-section', // Section ID
802 array(
803 'field_id' => $field_id, // Custom argument
804 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
805 'field_type' => 'with-prefix-suffix', // Custom argument
806 'field_prefix' => get_site_url() . '/', // Custom argument
807 'field_suffix' => '/ for:', // Custom argument
808 'field_description' => '', // Custom argument
809 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
810 )
811 );
812
813 $field_id = 'redirect_after_login_for';
814 $field_slug = 'redirect-after-login-for';
815
816 if ( is_array( $roles ) ) {
817 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
818
819 add_settings_field(
820 $field_id . '_' . $role_slug, // Field ID
821 '', // Field title
822 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
823 ASENHA_SLUG, // Settings page slug
824 'main-section', // Section ID
825 array(
826 'parent_field_id' => $field_id, // Custom argument
827 'field_id' => $role_slug, // Custom argument
828 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
829 'field_label' => $role_label, // Custom argument
830 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
831 )
832 );
833
834 }
835 }
836
837 // Redirect After Logout
838
839 $field_id = 'redirect_after_logout';
840 $field_slug = 'redirect-after-logout';
841
842 add_settings_field(
843 $field_id, // Field ID
844 'Redirect After Logout', // Field title
845 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
846 ASENHA_SLUG, // Settings page slug
847 'main-section', // Section ID
848 array(
849 'field_id' => $field_id, // Custom argument
850 'field_slug' => $field_slug, // Custom argument
851 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
852 'field_description' => 'Set custom redirect URL for all or some user roles after logout.', // Custom argument
853 'field_options_wrapper' => true, // Custom argument. Add container for additional options
854 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
855 'class' => 'asenha-toggle login-logout ' . $field_slug, // Custom class for the <tr> element
856 )
857 );
858
859 $field_id = 'redirect_after_logout_to_slug';
860 $field_slug = 'redirect-after-logout-to-slug';
861
862 add_settings_field(
863 $field_id, // Field ID
864 'Redirect to:', // Field title
865 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
866 ASENHA_SLUG, // Settings page slug
867 'main-section', // Section ID
868 array(
869 'field_id' => $field_id, // Custom argument
870 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
871 'field_type' => 'with-prefix-suffix', // Custom argument
872 'field_prefix' => get_site_url() . '/', // Custom argument
873 'field_suffix' => '/ for:', // Custom argument
874 'field_description' => '', // Custom argument
875 'class' => 'asenha-text with-prefix-suffix login-logout ' . $field_slug, // Custom class for the <tr> element
876 )
877 );
878
879 $field_id = 'redirect_after_logout_for';
880 $field_slug = 'redirect-after-logout-for';
881
882 if ( is_array( $roles ) ) {
883 foreach ( $roles as $role_slug => $role_label ) { // e.g. $role_slug is administrator, $role_label is Administrator
884
885 add_settings_field(
886 $field_id . '_' . $role_slug, // Field ID
887 '', // Field title
888 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
889 ASENHA_SLUG, // Settings page slug
890 'main-section', // Section ID
891 array(
892 'parent_field_id' => $field_id, // Custom argument
893 'field_id' => $role_slug, // Custom argument
894 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $role_slug . ']', // Custom argument
895 'field_label' => $role_label, // Custom argument
896 'class' => 'asenha-checkbox asenha-hide-th asenha-half login-logout ' . $field_slug . ' ' . $role_slug, // Custom class for the <tr> element
897 )
898 );
899
900 }
901 }
902
903 // =================================================================
904 // CUSTOM CODE
905 // =================================================================
906
907 // Enable Custom Admin CSS
908
909 $field_id = 'enable_custom_admin_css';
910 $field_slug = 'enable-custom-admin-css';
911
912 add_settings_field(
913 $field_id, // Field ID
914 'Custom Admin CSS', // Field title
915 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
916 ASENHA_SLUG, // Settings page slug
917 'main-section', // Section ID
918 array(
919 'field_id' => $field_id, // Custom argument
920 'field_slug' => $field_slug, // Custom argument
921 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
922 'field_description' => 'Add custom CSS on all admin pages for all user roles.', // Custom argument
923 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
924 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
925 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
926 )
927 );
928
929 $field_id = 'custom_admin_css';
930 $field_slug = 'custom-admin-css';
931
932 add_settings_field(
933 $field_id, // Field ID
934 '', // Field title
935 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
936 ASENHA_SLUG, // Settings page slug
937 'main-section', // Section ID
938 array(
939 'field_id' => $field_id, // Custom argument
940 'field_slug' => $field_slug, // Custom argument
941 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
942 'field_type' => 'textarea', // Custom argument
943 'field_rows' => 30,
944 'field_intro' => '', // Custom argument
945 'field_description' => '', // Custom argument
946 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
947 )
948 );
949
950 // Enable Custom Frontend CSS
951
952 $field_id = 'enable_custom_frontend_css';
953 $field_slug = 'enable-custom-frontend-css';
954
955 add_settings_field(
956 $field_id, // Field ID
957 'Custom Frontend CSS', // Field title
958 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
959 ASENHA_SLUG, // Settings page slug
960 'main-section', // Section ID
961 array(
962 'field_id' => $field_id, // Custom argument
963 'field_slug' => $field_slug, // Custom argument
964 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
965 'field_description' => 'Add custom CSS on all frontend pages for all user roles.', // Custom argument
966 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
967 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
968 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
969 )
970 );
971
972 $field_id = 'custom_frontend_css';
973 $field_slug = 'custom-frontend-css';
974
975 add_settings_field(
976 $field_id, // Field ID
977 '', // Field title
978 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
979 ASENHA_SLUG, // Settings page slug
980 'main-section', // Section ID
981 array(
982 'field_id' => $field_id, // Custom argument
983 'field_slug' => $field_slug, // Custom argument
984 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
985 'field_type' => 'textarea', // Custom argument
986 'field_rows' => 30,
987 'field_intro' => '', // Custom argument
988 'field_description' => '', // Custom argument
989 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
990 )
991 );
992
993 // Custom Body Class
994
995 $field_id = 'enable_custom_body_class';
996 $field_slug = 'enable-custom-body-class';
997
998 add_settings_field(
999 $field_id, // Field ID
1000 'Custom Body Class', // Field title
1001 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1002 ASENHA_SLUG, // Settings page slug
1003 'main-section', // Section ID
1004 array(
1005 'field_id' => $field_id, // Custom argument
1006 'field_slug' => $field_slug, // Custom argument
1007 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1008 '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>.', // Custom argument
1009 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1010 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1011 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1012 )
1013 );
1014
1015 $field_id = 'enable_custom_body_class_for';
1016 $field_slug = 'enable-custom-body-class-for';
1017
1018 if ( is_array( $asenha_public_post_types ) ) {
1019 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1020 if ( 'attachment' != $post_type_slug ) {
1021 add_settings_field(
1022 $field_id . '_' . $post_type_slug, // Field ID
1023 '', // Field title
1024 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1025 ASENHA_SLUG, // Settings page slug
1026 'main-section', // Section ID
1027 array(
1028 'parent_field_id' => $field_id, // Custom argument
1029 'field_id' => $post_type_slug, // Custom argument
1030 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1031 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1032 'class' => 'asenha-checkbox asenha-hide-th asenha-half custom-code ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1033 )
1034 );
1035 }
1036 }
1037 }
1038
1039 // Manage ads.txt and app-ads.txt
1040
1041 $field_id = 'manage_ads_appads_txt';
1042 $field_slug = 'manage-ads-appads-txt';
1043
1044 add_settings_field(
1045 $field_id, // Field ID
1046 'Manage ads.txt and app-ads.txt', // Field title
1047 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1048 ASENHA_SLUG, // Settings page slug
1049 'main-section', // Section ID
1050 array(
1051 'field_id' => $field_id, // Custom argument
1052 'field_slug' => $field_slug, // Custom argument
1053 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1054 '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.', // Custom argument
1055 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1056 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1057 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1058 )
1059 );
1060
1061 $field_id = 'ads_txt_content';
1062 $field_slug = 'ads-txt-content';
1063
1064 add_settings_field(
1065 $field_id, // Field ID
1066 '', // Field title
1067 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1068 ASENHA_SLUG, // Settings page slug
1069 'main-section', // Section ID
1070 array(
1071 'field_id' => $field_id, // Custom argument
1072 'field_slug' => $field_slug, // Custom argument
1073 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1074 'field_type' => 'textarea', // Custom argument
1075 'field_rows' => 15,
1076 'field_intro' => '<strong>Your ads.txt content:</strong>', // Custom argument
1077 '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>', // Custom argument
1078 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1079 )
1080 );
1081
1082 $field_id = 'app_ads_txt_content';
1083 $field_slug = 'app-ads-txt-content';
1084
1085 add_settings_field(
1086 $field_id, // Field ID
1087 '', // Field title
1088 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1089 ASENHA_SLUG, // Settings page slug
1090 'main-section', // Section ID
1091 array(
1092 'field_id' => $field_id, // Custom argument
1093 'field_slug' => $field_slug, // Custom argument
1094 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1095 'field_type' => 'textarea', // Custom argument
1096 'field_rows' => 15,
1097 'field_intro' => '<strong>Your app-ads.txt content:</strong>', // Custom argument
1098 '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>', // Custom argument
1099 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1100 )
1101 );
1102
1103 // Manage robots.txt
1104
1105 $field_id = 'manage_robots_txt';
1106 $field_slug = 'manage-robots-txt';
1107
1108 add_settings_field(
1109 $field_id, // Field ID
1110 'Manage robots.txt', // Field title
1111 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1112 ASENHA_SLUG, // Settings page slug
1113 'main-section', // Section ID
1114 array(
1115 'field_id' => $field_id, // Custom argument
1116 'field_slug' => $field_slug, // Custom argument
1117 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1118 'field_description' => 'Easily edit and validate your <a href="/robots.txt" target="_blank">robots.txt</a> content.', // Custom argument
1119 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1120 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1121 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1122 )
1123 );
1124
1125 $field_id = 'robots_txt_content';
1126 $field_slug = 'robots-txt-content';
1127
1128 add_settings_field(
1129 $field_id, // Field ID
1130 '', // Field title
1131 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1132 ASENHA_SLUG, // Settings page slug
1133 'main-section', // Section ID
1134 array(
1135 'field_id' => $field_id, // Custom argument
1136 'field_slug' => $field_slug, // Custom argument
1137 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1138 'field_type' => 'textarea', // Custom argument
1139 'field_rows' => 20,
1140 'field_intro' => '', // Custom argument
1141 '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>', // Custom argument
1142 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1143 )
1144 );
1145
1146 // Insert <head>, <body> and <footer> code
1147
1148 $field_id = 'insert_head_body_footer_code';
1149 $field_slug = 'insert-head-body-footer-code';
1150
1151 add_settings_field(
1152 $field_id, // Field ID
1153 'Insert &lt;head&gt;, &lt;body&gt; and &lt;footer&gt; Code', // Field title
1154 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1155 ASENHA_SLUG, // Settings page slug
1156 'main-section', // Section ID
1157 array(
1158 'field_id' => $field_id, // Custom argument
1159 'field_slug' => $field_slug, // Custom argument
1160 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1161 '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.', // Custom argument
1162 'field_options_wrapper' => true, // Custom argument. Add container for additional options.
1163 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1164 'class' => 'asenha-toggle custom-code ' . $field_slug, // Custom class for the <tr> element
1165 )
1166 );
1167
1168 $field_id = 'head_code_priority';
1169 $field_slug = 'head-code-priority';
1170
1171 add_settings_field(
1172 $field_id, // Field ID
1173 '', // Field title
1174 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1175 ASENHA_SLUG, // Settings page slug
1176 'main-section', // Section ID
1177 array(
1178 'field_id' => $field_id, // Custom argument
1179 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1180 'field_type' => 'with-prefix-suffix', // Custom argument
1181 'field_prefix' => '<strong>Code to insert before &lt;/head&gt; with the priority of</strong>', // Custom argument
1182 'field_suffix' => '', // Custom argument
1183 'field_intro' => '', // Custom argument
1184 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/head&gt;', // Custom argument
1185 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1186 )
1187 );
1188
1189 $field_id = 'head_code';
1190 $field_slug = 'head-code';
1191
1192 add_settings_field(
1193 $field_id, // Field ID
1194 '', // Field title
1195 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1196 ASENHA_SLUG, // Settings page slug
1197 'main-section', // Section ID
1198 array(
1199 'field_id' => $field_id, // Custom argument
1200 'field_slug' => $field_slug, // Custom argument
1201 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1202 'field_type' => 'textarea', // Custom argument
1203 'field_rows' => 15,
1204 'field_intro' => '', // Custom argument
1205 'field_description' => '', // Custom argument
1206 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1207 )
1208 );
1209
1210 $field_id = 'body_code_priority';
1211 $field_slug = 'body-code-priority';
1212
1213 add_settings_field(
1214 $field_id, // Field ID
1215 '', // Field title
1216 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1217 ASENHA_SLUG, // Settings page slug
1218 'main-section', // Section ID
1219 array(
1220 'field_id' => $field_id, // Custom argument
1221 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1222 'field_type' => 'with-prefix-suffix', // Custom argument
1223 'field_prefix' => '<strong>Code to insert after &lt;body&gt; with the priority of</strong>', // Custom argument
1224 'field_suffix' => '', // Custom argument
1225 'field_intro' => '', // Custom argument
1226 'field_description' => 'Default is 10. Smaller number insert code closer to &lt;body&gt;', // Custom argument
1227 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1228 )
1229 );
1230
1231 $field_id = 'body_code';
1232 $field_slug = 'body-code';
1233
1234 add_settings_field(
1235 $field_id, // Field ID
1236 '', // Field title
1237 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1238 ASENHA_SLUG, // Settings page slug
1239 'main-section', // Section ID
1240 array(
1241 'field_id' => $field_id, // Custom argument
1242 'field_slug' => $field_slug, // Custom argument
1243 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1244 'field_type' => 'textarea', // Custom argument
1245 'field_rows' => 15,
1246 'field_intro' => '', // Custom argument
1247 'field_description' => '', // Custom argument
1248 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1249 )
1250 );
1251
1252 $field_id = 'footer_code_priority';
1253 $field_slug = 'footer-code-priority';
1254
1255 add_settings_field(
1256 $field_id, // Field ID
1257 '', // Field title
1258 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1259 ASENHA_SLUG, // Settings page slug
1260 'main-section', // Section ID
1261 array(
1262 'field_id' => $field_id, // Custom argument
1263 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1264 'field_type' => 'with-prefix-suffix', // Custom argument
1265 'field_prefix' => '<strong>Code to insert in footer section before &lt;/body&gt;: with the priority of</strong>', // Custom argument
1266 'field_suffix' => '', // Custom argument
1267 'field_intro' => '', // Custom argument
1268 'field_description' => 'Default is 10. Larger number insert code closer to &lt;/body&gt;', // Custom argument
1269 'class' => 'asenha-number asenha-hide-th narrow custom-code ' . $field_slug, // Custom class for the <tr> element
1270 )
1271 );
1272
1273 $field_id = 'footer_code';
1274 $field_slug = 'footer-code';
1275
1276 add_settings_field(
1277 $field_id, // Field ID
1278 '', // Field title
1279 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
1280 ASENHA_SLUG, // Settings page slug
1281 'main-section', // Section ID
1282 array(
1283 'field_id' => $field_id, // Custom argument
1284 'field_slug' => $field_slug, // Custom argument
1285 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1286 'field_type' => 'textarea', // Custom argument
1287 'field_rows' => 15,
1288 'field_intro' => '', // Custom argument
1289 'field_description' => '', // Custom argument
1290 'class' => 'asenha-textarea asenha-hide-th syntax-highlighted custom-code ' . $field_slug, // Custom class for the <tr> element
1291 )
1292 );
1293
1294 // =================================================================
1295 // DISABLE COMPONENTS
1296 // =================================================================
1297
1298 // Disable Gutenberg
1299
1300 $field_id = 'disable_gutenberg';
1301 $field_slug = 'disable-gutenberg';
1302
1303 add_settings_field(
1304 $field_id, // Field ID
1305 'Disable Gutenberg', // Field title
1306 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1307 ASENHA_SLUG, // Settings page slug
1308 'main-section', // Section ID
1309 array(
1310 'field_id' => $field_id, // Custom argument
1311 'field_slug' => $field_slug, // Custom argument
1312 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1313 'field_description' => 'Disable the Gutenberg block editor for some or all applicable post types.', // Custom argument
1314 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1315 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1316 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1317 )
1318 );
1319
1320 $field_id = 'disable_gutenberg_for';
1321 $field_slug = 'disable-gutenberg-for';
1322
1323 if ( is_array( $asenha_gutenberg_post_types ) ) {
1324 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1325 add_settings_field(
1326 $field_id . '_' . $post_type_slug, // Field ID
1327 '', // Field title
1328 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1329 ASENHA_SLUG, // Settings page slug
1330 'main-section', // Section ID
1331 array(
1332 'parent_field_id' => $field_id, // Custom argument
1333 'field_id' => $post_type_slug, // Custom argument
1334 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1335 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1336 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1337 )
1338 );
1339 }
1340 }
1341
1342 $field_id = 'disable_gutenberg_frontend_styles';
1343 $field_slug = 'disable-gutenberg-frontend-styles';
1344
1345 add_settings_field(
1346 $field_id, // Field ID
1347 '', // Field title
1348 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1349 ASENHA_SLUG, // Settings page slug
1350 'main-section', // Section ID
1351 array(
1352 'field_id' => $field_id, // Custom argument
1353 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1354 'field_label' => 'Also disable frontend block styles / CSS files for the selected post types.', // Custom argument
1355 'class' => 'asenha-checkbox asenha-hide-th asenha-th-border-top disable-components ' . $field_slug, // Custom class for the <tr> element
1356 )
1357 );
1358
1359 // Disable Comments
1360
1361 $field_id = 'disable_comments';
1362 $field_slug = 'disable-comments';
1363
1364 add_settings_field(
1365 $field_id, // Field ID
1366 'Disable Comments', // Field title
1367 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1368 ASENHA_SLUG, // Settings page slug
1369 'main-section', // Section ID
1370 array(
1371 'field_id' => $field_id, // Custom argument
1372 'field_slug' => $field_slug, // Custom argument
1373 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1374 'field_description' => 'Disable comments for some or all public post types. When disabled, existing comments will also be hidden on the frontend.', // Custom argument
1375 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1376 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1377 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1378 )
1379 );
1380
1381 $field_id = 'disable_comments_for';
1382 $field_slug = 'disable-comments-for';
1383
1384 if ( is_array( $asenha_public_post_types ) ) {
1385 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1386 add_settings_field(
1387 $field_id . '_' . $post_type_slug, // Field ID
1388 '', // Field title
1389 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1390 ASENHA_SLUG, // Settings page slug
1391 'main-section', // Section ID
1392 array(
1393 'parent_field_id' => $field_id, // Custom argument
1394 'field_id' => $post_type_slug, // Custom argument
1395 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1396 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1397 'class' => 'asenha-checkbox asenha-hide-th asenha-half disable-components ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1398 )
1399 );
1400 }
1401 }
1402
1403 // Disable REST API
1404
1405 $field_id = 'disable_rest_api';
1406 $field_slug = 'disable-rest-api';
1407
1408 add_settings_field(
1409 $field_id, // Field ID
1410 'Disable REST API', // Field title
1411 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1412 ASENHA_SLUG, // Settings page slug
1413 'main-section', // Section ID
1414 array(
1415 'field_id' => $field_id, // Custom argument
1416 'field_slug' => $field_slug, // Custom argument
1417 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1418 'field_description' => 'Disable REST API access for non-authenticated users and remove URL traces from &lt;head&gt;, HTTP headers and WP RSD endpoint.', // Custom argument
1419 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1420 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1421 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1422 )
1423 );
1424
1425 // Disable Feeds
1426
1427 $field_id = 'disable_feeds';
1428 $field_slug = 'disable-feeds';
1429
1430 add_settings_field(
1431 $field_id, // Field ID
1432 'Disable Feeds', // Field title
1433 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1434 ASENHA_SLUG, // Settings page slug
1435 'main-section', // Section ID
1436 array(
1437 'field_id' => $field_id, // Custom argument
1438 'field_slug' => $field_slug, // Custom argument
1439 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1440 '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;.', // Custom argument
1441 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1442 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1443 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1444 )
1445 );
1446
1447 // Disable Auto Updates
1448
1449 $field_id = 'disable_all_updates';
1450 $field_slug = 'disable-all-updates';
1451
1452 add_settings_field(
1453 $field_id, // Field ID
1454 'Disable All Updates', // Field title
1455 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1456 ASENHA_SLUG, // Settings page slug
1457 'main-section', // Section ID
1458 array(
1459 'field_id' => $field_id, // Custom argument
1460 'field_slug' => $field_slug, // Custom argument
1461 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1462 'field_description' => 'Completely disable core, theme and plugin updates and auto-updates. Will also disable update checks, notices and emails.', // Custom argument
1463 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1464 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1465 'class' => 'asenha-toggle disable-components ' . $field_slug, // Custom class for the <tr> element
1466 )
1467 );
1468
1469 // Disable Smaller Components
1470
1471 $field_id = 'disable_smaller_components';
1472 $field_slug = 'disable-smaller-components';
1473
1474 add_settings_field(
1475 $field_id, // Field ID
1476 'Disable Smaller Components', // Field title
1477 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1478 ASENHA_SLUG, // Settings page slug
1479 'main-section', // Section ID
1480 array(
1481 'field_id' => $field_id, // Custom argument
1482 'field_slug' => $field_slug, // Custom argument
1483 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1484 'field_description' => 'Prevent smaller components from running or loading. Make the site more secure and load slightly faster.', // Custom argument
1485 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1486 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1487 'class' => 'asenha-toggle admin-interface ' . $field_slug, // Custom class for the <tr> element
1488 )
1489 );
1490
1491 $field_id = 'disable_head_generator_tag';
1492 $field_slug = 'disable-head-generator-tag';
1493
1494 add_settings_field(
1495 $field_id, // Field ID
1496 '', // Field title
1497 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1498 ASENHA_SLUG, // Settings page slug
1499 'main-section', // Section ID
1500 array(
1501 'field_id' => $field_id, // Custom argument
1502 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1503 '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).', // Custom argument
1504 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1505 )
1506 );
1507
1508 $field_id = 'disable_head_wlwmanifest_tag';
1509 $field_slug = 'disable-head-wlwmanifest-tag';
1510
1511 add_settings_field(
1512 $field_id, // Field ID
1513 '', // Field title
1514 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1515 ASENHA_SLUG, // Settings page slug
1516 'main-section', // Section ID
1517 array(
1518 'field_id' => $field_id, // Custom argument
1519 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1520 '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.', // Custom argument
1521 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1522 )
1523 );
1524
1525 $field_id = 'disable_head_rsd_tag';
1526 $field_slug = 'disable-head-rsd-tag';
1527
1528 add_settings_field(
1529 $field_id, // Field ID
1530 '', // Field title
1531 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1532 ASENHA_SLUG, // Settings page slug
1533 'main-section', // Section ID
1534 array(
1535 'field_id' => $field_id, // Custom argument
1536 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1537 '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.', // Custom argument
1538 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1539 )
1540 );
1541
1542 $field_id = 'disable_head_shortlink_tag';
1543 $field_slug = 'disable-head-shortlink-tag';
1544
1545 add_settings_field(
1546 $field_id, // Field ID
1547 '', // Field title
1548 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1549 ASENHA_SLUG, // Settings page slug
1550 'main-section', // Section ID
1551 array(
1552 'field_id' => $field_id, // Custom argument
1553 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1554 '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.', // Custom argument
1555 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1556 )
1557 );
1558
1559 $field_id = 'disable_frontend_dashicons';
1560 $field_slug = 'disable-frontend-dashicons';
1561
1562 add_settings_field(
1563 $field_id, // Field ID
1564 '', // Field title
1565 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1566 ASENHA_SLUG, // Settings page slug
1567 'main-section', // Section ID
1568 array(
1569 'field_id' => $field_id, // Custom argument
1570 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1571 'field_label' => 'Disable loading of <strong>dashicons CSS and JS files</strong> on the front-end for public site visitors.', // Custom argument
1572 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1573 )
1574 );
1575
1576 $field_id = 'disable_emoji_support';
1577 $field_slug = 'disable-emoji-support';
1578
1579 add_settings_field(
1580 $field_id, // Field ID
1581 '', // Field title
1582 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
1583 ASENHA_SLUG, // Settings page slug
1584 'main-section', // Section ID
1585 array(
1586 'field_id' => $field_id, // Custom argument
1587 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1588 '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.', // Custom argument
1589 'class' => 'asenha-checkbox asenha-hide-th admin-interface ' . $field_slug, // Custom class for the <tr> element
1590 )
1591 );
1592
1593 // =================================================================
1594 // SECURITY
1595 // =================================================================
1596
1597 // Limit Login Attempts
1598
1599 $field_id = 'limit_login_attempts';
1600 $field_slug = 'limit-login-attempts';
1601
1602 add_settings_field(
1603 $field_id, // Field ID
1604 'Limit Login Attempts', // Field title
1605 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1606 ASENHA_SLUG, // Settings page slug
1607 'main-section', // Section ID
1608 array(
1609 'field_id' => $field_id, // Custom argument
1610 'field_slug' => $field_slug, // Custom argument
1611 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1612 'field_description' => 'Prevent brute force attacks by limiting the number of failed login attempts allowed per IP address.', // Custom argument
1613 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1614 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1615 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1616 )
1617 );
1618
1619 $field_id = 'login_fails_allowed';
1620 $field_slug = 'login-fails-allowed';
1621
1622 add_settings_field(
1623 $field_id, // Field ID
1624 '', // Field title
1625 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1626 ASENHA_SLUG, // Settings page slug
1627 'main-section', // Section ID
1628 array(
1629 'field_id' => $field_id, // Custom argument
1630 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1631 'field_type' => 'with-prefix-suffix', // Custom argument
1632 'field_prefix' => '', // Custom argument
1633 'field_suffix' => 'failed login attempts allowed before 15 minutes lockout', // Custom argument
1634 'field_description' => '', // Custom argument
1635 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1636 )
1637 );
1638
1639 $field_id = 'login_lockout_maxcount';
1640 $field_slug = 'login-lockout-maxcount';
1641
1642 add_settings_field(
1643 $field_id, // Field ID
1644 '', // Field title
1645 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
1646 ASENHA_SLUG, // Settings page slug
1647 'main-section', // Section ID
1648 array(
1649 'field_id' => $field_id, // Custom argument
1650 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1651 'field_type' => 'with-prefix-suffix', // Custom argument
1652 'field_prefix' => '', // Custom argument
1653 'field_suffix' => 'lockout(s) will block further login attempts for 24 hours', // Custom argument
1654 'field_description' => '', // Custom argument
1655 'class' => 'asenha-text with-prefix-suffix narrow no-margin security ' . $field_slug, // Custom class for the <tr> element
1656 )
1657 );
1658
1659 $field_id = 'login_attempts_log_table';
1660 $field_slug = 'login-attempts-log-table';
1661
1662 add_settings_field(
1663 $field_id, // Field ID
1664 '', // Field title
1665 [ $render_field, 'render_datatable' ], // Callback to render field with custom arguments in the array below
1666 ASENHA_SLUG, // Settings page slug
1667 'main-section', // Section ID
1668 array(
1669 'field_id' => $field_id, // Custom argument
1670 'field_slug' => $field_slug, // Custom argument
1671 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1672 'field_type' => 'datatable', // Custom argument
1673 'field_description' => '', // Custom argument
1674 'class' => 'asenha-text datatable asenha-hide-th security ' . $field_slug, // Custom class for the <tr> element
1675 'table_title' => 'Failed Login Attempts Log',
1676 'table_name' => $wpdb->prefix . 'asenha_failed_logins',
1677 )
1678 );
1679
1680 // Obfuscate Author Slugs
1681
1682 $field_id = 'obfuscate_author_slugs';
1683 $field_slug = 'obfuscate-author-slugs';
1684
1685 add_settings_field(
1686 $field_id, // Field ID
1687 'Obfuscate Author Slugs', // Field title
1688 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1689 ASENHA_SLUG, // Settings page slug
1690 'main-section', // Section ID
1691 array(
1692 'field_id' => $field_id, // Custom argument
1693 'field_slug' => $field_slug, // Custom argument
1694 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1695 '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.', // Custom argument
1696 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1697 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1698 )
1699 );
1700
1701 // Disable XML-RPC
1702
1703 $field_id = 'disable_xmlrpc';
1704 $field_slug = 'disable-xmlrpc';
1705
1706 add_settings_field(
1707 $field_id, // Field ID
1708 'Disable XML-RPC', // Field title
1709 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1710 ASENHA_SLUG, // Settings page slug
1711 'main-section', // Section ID
1712 array(
1713 'field_id' => $field_id, // Custom argument
1714 'field_slug' => $field_slug, // Custom argument
1715 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1716 '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. ', // Custom argument
1717 'field_options_wrapper' => false, // Custom argument. Add container for additional options
1718 'class' => 'asenha-toggle security ' . $field_slug, // Custom class for the <tr> element
1719 )
1720 );
1721
1722 // =================================================================
1723 // OPTIMIZATIONS
1724 // =================================================================
1725
1726 // Image Upload Control
1727
1728 $field_id = 'image_upload_control';
1729 $field_slug = 'image-upload-control';
1730
1731 add_settings_field(
1732 $field_id, // Field ID
1733 'Image Upload Control', // Field title
1734 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1735 ASENHA_SLUG, // Settings page slug
1736 'main-section', // Section ID
1737 array(
1738 'field_id' => $field_id, // Custom argument
1739 'field_slug' => $field_slug, // Custom argument
1740 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1741 '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.', // Custom argument
1742 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1743 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1744 'class' => 'asenha-toggle optimizations ' . $field_slug, // Custom class for the <tr> element
1745 )
1746 );
1747
1748 $field_id = 'image_max_width';
1749 $field_slug = 'image-max-width';
1750
1751 add_settings_field(
1752 $field_id, // Field ID
1753 '', // Field title
1754 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1755 ASENHA_SLUG, // Settings page slug
1756 'main-section', // Section ID
1757 array(
1758 'field_id' => $field_id, // Custom argument
1759 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1760 'field_type' => 'with-prefix-suffix', // Custom argument
1761 'field_prefix' => 'Max width:', // Custom argument
1762 'field_suffix' => 'pixels. <span class="faded">(Default is 1920 pixels)</span>', // Custom argument
1763 'field_intro' => '', // Custom argument
1764 'field_description' => '', // Custom argument
1765 'class' => 'asenha-number asenha-hide-th narrow optimizations ' . $field_slug, // Custom class for the <tr> element
1766 )
1767 );
1768
1769 $field_id = 'image_max_height';
1770 $field_slug = 'image-max-height';
1771
1772 add_settings_field(
1773 $field_id, // Field ID
1774 '', // Field title
1775 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1776 ASENHA_SLUG, // Settings page slug
1777 'main-section', // Section ID
1778 array(
1779 'field_id' => $field_id, // Custom argument
1780 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1781 'field_type' => 'with-prefix-suffix', // Custom argument
1782 'field_prefix' => 'Max height:', // Custom argument
1783 'field_suffix' => 'pixels <span class="faded">(Default is 1920 pixels)</span>', // Custom argument
1784 'field_intro' => '', // Custom argument
1785 'field_description' => 'To exclude an image from conversion and resizing, append \'-nr\' suffix to the file name, e.g. bird-photo-4k-nr.jpg', // Custom argument
1786 'class' => 'asenha-number asenha-hide-th narrow optimizations ' . $field_slug, // Custom class for the <tr> element
1787 )
1788 );
1789
1790 // Enable Revisions Control
1791
1792 $field_id = 'enable_revisions_control';
1793 $field_slug = 'enable-revisions-control';
1794
1795 add_settings_field(
1796 $field_id, // Field ID
1797 'Revisions Control', // Field title
1798 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1799 ASENHA_SLUG, // Settings page slug
1800 'main-section', // Section ID
1801 array(
1802 'field_id' => $field_id, // Custom argument
1803 'field_slug' => $field_slug, // Custom argument
1804 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1805 'field_description' => 'Prevent bloating the database by limiting the number of revisions to keep for some or all post types supporting revisions.', // Custom argument
1806 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1807 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1808 'class' => 'asenha-toggle optimizations ' . $field_slug, // Custom class for the <tr> element
1809 )
1810 );
1811
1812 $field_id = 'revisions_max_number';
1813 $field_slug = 'revisions-max-number';
1814
1815 add_settings_field(
1816 $field_id, // Field ID
1817 '', // Field title
1818 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
1819 ASENHA_SLUG, // Settings page slug
1820 'main-section', // Section ID
1821 array(
1822 'field_id' => $field_id, // Custom argument
1823 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1824 'field_type' => 'with-prefix-suffix', // Custom argument
1825 'field_prefix' => 'Limit to', // Custom argument
1826 'field_suffix' => 'revisions for:', // Custom argument
1827 'field_intro' => '', // Custom argument
1828 'field_description' => '', // Custom argument
1829 'class' => 'asenha-number asenha-hide-th extra-narrow optimizations ' . $field_slug, // Custom class for the <tr> element
1830 )
1831 );
1832
1833 $field_id = 'enable_revisions_control_for';
1834 $field_slug = 'enable-revisions-control-for';
1835
1836 if ( is_array( $asenha_revisions_post_types ) ) {
1837 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) { // e.g. $post_type_slug is post, $post_type_label is Posts
1838 add_settings_field(
1839 $field_id . '_' . $post_type_slug, // Field ID
1840 '', // Field title
1841 [ $render_field, 'render_checkbox_subfield' ], // Callback to render field with custom arguments in the array below
1842 ASENHA_SLUG, // Settings page slug
1843 'main-section', // Section ID
1844 array(
1845 'parent_field_id' => $field_id, // Custom argument
1846 'field_id' => $post_type_slug, // Custom argument
1847 'field_name' => ASENHA_SLUG_U . '['. $field_id .'][' . $post_type_slug . ']', // Custom argument
1848 'field_label' => $post_type_label . ' <span class="faded">('. $post_type_slug .')</span>', // Custom argument
1849 'class' => 'asenha-checkbox asenha-hide-th asenha-half optimizations ' . $field_slug . ' ' . $post_type_slug, // Custom class for the <tr> element
1850 )
1851 );
1852 }
1853 }
1854
1855 // Enable Heartbeat Control
1856
1857 $field_id = 'enable_heartbeat_control';
1858 $field_slug = 'enable-heartbeat-control';
1859
1860 add_settings_field(
1861 $field_id, // Field ID
1862 'Heartbeat Control', // Field title
1863 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
1864 ASENHA_SLUG, // Settings page slug
1865 'main-section', // Section ID
1866 array(
1867 'field_id' => $field_id, // Custom argument
1868 'field_slug' => $field_slug, // Custom argument
1869 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1870 '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.', // Custom argument
1871 'field_options_wrapper' => true, // Custom argument. Add container for additional options
1872 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
1873 'class' => 'asenha-toggle optimizations ' . $field_slug, // Custom class for the <tr> element
1874 )
1875 );
1876
1877 $field_id = 'heartbeat_control_for_admin_pages';
1878 $field_slug = 'heartbeat-control-for-admin-pages';
1879
1880 add_settings_field(
1881 $field_id, // Field ID
1882 'On admin pages', // Field title
1883 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1884 ASENHA_SLUG, // Settings page slug
1885 'main-section', // Section ID
1886 array(
1887 'field_id' => $field_id, // Custom argument
1888 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1889 // 'field_label' => 'Temporary label', // Custom argument
1890 'field_radios' => array(
1891 'Keep as is' => 'default',
1892 'Modify' => 'modify',
1893 'Disable' => 'disable',
1894 ),
1895 'field_default' => 'default',
1896 'class' => 'asenha-radio-buttons optimizations ' . $field_slug, // Custom class for the <tr> element
1897 ),
1898 );
1899
1900 $field_id = 'heartbeat_interval_for_admin_pages';
1901 $field_slug = 'heartbeat-interval-for-admin-pages';
1902
1903 add_settings_field(
1904 $field_id, // Field ID
1905 '', // Field title
1906 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
1907 ASENHA_SLUG, // Settings page slug
1908 'main-section', // Section ID
1909 array(
1910 'field_id' => $field_id, // Custom argument
1911 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1912 'field_type' => 'with-prefix-suffix', // Custom argument
1913 'field_prefix' => 'Set interval to once every', // Custom argument
1914 'field_suffix' => '<span class="faded">(Default is 1 minute)</span>', // Custom argument
1915 'field_select_options' => array(
1916 '15 seconds' => 15,
1917 '30 seconds' => 30,
1918 '1 minute' => 60,
1919 '2 minutes' => 120,
1920 '3 minutes' => 180,
1921 '5 minutes' => 300,
1922 '10 minutes' => 600,
1923 ),
1924 'field_select_default' => 60,
1925 'field_intro' => '', // Custom argument
1926 'field_description' => '', // Custom argument
1927 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
1928 'display_none_on_load' => true,
1929 )
1930 );
1931
1932 $field_id = 'heartbeat_control_for_post_edit';
1933 $field_slug = 'heartbeat-control-for-post-edit';
1934
1935 add_settings_field(
1936 $field_id, // Field ID
1937 'On post creation and edit screens', // Field title
1938 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1939 ASENHA_SLUG, // Settings page slug
1940 'main-section', // Section ID
1941 array(
1942 'field_id' => $field_id, // Custom argument
1943 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1944 // 'field_label' => 'Temporary label', // Custom argument
1945 'field_radios' => array(
1946 'Keep as is' => 'default',
1947 'Modify' => 'modify',
1948 'Disable' => 'disable',
1949 ),
1950 'field_default' => 'default',
1951 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug, // Custom class for the <tr> element
1952 ),
1953 );
1954
1955 $field_id = 'heartbeat_interval_for_post_edit';
1956 $field_slug = 'heartbeat-interval-for-post-edit';
1957
1958 add_settings_field(
1959 $field_id, // Field ID
1960 '', // Field title
1961 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
1962 ASENHA_SLUG, // Settings page slug
1963 'main-section', // Section ID
1964 array(
1965 'field_id' => $field_id, // Custom argument
1966 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
1967 'field_type' => 'with-prefix-suffix', // Custom argument
1968 'field_prefix' => 'Set interval to once every', // Custom argument
1969 'field_suffix' => '<span class="faded">(Default is 15 seconds)</span>', // Custom argument
1970 'field_select_options' => array(
1971 '15 seconds' => 15,
1972 '30 seconds' => 30,
1973 '45 seconds' => 45,
1974 '60 seconds' => 60,
1975 '90 seconds' => 90,
1976 '120 seconds' => 120
1977 ),
1978 'field_select_default' => 15,
1979 'field_intro' => '', // Custom argument
1980 'field_description' => '', // Custom argument
1981 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
1982 'display_none_on_load' => true,
1983 )
1984 );
1985
1986 $field_id = 'heartbeat_control_for_frontend';
1987 $field_slug = 'heartbeat-control-for-frontend';
1988
1989 add_settings_field(
1990 $field_id, // Field ID
1991 'On the frontend', // Field title
1992 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
1993 ASENHA_SLUG, // Settings page slug
1994 'main-section', // Section ID
1995 array(
1996 'field_id' => $field_id, // Custom argument
1997 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
1998 // 'field_label' => 'Temporary label', // Custom argument
1999 'field_radios' => array(
2000 'Keep as is' => 'default',
2001 'Modify' => 'modify',
2002 'Disable' => 'disable',
2003 ),
2004 'field_default' => 'default',
2005 'class' => 'asenha-radio-buttons optimizations top-border ' . $field_slug, // Custom class for the <tr> element
2006 ),
2007 );
2008
2009 $field_id = 'heartbeat_interval_for_frontend';
2010 $field_slug = 'heartbeat-interval-for-frontend';
2011
2012 add_settings_field(
2013 $field_id, // Field ID
2014 '', // Field title
2015 [ $render_field, 'render_select_subfield' ], // Callback to render field with custom arguments in the array below
2016 ASENHA_SLUG, // Settings page slug
2017 'main-section', // Section ID
2018 array(
2019 'field_id' => $field_id, // Custom argument
2020 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2021 'field_type' => 'with-prefix-suffix', // Custom argument
2022 'field_prefix' => 'Set interval to once every', // Custom argument
2023 'field_suffix' => '', // Custom argument
2024 'field_select_options' => array(
2025 '15 seconds' => 15,
2026 '30 seconds' => 30,
2027 '1 minute' => 60,
2028 '2 minutes' => 120,
2029 '3 minutes' => 180,
2030 '5 minutes' => 300,
2031 '10 minutes' => 600,
2032 ),
2033 'field_select_default' => 60,
2034 'field_intro' => '', // Custom argument
2035 'field_description' => '', // Custom argument
2036 'class' => 'asenha-number asenha-hide-th extra-narrow shift-up optimizations ' . $field_slug, // Custom class for the <tr> element
2037 'display_none_on_load' => true,
2038 )
2039 );
2040
2041 // =================================================================
2042 // UTILITIES
2043 // =================================================================
2044
2045 // SMTP Email Delivery
2046
2047 $field_id = 'smtp_email_delivery';
2048 $field_slug = 'smtp-email-delivery';
2049
2050 add_settings_field(
2051 $field_id, // Field ID
2052 'SMTP Email Delivery', // Field title
2053 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
2054 ASENHA_SLUG, // Settings page slug
2055 'main-section', // Section ID
2056 array(
2057 'field_id' => $field_id, // Custom argument
2058 'field_slug' => $field_slug, // Custom argument
2059 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2060 'field_description' => 'Use external SMTP service to ensure notification and transactional emails from your site are being delivered to inboxes.', // Custom argument
2061 'field_options_wrapper' => true, // Custom argument. Add container for additional options
2062 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
2063 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
2064 )
2065 );
2066
2067 $field_id = 'smtp_host';
2068 $field_slug = 'smtp-host';
2069
2070 add_settings_field(
2071 $field_id, // Field ID
2072 '<span class="field-sublabel sublabel-wide">Host</span>', // Field title
2073 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
2074 ASENHA_SLUG, // Settings page slug
2075 'main-section', // Section ID
2076 array(
2077 'field_id' => $field_id, // Custom argument
2078 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2079 'field_type' => '', // Custom argument
2080 'field_prefix' => '', // Custom argument
2081 'field_suffix' => '', // Custom argument
2082 'field_description' => '', // Custom argument
2083 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug, // Custom class for the <tr> element
2084 )
2085 );
2086
2087 $field_id = 'smtp_port';
2088 $field_slug = 'smtp-port';
2089
2090 add_settings_field(
2091 $field_id, // Field ID
2092 '<span class="field-sublabel sublabel-wide">Port</span>', // Field title
2093 [ $render_field, 'render_number_subfield' ], // Callback to render field with custom arguments in the array below
2094 ASENHA_SLUG, // Settings page slug
2095 'main-section', // Section ID
2096 array(
2097 'field_id' => $field_id, // Custom argument
2098 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2099 'field_type' => '', // Custom argument
2100 'field_prefix' => '', // Custom argument
2101 'field_suffix' => '', // Custom argument
2102 'field_intro' => '', // Custom argument
2103 'field_description' => '', // Custom argument
2104 'class' => 'asenha-text with-prefix-suffix narrow utilities ' . $field_slug, // Custom class for the <tr> element
2105 )
2106 );
2107
2108 $field_id = 'smtp_security';
2109 $field_slug = 'smtp-security';
2110
2111 add_settings_field(
2112 $field_id, // Field ID
2113 '<span class="field-sublabel sublabel-wide">Security</span>', // Field title
2114 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
2115 ASENHA_SLUG, // Settings page slug
2116 'main-section', // Section ID
2117 array(
2118 'field_id' => $field_id, // Custom argument
2119 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
2120 // 'field_label' => 'Temporary label', // Custom argument
2121 'field_radios' => array(
2122 'None' => 'none',
2123 'SSL' => 'ssl',
2124 'TLS' => 'tls',
2125 ),
2126 'field_default' => 'default',
2127 'class' => 'asenha-radio-buttons with-prefix-suffix utilities ' . $field_slug, // Custom class for the <tr> element
2128 ),
2129 );
2130
2131 $field_id = 'smtp_username';
2132 $field_slug = 'smtp-username';
2133
2134 add_settings_field(
2135 $field_id, // Field ID
2136 '<span class="field-sublabel sublabel-wide">Username</span>', // Field title
2137 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
2138 ASENHA_SLUG, // Settings page slug
2139 'main-section', // Section ID
2140 array(
2141 'field_id' => $field_id, // Custom argument
2142 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2143 'field_type' => '', // Custom argument
2144 'field_prefix' => '', // Custom argument
2145 'field_suffix' => '', // Custom argument
2146 'field_description' => '', // Custom argument
2147 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug, // Custom class for the <tr> element
2148 )
2149 );
2150
2151 $field_id = 'smtp_password';
2152 $field_slug = 'smtp-password';
2153
2154 add_settings_field(
2155 $field_id, // Field ID
2156 '<span class="field-sublabel sublabel-wide">Password</span>', // Field title
2157 [ $render_field, 'render_password_subfield' ], // Callback to render field with custom arguments in the array below
2158 ASENHA_SLUG, // Settings page slug
2159 'main-section', // Section ID
2160 array(
2161 'field_id' => $field_id, // Custom argument
2162 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2163 'field_type' => '', // Custom argument
2164 'field_prefix' => '', // Custom argument
2165 'field_suffix' => '', // Custom argument
2166 'field_description' => '', // Custom argument
2167 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug, // Custom class for the <tr> element
2168 )
2169 );
2170
2171 $field_id = 'smtp_default_from_name';
2172 $field_slug = 'smtp-default-from-name';
2173
2174 add_settings_field(
2175 $field_id, // Field ID
2176 '<span class="field-sublabel sublabel-wide">FROM name</span>', // Field title
2177 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
2178 ASENHA_SLUG, // Settings page slug
2179 'main-section', // Section ID
2180 array(
2181 'field_id' => $field_id, // Custom argument
2182 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2183 'field_type' => '', // Custom argument
2184 'field_prefix' => '', // Custom argument
2185 'field_suffix' => '', // Custom argument
2186 'field_description' => '', // Custom argument
2187 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug, // Custom class for the <tr> element
2188 )
2189 );
2190
2191 $field_id = 'smtp_default_from_email';
2192 $field_slug = 'smtp-default-from-email';
2193
2194 add_settings_field(
2195 $field_id, // Field ID
2196 '<span class="field-sublabel sublabel-wide">FROM email</span>', // Field title
2197 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
2198 ASENHA_SLUG, // Settings page slug
2199 'main-section', // Section ID
2200 array(
2201 'field_id' => $field_id, // Custom argument
2202 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2203 'field_type' => '', // Custom argument
2204 'field_prefix' => '', // Custom argument
2205 'field_suffix' => '', // Custom argument
2206 'field_description' => '', // Custom argument
2207 'class' => 'asenha-text with-prefix-suffix wide utilities ' . $field_slug, // Custom class for the <tr> element
2208 )
2209 );
2210
2211 $field_id = 'smtp_default_from_description';
2212 $field_slug = 'smtp-default-from-description';
2213
2214 add_settings_field(
2215 $field_id, // Field ID
2216 '', // Field title
2217 [ $render_field, 'render_description_subfield' ], // Callback to render field with custom arguments in the array below
2218 ASENHA_SLUG, // Settings page slug
2219 'main-section', // Section ID
2220 array(
2221 'field_description' => 'If set, the FROM name/email overrides WordPress core defaults but can still be overridden by plugins that enables custom FROM name/email, e.g. form plugins.', // Custom argument
2222 'class' => 'asenha-description utilities ' . $field_slug, // Custom class for the <tr> element
2223 )
2224 );
2225
2226 $field_id = 'smtp_debug';
2227 $field_slug = 'smtp-debug';
2228
2229 add_settings_field(
2230 $field_id, // Field ID
2231 '', // Field title
2232 [ $render_field, 'render_checkbox_plain' ], // Callback to render field with custom arguments in the array below
2233 ASENHA_SLUG, // Settings page slug
2234 'main-section', // Section ID
2235 array(
2236 'field_id' => $field_id, // Custom argument
2237 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
2238 'field_label' => 'Enable debug mode and output the debug info into WordPress debug.log file.', // Custom argument
2239 'class' => 'asenha-checkbox asenha-hide-th top-border utilities ' . $field_slug, // Custom class for the <tr> element
2240 )
2241 );
2242
2243 // View Admin as Role
2244
2245 $field_id = 'view_admin_as_role';
2246 $field_slug = 'view-admin-as-role';
2247
2248 add_settings_field(
2249 $field_id, // Field ID
2250 'View Admin as Role', // Field title
2251 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
2252 ASENHA_SLUG, // Settings page slug
2253 'main-section', // Section ID
2254 array(
2255 'field_id' => $field_id, // Custom argument
2256 'field_slug' => $field_slug, // Custom argument
2257 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2258 'field_description' => 'View admin pages and the site (logged-in) as one of the non-administrator user roles.', // Custom argument
2259 'field_options_wrapper' => true, // Custom argument. Add container for additional options
2260 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
2261 )
2262 );
2263
2264 // Enable Password Protection
2265
2266 $field_id = 'enable_password_protection';
2267 $field_slug = 'enable-password-protection';
2268
2269 add_settings_field(
2270 $field_id, // Field ID
2271 'Password Protection', // Field title
2272 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
2273 ASENHA_SLUG, // Settings page slug
2274 'main-section', // Section ID
2275 array(
2276 'field_id' => $field_id, // Custom argument
2277 'field_slug' => $field_slug, // Custom argument
2278 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2279 '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.', // Custom argument
2280 'field_options_wrapper' => true, // Custom argument. Add container for additional options
2281 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
2282 )
2283 );
2284
2285 $field_id = 'password_protection_password';
2286 $field_slug = 'password-protection-password';
2287
2288 add_settings_field(
2289 $field_id, // Field ID
2290 'Set the password:', // Field title
2291 [ $render_field, 'render_password_subfield' ], // Callback to render field with custom arguments in the array below
2292 ASENHA_SLUG, // Settings page slug
2293 'main-section', // Section ID
2294 array(
2295 'field_id' => $field_id, // Custom argument
2296 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2297 'field_type' => 'with-prefix-suffix', // Custom argument
2298 'field_prefix' => '', // Custom argument
2299 'field_suffix' => '<span class="faded">(Default is \'secret\')</span>', // Custom argument
2300 'field_description' => '', // Custom argument
2301 'class' => 'asenha-text with-prefix-suffix utilities ' . $field_slug, // Custom class for the <tr> element
2302 )
2303 );
2304
2305 // Maintenance Mode
2306
2307 $field_id = 'maintenance_mode';
2308 $field_slug = 'maintenance-mode';
2309
2310 add_settings_field(
2311 $field_id, // Field ID
2312 'Maintenance Mode', // Field title
2313 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
2314 ASENHA_SLUG, // Settings page slug
2315 'main-section', // Section ID
2316 array(
2317 'field_id' => $field_id, // Custom argument
2318 'field_slug' => $field_slug, // Custom argument
2319 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2320 '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.', // Custom argument
2321 'field_options_wrapper' => true, // Custom argument. Add container for additional options
2322 'field_options_moreless' => true, // Custom argument. Add show more/less toggler.
2323 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
2324 )
2325 );
2326
2327 $field_id = 'maintenance_page_heading';
2328 $field_slug = 'maintenance-page-heading';
2329
2330 add_settings_field(
2331 $field_id, // Field ID
2332 'Heading', // Field title
2333 [ $render_field, 'render_text_subfield' ], // Callback to render field with custom arguments in the array below
2334 ASENHA_SLUG, // Settings page slug
2335 'main-section', // Section ID
2336 array(
2337 'field_id' => $field_id, // Custom argument
2338 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2339 'field_type' => '', // Custom argument
2340 'field_prefix' => '', // Custom argument
2341 'field_suffix' => '', // Custom argument
2342 'field_description' => '', // Custom argument
2343 'field_placeholder' => 'We\'ll be back soon.',
2344 'class' => 'asenha-text utilities full-width ' . $field_slug, // Custom class for the <tr> element
2345 )
2346 );
2347
2348 $field_id = 'maintenance_page_description';
2349 $field_slug = 'maintenance-page-description';
2350
2351 add_settings_field(
2352 $field_id, // Field ID
2353 'Description', // Field title
2354 [ $render_field, 'render_textarea_subfield' ], // Callback to render field with custom arguments in the array below
2355 ASENHA_SLUG, // Settings page slug
2356 'main-section', // Section ID
2357 array(
2358 'field_id' => $field_id, // Custom argument
2359 'field_slug' => $field_slug, // Custom argument
2360 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2361 'field_type' => 'textarea', // Custom argument
2362 'field_rows' => 5,
2363 'field_intro' => '', // Custom argument
2364 'field_description' => '', // Custom argument
2365 'field_placeholder' => 'This site is undergoing maintenance for an extended period today. Thanks for your patience.',
2366 'class' => 'asenha-textarea utilities ' . $field_slug, // Custom class for the <tr> element
2367 )
2368 );
2369
2370 $field_id = 'maintenance_page_background';
2371 $field_slug = 'maintenance-page-background';
2372
2373 add_settings_field(
2374 $field_id, // Field ID
2375 'Background', // Field title
2376 [ $render_field, 'render_radio_buttons_subfield' ], // Callback to render field with custom arguments in the array below
2377 ASENHA_SLUG, // Settings page slug
2378 'main-section', // Section ID
2379 array(
2380 'field_id' => $field_id, // Custom argument
2381 'field_name' => ASENHA_SLUG_U . '[' . $field_id . ']', // Custom argument
2382 // 'field_label' => 'Temporary label', // Custom argument
2383 'field_radios' => array(
2384 'Stripes' => 'stripes',
2385 'Curves' => 'curves',
2386 'Lines' => 'lines',
2387 ),
2388 'field_default' => 'default',
2389 'class' => 'asenha-radio-buttons utilities ' . $field_slug, // Custom class for the <tr> element
2390 ),
2391 );
2392
2393 $field_id = 'maintenance_mode_description';
2394 $field_slug = 'maintenance-mode-description';
2395
2396 add_settings_field(
2397 $field_id, // Field ID
2398 '', // Field title
2399 [ $render_field, 'render_description_subfield' ], // Callback to render field with custom arguments in the array below
2400 ASENHA_SLUG, // Settings page slug
2401 'main-section', // Section ID
2402 array(
2403 '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>', // Custom argument
2404 'class' => 'asenha-description utilities ' . $field_slug, // Custom class for the <tr> element
2405 )
2406 );
2407
2408 // Redirect 404 to Homepage
2409
2410 $field_id = 'redirect_404_to_homepage';
2411 $field_slug = 'redirect-404-to-homepage';
2412
2413 add_settings_field(
2414 $field_id, // Field ID
2415 'Redirect 404 to Homepage', // Field title
2416 [ $render_field, 'render_checkbox_toggle' ], // Callback to render field with custom arguments in the array below
2417 ASENHA_SLUG, // Settings page slug
2418 'main-section', // Section ID
2419 array(
2420 'field_id' => $field_id, // Custom argument
2421 'field_slug' => $field_slug, // Custom argument
2422 'field_name' => ASENHA_SLUG_U . '['. $field_id .']', // Custom argument
2423 'field_description' => 'Perform 301 (permanent) redirect to the homepage for all 404 (not found) pages.', // Custom argument
2424 'field_options_wrapper' => true, // Custom argument. Add container for additional options
2425 'class' => 'asenha-toggle utilities ' . $field_slug, // Custom class for the <tr> element
2426 )
2427 );
2428
2429 }
2430
2431 }