PluginProbe ʕ •ᴥ•ʔ
Admin and Site Enhancements (ASE) / 7.3.3
Admin and Site Enhancements (ASE) v7.3.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-sanitization.php
admin-site-enhancements / classes Last commit date
class-activation.php 2 years ago class-admin-columns-manager.php 2 years ago class-admin-menu-organizer.php 2 years ago class-auto-publish-posts-with-missed-schedule.php 2 years ago class-avif-upload.php 2 years ago class-change-login-url.php 2 years ago class-cleanup-admin-bar.php 2 years ago class-code-snippets-manager.php 2 years ago class-common-methods.php 2 years ago class-content-duplication.php 2 years ago class-content-order.php 2 years ago class-custom-admin-footer-text.php 2 years ago class-custom-body-class.php 2 years ago class-custom-content-types.php 2 years ago class-custom-css.php 2 years ago class-custom-nav-menu-items-in-new-tab.php 2 years ago class-deactivation.php 2 years ago class-disable-comments.php 2 years ago class-disable-dashboard-widgets.php 2 years ago class-disable-feeds.php 2 years ago class-disable-gutenberg.php 2 years ago class-disable-rest-api.php 2 years ago class-disable-smaller-components.php 2 years ago class-disable-updates.php 2 years ago class-disable-xml-rpc.php 2 years ago class-display-system-summary.php 2 years ago class-email-address-obfuscator.php 2 years ago class-email-delivery.php 2 years ago class-enhance-list-tables.php 2 years ago class-external-permalinks.php 2 years ago class-heartbeat-control.php 2 years ago class-hide-admin-bar.php 2 years ago class-hide-admin-notices.php 2 years ago class-image-sizes-panel.php 2 years ago class-image-upload-control.php 2 years ago class-insert-head-body-footer-code.php 2 years ago class-last-login-column.php 2 years ago class-limit-login-attempts.php 2 years ago class-login-id-type.php 2 years ago class-login-logout-menu.php 2 years ago class-maintenance-mode.php 2 years ago class-manage-ads-appads-txt.php 2 years ago class-manage-robots-txt.php 2 years ago class-media-replacement.php 2 years ago class-multiple-user-roles.php 2 years ago class-obfuscate-author-slugs.php 2 years ago class-open-external-links-in-new-tab.php 2 years ago class-password-protection.php 2 years ago class-redirect-after-login.php 2 years ago class-redirect-after-logout.php 2 years ago class-redirect-fourofour.php 2 years ago class-revisions-control.php 2 years ago class-search-engines-visibility.php 2 years ago class-settings-fields-render.php 2 years ago class-settings-sanitization.php 2 years ago class-settings-sections-fields.php 2 years ago class-show-custom-taxonomy-filters.php 2 years ago class-site-identity-on-login-page.php 2 years ago class-svg-upload.php 2 years ago class-various-admin-ui-enhancements.php 2 years ago class-view-admin-as-role.php 2 years ago class-wider-admin-menu.php 2 years ago
class-settings-sanitization.php
790 lines
1 <?php
2
3 namespace ASENHA\Classes;
4
5 /**
6 * Class related to sanitization of settings fields for saving as options
7 *
8 * @since 2.2.0
9 */
10 class Settings_Sanitization {
11 /**
12 * Sanitize options
13 *
14 * @since 1.0.0
15 */
16 function sanitize_for_options( $options ) {
17 // Call WordPress globals required for validating the fields
18 global
19 $wp_roles,
20 $asenha_all_post_types,
21 $asenha_public_post_types,
22 $asenha_nonpublic_post_types,
23 $asenha_gutenberg_post_types,
24 $asenha_revisions_post_types,
25 $active_plugin_slugs
26 ;
27 $roles = $wp_roles->get_names();
28 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
29 if ( false === $options_extra ) {
30 add_option( ASENHA_SLUG_U . '_extra', array(), true );
31 }
32 // Content Duplication
33 if ( !isset( $options['enable_duplication'] ) ) {
34 $options['enable_duplication'] = false;
35 }
36 $options['enable_duplication'] = ( 'on' == $options['enable_duplication'] ? true : false );
37 if ( !isset( $options['duplication_redirect_destination'] ) ) {
38 $options['duplication_redirect_destination'] = 'edit';
39 }
40 // Content Order
41 if ( !isset( $options['content_order'] ) ) {
42 $options['content_order'] = false;
43 }
44 $options['content_order'] = ( 'on' == $options['content_order'] ? true : false );
45 if ( is_array( $asenha_all_post_types ) ) {
46 foreach ( $asenha_all_post_types as $post_type_slug => $post_type_label ) {
47 // e.g. $post_type_slug is post, $post_type_label is Posts
48 if ( post_type_supports( $post_type_slug, 'page-attributes' ) || is_post_type_hierarchical( $post_type_slug ) ) {
49 if ( !isset( $options['content_order_for'][$post_type_slug] ) ) {
50 $options['content_order_for'][$post_type_slug] = false;
51 }
52 $options['content_order_for'][$post_type_slug] = ( 'on' == $options['content_order_for'][$post_type_slug] ? true : false );
53 }
54 }
55 }
56 // Enable Media Replacement
57 if ( !isset( $options['enable_media_replacement'] ) ) {
58 $options['enable_media_replacement'] = false;
59 }
60 $options['enable_media_replacement'] = ( 'on' == $options['enable_media_replacement'] ? true : false );
61 // Enable SVG Upload
62 if ( !isset( $options['enable_svg_upload'] ) ) {
63 $options['enable_svg_upload'] = false;
64 }
65 $options['enable_svg_upload'] = ( 'on' == $options['enable_svg_upload'] ? true : false );
66 if ( is_array( $roles ) ) {
67 foreach ( $roles as $role_slug => $role_label ) {
68 // e.g. $role_slug is administrator, $role_label is Administrator
69 if ( !isset( $options['enable_svg_upload_for'][$role_slug] ) ) {
70 $options['enable_svg_upload_for'][$role_slug] = false;
71 }
72 $options['enable_svg_upload_for'][$role_slug] = ( 'on' == $options['enable_svg_upload_for'][$role_slug] ? true : false );
73 }
74 }
75 // Enable SVG Upload
76 if ( !isset( $options['enable_avif_upload'] ) ) {
77 $options['enable_avif_upload'] = false;
78 }
79 $options['enable_avif_upload'] = ( 'on' == $options['enable_avif_upload'] ? true : false );
80 // Enable External Permalinks
81 if ( !isset( $options['enable_external_permalinks'] ) ) {
82 $options['enable_external_permalinks'] = false;
83 }
84 $options['enable_external_permalinks'] = ( 'on' == $options['enable_external_permalinks'] ? true : false );
85 if ( is_array( $asenha_public_post_types ) ) {
86 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
87 // e.g. $post_type_slug is post, $post_type_label is Posts
88 if ( !isset( $options['enable_external_permalinks_for'][$post_type_slug] ) ) {
89 $options['enable_external_permalinks_for'][$post_type_slug] = false;
90 }
91 $options['enable_external_permalinks_for'][$post_type_slug] = ( 'on' == $options['enable_external_permalinks_for'][$post_type_slug] ? true : false );
92 }
93 }
94 // Open All External Links in New Tab
95 if ( !isset( $options['external_links_new_tab'] ) ) {
96 $options['external_links_new_tab'] = false;
97 }
98 $options['external_links_new_tab'] = ( 'on' == $options['external_links_new_tab'] ? true : false );
99 // Allow Custom Nav Menu Items to Open in New Tab
100 if ( !isset( $options['custom_nav_menu_items_new_tab'] ) ) {
101 $options['custom_nav_menu_items_new_tab'] = false;
102 }
103 $options['custom_nav_menu_items_new_tab'] = ( 'on' == $options['custom_nav_menu_items_new_tab'] ? true : false );
104 // Enable Auto-Publishing of Posts with Missed Schedules
105 if ( !isset( $options['enable_missed_schedule_posts_auto_publish'] ) ) {
106 $options['enable_missed_schedule_posts_auto_publish'] = false;
107 }
108 $options['enable_missed_schedule_posts_auto_publish'] = ( 'on' == $options['enable_missed_schedule_posts_auto_publish'] ? true : false );
109 // =================================================================
110 // ADMIN INTERFACE
111 // =================================================================
112 // Hide or Modify Elements / Clean Up Admin Bar
113 if ( !isset( $options['hide_modify_elements'] ) ) {
114 $options['hide_modify_elements'] = false;
115 }
116 $options['hide_modify_elements'] = ( 'on' == $options['hide_modify_elements'] ? true : false );
117 if ( !isset( $options['hide_ab_wp_logo_menu'] ) ) {
118 $options['hide_ab_wp_logo_menu'] = false;
119 }
120 $options['hide_ab_wp_logo_menu'] = ( 'on' == $options['hide_ab_wp_logo_menu'] ? true : false );
121 if ( !isset( $options['hide_ab_customize_menu'] ) ) {
122 $options['hide_ab_customize_menu'] = false;
123 }
124 $options['hide_ab_customize_menu'] = ( 'on' == $options['hide_ab_customize_menu'] ? true : false );
125 if ( !isset( $options['hide_ab_comments_menu'] ) ) {
126 $options['hide_ab_comments_menu'] = false;
127 }
128 $options['hide_ab_comments_menu'] = ( 'on' == $options['hide_ab_comments_menu'] ? true : false );
129 if ( !isset( $options['hide_ab_updates_menu'] ) ) {
130 $options['hide_ab_updates_menu'] = false;
131 }
132 $options['hide_ab_updates_menu'] = ( 'on' == $options['hide_ab_updates_menu'] ? true : false );
133 if ( !isset( $options['hide_ab_new_content_menu'] ) ) {
134 $options['hide_ab_new_content_menu'] = false;
135 }
136 $options['hide_ab_new_content_menu'] = ( 'on' == $options['hide_ab_new_content_menu'] ? true : false );
137 if ( !isset( $options['hide_ab_howdy'] ) ) {
138 $options['hide_ab_howdy'] = false;
139 }
140 $options['hide_ab_howdy'] = ( 'on' == $options['hide_ab_howdy'] ? true : false );
141 if ( !isset( $options['hide_help_drawer'] ) ) {
142 $options['hide_help_drawer'] = false;
143 }
144 $options['hide_help_drawer'] = ( 'on' == $options['hide_help_drawer'] ? true : false );
145 // Hide Admin Notices
146 if ( !isset( $options['hide_admin_notices'] ) ) {
147 $options['hide_admin_notices'] = false;
148 }
149 $options['hide_admin_notices'] = ( 'on' == $options['hide_admin_notices'] ? true : false );
150 // Disable Dashboard Widgets
151 if ( !isset( $options['disable_dashboard_widgets'] ) ) {
152 $options['disable_dashboard_widgets'] = false;
153 }
154 $options['disable_dashboard_widgets'] = ( 'on' == $options['disable_dashboard_widgets'] ? true : false );
155 $dashboard_widgets = $options_extra['dashboard_widgets'];
156 if ( is_array( $dashboard_widgets ) ) {
157 foreach ( $dashboard_widgets as $widget ) {
158 if ( !isset( $options['disabled_dashboard_widgets'][$widget['id'] . '__' . $widget['context'] . '__' . $widget['priority']] ) ) {
159 $options['disabled_dashboard_widgets'][$widget['id'] . '__' . $widget['context'] . '__' . $widget['priority']] = false;
160 }
161 $options['disabled_dashboard_widgets'][$widget['id'] . '__' . $widget['context'] . '__' . $widget['priority']] = ( 'on' == $options['disabled_dashboard_widgets'][$widget['id'] . '__' . $widget['context'] . '__' . $widget['priority']] ? true : false );
162 }
163 }
164 if ( !isset( $options['disable_welcome_panel_in_dashboard'] ) ) {
165 $options['disable_welcome_panel_in_dashboard'] = false;
166 }
167 $options['disable_welcome_panel_in_dashboard'] = ( 'on' == $options['disable_welcome_panel_in_dashboard'] ? true : false );
168 // Hide Admin Bar
169 if ( !isset( $options['hide_admin_bar'] ) ) {
170 $options['hide_admin_bar'] = false;
171 }
172 $options['hide_admin_bar'] = ( 'on' == $options['hide_admin_bar'] ? true : false );
173 if ( is_array( $roles ) ) {
174 foreach ( $roles as $role_slug => $role_label ) {
175 // e.g. $role_slug is administrator, $role_label is Administrator
176 // on the frontend
177 if ( !isset( $options['hide_admin_bar_for'][$role_slug] ) ) {
178 $options['hide_admin_bar_for'][$role_slug] = false;
179 }
180 $options['hide_admin_bar_for'][$role_slug] = ( 'on' == $options['hide_admin_bar_for'][$role_slug] ? true : false );
181 }
182 }
183 // Wider Admin Menu
184 if ( !isset( $options['wider_admin_menu'] ) ) {
185 $options['wider_admin_menu'] = false;
186 }
187 $options['wider_admin_menu'] = ( 'on' == $options['wider_admin_menu'] ? true : false );
188 if ( !isset( $options['admin_menu_width'] ) ) {
189 $options['admin_menu_width'] = 200;
190 }
191 $options['admin_menu_width'] = ( !empty( $options['admin_menu_width'] ) ? sanitize_text_field( $options['admin_menu_width'] ) : 200 );
192 // Admin Menu Organizer
193 if ( !isset( $options['customize_admin_menu'] ) ) {
194 $options['customize_admin_menu'] = false;
195 }
196 $options['customize_admin_menu'] = ( 'on' == $options['customize_admin_menu'] ? true : false );
197 if ( !isset( $options['custom_menu_order'] ) ) {
198 $options['custom_menu_order'] = '';
199 }
200 // The following fields are added on rendering of custom_menu_order field
201 if ( !isset( $options['custom_menu_titles'] ) ) {
202 $options['custom_menu_titles'] = '';
203 }
204 if ( !isset( $options['custom_menu_hidden'] ) ) {
205 $options['custom_menu_hidden'] = '';
206 }
207 // Enhance List Tables
208 if ( !isset( $options['enhance_list_tables'] ) ) {
209 $options['enhance_list_tables'] = false;
210 }
211 $options['enhance_list_tables'] = ( 'on' == $options['enhance_list_tables'] ? true : false );
212 // Show Featured Image Column
213 if ( !isset( $options['show_featured_image_column'] ) ) {
214 $options['show_featured_image_column'] = false;
215 }
216 $options['show_featured_image_column'] = ( 'on' == $options['show_featured_image_column'] ? true : false );
217 // Show Excerpt Column
218 if ( !isset( $options['show_excerpt_column'] ) ) {
219 $options['show_excerpt_column'] = false;
220 }
221 $options['show_excerpt_column'] = ( 'on' == $options['show_excerpt_column'] ? true : false );
222 // Show ID Column
223 if ( !isset( $options['show_id_column'] ) ) {
224 $options['show_id_column'] = false;
225 }
226 $options['show_id_column'] = ( 'on' == $options['show_id_column'] ? true : false );
227 // Show File Size Column in Media Library
228 if ( !isset( $options['show_file_size_column'] ) ) {
229 $options['show_file_size_column'] = false;
230 }
231 $options['show_file_size_column'] = ( 'on' == $options['show_file_size_column'] ? true : false );
232 // Show ID in Action Row
233 if ( !isset( $options['show_id_in_action_row'] ) ) {
234 $options['show_id_in_action_row'] = false;
235 }
236 $options['show_id_in_action_row'] = ( 'on' == $options['show_id_in_action_row'] ? true : false );
237 // Show Custom Taxonomy Filters
238 if ( !isset( $options['show_custom_taxonomy_filters'] ) ) {
239 $options['show_custom_taxonomy_filters'] = false;
240 }
241 $options['show_custom_taxonomy_filters'] = ( 'on' == $options['show_custom_taxonomy_filters'] ? true : false );
242 // Hide Comments Column
243 if ( !isset( $options['hide_comments_column'] ) ) {
244 $options['hide_comments_column'] = false;
245 }
246 $options['hide_comments_column'] = ( 'on' == $options['hide_comments_column'] ? true : false );
247 // Hide Post Tags Column
248 if ( !isset( $options['hide_post_tags_column'] ) ) {
249 $options['hide_post_tags_column'] = false;
250 }
251 $options['hide_post_tags_column'] = ( 'on' == $options['hide_post_tags_column'] ? true : false );
252 // Custom Admin Footer Text
253 if ( !isset( $options['custom_admin_footer_text'] ) ) {
254 $options['custom_admin_footer_text'] = false;
255 }
256 $options['custom_admin_footer_text'] = ( 'on' == $options['custom_admin_footer_text'] ? true : false );
257 if ( !isset( $options['custom_admin_footer_left'] ) ) {
258 $options['custom_admin_footer_left'] = '';
259 }
260 $options['custom_admin_footer_left'] = ( !empty( $options['custom_admin_footer_left'] ) ? wp_kses_post( $options['custom_admin_footer_left'] ) : '' );
261 if ( !isset( $options['custom_admin_footer_right'] ) ) {
262 $options['custom_admin_footer_right'] = '';
263 }
264 $options['custom_admin_footer_right'] = ( !empty( $options['custom_admin_footer_right'] ) ? wp_kses_post( $options['custom_admin_footer_right'] ) : '' );
265 // Various Admin Enhancements
266 if ( !isset( $options['various_admin_ui_enhancements'] ) ) {
267 $options['various_admin_ui_enhancements'] = false;
268 }
269 $options['various_admin_ui_enhancements'] = ( 'on' == $options['various_admin_ui_enhancements'] ? true : false );
270 // Media Library Infinite Scrolling
271 if ( !isset( $options['media_library_infinite_scrolling'] ) ) {
272 $options['media_library_infinite_scrolling'] = false;
273 }
274 $options['media_library_infinite_scrolling'] = ( 'on' == $options['media_library_infinite_scrolling'] ? true : false );
275 // Display Active Plugins First
276 if ( !isset( $options['display_active_plugins_first'] ) ) {
277 $options['display_active_plugins_first'] = false;
278 }
279 $options['display_active_plugins_first'] = ( 'on' == $options['display_active_plugins_first'] ? true : false );
280 // =================================================================
281 // LOG IN | LOG OUT
282 // =================================================================
283 // Change Login URL
284 if ( !isset( $options['change_login_url'] ) ) {
285 $options['change_login_url'] = false;
286 }
287 $options['change_login_url'] = ( 'on' == $options['change_login_url'] ? true : false );
288 if ( !isset( $options['custom_login_slug'] ) ) {
289 $options['custom_login_slug'] = 'backend';
290 }
291 $options['custom_login_slug'] = ( !empty( $options['custom_login_slug'] ) ? sanitize_text_field( trim( $options['custom_login_slug'], '/' ) ) : 'backend' );
292 // Login ID Type
293 if ( !isset( $options['login_id_type_restriction'] ) ) {
294 $options['login_id_type_restriction'] = false;
295 }
296 $options['login_id_type_restriction'] = ( 'on' == $options['login_id_type_restriction'] ? true : false );
297 if ( !isset( $options['login_id_type'] ) ) {
298 $options['login_id_type'] = 'username';
299 }
300 $options['login_id_type'] = ( !empty( $options['login_id_type'] ) ? sanitize_text_field( $options['login_id_type'] ) : 'username' );
301 // Use Site Identity on the Login Page
302 if ( !isset( $options['site_identity_on_login'] ) ) {
303 $options['site_identity_on_login'] = false;
304 }
305 $options['site_identity_on_login'] = ( 'on' == $options['site_identity_on_login'] ? true : false );
306 // Enable Login Logout Menu
307 if ( !isset( $options['enable_login_logout_menu'] ) ) {
308 $options['enable_login_logout_menu'] = false;
309 }
310 $options['enable_login_logout_menu'] = ( 'on' == $options['enable_login_logout_menu'] ? true : false );
311 // Redirect After Login
312 if ( !isset( $options['redirect_after_login'] ) ) {
313 $options['redirect_after_login'] = false;
314 }
315 $options['redirect_after_login'] = ( 'on' == $options['redirect_after_login'] ? true : false );
316 if ( !isset( $options['redirect_after_login_type'] ) ) {
317 $options['redirect_after_login_type'] = 'single_url';
318 }
319 $options['redirect_after_login_type'] = ( !empty( $options['redirect_after_login_type'] ) ? sanitize_text_field( $options['redirect_after_login_type'] ) : 'single_url' );
320 if ( !isset( $options['redirect_after_login_to_slug'] ) ) {
321 $options['redirect_after_login_to_slug'] = '';
322 }
323 $options['redirect_after_login_to_slug'] = ( !empty( $options['redirect_after_login_to_slug'] ) ? sanitize_text_field( $options['redirect_after_login_to_slug'] ) : '' );
324 if ( is_array( $roles ) ) {
325 foreach ( $roles as $role_slug => $role_label ) {
326 // e.g. $role_slug is administrator, $role_label is Administrator
327 if ( !isset( $options['redirect_after_login_for'][$role_slug] ) ) {
328 $options['redirect_after_login_for'][$role_slug] = false;
329 }
330 $options['redirect_after_login_for'][$role_slug] = ( 'on' == $options['redirect_after_login_for'][$role_slug] ? true : false );
331 }
332 }
333 // Redirect After Logout
334 if ( !isset( $options['redirect_after_logout'] ) ) {
335 $options['redirect_after_logout'] = false;
336 }
337 $options['redirect_after_logout'] = ( 'on' == $options['redirect_after_logout'] ? true : false );
338 if ( !isset( $options['redirect_after_logout_type'] ) ) {
339 $options['redirect_after_logout_type'] = 'single_url';
340 }
341 $options['redirect_after_logout_type'] = ( !empty( $options['redirect_after_logout_type'] ) ? sanitize_text_field( $options['redirect_after_logout_type'] ) : 'single_url' );
342 if ( !isset( $options['redirect_after_logout_to_slug'] ) ) {
343 $options['redirect_after_logout_to_slug'] = '';
344 }
345 $options['redirect_after_logout_to_slug'] = ( !empty( $options['redirect_after_logout_to_slug'] ) ? sanitize_text_field( $options['redirect_after_logout_to_slug'] ) : '' );
346 if ( is_array( $roles ) ) {
347 foreach ( $roles as $role_slug => $role_label ) {
348 // e.g. $role_slug is administrator, $role_label is Administrator
349 if ( !isset( $options['redirect_after_logout_for'][$role_slug] ) ) {
350 $options['redirect_after_logout_for'][$role_slug] = false;
351 }
352 $options['redirect_after_logout_for'][$role_slug] = ( 'on' == $options['redirect_after_logout_for'][$role_slug] ? true : false );
353 }
354 }
355 // Enable Last Login Column
356 if ( !isset( $options['enable_last_login_column'] ) ) {
357 $options['enable_last_login_column'] = false;
358 }
359 $options['enable_last_login_column'] = ( 'on' == $options['enable_last_login_column'] ? true : false );
360 // Enable Custom Admin CSS
361 if ( !isset( $options['enable_custom_admin_css'] ) ) {
362 $options['enable_custom_admin_css'] = false;
363 }
364 $options['enable_custom_admin_css'] = ( 'on' == $options['enable_custom_admin_css'] ? true : false );
365 if ( !isset( $options['custom_admin_css'] ) ) {
366 $options['custom_admin_css'] = '';
367 }
368 $options['custom_admin_css'] = ( !empty( $options['custom_admin_css'] ) ? $options['custom_admin_css'] : '' );
369 // Enable Custom Frontend CSS
370 if ( !isset( $options['enable_custom_frontend_css'] ) ) {
371 $options['enable_custom_frontend_css'] = false;
372 }
373 $options['enable_custom_frontend_css'] = ( 'on' == $options['enable_custom_frontend_css'] ? true : false );
374 if ( !isset( $options['custom_frontend_css'] ) ) {
375 $options['custom_frontend_css'] = '';
376 }
377 $options['custom_frontend_css'] = ( !empty( $options['custom_frontend_css'] ) ? $options['custom_frontend_css'] : '' );
378 // Custom Body Class
379 if ( !isset( $options['enable_custom_body_class'] ) ) {
380 $options['enable_custom_body_class'] = false;
381 }
382 $options['enable_custom_body_class'] = ( 'on' == $options['enable_custom_body_class'] ? true : false );
383 if ( is_array( $asenha_public_post_types ) ) {
384 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
385 // e.g. $post_type_slug is post, $post_type_label is Posts
386 if ( !isset( $options['enable_custom_body_class_for'][$post_type_slug] ) ) {
387 $options['enable_custom_body_class_for'][$post_type_slug] = false;
388 }
389 $options['enable_custom_body_class_for'][$post_type_slug] = ( 'on' == $options['enable_custom_body_class_for'][$post_type_slug] ? true : false );
390 }
391 }
392 // Manage ads.txt and app-ads.txt
393 if ( !isset( $options['manage_ads_appads_txt'] ) ) {
394 $options['manage_ads_appads_txt'] = false;
395 }
396 $options['manage_ads_appads_txt'] = ( 'on' == $options['manage_ads_appads_txt'] ? true : false );
397 if ( !isset( $options['ads_txt_content'] ) ) {
398 $options['ads_txt_content'] = '';
399 }
400 $options['ads_txt_content'] = ( !empty( $options['ads_txt_content'] ) ? $options['ads_txt_content'] : '' );
401 if ( !isset( $options['app_ads_txt_content'] ) ) {
402 $options['app_ads_txt_content'] = '';
403 }
404 $options['app_ads_txt_content'] = ( !empty( $options['app_ads_txt_content'] ) ? $options['app_ads_txt_content'] : '' );
405 // Manage robots.txt
406 if ( !isset( $options['manage_robots_txt'] ) ) {
407 $options['manage_robots_txt'] = false;
408 }
409 $options['manage_robots_txt'] = ( 'on' == $options['manage_robots_txt'] ? true : false );
410 if ( !isset( $options['robots_txt_content'] ) ) {
411 $options['robots_txt_content'] = '';
412 } else {
413 if ( !empty( $options['robots_txt_content'] ) ) {
414 $options['robots_txt_content'] = $options['robots_txt_content'];
415 $is_robots_txt_real_file = is_file( ABSPATH . 'robots.txt' );
416 // rename real robots.txt file if it exists and Mange robots.txt is enabled
417 if ( $is_robots_txt_real_file && 'on' == $options['manage_robots_txt'] ) {
418 $robots_txt_backup_filename = 'robots_backup_' . date( 'Y_m_d__H_i', time() ) . '.txt';
419 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
420 $options_extra['robots_txt_backup_file_name'] = $robots_txt_backup_filename;
421 update_option( ASENHA_SLUG_U . '_extra', $options_extra, true );
422 rename( ABSPATH . 'robots.txt', ABSPATH . $robots_txt_backup_filename );
423 } elseif ( 'on' != $options['manage_robots_txt'] ) {
424 $options_extra = get_option( ASENHA_SLUG_U . '_extra', array() );
425 if ( array_key_exists( 'robots_txt_backup_file_name', $options_extra ) ) {
426 if ( is_file( ABSPATH . $options_extra['robots_txt_backup_file_name'] ) ) {
427 rename( ABSPATH . $options_extra['robots_txt_backup_file_name'], ABSPATH . 'robots.txt' );
428 }
429 }
430 }
431 } else {
432 $options['robots_txt_content'] = '';
433 }
434 }
435 // Insert <head>, <body> and <footer> code
436 if ( !isset( $options['insert_head_body_footer_code'] ) ) {
437 $options['insert_head_body_footer_code'] = false;
438 }
439 $options['insert_head_body_footer_code'] = ( 'on' == $options['insert_head_body_footer_code'] ? true : false );
440 if ( !isset( $options['head_code_priority'] ) ) {
441 $options['head_code_priority'] = 10;
442 }
443 $options['head_code_priority'] = ( !empty( $options['head_code_priority'] ) ? $options['head_code_priority'] : 10 );
444 if ( !isset( $options['head_code'] ) ) {
445 $options['head_code'] = '';
446 }
447 $options['head_code'] = ( !empty( $options['head_code'] ) ? $options['head_code'] : '' );
448 if ( !isset( $options['body_code_priority'] ) ) {
449 $options['body_code_priority'] = 10;
450 }
451 $options['body_code_priority'] = ( !empty( $options['body_code_priority'] ) ? $options['body_code_priority'] : 10 );
452 if ( !isset( $options['body_code'] ) ) {
453 $options['body_code'] = '';
454 }
455 $options['body_code'] = ( !empty( $options['body_code'] ) ? $options['body_code'] : '' );
456 if ( !isset( $options['footer_code_priority'] ) ) {
457 $options['footer_code_priority'] = 10;
458 }
459 $options['footer_code_priority'] = ( !empty( $options['footer_code_priority'] ) ? $options['footer_code_priority'] : 10 );
460 if ( !isset( $options['footer_code'] ) ) {
461 $options['footer_code'] = '';
462 }
463 $options['footer_code'] = ( !empty( $options['footer_code'] ) ? $options['footer_code'] : '' );
464 // =================================================================
465 // DISABLE COMPONENTS
466 // =================================================================
467 // Disable Gutenberg
468 if ( !isset( $options['disable_gutenberg'] ) ) {
469 $options['disable_gutenberg'] = false;
470 }
471 $options['disable_gutenberg'] = ( 'on' == $options['disable_gutenberg'] ? true : false );
472 if ( is_array( $asenha_gutenberg_post_types ) ) {
473 foreach ( $asenha_gutenberg_post_types as $post_type_slug => $post_type_label ) {
474 // e.g. $post_type_slug is post,
475 if ( !isset( $options['disable_gutenberg_for'][$post_type_slug] ) ) {
476 $options['disable_gutenberg_for'][$post_type_slug] = false;
477 }
478 $options['disable_gutenberg_for'][$post_type_slug] = ( 'on' == $options['disable_gutenberg_for'][$post_type_slug] ? true : false );
479 }
480 }
481 if ( !isset( $options['disable_gutenberg_frontend_styles'] ) ) {
482 $options['disable_gutenberg_frontend_styles'] = false;
483 }
484 $options['disable_gutenberg_frontend_styles'] = ( 'on' == $options['disable_gutenberg_frontend_styles'] ? true : false );
485 // Disable Comments
486 if ( !isset( $options['disable_comments'] ) ) {
487 $options['disable_comments'] = false;
488 }
489 $options['disable_comments'] = ( 'on' == $options['disable_comments'] ? true : false );
490 if ( is_array( $asenha_public_post_types ) ) {
491 foreach ( $asenha_public_post_types as $post_type_slug => $post_type_label ) {
492 // e.g. $post_type_slug is post, $post_type_label is Posts
493 if ( !isset( $options['disable_comments_for'][$post_type_slug] ) ) {
494 $options['disable_comments_for'][$post_type_slug] = false;
495 }
496 $options['disable_comments_for'][$post_type_slug] = ( 'on' == $options['disable_comments_for'][$post_type_slug] ? true : false );
497 }
498 }
499 // Disable REST API
500 if ( !isset( $options['disable_rest_api'] ) ) {
501 $options['disable_rest_api'] = false;
502 }
503 $options['disable_rest_api'] = ( 'on' == $options['disable_rest_api'] ? true : false );
504 // Disable Feeds
505 if ( !isset( $options['disable_feeds'] ) ) {
506 $options['disable_feeds'] = false;
507 }
508 $options['disable_feeds'] = ( 'on' == $options['disable_feeds'] ? true : false );
509 // Disable Auto Updates
510 if ( !isset( $options['disable_all_updates'] ) ) {
511 $options['disable_all_updates'] = false;
512 }
513 $options['disable_all_updates'] = ( 'on' == $options['disable_all_updates'] ? true : false );
514 // Disable Smaller Components
515 if ( !isset( $options['disable_smaller_components'] ) ) {
516 $options['disable_smaller_components'] = false;
517 }
518 $options['disable_smaller_components'] = ( 'on' == $options['disable_smaller_components'] ? true : false );
519 if ( !isset( $options['disable_head_generator_tag'] ) ) {
520 $options['disable_head_generator_tag'] = false;
521 }
522 $options['disable_head_generator_tag'] = ( 'on' == $options['disable_head_generator_tag'] ? true : false );
523 if ( !isset( $options['disable_feed_generator_tag'] ) ) {
524 $options['disable_feed_generator_tag'] = false;
525 }
526 $options['disable_feed_generator_tag'] = ( 'on' == $options['disable_feed_generator_tag'] ? true : false );
527 if ( !isset( $options['disable_resource_version_number'] ) ) {
528 $options['disable_resource_version_number'] = false;
529 }
530 $options['disable_resource_version_number'] = ( 'on' == $options['disable_resource_version_number'] ? true : false );
531 if ( !isset( $options['disable_head_wlwmanifest_tag'] ) ) {
532 $options['disable_head_wlwmanifest_tag'] = false;
533 }
534 $options['disable_head_wlwmanifest_tag'] = ( 'on' == $options['disable_head_wlwmanifest_tag'] ? true : false );
535 if ( !isset( $options['disable_head_rsd_tag'] ) ) {
536 $options['disable_head_rsd_tag'] = false;
537 }
538 $options['disable_head_rsd_tag'] = ( 'on' == $options['disable_head_rsd_tag'] ? true : false );
539 if ( !isset( $options['disable_head_shortlink_tag'] ) ) {
540 $options['disable_head_shortlink_tag'] = false;
541 }
542 $options['disable_head_shortlink_tag'] = ( 'on' == $options['disable_head_shortlink_tag'] ? true : false );
543 if ( !isset( $options['disable_frontend_dashicons'] ) ) {
544 $options['disable_frontend_dashicons'] = false;
545 }
546 $options['disable_frontend_dashicons'] = ( 'on' == $options['disable_frontend_dashicons'] ? true : false );
547 if ( !isset( $options['disable_emoji_support'] ) ) {
548 $options['disable_emoji_support'] = false;
549 }
550 $options['disable_emoji_support'] = ( 'on' == $options['disable_emoji_support'] ? true : false );
551 if ( !isset( $options['disable_jquery_migrate'] ) ) {
552 $options['disable_jquery_migrate'] = false;
553 }
554 $options['disable_jquery_migrate'] = ( 'on' == $options['disable_jquery_migrate'] ? true : false );
555 if ( !isset( $options['disable_block_widgets'] ) ) {
556 $options['disable_block_widgets'] = false;
557 }
558 $options['disable_block_widgets'] = ( 'on' == $options['disable_block_widgets'] ? true : false );
559 if ( !isset( $options['disable_lazy_load'] ) ) {
560 $options['disable_lazy_load'] = false;
561 }
562 $options['disable_lazy_load'] = ( 'on' == $options['disable_lazy_load'] ? true : false );
563 // =================================================================
564 // SECURITY
565 // =================================================================
566 // Limit Login Attempts
567 if ( !isset( $options['limit_login_attempts'] ) ) {
568 $options['limit_login_attempts'] = false;
569 }
570 $options['limit_login_attempts'] = ( 'on' == $options['limit_login_attempts'] ? true : false );
571 if ( !isset( $options['login_fails_allowed'] ) ) {
572 $options['login_fails_allowed'] = 3;
573 }
574 $options['login_fails_allowed'] = ( !empty( $options['login_fails_allowed'] ) ? sanitize_text_field( $options['login_fails_allowed'] ) : 3 );
575 if ( !isset( $options['login_lockout_maxcount'] ) ) {
576 $options['login_lockout_maxcount'] = 3;
577 }
578 $options['login_lockout_maxcount'] = ( !empty( $options['login_lockout_maxcount'] ) ? sanitize_text_field( $options['login_lockout_maxcount'] ) : 3 );
579 if ( !isset( $options['login_attempts_log_table'] ) ) {
580 $options['login_attempts_log_table'] = '';
581 }
582 $options['login_attempts_log_table'] = '';
583 // Obfuscate Author Slugs
584 if ( !isset( $options['obfuscate_author_slugs'] ) ) {
585 $options['obfuscate_author_slugs'] = false;
586 }
587 $options['obfuscate_author_slugs'] = ( 'on' == $options['obfuscate_author_slugs'] ? true : false );
588 // Obfuscate Email Address
589 if ( !isset( $options['obfuscate_email_address'] ) ) {
590 $options['obfuscate_email_address'] = false;
591 }
592 $options['obfuscate_email_address'] = ( 'on' == $options['obfuscate_email_address'] ? true : false );
593 if ( !isset( $options['obfuscate_email_address_in_content'] ) ) {
594 $options['obfuscate_email_address_in_content'] = false;
595 }
596 $options['obfuscate_email_address_in_content'] = ( 'on' == $options['obfuscate_email_address_in_content'] ? true : false );
597 if ( !isset( $options['obfuscate_email_address_visitor_only'] ) ) {
598 $options['obfuscate_email_address_visitor_only'] = false;
599 }
600 $options['obfuscate_email_address_visitor_only'] = ( 'on' == $options['obfuscate_email_address_visitor_only'] ? true : false );
601 // Disable XML-RPC
602 if ( !isset( $options['disable_xmlrpc'] ) ) {
603 $options['disable_xmlrpc'] = false;
604 }
605 $options['disable_xmlrpc'] = ( 'on' == $options['disable_xmlrpc'] ? true : false );
606 // =================================================================
607 // OPTIMIZATIONS
608 // =================================================================
609 // Image Upload Control
610 if ( !isset( $options['image_upload_control'] ) ) {
611 $options['image_upload_control'] = false;
612 }
613 $options['image_upload_control'] = ( 'on' == $options['image_upload_control'] ? true : false );
614 if ( !isset( $options['image_max_width'] ) ) {
615 $options['image_max_width'] = 1920;
616 }
617 $options['image_max_width'] = ( !empty( $options['image_max_width'] ) ? sanitize_text_field( $options['image_max_width'] ) : 1920 );
618 if ( !isset( $options['image_max_height'] ) ) {
619 $options['image_max_height'] = 1920;
620 }
621 $options['image_max_height'] = ( !empty( $options['image_max_height'] ) ? sanitize_text_field( $options['image_max_height'] ) : 1920 );
622 // Enable Revisions Control
623 if ( !isset( $options['enable_revisions_control'] ) ) {
624 $options['enable_revisions_control'] = false;
625 }
626 $options['enable_revisions_control'] = ( 'on' == $options['enable_revisions_control'] ? true : false );
627 if ( !isset( $options['revisions_max_number'] ) ) {
628 $options['revisions_max_number'] = 10;
629 }
630 $options['revisions_max_number'] = ( !empty( $options['revisions_max_number'] ) ? sanitize_text_field( $options['revisions_max_number'] ) : 10 );
631 if ( is_array( $asenha_revisions_post_types ) ) {
632 foreach ( $asenha_revisions_post_types as $post_type_slug => $post_type_label ) {
633 // e.g. $post_type_slug is post,
634 if ( !isset( $options['enable_revisions_control_for'][$post_type_slug] ) ) {
635 $options['enable_revisions_control_for'][$post_type_slug] = false;
636 }
637 $options['enable_revisions_control_for'][$post_type_slug] = ( 'on' == $options['enable_revisions_control_for'][$post_type_slug] ? true : false );
638 }
639 }
640 // Enable Heartbeat Control
641 if ( !isset( $options['enable_heartbeat_control'] ) ) {
642 $options['enable_heartbeat_control'] = false;
643 }
644 $options['enable_heartbeat_control'] = ( 'on' == $options['enable_heartbeat_control'] ? true : false );
645 if ( !isset( $options['heartbeat_control_for_admin_pages'] ) ) {
646 $options['heartbeat_control_for_admin_pages'] = 'default';
647 }
648 if ( !isset( $options['heartbeat_control_for_post_edit'] ) ) {
649 $options['heartbeat_control_for_post_edit'] = 'default';
650 }
651 if ( !isset( $options['heartbeat_control_for_frontend'] ) ) {
652 $options['heartbeat_control_for_frontend'] = 'default';
653 }
654 if ( !isset( $options['heartbeat_interval_for_admin_pages'] ) ) {
655 $options['heartbeat_interval_for_admin_pages'] = 60;
656 }
657 $options['heartbeat_interval_for_admin_pages'] = ( !empty( $options['heartbeat_interval_for_admin_pages'] ) ? sanitize_text_field( $options['heartbeat_interval_for_admin_pages'] ) : 60 );
658 if ( !isset( $options['heartbeat_interval_for_post_edit'] ) ) {
659 $options['heartbeat_interval_for_post_edit'] = 15;
660 }
661 $options['heartbeat_interval_for_post_edit'] = ( !empty( $options['heartbeat_interval_for_post_edit'] ) ? sanitize_text_field( $options['heartbeat_interval_for_post_edit'] ) : 15 );
662 if ( !isset( $options['heartbeat_interval_for_frontend'] ) ) {
663 $options['heartbeat_interval_for_frontend'] = 60;
664 }
665 $options['heartbeat_interval_for_frontend'] = ( !empty( $options['heartbeat_interval_for_frontend'] ) ? sanitize_text_field( $options['heartbeat_interval_for_frontend'] ) : 60 );
666 // =================================================================
667 // UTILITIES
668 // =================================================================
669 // SMTP Email Delivery
670 if ( !isset( $options['smtp_email_delivery'] ) ) {
671 $options['smtp_email_delivery'] = false;
672 }
673 $options['smtp_email_delivery'] = ( 'on' == $options['smtp_email_delivery'] ? true : false );
674 if ( !isset( $options['smtp_host'] ) ) {
675 $options['smtp_host'] = '';
676 }
677 $options['smtp_host'] = ( !empty( $options['smtp_host'] ) ? sanitize_text_field( $options['smtp_host'] ) : '' );
678 if ( !isset( $options['smtp_port'] ) ) {
679 $options['smtp_port'] = '';
680 }
681 $options['smtp_port'] = ( !empty( $options['smtp_port'] ) ? $options['smtp_port'] : '' );
682 if ( !isset( $options['smtp_security'] ) ) {
683 $options['smtp_security'] = 'none';
684 }
685 $options['smtp_security'] = ( !empty( $options['smtp_security'] ) ? $options['smtp_security'] : 'none' );
686 if ( !isset( $options['smtp_username'] ) ) {
687 $options['smtp_username'] = '';
688 }
689 $options['smtp_username'] = ( !empty( $options['smtp_username'] ) ? sanitize_text_field( $options['smtp_username'] ) : '' );
690 if ( !isset( $options['smtp_password'] ) ) {
691 $options['smtp_password'] = '';
692 }
693 $options['smtp_password'] = ( !empty( $options['smtp_password'] ) ? $options['smtp_password'] : '' );
694 if ( !isset( $options['smtp_default_from_name'] ) ) {
695 $options['smtp_default_from_name'] = '';
696 }
697 $options['smtp_default_from_name'] = ( !empty( $options['smtp_default_from_name'] ) ? sanitize_text_field( $options['smtp_default_from_name'] ) : '' );
698 if ( !isset( $options['smtp_default_from_email'] ) ) {
699 $options['smtp_default_from_email'] = '';
700 }
701 $options['smtp_default_from_email'] = ( !empty( $options['smtp_default_from_email'] ) ? sanitize_text_field( $options['smtp_default_from_email'] ) : '' );
702 if ( !isset( $options['smtp_default_from_description'] ) ) {
703 $options['smtp_default_from_description'] = '';
704 }
705 if ( !isset( $options['smtp_force_from'] ) ) {
706 $options['smtp_force_from'] = false;
707 }
708 $options['smtp_force_from'] = ( 'on' == $options['smtp_force_from'] ? true : false );
709 if ( !isset( $options['smtp_bypass_ssl_verification'] ) ) {
710 $options['smtp_bypass_ssl_verification'] = false;
711 }
712 $options['smtp_bypass_ssl_verification'] = ( 'on' == $options['smtp_bypass_ssl_verification'] ? true : false );
713 if ( !isset( $options['smtp_debug'] ) ) {
714 $options['smtp_debug'] = false;
715 }
716 $options['smtp_debug'] = ( 'on' == $options['smtp_debug'] ? true : false );
717 // Multiple User Roles
718 if ( !isset( $options['multiple_user_roles'] ) ) {
719 $options['multiple_user_roles'] = false;
720 }
721 $options['multiple_user_roles'] = ( 'on' == $options['multiple_user_roles'] ? true : false );
722 // Image Sizes Panel
723 if ( !isset( $options['image_sizes_panel'] ) ) {
724 $options['image_sizes_panel'] = false;
725 }
726 $options['image_sizes_panel'] = ( 'on' == $options['image_sizes_panel'] ? true : false );
727 // View Admin as Role
728 if ( !isset( $options['view_admin_as_role'] ) ) {
729 $options['view_admin_as_role'] = false;
730 }
731 $options['view_admin_as_role'] = ( 'on' == $options['view_admin_as_role'] ? true : false );
732 // Enable Password Protection
733 if ( !isset( $options['enable_password_protection'] ) ) {
734 $options['enable_password_protection'] = false;
735 }
736 $options['enable_password_protection'] = ( 'on' == $options['enable_password_protection'] ? true : false );
737 if ( !isset( $options['password_protection_password'] ) ) {
738 $options['password_protection_password'] = 'secret';
739 }
740 $options['password_protection_password'] = ( !empty( $options['password_protection_password'] ) ? $options['password_protection_password'] : 'secret' );
741 // Maintenance Mode
742 if ( !isset( $options['maintenance_mode'] ) ) {
743 $options['maintenance_mode'] = false;
744 }
745 $options['maintenance_mode'] = ( 'on' == $options['maintenance_mode'] ? true : false );
746 if ( !isset( $options['maintenance_page_heading'] ) ) {
747 $options['maintenance_page_heading'] = 'We\'ll be back soon.';
748 }
749 $options['maintenance_page_heading'] = ( !empty( $options['maintenance_page_heading'] ) ? sanitize_text_field( $options['maintenance_page_heading'] ) : 'We\'ll be back soon.' );
750 if ( !isset( $options['maintenance_page_description'] ) ) {
751 $options['maintenance_page_description'] = 'This site is undergoing maintenance for an extended period today. Thanks for your patience.';
752 }
753 $options['maintenance_page_description'] = ( !empty( $options['maintenance_page_description'] ) ? sanitize_text_field( $options['maintenance_page_description'] ) : 'This site is undergoing maintenance for an extended period today. Thanks for your patience.' );
754 if ( !isset( $options['maintenance_page_background'] ) ) {
755 $options['maintenance_page_background'] = 'stripes';
756 }
757 $options['maintenance_page_background'] = ( !empty( $options['maintenance_page_background'] ) ? $options['maintenance_page_background'] : 'stripes' );
758 if ( !isset( $options['maintenance_mode_description'] ) ) {
759 $options['maintenance_mode_description'] = '';
760 }
761 // Redirect 404 to Homepage
762 if ( !isset( $options['redirect_404_to_homepage'] ) ) {
763 $options['redirect_404_to_homepage'] = false;
764 }
765 $options['redirect_404_to_homepage'] = ( 'on' == $options['redirect_404_to_homepage'] ? true : false );
766 // Show System Summary in At a Glance Dashboard Widget
767 if ( !isset( $options['display_system_summary'] ) ) {
768 $options['display_system_summary'] = false;
769 }
770 $options['display_system_summary'] = ( 'on' == $options['display_system_summary'] ? true : false );
771 // Search Engines Visibility Status
772 if ( !isset( $options['search_engine_visibility_status'] ) ) {
773 $options['search_engine_visibility_status'] = false;
774 }
775 $options['search_engine_visibility_status'] = ( 'on' == $options['search_engine_visibility_status'] ? true : false );
776 return $options;
777 }
778
779 /**
780 * Sanitize checkbox field. For reference purpose. Not currently in use.
781 *
782 * @since 1.0.0
783 */
784 function asenha_sanitize_checkbox_field( $value ) {
785 // A checked checkbox field will originally be saved as an 'on' value in the option. We transform that into true (shown as 1) or false (shown as empty value)
786 return ( 'on' === $value ? true : false );
787 }
788
789 }
790