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 | includes/_functions/versions.php +49 -37 11.4.3 → 11.9 View file →
@@ -17,43 +17,39 @@
17 17 // =====================================================================================================================
18 18 // == Versions ==
19 19 // =====================================================================================================================
20 20
21 -/**
22 - * Check if this demo website
23 - *
24 - * @return bool
25 - */
26 -function wpbc_is_this_demo() {
21 +/**
22 + * Check whether the site is a managed public Booking Calendar live demo.
23 + *
24 + * This compatibility helper delegates to the shared environment policy so
25 + * legacy consumers and newer capability checks cannot classify the same host
26 + * differently.
27 + *
28 + * @return bool True for a managed public live demo.
29 + */
30 +function wpbc_is_this_demo() {
31 + return WPBC_Environment_Policy::is_live_demo();
32 +}
27 33
28 -// return true; //.
29 34
30 - if ( ! class_exists( 'wpdev_bk_personal' ) ) {
31 - return false; // If this is Booking Calendar Free version, then it's not the demo.
32 - }
35 +/**
36 + * Determine whether the current request uses the local beta hostname.
37 + *
38 + * The comparison intentionally ignores a port and one trailing DNS dot. It
39 + * does not classify beta subdomains or path names as the trusted beta host.
40 + *
41 + * @return bool True only for an HTTP Host whose normalized hostname is `beta`.
42 + */
43 +function wpbc_is_this_beta() {
44 + $http_host = isset( $_SERVER['HTTP_HOST'] ) ? wp_unslash( $_SERVER['HTTP_HOST'] ) : '';
45 + $http_host = wp_parse_url( 'http://' . ltrim( strtolower( $http_host ), '/' ), PHP_URL_HOST );
46 + $is_beta = is_string( $http_host ) && ( 'beta' === rtrim( $http_host, '.' ) );
47 +
48 + return $is_beta;
49 +}
33 50
34 - // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
35 - if ( ( ( isset( $_SERVER['SCRIPT_FILENAME'] ) ) && ( strpos( $_SERVER['SCRIPT_FILENAME'], 'wpbookingcalendar.com' ) !== false ) ) || ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( strpos( $_SERVER['HTTP_HOST'], 'wpbookingcalendar.com' ) !== false ) ) ) {
36 - return true;
37 - } else {
38 - return false;
39 - }
40 -}
41 51
42 -
43 -/**
44 - * Check if this Beta Demo website
45 - *
46 - * @return bool
47 - */
48 -function wpbc_is_this_beta() {
49 -
50 - $is_beta = ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) );
51 -
52 - return $is_beta;
53 -}
54 -
55 -
56 52 /** Get Warning Text for Demo websites */
57 53 function wpbc_get_warning_text_in_demo_mode() {
58 54 // return '<div class="wpbc-error-message wpbc_demo_test_version_warning"><strong>Warning!</strong> Demo test version does not allow changes to these items.</div>'; //Old Style
59 55 return '<div class="wpbc-settings-notice notice-warning"><strong>Warning!</strong> Demo test version does not allow changes to these items.</div>';
@@ -243,9 +239,9 @@
243 239 * Is show upgrade link.
244 240 *
245 241 * @return bool
246 242 */
247 -function wpbc_is_show_up() {
243 +function wpbc_is_show_up() {
248 244
249 245 // $is_show_up = get_bk_option( 'booking_wpdev_copyright_adminpanel' );
250 246 // $is_show_up = ( ( 'Off' !== $is_show_up ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) );
251 247 // return $is_show_up;
@@ -251,13 +247,29 @@
251 247 // return $is_show_up;
252 248
253 249 $is_show_up = ( ( 'hide' !== get_bk_option( 'booking_menu_go_pro' ) ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) );
254 250
255 - return $is_show_up;
256 -}
257 -
258 -
259 -/**
251 + return $is_show_up;
252 +}
253 +
254 +
255 +/**
256 + * Check whether Free-edition upgrade navigation may be shown.
257 + *
258 + * This combines the existing administrator preference and MultiUser policy
259 + * with the product-edition check used by Free-only upgrade actions.
260 + *
261 + * @since 11.8.0
262 + *
263 + * @return bool True when Free-edition upgrade navigation may be rendered.
264 + */
265 +function wpbc_is_show_free_upgrade() {
266 +
267 + return wpbc_is_show_up() && ! class_exists( 'wpdev_bk_personal' );
268 +}
269 +
270 +
271 +/**
260 272 * Get Up link.
261 273 *
262 274 * @return string
263 275 */