| @@ -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; |
| @@ -160,8 +187,18 @@ | ||
| 160 | 187 | |
| 161 | 188 | |
| 162 | 189 | function get_bk_option( $option, $default = false ) { // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound |
| 163 | 190 | |
| 191 | + global $wpbc__skip_get_bk_options; | |
| 192 | + | |
| 193 | + if ( | |
| 194 | + ! empty( $wpbc__skip_get_bk_options ) | |
| 195 | + && is_array( $wpbc__skip_get_bk_options ) | |
| 196 | + && in_array( $option, $wpbc__skip_get_bk_options, true ) | |
| 197 | + ) { | |
| 198 | + return $default; | |
| 199 | + } | |
| 200 | + | |
| 164 | 201 | $u_value = apply_bk_filter( 'wpdev_bk_get_option', 'no-values', $option, $default ); |
| 165 | 202 | if ( 'no-values' !== $u_value ) { |
| 166 | 203 | return $u_value; |
| 167 | 204 | } |
| @@ -282,5 +319,5 @@ | ||
| 282 | 319 | } |
| 283 | 320 | } |
| 284 | 321 | |
| 285 | 322 | return $exist_booking_option_arr; |
| 286 | -} | |
| 323 | +} | |