| @@ -17,30 +17,22 @@ | ||
| 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 | - } | |
| 33 | - | |
| 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 | - | |
| 42 | - | |
| 43 | 35 | /** |
| 44 | 36 | * Determine whether the current request uses the local beta hostname. |
| 45 | 37 | * |
| 46 | 38 | * The comparison intentionally ignores a port and one trailing DNS dot. It |
| @@ -247,9 +239,9 @@ | ||
| 247 | 239 | * Is show upgrade link. |
| 248 | 240 | * |
| 249 | 241 | * @return bool |
| 250 | 242 | */ |
| 251 | -function wpbc_is_show_up() { | |
| 243 | +function wpbc_is_show_up() { | |
| 252 | 244 | |
| 253 | 245 | // $is_show_up = get_bk_option( 'booking_wpdev_copyright_adminpanel' ); |
| 254 | 246 | // $is_show_up = ( ( 'Off' !== $is_show_up ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) ); |
| 255 | 247 | // return $is_show_up; |
| @@ -255,13 +247,29 @@ | ||
| 255 | 247 | // return $is_show_up; |
| 256 | 248 | |
| 257 | 249 | $is_show_up = ( ( 'hide' !== get_bk_option( 'booking_menu_go_pro' ) ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) ); |
| 258 | 250 | |
| 259 | - return $is_show_up; | |
| 260 | -} | |
| 261 | - | |
| 262 | - | |
| 263 | -/** | |
| 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 | +/** | |
| 264 | 272 | * Get Up link. |
| 265 | 273 | * |
| 266 | 274 | * @return string |
| 267 | 275 | */ |