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