PluginProbe
Booking Calendar / 11.7
Booking Calendar v11.7
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-appointment-services / ajax / appointment_services__archive.php

appointment_services__archive.php in Booking Calendar 11.7, at includes/page-appointment-services/ajax/appointment_services__archive.php

20 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /** AJAX: archive an Appointment Service. @package Booking Calendar */
3 if ( ! defined( 'ABSPATH' ) ) { exit; }
4
5 /**
6 * Archive one Service through the configured data provider.
7 *
8 * @return void Terminates with a JSON success or error response.
9 */
10 function wpbc_appointment_services_ajax_archive() {
11 wpbc_appointment_services_ajax_authorize(); $provider = wpbc_appointment_services_get_data_provider();
12 if ( ! is_object( $provider ) || ! method_exists( $provider, 'archive' ) ) { wpbc_appointment_services_send_provider_error( wpbc_appointment_services_storage_error(), __( 'Service storage is unavailable.', 'booking' ) ); }
13 // phpcs:ignore WordPress.Security.NonceVerification.Missing
14 $service_id = isset( $_POST['service_id'] ) ? absint( $_POST['service_id'] ) : 0;
15 $result = $service_id ? $provider->archive( $service_id ) : new WP_Error( 'invalid_service_id', __( 'A valid Service ID is required.', 'booking' ) );
16 if ( is_wp_error( $result ) || ! $result ) { wpbc_appointment_services_send_provider_error( $result, __( 'The Service could not be archived.', 'booking' ) ); }
17 wp_send_json_success( array( 'message' => __( 'Service archived.', 'booking' ) ) );
18 }
19 add_action( 'wp_ajax_WPBC_AJX_APPOINTMENT_SERVICE_ARCHIVE', 'wpbc_appointment_services_ajax_archive' );
20