| 1 |
<?php |
| 2 |
/** |
| 3 |
* Front-end booking form settings helpers. |
| 4 |
* |
| 5 |
* @package Booking Calendar |
| 6 |
* @since 11.2.1.1 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 13 |
if ( ! class_exists( 'WPBC_Frontend_Settings' ) ) { |
| 14 |
|
| 15 |
/** |
| 16 |
* Shared front-end settings helper. |
| 17 |
*/ |
| 18 |
class WPBC_Frontend_Settings { |
| 19 |
|
| 20 |
/** |
| 21 |
* Is the BFB feature compiled/available in this build. |
| 22 |
* |
| 23 |
* @return bool |
| 24 |
*/ |
| 25 |
public static function is_bfb_feature_available() { |
| 26 |
return ( defined( 'WPBC_NEW_FORM_BUILDER' ) && WPBC_NEW_FORM_BUILDER ); |
| 27 |
} |
| 28 |
|
| 29 |
/** |
| 30 |
* Is BFB enabled in settings. |
| 31 |
* |
| 32 |
* @param mixed $ctx Optional context for filters. |
| 33 |
* |
| 34 |
* @return bool |
| 35 |
*/ |
| 36 |
public static function is_bfb_enabled( $ctx = null ) { |
| 37 |
|
| 38 |
if ( ! self::is_bfb_feature_available() ) { |
| 39 |
return false; |
| 40 |
} |
| 41 |
|
| 42 |
$is_enabled = ( 'On' === get_bk_option( 'booking_use_bfb_form' ) ); |
| 43 |
|
| 44 |
/** |
| 45 |
* Allow forcing enable/disable externally if needed. |
| 46 |
* |
| 47 |
* @param bool $is_enabled |
| 48 |
* @param mixed $ctx |
| 49 |
*/ |
| 50 |
$is_enabled = (bool) apply_filters( 'wpbc_frontend_is_bfb_enabled', $is_enabled, $ctx ); |
| 51 |
|
| 52 |
return $is_enabled; |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
|