PluginProbe
Booking Calendar / 11.8.4
Booking Calendar v11.8.4
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 10.11 All 204 releases
booking / includes / booking_modes_v3 / booking_modes-services.php

booking_modes-services.php in Booking Calendar 11.8.4, at includes/booking_modes_v3/booking_modes-services.php

89 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Request-scoped shared-service loader for Booking Modes V3.
4 *
5 * @package Booking Calendar
6 * @since 11.8.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Read one scalar bootstrap request value without building cached mode context.
15 *
16 * The loader runs before paid page contributors attach their filters. Reading
17 * raw routing keys here avoids freezing the public context or mode registries
18 * before those contributors have loaded.
19 *
20 * @param string $request_key Request parameter name.
21 *
22 * @return string Sanitized request identifier, or an empty string.
23 */
24 function wpbc_booking_modes_v3_get_bootstrap_request_key( $request_key ) {
25 if ( ! isset( $_REQUEST[ $request_key ] ) || ! is_scalar( $_REQUEST[ $request_key ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only request routing.
26 return '';
27 }
28
29 return sanitize_key( wp_unslash( $_REQUEST[ $request_key ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only request routing.
30 }
31
32 if ( ! is_admin() ) {
33 return;
34 }
35
36 $wpbc_booking_modes_v3_page = wpbc_booking_modes_v3_get_bootstrap_request_key( 'page' );
37 $wpbc_booking_modes_v3_action = wpbc_booking_modes_v3_get_bootstrap_request_key( 'action' );
38 $wpbc_booking_modes_v3_is_wpbc_page = 0 === strpos( $wpbc_booking_modes_v3_page, 'wpbc' );
39 $wpbc_booking_modes_v3_is_setup_request = 'wpbc_ajx_setup_wizard_page' === $wpbc_booking_modes_v3_action;
40 $wpbc_booking_modes_v3_is_switch_request = 'wpbc_ajx_booking_mode_switch' === $wpbc_booking_modes_v3_action;
41 $wpbc_booking_modes_v3_is_quickstart = 'wpbc_ajx_booking_mode_quickstart' === $wpbc_booking_modes_v3_action;
42 $wpbc_booking_modes_v3_is_landing_request = $wpbc_booking_modes_v3_is_wpbc_page
43 && '1' === wpbc_booking_modes_v3_get_bootstrap_request_key( 'wpbc_booking_mode_landing' );
44
45 // Setup remains available when the presentation boundary is disabled, matching V1.
46 if ( ( $wpbc_booking_modes_v3_is_wpbc_page && ! $wpbc_booking_modes_v3_is_landing_request ) || $wpbc_booking_modes_v3_is_setup_request ) {
47 require_once __DIR__ . '/booking_modes-setup.php';
48 }
49
50 if ( ! wpbc_booking_modes_is_navigation_boundary_enabled() ) {
51 return;
52 }
53
54 if ( ( $wpbc_booking_modes_v3_is_wpbc_page && ! $wpbc_booking_modes_v3_is_landing_request ) || $wpbc_booking_modes_v3_is_quickstart ) {
55 require_once __DIR__ . '/quickstart/booking_modes-quickstart.php';
56 }
57
58 if ( $wpbc_booking_modes_v3_is_wpbc_page && ! $wpbc_booking_modes_v3_is_landing_request ) {
59 require_once __DIR__ . '/booking_modes-toolbar.php';
60 }
61
62 if ( $wpbc_booking_modes_v3_is_switch_request || $wpbc_booking_modes_v3_is_landing_request ) {
63 require_once __DIR__ . '/class-wpbc-booking-modes-v3-switch-intent.php';
64 }
65
66 if ( $wpbc_booking_modes_v3_is_switch_request ) {
67 require_once __DIR__ . '/ajax/booking_mode_switch.php';
68 }
69
70 if ( $wpbc_booking_modes_v3_is_landing_request ) {
71 require_once __DIR__ . '/booking_modes-landing.php';
72 }
73
74 if ( $wpbc_booking_modes_v3_is_quickstart ) {
75 require_once __DIR__ . '/quickstart/appointment.php';
76 require_once __DIR__ . '/quickstart/rental.php';
77 require_once __DIR__ . '/ajax/booking_mode_quickstart.php';
78 }
79
80 unset(
81 $wpbc_booking_modes_v3_page,
82 $wpbc_booking_modes_v3_action,
83 $wpbc_booking_modes_v3_is_wpbc_page,
84 $wpbc_booking_modes_v3_is_setup_request,
85 $wpbc_booking_modes_v3_is_switch_request,
86 $wpbc_booking_modes_v3_is_quickstart,
87 $wpbc_booking_modes_v3_is_landing_request
88 );
89