| @@ -25,10 +25,127 @@ | ||
| 25 | 25 | require_once WPBC_PLUGIN_DIR . '/core/wpbc-debug.php'; // Debug = Package: WPBC =. |
| 26 | 26 | require_once WPBC_PLUGIN_DIR . '/core/wpbc-core.php'; // Core. |
| 27 | 27 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/feature-flags.php'; // Release gates for functionality under development. |
| 28 | 28 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/starter-assets.php'; // Local or remote starter-image URLs. |
| 29 | -require_once WPBC_PLUGIN_DIR . '/includes/booking_modes/booking_modes.php'; // Administration presentation modes. | |
| 30 | 29 | |
| 30 | +/** | |
| 31 | + * Register a fail-closed diagnostic when no complete booking-mode engine exists. | |
| 32 | + * | |
| 33 | + * The production package contains one booking-mode engine. An incomplete V3 | |
| 34 | + * package must stop before registering partial navigation, services, or assets. | |
| 35 | + * Translation remains inside the later notice callback so this early bootstrap | |
| 36 | + * does not load the text domain prematurely. | |
| 37 | + * | |
| 38 | + * @param array<int,string> $errors Preflight or package-integrity errors. | |
| 39 | + * | |
| 40 | + * @return void | |
| 41 | + */ | |
| 42 | +function wpbc_booking_modes_register_missing_engine_diagnostic( $errors ) { | |
| 43 | + $GLOBALS['wpbc_booking_modes_missing_engine_errors'] = is_array( $errors ) ? $errors : array(); | |
| 44 | + add_action( 'admin_notices', 'wpbc_booking_modes_render_missing_engine_diagnostic' ); | |
| 45 | +} | |
| 46 | + | |
| 47 | +/** | |
| 48 | + * Render the administrator-only missing-engine package diagnostic. | |
| 49 | + * | |
| 50 | + * @return void | |
| 51 | + */ | |
| 52 | +function wpbc_booking_modes_render_missing_engine_diagnostic() { | |
| 53 | + if ( ! current_user_can( 'activate_plugins' ) ) { | |
| 54 | + return; | |
| 55 | + } | |
| 56 | + | |
| 57 | + $errors = isset( $GLOBALS['wpbc_booking_modes_missing_engine_errors'] ) && is_array( $GLOBALS['wpbc_booking_modes_missing_engine_errors'] ) | |
| 58 | + ? $GLOBALS['wpbc_booking_modes_missing_engine_errors'] | |
| 59 | + : array(); | |
| 60 | + ?> | |
| 61 | + <div class="notice notice-error"> | |
| 62 | + <p><strong><?php esc_html_e( 'Booking Calendar could not start a complete booking-mode engine. Restore a complete plugin package before using Booking Calendar administration pages.', 'booking' ); ?></strong></p> | |
| 63 | + <?php if ( ! empty( $errors ) ) : ?> | |
| 64 | + <ul> | |
| 65 | + <?php foreach ( array_slice( $errors, 0, 10 ) as $error_message ) : ?> | |
| 66 | + <li><?php echo esc_html( $error_message ); ?></li> | |
| 67 | + <?php endforeach; ?> | |
| 68 | + </ul> | |
| 69 | + <?php endif; ?> | |
| 70 | + </div> | |
| 71 | + <?php | |
| 72 | +} | |
| 73 | + | |
| 74 | +/** | |
| 75 | + * Register a migration notice for the removed development engine selector. | |
| 76 | + * | |
| 77 | + * The constant is intentionally ignored after cutover. Keeping a late notice | |
| 78 | + * gives administrators an actionable upgrade path without loading translations | |
| 79 | + * during the early plugin bootstrap. | |
| 80 | + * | |
| 81 | + * @return void | |
| 82 | + */ | |
| 83 | +function wpbc_booking_modes_register_obsolete_selector_diagnostic() { | |
| 84 | + add_action( 'admin_notices', 'wpbc_booking_modes_render_obsolete_selector_diagnostic' ); | |
| 85 | +} | |
| 86 | + | |
| 87 | +/** | |
| 88 | + * Render the administrator-only obsolete-selector migration notice. | |
| 89 | + * | |
| 90 | + * @return void | |
| 91 | + */ | |
| 92 | +function wpbc_booking_modes_render_obsolete_selector_diagnostic() { | |
| 93 | + if ( ! current_user_can( 'activate_plugins' ) ) { | |
| 94 | + return; | |
| 95 | + } | |
| 96 | + ?> | |
| 97 | + <div class="notice notice-warning is-dismissible"> | |
| 98 | + <p><?php esc_html_e( 'Booking Calendar V3 is now the production booking-mode engine. Remove the obsolete WPBC_BOOKING_MODE constant from your configuration.', 'booking' ); ?></p> | |
| 99 | + </div> | |
| 100 | + <?php | |
| 101 | +} | |
| 102 | + | |
| 103 | +if ( defined( 'WPBC_BOOKING_MODE' ) ) { | |
| 104 | + wpbc_booking_modes_register_obsolete_selector_diagnostic(); | |
| 105 | +} | |
| 106 | + | |
| 107 | +$wpbc_booking_modes_v3_preflight_file = WPBC_PLUGIN_DIR . '/includes/booking_modes_v3/preflight.php'; | |
| 108 | +$wpbc_booking_modes_v3_result = array( | |
| 109 | + 'ready' => false, | |
| 110 | + 'errors' => array(), | |
| 111 | +); | |
| 112 | + | |
| 113 | +if ( is_readable( $wpbc_booking_modes_v3_preflight_file ) ) { | |
| 114 | + require_once $wpbc_booking_modes_v3_preflight_file; | |
| 115 | + $wpbc_booking_modes_v3_result = wpbc_booking_modes_v3_preflight(); | |
| 116 | +} else { | |
| 117 | + $wpbc_booking_modes_v3_result['errors'][] = 'Missing or unreadable V3 component: preflight.php'; | |
| 118 | +} | |
| 119 | + | |
| 120 | +if ( ! empty( $wpbc_booking_modes_v3_result['ready'] ) ) { | |
| 121 | + if ( ! defined( 'WPBC_BOOKING_MODES_ACTIVE_ENGINE' ) ) { | |
| 122 | + define( 'WPBC_BOOKING_MODES_ACTIVE_ENGINE', 'v3' ); | |
| 123 | + } | |
| 124 | + require_once WPBC_PLUGIN_DIR . '/includes/booking_modes_v3/booking_modes.php'; | |
| 125 | +} else { | |
| 126 | + if ( ! defined( 'WPBC_BOOKING_MODES_ACTIVE_ENGINE' ) ) { | |
| 127 | + define( 'WPBC_BOOKING_MODES_ACTIVE_ENGINE', 'none' ); | |
| 128 | + } | |
| 129 | + | |
| 130 | + $wpbc_booking_modes_missing_engine_errors = isset( $wpbc_booking_modes_v3_result['errors'] ) && is_array( $wpbc_booking_modes_v3_result['errors'] ) | |
| 131 | + ? $wpbc_booking_modes_v3_result['errors'] | |
| 132 | + : array(); | |
| 133 | + wpbc_booking_modes_register_missing_engine_diagnostic( $wpbc_booking_modes_missing_engine_errors ); | |
| 134 | + | |
| 135 | + unset( | |
| 136 | + $wpbc_booking_modes_v3_preflight_file, | |
| 137 | + $wpbc_booking_modes_v3_result, | |
| 138 | + $wpbc_booking_modes_missing_engine_errors | |
| 139 | + ); | |
| 140 | + return; | |
| 141 | +} | |
| 142 | + | |
| 143 | +unset( | |
| 144 | + $wpbc_booking_modes_v3_preflight_file, | |
| 145 | + $wpbc_booking_modes_v3_result | |
| 146 | +); | |
| 147 | + | |
| 31 | 148 | require_once WPBC_PLUGIN_DIR . '/core/any/class-css-js.php'; // Abstract. Loading CSS & JS files = Package: Any =. |
| 32 | 149 | require_once WPBC_PLUGIN_DIR . '/core/any/class-admin-settings-api.php'; // Abstract. Settings API. |
| 33 | 150 | |
| 34 | 151 | require_once WPBC_PLUGIN_DIR . '/includes/ui_settings/class-settings-page-parts.php'; // Settings Template - "Settins Parts", which used in the class-page-structure.php . |
| @@ -90,9 +207,11 @@ | ||
| 90 | 207 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/booking_data__get.php'; // Booking details | replace / fields functions. |
| 91 | 208 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/simple_html_tags.php'; // Simple HTML Tags - Custom Shortcodes. |
| 92 | 209 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/admin_menu_url.php'; // Admin Menu Pages & URLs. |
| 93 | 210 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/admin_top_bar.php'; // Admin Top Bar. |
| 211 | +require_once WPBC_PLUGIN_DIR . '/includes/_functions/admin-cost-correction.php'; // Shared Add Booking and Add Appointment exact-total control. | |
| 94 | 212 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/news_version.php'; // News, Version. |
| 213 | +require_once WPBC_PLUGIN_DIR . '/includes/_functions/class-wpbc-environment-policy.php'; // Shared environment identity and capability policy. | |
| 95 | 214 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/versions.php'; // Versions. |
| 96 | 215 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/booking-resources-catalog-compatibility.php'; // Temporary 11.6 Resources catalog compatibility. |
| 97 | 216 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/sanitizing.php'; // Sanitizing. |
| 98 | 217 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/request.php'; // Class for sanitizing $_REQUEST parameters and saving or getting it from DB // FixIn: 9.3.1.2. |
| @@ -102,9 +221,9 @@ | ||
| 102 | 221 | require_once WPBC_PLUGIN_DIR . '/includes/_functions/calendar_scripts.php'; // Calendar Scripts. |
| 103 | 222 | |
| 104 | 223 | require_once WPBC_PLUGIN_DIR . '/core/wpbc_functions.php'; // Functions. |
| 105 | 224 | require_once WPBC_PLUGIN_DIR . '/core/wpbc_functions_dates.php'; // Function Dates New in 9.8. |
| 106 | -require_once WPBC_PLUGIN_DIR . '/includes/_front_end/class-fe-booking-context.php'; // Signed Classic shortcode context for AJAX availability and booking requests. | |
| 225 | +require_once WPBC_PLUGIN_DIR . '/includes/_front_end/class-fe-booking-context.php'; // Signed native Booking Form context for AJAX availability and booking requests. | |
| 107 | 226 | require_once WPBC_PLUGIN_DIR . '/core/form_parser.php'; // Parser for booking form New in 9.8. |
| 108 | 227 | require_once WPBC_PLUGIN_DIR . '/core/wpbc-dates.php'; // Dates. |
| 109 | 228 | require_once WPBC_PLUGIN_DIR . '/includes/_front_end/date-hints.php'; // Front-end date hints for Free. // FixIn: 10.15.6.2. |
| 110 | 229 | require_once WPBC_PLUGIN_DIR . '/core/wpbc_welcome.php'; // Welcome Panel Functions. |
| @@ -118,8 +237,9 @@ | ||
| 118 | 237 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/capacity.php'; // Get Dates from DB - Capacity, Availability and more ... |
| 119 | 238 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/get_times_fields.php'; // Get Times Fields options from Booking Form. |
| 120 | 239 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/aggregate.php'; // Aggregate functions for 'aggregate' parameter in shortcode. |
| 121 | 240 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/where_to_save.php'; // Check where to save booking. |
| 241 | +require_once WPBC_PLUGIN_DIR . '/includes/_capacity/booking_availability_guard.php'; // Serialize final availability validation and booking persistence on supported databases. | |
| 122 | 242 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/create_booking.php'; // Functions to create new bookings. |
| 123 | 243 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/confirmation.php'; // Confirmation section - get data. |
| 124 | 244 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/confirmation_page.php'; // Confirmation Page. |
| 125 | 245 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/calendar_load.php'; // Scripts to load calendar. |
| @@ -125,31 +245,9 @@ | ||
| 125 | 245 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/calendar_load.php'; // Scripts to load calendar. |
| 126 | 246 | require_once WPBC_PLUGIN_DIR . '/includes/_capacity/captcha_simple_text.php'; // Simple text captcha checking. |
| 127 | 247 | |
| 128 | 248 | require_once WPBC_PLUGIN_DIR . '/core/wpbc-translation.php'; // Translation, must be loaded after '/core/wpbc-core.php', because there defined add_bk_filter(), etc... |
| 129 | -// FixIn: 8.9.4.12. | |
| 130 | -if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations.php' ) ) { | |
| 131 | 249 | |
| 132 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations.php'; // All Translation Terms. | |
| 133 | - | |
| 134 | - // FixIn: 8.7.3.6. | |
| 135 | - if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations1.php' ) ) { | |
| 136 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations1.php'; | |
| 137 | - } | |
| 138 | - if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations2.php' ) ) { | |
| 139 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations2.php'; | |
| 140 | - } | |
| 141 | - if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations3.php' ) ) { | |
| 142 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations3.php'; | |
| 143 | - } | |
| 144 | - if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations4.php' ) ) { | |
| 145 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations4.php'; | |
| 146 | - } | |
| 147 | - if ( file_exists( WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations5.php' ) ) { | |
| 148 | - require_once WPBC_PLUGIN_DIR . '/core/lang/wpbc_all_translations5.php'; | |
| 149 | - } | |
| 150 | -} | |
| 151 | - | |
| 152 | 250 | require_once WPBC_PLUGIN_DIR . '/core/wpbc-frontend-messages.php'; // Visitor-facing form messages and multilingual overrides. |
| 153 | 251 | |
| 154 | 252 | require_once WPBC_PLUGIN_DIR . '/includes/publish/class-wpbc-booking-form-publisher.php'; // Neutral Booking Form page publishing service. |
| 155 | 253 | require_once WPBC_PLUGIN_DIR . '/includes/publish/wpbc-create-pages.php'; // Create pages for different purposes // FixIn: 9.6.2.10. |
| @@ -219,9 +317,12 @@ | ||
| 219 | 317 | |
| 220 | 318 | // Domain-neutral template-driven catalog mechanics shared by all registered catalogs. |
| 221 | 319 | require_once WPBC_PLUGIN_DIR . '/includes/_shared-ui-catalog/wpbc-ui-catalog.php'; |
| 222 | 320 | |
| 223 | -if ( wpbc_is_11_6_features_enabled() && wpbc_is_11_6_catalog_v2_enabled() ) { | |
| 321 | +// Reusable Booking Resources read/create domain used by production workflows. | |
| 322 | +require_once WPBC_PLUGIN_DIR . '/includes/page-catalog-booking-resources/booking-resources-domain.php'; | |
| 323 | + | |
| 324 | +if ( wpbc_is_11_6_features_enabled() ) { | |
| 224 | 325 | // Independent template-driven Booking Resources catalog. |
| 225 | 326 | require_once WPBC_PLUGIN_DIR . '/includes/page-catalog-booking-resources/booking-resources-catalog.php'; |
| 226 | 327 | } |
| 227 | 328 | |
| @@ -299,10 +400,10 @@ | ||
| 299 | 400 | require_once WPBC_PLUGIN_DIR . '/includes/page-settings-messages/settings_messages__page.php'; // Visitor-facing Form Messages settings. |
| 300 | 401 | require_once WPBC_PLUGIN_DIR . '/includes/page-settings-messages/ajax/settings_messages__save.php'; |
| 301 | 402 | |
| 302 | 403 | // Booking > Setup page // FixIn: 10.2.0.1. |
| 303 | -// FixIn: 9.8.0.2. | |
| 304 | -require_once WPBC_PLUGIN_DIR . '/includes/page-setup/setup__page.php'; | |
| 404 | +require_once WPBC_PLUGIN_DIR . '/includes/page-setup-wizard/first-run-launcher/class-wpbc-setup-wizard-first-install-state.php'; | |
| 405 | +require_once WPBC_PLUGIN_DIR . '/includes/page-setup-wizard/setup-wizard.php'; | |
| 305 | 406 | require_once WPBC_PLUGIN_DIR . '/includes/_tour/wpbc_tour.php'; // FixIn: 10.4.0.1. |
| 306 | 407 | |
| 307 | 408 | |
| 308 | 409 | require_once WPBC_PLUGIN_DIR . '/includes/_feedback/feedback.php'; // FixIn: 9.2.3.6. |