| @@ -1,4 +1,4 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * @version 1.0 |
| 4 | 4 | * @package Booking Calendar |
| @@ -20,9 +20,36 @@ | ||
| 20 | 20 | // --------------------------------------------------------------------------------------------------------------------- |
| 21 | 21 | // Internal plugin action hooks system |
| 22 | 22 | // --------------------------------------------------------------------------------------------------------------------- |
| 23 | 23 | // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 24 | -global $wpbc_bk_action, $wpbc_bk_filter; | |
| 24 | +global $wpbc_bk_action, $wpbc_bk_filter; | |
| 25 | + | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Mark whether destructive Booking Calendar deactivation is running in this request. | |
| 29 | + * | |
| 30 | + * WordPress cannot unload plugin PHP after deactivate_plugins() is called. This | |
| 31 | + * state lets already-loaded Pro and MultiUser callbacks avoid using deleted data. | |
| 32 | + * | |
| 33 | + * @param bool $is_deactivating Whether deactivation is in progress. | |
| 34 | + */ | |
| 35 | +function wpbc_set_plugin_deactivation_state( $is_deactivating ) { | |
| 36 | + global $wpbc_plugin_deactivation_in_progress; | |
| 37 | + | |
| 38 | + $wpbc_plugin_deactivation_in_progress = (bool) $is_deactivating; | |
| 39 | +} | |
| 40 | + | |
| 41 | + | |
| 42 | +/** | |
| 43 | + * Check whether destructive Booking Calendar deactivation is running. | |
| 44 | + * | |
| 45 | + * @return bool | |
| 46 | + */ | |
| 47 | +function wpbc_is_plugin_deactivation_in_progress() { | |
| 48 | + global $wpbc_plugin_deactivation_in_progress; | |
| 49 | + | |
| 50 | + return ! empty( $wpbc_plugin_deactivation_in_progress ); | |
| 51 | +} | |
| 25 | 52 | |
| 26 | 53 | |
| 27 | 54 | function add_bk_filter( $filter_type, $filter ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 28 | 55 | global $wpbc_bk_filter; |