| @@ -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 |
| @@ -57,9 +58,11 @@ | ||
| 57 | 58 | public function tabs() { |
| 58 | 59 | |
| 59 | 60 | $tabs = array(); |
| 60 | 61 | $tabs[ 'step_01' ] = array( |
| 62 | + 'is_force_full_screen' => true, // true | false. Force full screen independently from user preference. | |
| 61 | 63 | 'left_navigation__default_view_mode' => 'none', // '' | 'min' | 'compact' | 'max' | 'none'. By default value is: ''. |
| 64 | + 'left_navigation__force_view_mode' => 'none', // '' | 'min' | 'compact' | 'max' | 'none'. Force sidebar mode independently from user preference. | |
| 62 | 65 | 'title' => __( 'Setup', 'booking' ) // Title of TAB |
| 63 | 66 | , 'hint' => false//__( 'Setup', 'booking' ) . ' - ' . 'Booking Calendar' // Hint |
| 64 | 67 | , 'page_title' => false//__( 'Setup', 'booking' ) . ' - ' . 'Booking Calendar' // Title of Page |
| 65 | 68 | , 'link' => '' // Can be skiped, then generated link based on Page and Tab tags. Or can be extenral link |
| @@ -307,12 +310,12 @@ | ||
| 307 | 310 | // Delete from DB |
| 308 | 311 | $is_reseted = $user_request->user_request_params__db_delete(); |
| 309 | 312 | |
| 310 | 313 | // Clear All Steps Mark as Undone |
| 311 | - $setup_steps = new WPBC_SETUP_WIZARD_STEPS(); | |
| 312 | - $setup_steps->db__set_all_steps_as( false ); | |
| 313 | - update_bk_option( 'booking_wizard_data', array() ); | |
| 314 | - 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 ); | |
| 315 | 318 | |
| 316 | 319 | return true; |
| 317 | 320 | } |
| 318 | 321 | |
| @@ -317,16 +320,21 @@ | ||
| 317 | 320 | } |
| 318 | 321 | |
| 319 | 322 | $setup_steps = new WPBC_SETUP_WIZARD_STEPS(); |
| 320 | 323 | $steps_arr = $setup_steps->get_steps_arr(); |
| 321 | - $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' ); | |
| 322 | 336 | |
| 323 | - if ( 'On' === get_bk_option( 'booking_setup_wizard_page_is_completed' ) ) { | |
| 324 | - wpbc_setup_wizard__set_full_screen_mode_for_current_user( false ); | |
| 325 | - return true; | |
| 326 | - } | |
| 327 | - $is_external_setup_flow_started = $setup_steps->db__is_step_completed( 'bookings_types' ); | |
| 328 | - | |
| 329 | 337 | // Persist the real setup step when the user lands on an external WPBC admin page. |
| 330 | 338 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 331 | 339 | if ( isset( $_REQUEST['wpbc_setup_step'] ) ) { |
| 332 | 340 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| @@ -345,18 +353,30 @@ | ||
| 345 | 353 | wpbc_setup_wizard__set_full_screen_mode_for_current_user( ! wpbc_setup_wizard__is_internal_step( $detected_step ) ); |
| 346 | 354 | } |
| 347 | 355 | } |
| 348 | 356 | |
| 349 | - // Existing settings pages submit their own forms. This flag lets the setup bar remember that save across reloads. | |
| 350 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 351 | - if ( isset( $_REQUEST['wpbc_setup_saved_step'] ) ) { | |
| 352 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing | |
| 353 | - $saved_step = sanitize_key( wp_unslash( $_REQUEST['wpbc_setup_saved_step'] ) ); | |
| 354 | - if ( isset( $steps_arr[ $saved_step ] ) ) { | |
| 355 | - $setup_steps->db__set_step_as_saved( $saved_step, true ); | |
| 356 | - $setup_steps->db__save_current_step_name( $saved_step ); | |
| 357 | - } | |
| 358 | - } | |
| 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 | + } | |
| 359 | 379 | |
| 360 | 380 | // Continue from an existing WPBC settings page to the next setup target. |
| 361 | 381 | // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing |
| 362 | 382 | if ( isset( $_REQUEST['wpbc_setup_wizard'] ) && 'continue' === $_REQUEST['wpbc_setup_wizard'] ) { |