PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 11.8.4 11.8.3 11.8.2 11.8.1 11.8 11.7 11.6.1 11.6 11.5 11.4.3 11.4.2 11.4.1 11.4 11.3 11.2.1 11.2 11.1 11.0 10.15.7 10.15.6 10.1.3 10.10 10.10.1 10.10.2 All 205 releases
← All changes | includes/save-load-option/option-save-policies.php +42 -0 11.8.2 → 11.9 View file →
@@ -137,8 +137,23 @@
137 137 }
138 138
139 139 return sanitize_text_field( is_scalar( $value ) ? (string) $value : '' );
140 140 }
141 +
142 + /**
143 + * Normalize the pre-check-in hint duration used by the Form Builder setting.
144 + *
145 + * @param mixed $value Raw value.
146 + * @param string $data_name Submitted option name.
147 + *
148 + * @return string Number of days between 1 and 91.
149 + */
150 + public static function normalize_pre_checkin_days( $value, $data_name = '' ) {
151 +
152 + $days = is_scalar( $value ) ? absint( $value ) : 14;
153 +
154 + return (string) min( 91, max( 1, $days ) );
155 + }
141 156 }
142 157
143 158 /**
144 159 * Calendar global option policies.
@@ -382,8 +397,17 @@
382 397 )
383 398 );
384 399
385 400 wpbc_option_saver_loader::register_option_policy(
401 + 'booking_is_use_autofill_4_logged_user',
402 + array(
403 + 'can_save' => array( 'WPBC_Option_Save_Policy_Global_Options', 'can_save_global_options' ),
404 + 'permission_message' => __( 'You do not have permission to save global form options.', 'booking' ),
405 + 'normalize_raw' => array( 'WPBC_Option_Save_Policy_Global_Options', 'normalize_on_off' ),
406 + )
407 + );
408 +
409 + wpbc_option_saver_loader::register_option_policy(
386 410 'booking_form_accent_enabled',
387 411 array(
388 412 'can_save' => array( 'WPBC_Option_Save_Policy_Global_Options', 'can_save_global_options' ),
389 413 'permission_message' => __( 'You do not have permission to save global form appearance options.', 'booking' ),
@@ -405,8 +429,26 @@
405 429 array(
406 430 'can_save' => array( 'WPBC_Option_Save_Policy_Global_Options', 'can_save_global_options' ),
407 431 'permission_message' => __( 'You do not have permission to save global form appearance options.', 'booking' ),
408 432 'normalize_raw' => array( 'WPBC_Option_Save_Policy_Global_Options', 'normalize_hex_color' ),
433 + )
434 + );
435 +
436 + wpbc_option_saver_loader::register_option_policy(
437 + 'booking_is_use_phone_validation',
438 + array(
439 + 'can_save' => array( 'WPBC_Option_Save_Policy_Global_Options', 'can_save_global_options' ),
440 + 'permission_message' => __( 'You do not have permission to save global form options.', 'booking' ),
441 + 'normalize_raw' => array( 'WPBC_Option_Save_Policy_Global_Options', 'normalize_on_off' ),
442 + )
443 + );
444 +
445 + wpbc_option_saver_loader::register_option_policy(
446 + 'booking_number_for_pre_checkin_date_hint',
447 + array(
448 + 'can_save' => array( 'WPBC_Option_Save_Policy_Global_Options', 'can_save_global_options' ),
449 + 'permission_message' => __( 'You do not have permission to save global form options.', 'booking' ),
450 + 'normalize_raw' => array( 'WPBC_Option_Save_Policy_Global_Options', 'normalize_pre_checkin_days' ),
409 451 )
410 452 );
411 453 }
412 454 add_action( 'init', 'wpbc_register_builtin_option_save_policies', 5 );