PluginProbe
Booking Calendar / 11.6
Booking Calendar v11.6
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
booking / includes / page-settings-calendar / ajax / settings_calendar__save.php

settings_calendar__save.php in Booking Calendar 11.6, at includes/page-settings-calendar/ajax/settings_calendar__save.php

42 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * AJAX save handler for Calendar settings.
4 *
5 * @package Booking Calendar
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 /**
13 * AJAX: save Calendar settings.
14 *
15 * @return void
16 */
17 function wpbc_settings_calendar_ajax_save() {
18
19 $nonce_result = check_ajax_referer( 'wpbc_settings_calendar_ajax_nonce', 'nonce', false );
20 if ( false === $nonce_result ) {
21 wp_send_json_error( array( 'message' => __( 'Security check failed.', 'booking' ) ), 403 );
22 }
23
24 if ( ! wpbc_is_mu_user_can_be_here( 'only_super_admin' ) || ! current_user_can( wpbc_settings_calendar__get_manage_cap() ) ) {
25 wp_send_json_error( array( 'message' => __( 'You do not have permission to change calendar settings.', 'booking' ) ), 403 );
26 }
27
28 $cleaned_data = wpbc_settings_calendar__validate_data( $_POST ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing
29 wpbc_settings_calendar__update_settings( $cleaned_data );
30
31 $message = __( 'Calendar settings updated.', 'booking' );
32
33 wp_send_json_success(
34 array(
35 'message' => $message,
36 'settings' => wpbc_settings_calendar__get_settings_response(),
37 'days_selection' => wpbc_settings_calendar__get_days_selection_response(),
38 )
39 );
40 }
41 add_action( 'wp_ajax_WPBC_AJX_SETTINGS_CALENDAR_SAVE', 'wpbc_settings_calendar_ajax_save' );
42