PluginProbe
Booking Calendar / 11.8.3
Booking Calendar v11.8.3
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 10.11.2 All 203 releases
booking / includes / booking_modes_v3 / preflight.php

preflight.php in Booking Calendar 11.8.3, at includes/booking_modes_v3/preflight.php

85 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Side-effect-free Booking Modes V3 preflight boundary.
4 *
5 * @package Booking Calendar
6 * @since 11.8.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * Verify the complete V3 production manifest and all declarations before bootstrap.
15 *
16 * Loading validator classes is intentionally allowed here; hooks, assets, and
17 * public compatibility functions are registered only after this returns true.
18 *
19 * @return array<string,mixed> Result with ready and errors keys.
20 */
21 function wpbc_booking_modes_v3_preflight() {
22 static $result = null;
23
24 if ( null !== $result ) {
25 return $result;
26 }
27
28 $base_directory = __DIR__;
29 $required_files = array(
30 $base_directory . '/class-wpbc-booking-modes-v3-definition-validator.php',
31 $base_directory . '/class-wpbc-booking-modes-v3-definition-registry.php',
32 $base_directory . '/class-wpbc-booking-modes-v3-definition-translator.php',
33 $base_directory . '/class-wpbc-booking-modes-v3-page-registry.php',
34 $base_directory . '/class-wpbc-booking-modes-v3-compatibility-registry.php',
35 $base_directory . '/class-wpbc-booking-modes-v3-context.php',
36 $base_directory . '/class-wpbc-booking-modes-v3-storage.php',
37 $base_directory . '/class-wpbc-booking-modes-v3-source-index.php',
38 $base_directory . '/class-wpbc-booking-modes-v3-compiler.php',
39 $base_directory . '/class-wpbc-booking-modes-v3-switch-intent.php',
40 $base_directory . '/canonical-pages.php',
41 $base_directory . '/booking_modes-api.php',
42 $base_directory . '/booking_modes-navigation.php',
43 $base_directory . '/booking_modes-services.php',
44 $base_directory . '/booking_modes-setup.php',
45 $base_directory . '/booking_modes-toolbar.php',
46 $base_directory . '/booking_modes-landing.php',
47 $base_directory . '/ajax/booking_mode_switch.php',
48 $base_directory . '/ajax/booking_mode_quickstart.php',
49 $base_directory . '/quickstart/booking_modes-quickstart.php',
50 $base_directory . '/quickstart/appointment.php',
51 $base_directory . '/quickstart/rental.php',
52 $base_directory . '/_out/booking_modes.js',
53 $base_directory . '/_out/booking_modes.css',
54 $base_directory . '/_out/booking_modes-native-menu.css',
55 $base_directory . '/booking_modes.php',
56 $base_directory . '/modes/classic.php',
57 $base_directory . '/modes/appointment.php',
58 $base_directory . '/modes/rental.php',
59 );
60
61 $errors = array();
62 foreach ( $required_files as $required_file ) {
63 if ( ! is_readable( $required_file ) ) {
64 $errors[] = 'Missing or unreadable V3 component: ' . basename( $required_file );
65 }
66 }
67
68 if ( ! empty( $errors ) ) {
69 $result = array( 'ready' => false, 'errors' => $errors );
70 return $result;
71 }
72
73 require_once $base_directory . '/class-wpbc-booking-modes-v3-definition-validator.php';
74 require_once $base_directory . '/class-wpbc-booking-modes-v3-definition-registry.php';
75
76 $registry = WPBC_Booking_Modes_V3_Definition_Registry::get_instance();
77 $is_valid = $registry->load( $base_directory );
78 $result = array(
79 'ready' => $is_valid,
80 'errors' => $registry->get_errors(),
81 );
82
83 return $result;
84 }
85