PluginProbe
Booking Calendar / 11.9
Booking Calendar v11.9
11.9 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 All 205 releases
← All changes | core/wpbc-activation.php +81 -7 11.8 → 11.9 View file →
@@ -13,8 +13,59 @@
13 13
14 14 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
15 15
16 16
17 +/**
18 + * Evaluate whether the current activation starts from a genuinely empty install.
19 + *
20 + * Both signals are required. A missing version option by itself is not reliable,
21 + * because older installations or interrupted upgrades can still have Booking
22 + * Calendar tables. A missing table by itself is also insufficient when stored
23 + * installation metadata remains.
24 + *
25 + * @param mixed $stored_version Stored Booking Calendar version, or false when absent.
26 + * @param bool $booking_table_exists Whether the canonical booking table exists.
27 + *
28 + * @return bool True only when neither installation signal exists.
29 + */
30 +function wpbc_is_plugin_initial_install_state( $stored_version, $booking_table_exists ) {
31 +
32 + return ( false === $stored_version ) && ! (bool) $booking_table_exists;
33 +}
34 +
35 +
36 +/**
37 + * Check whether the active activation request is a genuine first installation.
38 + *
39 + * The result is cached before activation creates tables or saves
40 + * `booking_version_num`, allowing later activation callbacks to consume the same
41 + * immutable request-scoped decision. For later administration requests, use the
42 + * persisted first-install marker owned by the Setup Wizard instead.
43 + *
44 + * @return bool True during a genuine first-install activation; otherwise false.
45 + */
46 +function wpbc_is_plugin_initial_install() {
47 +
48 + static $is_initial_install = null;
49 +
50 + if ( null !== $is_initial_install ) {
51 + return $is_initial_install;
52 + }
53 +
54 + if ( ! function_exists( 'wpbc_is_table_exists' ) ) {
55 + $is_initial_install = false;
56 + return $is_initial_install;
57 + }
58 +
59 + $is_initial_install = wpbc_is_plugin_initial_install_state(
60 + get_option( 'booking_version_num', false ),
61 + wpbc_is_table_exists( 'booking' )
62 + );
63 +
64 + return $is_initial_install;
65 +}
66 +
67 +
17 68 /** Activation & Deactivation of Booking Calendar */
18 69 class WPBC_BookingInstall extends WPBC_Install {
19 70
20 71 /**
@@ -190,12 +241,9 @@
190 241 function wpbc_booking_activate() {
191 242
192 243 wpbc_load_translation();
193 244
194 - $is_new_install = (
195 - false === get_option( 'booking_version_num', false )
196 - && ! wpbc_is_table_exists( 'booking' )
197 - );
245 + $is_new_install = wpbc_is_plugin_initial_install();
198 246
199 247 make_bk_action( 'wpbc_before_activation' );
200 248
201 249
@@ -209,8 +257,11 @@
209 257 $default_options_to_add = wpbc_get_default_options();
210 258 // Existing installations retain their saved value; add_bk_option() never overwrites it during upgrades.
211 259 if ( $is_new_install ) {
212 260 $default_options_to_add['booking_form_accent_enabled'] = 'On';
261 + $default_options_to_add['booking_setup_wizard_initial_install'] = 'On';
262 + $default_options_to_add['booking_setup_wizard_first_run_prompt'] = 'On';
263 + $default_options_to_add['booking_setup_wizard_booking_pages_prompt'] = 'On';
213 264 if ( ! class_exists( 'wpdev_bk_personal' ) ) {
214 265 $default_options_to_add['booking_resources_catalog_default_view'] = 'publishing';
215 266 }
216 267 }
@@ -628,11 +679,16 @@
628 679
629 680 // If this option here, then system get this option from "Super Admin" options configuration for "Regular" users.
630 681 $mu_option4delete = array();
631 682
632 - // FixIn: 9.6.3.5.
633 - $default_options['booking_setup_wizard_page_steps_is_done'] = '';
634 - $mu_option4delete[]='booking_setup_wizard_page_steps_is_done';
683 + $default_options['booking_setup_wizard_initial_install'] = 'Off';
684 + $mu_option4delete[] = 'booking_setup_wizard_initial_install';
685 + $default_options['booking_setup_wizard_first_run_prompt'] = 'Off';
686 + $mu_option4delete[] = 'booking_setup_wizard_first_run_prompt';
687 + $default_options['booking_setup_wizard_booking_pages_prompt'] = 'Off';
688 + $mu_option4delete[] = 'booking_setup_wizard_booking_pages_prompt';
689 + $default_options['booking_update_navigation_context'] = array();
690 + $mu_option4delete[] = 'booking_update_navigation_context';
635 691
636 692 $default_options['booking_admin_cal_count'] = ($is_demo) ? '3' : '2';
637 693 $mu_option4delete[]='booking_admin_cal_count'; // $multiuser_general_option[] = implode( '', array_keys( array_slice( $default_options, -1 ) ) );
638 694 $default_options['booking_skin'] = '/css/skins/25_5__square_1.css'; // FixIn: 10.11.4.2.
@@ -1332,8 +1388,26 @@
1332 1388 // FixIn: 9.2.3.8.
1333 1389 $default_options['booking_super_admin_receive_regular_user_payments'] = 'Off';
1334 1390 $mu_option4delete[]='booking_super_admin_receive_regular_user_payments';
1335 1391 }
1392 +
1393 + /**
1394 + * Filters the complete Booking Calendar default-option registry.
1395 + *
1396 + * Edition modules may register missing-value defaults without placing their
1397 + * domain-specific option names in the shared Free-version implementation.
1398 + * Existing stored values continue to be preserved by the activation layer.
1399 + *
1400 + * @param array $default_options Default option names and values.
1401 + */
1402 + $default_options = apply_filters( 'wpbc_default_options', $default_options );
1403 +
1404 + /**
1405 + * Filters option names handled by the applicable MultiUser cleanup flow.
1406 + *
1407 + * @param array $mu_option4delete Option names registered for cleanup.
1408 + */
1409 + $mu_option4delete = apply_filters( 'wpbc_multiuser_options_for_delete', $mu_option4delete );
1336 1410
1337 1411
1338 1412 if ( ! $is_get_multiuser_general_options ) {
1339 1413