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
← All changes | includes/page-setup/setup_profiles.php +88 -28 11.511.8.4 View file →
@@ -28,26 +28,13 @@
28 28 return false;
29 29 }
30 30
31 31 $full_screen_value = $is_full_screen ? 'On' : 'Off';
32 - $cookie_path = ( defined( 'COOKIEPATH' ) && COOKIEPATH ) ? COOKIEPATH : '/';
33 - $cookie_domain = defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : '';
34 32
35 - if ( ! headers_sent() ) {
36 - setcookie(
37 - 'wpbc_admin_full_screen',
38 - $full_screen_value,
39 - time() + YEAR_IN_SECONDS,
40 - $cookie_path,
41 - $cookie_domain,
42 - is_ssl(),
43 - false
44 - );
33 + if ( function_exists( 'wpbc_ui__set_full_screen_mode_cookie' ) ) {
34 + wpbc_ui__set_full_screen_mode_cookie( $full_screen_value );
45 35 }
46 36
47 - // Keep cookie-aware page rendering deterministic during the current request.
48 - $_COOKIE['wpbc_admin_full_screen'] = $full_screen_value;
49 -
50 37 return update_user_option(
51 38 $user_id,
52 39 'booking_custom_is_full_screen',
53 40 array( 'value' => $full_screen_value )
@@ -307,9 +294,29 @@
307 294 $profile = ( null === $profile ) ? wpbc_setup_wizard__get_selected_profile() : $profile;
308 295 $mode_id = wpbc_setup_wizard__get_selected_mode_id();
309 296 $route_map = wpbc_setup_wizard__get_profile_route_map();
310 297
311 - if ( 'appointment' === $mode_id ) {
298 + /**
299 + * Filter whether Setup temporarily ends with a Form Builder handoff.
300 + *
301 + * The compact route keeps the four introductory screens and uses Form
302 + * Builder as the fifth and final destination. Returning false restores the
303 + * longer mode-aware route while it remains available for compatibility.
304 + *
305 + * @param bool $is_enabled Whether the compact Form Builder handoff is enabled.
306 + * @param string $mode_id Active administration mode.
307 + * @param string $profile Selected booking behavior profile.
308 + */
309 + $is_compact_form_builder_handoff = (bool) apply_filters(
310 + 'wpbc_setup_wizard_compact_form_builder_handoff_enabled',
311 + true,
312 + $mode_id,
313 + $profile
314 + );
315 +
316 + if ( $is_compact_form_builder_handoff ) {
317 + $route = array( 'form_structure' );
318 + } elseif ( 'appointment' === $mode_id ) {
312 319 $route = array(
313 320 'service_provider',
314 321 'working_time',
315 322 'date_availability',
@@ -621,9 +628,9 @@
621 628 return __( 'Open a published Property booking page to test the Rental flow. If no page is listed, run Rental QuickStart or publish the booking form first.', 'booking' );
622 629 }
623 630
624 631 if ( 'date_availability' === $step_name && 'appointment' === $mode_id ) {
625 - return __( 'Use the canonical Days Availability calendar to block holidays, leave, and other Provider-specific exceptions.', 'booking' );
632 + return __( 'Use the Block Dates calendar to block holidays, leave, and other Provider-specific exceptions.', 'booking' );
626 633 }
627 634
628 635 $step_descriptions = array(
629 636 'welcome' => __( 'Begin the guided setup. You can leave the wizard at any time and continue later from the setup bar.', 'booking' ),
@@ -655,16 +662,9 @@
655 662 *
656 663 * @return array
657 664 */
658 665 function wpbc_setup_wizard__get_step_ui_matrix() {
659 - $publish_step_ui = array(
660 - 'save_behavior' => 'link_only',
661 - 'target_selector' => '.ui_group__publish_btn, .wpbc_resource_field__publish, .wpbc_resource_publish, .wpbc_publish_resources, [data-wpbc-resource-publish]',
662 - 'scroll_selector' => '.ui_group__publish_btn:visible, .wpbc_resource_field__publish:visible, .wpbc_resource_publish:visible, .wpbc_publish_resources:visible, [data-wpbc-resource-publish]:visible',
663 - 'highlight_selector' => '.ui_group__publish_btn:visible, .wpbc_resource_field__publish:visible, .wpbc_resource_publish:visible, .wpbc_publish_resources:visible, [data-wpbc-resource-publish]:visible',
664 - 'highlight_all' => '1',
665 - 'open_action' => 'publish_area',
666 - );
666 + $publish_step_ui = wpbc_setup_wizard__get_publish_step_ui();
667 667 $time_slots_step_ui = array(
668 668 'save_behavior' => 'link_only',
669 669 'target_selector' => '.wpbc_admin_page__tab__time_slots_availability, .wpbc_ts_page',
670 670 'scroll_selector' => '.wpbc_admin_page__tab__time_slots_availability:visible, .wpbc_ts_page:visible',
@@ -774,8 +774,58 @@
774 774 );
775 775 }
776 776
777 777 /**
778 + * Determine whether Setup Wizard publishing should use the shared Resource catalog.
779 + *
780 + * The compatibility resolver remains authoritative so an older paid edition,
781 + * the temporary legacy preference, or the support rollback constant keeps the
782 + * wizard connected to the released legacy Resources renderer.
783 + *
784 + * @return bool True when the new Resource catalog is the effective renderer.
785 + */
786 +function wpbc_setup_wizard__uses_new_resources_catalog() {
787 + return function_exists( 'wpbc_booking_resources_catalog_should_use_new_renderer' )
788 + && wpbc_booking_resources_catalog_should_use_new_renderer();
789 +}
790 +
791 +/**
792 + * Get the renderer-aware Setup Wizard publishing integration.
793 + *
794 + * The new catalog is opened through its domain action event after the initial
795 + * AJAX response. The legacy selectors are intentionally retained unchanged
796 + * while the compatibility renderer remains available in Booking Calendar 11.6.
797 + *
798 + * @param bool|null $use_new_catalog Optional renderer override for deterministic tests. Null uses the effective compatibility resolver.
799 + *
800 + * @return array<string,string> Setup bar selector and action configuration.
801 + */
802 +function wpbc_setup_wizard__get_publish_step_ui( $use_new_catalog = null ) {
803 + if ( null === $use_new_catalog ) {
804 + $use_new_catalog = wpbc_setup_wizard__uses_new_resources_catalog();
805 + }
806 +
807 + if ( true === $use_new_catalog ) {
808 + return array(
809 + 'save_behavior' => 'link_only',
810 + 'target_selector' => '#wpbc_catalog_booking_resources',
811 + 'scroll_selector' => '#wpbc_catalog_booking_resources:visible',
812 + 'highlight_disabled' => '1',
813 + 'open_action' => 'catalog_publish',
814 + );
815 + }
816 +
817 + return array(
818 + 'save_behavior' => 'link_only',
819 + 'target_selector' => '.ui_group__publish_btn, .wpbc_resource_field__publish, .wpbc_resource_publish, .wpbc_publish_resources, [data-wpbc-resource-publish]',
820 + 'scroll_selector' => '.ui_group__publish_btn:visible, .wpbc_resource_field__publish:visible, .wpbc_resource_publish:visible, .wpbc_publish_resources:visible, [data-wpbc-resource-publish]:visible',
821 + 'highlight_selector' => '.ui_group__publish_btn:visible, .wpbc_resource_field__publish:visible, .wpbc_resource_publish:visible, .wpbc_publish_resources:visible, [data-wpbc-resource-publish]:visible',
822 + 'highlight_all' => '1',
823 + 'open_action' => 'publish_area',
824 + );
825 +}
826 +
827 +/**
778 828 * Get one UI integration value from the external setup step matrix.
779 829 *
780 830 * @param string $step_name Step name.
781 831 * @param string $key Matrix key.
@@ -986,8 +1036,9 @@
986 1036 *
987 1037 * @return string
988 1038 */
989 1039 function wpbc_setup_wizard__get_step_target_url( $step_name ) {
1040 + $target_fragment = '';
990 1041
991 1042 if ( wpbc_setup_wizard__is_internal_step( $step_name ) ) {
992 1043 return add_query_arg( 'current_step', $step_name, wpbc_get_setup_wizard_page_url() );
993 1044 }
@@ -1059,11 +1110,14 @@
1059 1110 $url = function_exists( 'wpbc_booking_modes_get_canonical_page_url' )
1060 1111 ? wpbc_booking_modes_get_canonical_page_url( 'wpbc-resources__resources' )
1061 1112 : '';
1062 1113 if ( empty( $url ) ) {
1063 - $url = add_query_arg( 'tab', 'resources', wpbc_get_resources_url() );
1114 + $url = wpbc_get_resources_url();
1064 1115 }
1065 - $url .= '#wpbc_booking_resource_table';
1116 + $url = add_query_arg( 'tab', 'resources', $url );
1117 + $target_fragment = wpbc_setup_wizard__uses_new_resources_catalog()
1118 + ? 'wpbc_catalog_booking_resources'
1119 + : 'wpbc_booking_resource_table';
1066 1120 break;
1067 1121
1068 1122 case 'get_started':
1069 1123 $url = wpbc_get_bookings_url() . '&tab=vm_booking_listing';
@@ -1073,9 +1127,15 @@
1073 1127 $url = wpbc_get_setup_wizard_page_url();
1074 1128 break;
1075 1129 }
1076 1130
1077 - return wpbc_setup_wizard__add_setup_context_to_url( $url, $step_name );
1131 + $url = wpbc_setup_wizard__add_setup_context_to_url( $url, $step_name );
1132 +
1133 + if ( ! empty( $target_fragment ) ) {
1134 + $url .= '#' . $target_fragment;
1135 + }
1136 +
1137 + return $url;
1078 1138 }
1079 1139
1080 1140 /**
1081 1141 * Get URL that completes an external setup step and redirects to the next mapped step.