db__is_all_steps_completed(); return $is_all_steps_completed; } /** * Check whether the Setup Wizard has started and is not yet complete. * * Explicit Setup Wizard requests count as active before the first step has * been saved. Persisted completed steps keep the wizard active while the user * visits another Booking Calendar administration page. A completed or skipped * wizard is not considered in progress. * * @return bool True while an unfinished Setup Wizard is in progress. */ function wpbc_setup_wizard_page__is_in_progress() { if ( wpbc_setup_wizard_page__is_all_steps_completed() ) { return false; } if ( function_exists( 'wpbc_is_setup_wizard_page' ) && wpbc_is_setup_wizard_page() ) { return true; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. $setup_context = isset( $_GET['wpbc_setup'] ) && is_scalar( $_GET['wpbc_setup'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. ? sanitize_text_field( wp_unslash( $_GET['wpbc_setup'] ) ) : ''; if ( '1' === $setup_context ) { return true; } $steps_is_done = get_bk_option( 'booking_setup_wizard_page_steps_is_done' ); if ( ! is_array( $steps_is_done ) ) { return false; } foreach ( $steps_is_done as $is_step_done ) { if ( ! empty( $is_step_done ) ) { return true; } } return false; } /** * Check whether the current request explicitly targets one Setup Wizard step. * * This read-only request check is intentionally independent from saved wizard * completion state. It lets an authorized user follow an explicit external * setup URL without causing ordinary administration-page visits to reopen the * completed wizard. * * @param string $step_name Expected Setup Wizard step identifier. * * @return bool True when the current URL explicitly requests the step. */ function wpbc_setup_wizard_page__has_explicit_step_context( $step_name ) { $step_name = sanitize_key( (string) $step_name ); if ( '' === $step_name ) { return false; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. $setup_context = isset( $_GET['wpbc_setup'] ) && is_scalar( $_GET['wpbc_setup'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. ? sanitize_text_field( wp_unslash( $_GET['wpbc_setup'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. $request_step = isset( $_GET['wpbc_setup_step'] ) && is_scalar( $_GET['wpbc_setup_step'] ) // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context. ? sanitize_key( wp_unslash( $_GET['wpbc_setup_step'] ) ) : ''; return '1' === $setup_context && $step_name === $request_step; } /** * Check whether the current request is one explicit external Setup Wizard step. * * The setup context flag prevents ordinary visits to the same administration * page from receiving wizard-only defaults. * * @param string $step_name Expected Setup Wizard step identifier. * * @return bool True when the unfinished wizard explicitly requested the step. */ function wpbc_setup_wizard_page__is_active_step( $step_name ) { $step_name = sanitize_key( (string) $step_name ); if ( '' === $step_name || ! wpbc_setup_wizard_page__is_in_progress() ) { return false; } return wpbc_setup_wizard_page__has_explicit_step_context( $step_name ); } /** * Is user can access Wizard Setup page ? * @return bool */ function wpbc_is_user_can_access_wizard_page() { $is_user_can_access_wizard_page = true; if ( class_exists( 'wpdev_bk_multiuser' ) ) { $real_current_user_id = get_current_user_id(); // Is current user suer booking admin and if this user was simulated log in $is_user_super_admin = apply_bk_filter( 'is_user_super_admin', $real_current_user_id ); if ( ! $is_user_super_admin ) { $is_user_can_access_wizard_page = false; } } return $is_user_can_access_wizard_page; } // ===================================================================================================================== // == Shortcodes Content == // ===================================================================================================================== /** * Get "Booking Form" Shortcode Content * * @param $resource_id * * @return false|string */ function wpbc_setup_wizard_page__get_shortcode_html( $resource_id = 1 , $is_show_only_calendar = false ) { ob_start(); $localized_js_vars_script = wpbc_get_localized_js_vars(); if ( $is_show_only_calendar ) { // Center calendar. ?>
: Availability > General Availability'; ?>
get_steps_arr() ) as $step_name ) { $navigation_menu_arr[ $step_name ] = array( 'title' => function_exists( 'wpbc_setup_wizard__get_step_title' ) ? wpbc_setup_wizard__get_step_title( $step_name ) : $step_name, 'icon' => 'wpbc_icn_circle_outline', 'class' => '', 'action' => "wpbc_ajx__setup_wizard_page__send_request_with_params( { 'current_step':'" . esc_js( $step_name ) . "' } );", ); } return $navigation_menu_arr; } /** * Show Warning Conflict with "Wordfence" plugin * * @return void */ function wpbc_maybe_show_warning_conflict__wordfence( $style = '' ) { if ( class_exists( 'wordfence' ) ) { $is_panel_visible = wpbc_is_dismissed_panel_visible( 'wpbc_show_warning_wordfence' ); // FixIn: 9.9.0.8. if ( $is_panel_visible ) { ?>
' . esc_html__('Important!' ,'booking') . ' ' ; // FixIn: 10.9.1.1. /* translators: 1: ... */ echo wp_kses_post( sprintf( __( 'We detect that you use %s plugin.', 'booking' ), 'Wordfence' ) ); echo '
'; /* translators: 1: ... */ echo wp_kses_post( sprintf( __( 'If you encounter any issues, follow this %1$stroubleshooting instruction%2$s.', 'booking' ), '', '' ) ); ?>
' ', 'hint' => __( 'Dismiss', 'booking' ), 'class' => 'wpbc_panel_get_started_dismiss', 'css' => 'background: #fff;border-radius: 7px;' )); $dismiss_x_button = ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo wpbc_replace__js_scripts__to__tpl_scripts( $dismiss_x_button ); ?>
/i'; $calendar_html_content = preg_replace( $pattern, '', $calendar_html_content ); $pattern = '/<\/script>/i'; $calendar_html_content = preg_replace( $pattern, '', $calendar_html_content ); return $calendar_html_content; }