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
← All changes | includes/page-setup/setup__page.php +41 -23 11.311.8.3 View file →
@@ -1,4 +1,4 @@
1 1 <?php
2 2 /*
3 3 * @package: AJX_Setup_Wizard Page
4 4 * @category: Initial setup and plugin customization
@@ -28,10 +28,11 @@
28 28 require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/templates/04.bookings_types__tpl.php' );
29 29 require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/templates/04.bookings_types__action.php' );
30 30
31 31 require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/setup_steps.php' );
32 -require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/setup_ajax.php' );
33 -require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/setup_support.php' );
32 +require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/setup_ajax.php' );
33 +require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/setup_support.php' );
34 +require_once( WPBC_PLUGIN_DIR . '/includes/page-setup/first-run-popup.php' );
34 35
35 36 /** Show Content
36 37 * Update Content
37 38 * Define Slug
@@ -309,12 +310,12 @@
309 310 // Delete from DB
310 311 $is_reseted = $user_request->user_request_params__db_delete();
311 312
312 313 // Clear All Steps Mark as Undone
313 - $setup_steps = new WPBC_SETUP_WIZARD_STEPS();
314 - $setup_steps->db__set_all_steps_as( false );
315 - update_bk_option( 'booking_wizard_data', array() );
316 - wpbc_setup_wizard__set_full_screen_mode_for_current_user( false );
314 + $setup_steps = new WPBC_SETUP_WIZARD_STEPS();
315 + $setup_steps->db__set_all_steps_as( false );
316 + update_bk_option( 'booking_wizard_data', array() );
317 + wpbc_setup_wizard__set_full_screen_mode_for_current_user( true );
317 318
318 319 return true;
319 320 }
320 321
@@ -319,16 +320,21 @@
319 320 }
320 321
321 322 $setup_steps = new WPBC_SETUP_WIZARD_STEPS();
322 323 $steps_arr = $setup_steps->get_steps_arr();
323 - $request_step = '';
324 + $request_step = '';
325 +
326 + if ( 'On' === get_bk_option( 'booking_setup_wizard_page_is_completed' ) ) {
327 + // A completed wizard has no authority over the administrator's later Full Screen preference.
328 + return true;
329 + }
330 +
331 + if ( wpbc_is_setup_wizard_page() ) {
332 + wpbc_setup_wizard__set_full_screen_mode_for_current_user( true );
333 + }
334 +
335 + $is_external_setup_flow_started = $setup_steps->db__is_step_completed( 'bookings_types' );
324 336
325 - if ( 'On' === get_bk_option( 'booking_setup_wizard_page_is_completed' ) ) {
326 - wpbc_setup_wizard__set_full_screen_mode_for_current_user( false );
327 - return true;
328 - }
329 - $is_external_setup_flow_started = $setup_steps->db__is_step_completed( 'bookings_types' );
330 -
331 337 // Persist the real setup step when the user lands on an external WPBC admin page.
332 338 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
333 339 if ( isset( $_REQUEST['wpbc_setup_step'] ) ) {
334 340 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
@@ -347,18 +353,30 @@
347 353 wpbc_setup_wizard__set_full_screen_mode_for_current_user( ! wpbc_setup_wizard__is_internal_step( $detected_step ) );
348 354 }
349 355 }
350 356
351 - // Existing settings pages submit their own forms. This flag lets the setup bar remember that save across reloads.
352 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
353 - if ( isset( $_REQUEST['wpbc_setup_saved_step'] ) ) {
354 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
355 - $saved_step = sanitize_key( wp_unslash( $_REQUEST['wpbc_setup_saved_step'] ) );
356 - if ( isset( $steps_arr[ $saved_step ] ) ) {
357 - $setup_steps->db__set_step_as_saved( $saved_step, true );
358 - $setup_steps->db__save_current_step_name( $saved_step );
359 - }
360 - }
357 + $is_ajax_request = ( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX );
358 +
359 + // Existing settings pages submit their own forms. This flag lets the setup bar remember that save across reloads.
360 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
361 + if ( isset( $_REQUEST['wpbc_setup_saved_step'] ) && ! $is_ajax_request ) {
362 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
363 + $saved_step = sanitize_key( wp_unslash( $_REQUEST['wpbc_setup_saved_step'] ) );
364 + if ( isset( $steps_arr[ $saved_step ] ) ) {
365 + $setup_steps->db__set_step_as_saved( $saved_step, true );
366 + $setup_steps->db__save_current_step_name( $saved_step );
367 +
368 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
369 + $continue_after_save = isset( $_REQUEST['wpbc_setup_continue_after_save'] )
370 + // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
371 + ? sanitize_text_field( wp_unslash( $_REQUEST['wpbc_setup_continue_after_save'] ) )
372 + : '';
373 + if ( '1' === $continue_after_save ) {
374 + wpbc_redirect( $setup_steps->get_step_continue_url( $saved_step ) );
375 + exit;
376 + }
377 + }
378 + }
361 379
362 380 // Continue from an existing WPBC settings page to the next setup target.
363 381 // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing
364 382 if ( isset( $_REQUEST['wpbc_setup_wizard'] ) && 'continue' === $_REQUEST['wpbc_setup_wizard'] ) {