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_support.php +51 -11 11.511.8.4 View file →
@@ -9,13 +9,29 @@
9 9 *
10 10 * @modified 2024-09-06
11 11 */
12 12
13 -if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14 -
15 -
16 -/**
17 - * Do we need to start 'Setup Wizard' ?
13 +if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14 +
15 +
16 +/**
17 + * Check whether this site was initialized by the current first-install flow.
18 + *
19 + * This persisted marker is intentionally separate from wizard completion and
20 + * prompt dismissal. It prevents plugin updates from adding the native Setup menu
21 + * while allowing a new administrator to postpone the popup and return through
22 + * that menu later.
23 + *
24 + * @return bool True for sites marked during genuine first installation.
25 + */
26 +function wpbc_setup_wizard_is_initial_install_site() {
27 +
28 + return 'On' === get_bk_option( 'booking_setup_wizard_initial_install' );
29 +}
30 +
31 +
32 +/**
33 + * Do we need to start 'Setup Wizard' ?
18 34 *
19 35 * @return bool
20 36 */
21 37 function wpbc_setup_wizard_page__is_need_start(){
@@ -103,22 +119,24 @@
103 119 }
104 120
105 121
106 122 /**
107 - * Check whether the current request is one explicit external Setup Wizard step.
123 + * Check whether the current request explicitly targets one Setup Wizard step.
108 124 *
109 - * The setup context flag prevents ordinary visits to the same administration
110 - * page from receiving wizard-only defaults.
125 + * This read-only request check is intentionally independent from saved wizard
126 + * completion state. It lets an authorized user follow an explicit external
127 + * setup URL without causing ordinary administration-page visits to reopen the
128 + * completed wizard.
111 129 *
112 130 * @param string $step_name Expected Setup Wizard step identifier.
113 131 *
114 - * @return bool True when the unfinished wizard explicitly requested the step.
132 + * @return bool True when the current URL explicitly requests the step.
115 133 */
116 -function wpbc_setup_wizard_page__is_active_step( $step_name ) {
134 +function wpbc_setup_wizard_page__has_explicit_step_context( $step_name ) {
117 135
118 136 $step_name = sanitize_key( (string) $step_name );
119 137
120 - if ( '' === $step_name || ! wpbc_setup_wizard_page__is_in_progress() ) {
138 + if ( '' === $step_name ) {
121 139 return false;
122 140 }
123 141
124 142 // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only UI context.
@@ -132,8 +150,30 @@
132 150 ? sanitize_key( wp_unslash( $_GET['wpbc_setup_step'] ) )
133 151 : '';
134 152
135 153 return '1' === $setup_context && $step_name === $request_step;
154 +}
155 +
156 +
157 +/**
158 + * Check whether the current request is one explicit external Setup Wizard step.
159 + *
160 + * The setup context flag prevents ordinary visits to the same administration
161 + * page from receiving wizard-only defaults.
162 + *
163 + * @param string $step_name Expected Setup Wizard step identifier.
164 + *
165 + * @return bool True when the unfinished wizard explicitly requested the step.
166 + */
167 +function wpbc_setup_wizard_page__is_active_step( $step_name ) {
168 +
169 + $step_name = sanitize_key( (string) $step_name );
170 +
171 + if ( '' === $step_name || ! wpbc_setup_wizard_page__is_in_progress() ) {
172 + return false;
173 + }
174 +
175 + return wpbc_setup_wizard_page__has_explicit_step_context( $step_name );
136 176 }
137 177
138 178 /**
139 179 * Is user can access Wizard Setup page ?