| @@ -39,21 +39,25 @@ | ||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | -/** | |
| 44 | - * Check if this Beta Demo website | |
| 45 | - * | |
| 46 | - * @return bool | |
| 47 | - */ | |
| 48 | -function wpbc_is_this_beta() { | |
| 43 | +/** | |
| 44 | + * Determine whether the current request uses the local beta hostname. | |
| 45 | + * | |
| 46 | + * The comparison intentionally ignores a port and one trailing DNS dot. It | |
| 47 | + * does not classify beta subdomains or path names as the trusted beta host. | |
| 48 | + * | |
| 49 | + * @return bool True only for an HTTP Host whose normalized hostname is `beta`. | |
| 50 | + */ | |
| 51 | +function wpbc_is_this_beta() { | |
| 52 | + $http_host = isset( $_SERVER['HTTP_HOST'] ) ? wp_unslash( $_SERVER['HTTP_HOST'] ) : ''; | |
| 53 | + $http_host = wp_parse_url( 'http://' . ltrim( strtolower( $http_host ), '/' ), PHP_URL_HOST ); | |
| 54 | + $is_beta = is_string( $http_host ) && ( 'beta' === rtrim( $http_host, '.' ) ); | |
| 55 | + | |
| 56 | + return $is_beta; | |
| 57 | +} | |
| 49 | 58 | |
| 50 | - $is_beta = ( ( isset( $_SERVER['HTTP_HOST'] ) ) && ( 'beta' === $_SERVER['HTTP_HOST'] ) ); | |
| 51 | 59 | |
| 52 | - return $is_beta; | |
| 53 | -} | |
| 54 | - | |
| 55 | - | |
| 56 | 60 | /** Get Warning Text for Demo websites */ |
| 57 | 61 | function wpbc_get_warning_text_in_demo_mode() { |
| 58 | 62 | // 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 | 63 | return '<div class="wpbc-settings-notice notice-warning"><strong>Warning!</strong> Demo test version does not allow changes to these items.</div>'; |
| @@ -243,9 +247,9 @@ | ||
| 243 | 247 | * Is show upgrade link. |
| 244 | 248 | * |
| 245 | 249 | * @return bool |
| 246 | 250 | */ |
| 247 | -function wpbc_is_show_up() { | |
| 251 | +function wpbc_is_show_up() { | |
| 248 | 252 | |
| 249 | 253 | // $is_show_up = get_bk_option( 'booking_wpdev_copyright_adminpanel' ); |
| 250 | 254 | // $is_show_up = ( ( 'Off' !== $is_show_up ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) ); |
| 251 | 255 | // return $is_show_up; |
| @@ -251,13 +255,29 @@ | ||
| 251 | 255 | // return $is_show_up; |
| 252 | 256 | |
| 253 | 257 | $is_show_up = ( ( 'hide' !== get_bk_option( 'booking_menu_go_pro' ) ) && ( ! class_exists( 'wpdev_bk_multiuser' ) ) ); |
| 254 | 258 | |
| 255 | - return $is_show_up; | |
| 256 | -} | |
| 257 | - | |
| 258 | - | |
| 259 | -/** | |
| 259 | + return $is_show_up; | |
| 260 | +} | |
| 261 | + | |
| 262 | + | |
| 263 | +/** | |
| 264 | + * Check whether Free-edition upgrade navigation may be shown. | |
| 265 | + * | |
| 266 | + * This combines the existing administrator preference and MultiUser policy | |
| 267 | + * with the product-edition check used by Free-only upgrade actions. | |
| 268 | + * | |
| 269 | + * @since 11.8.0 | |
| 270 | + * | |
| 271 | + * @return bool True when Free-edition upgrade navigation may be rendered. | |
| 272 | + */ | |
| 273 | +function wpbc_is_show_free_upgrade() { | |
| 274 | + | |
| 275 | + return wpbc_is_show_up() && ! class_exists( 'wpdev_bk_personal' ); | |
| 276 | +} | |
| 277 | + | |
| 278 | + | |
| 279 | +/** | |
| 260 | 280 | * Get Up link. |
| 261 | 281 | * |
| 262 | 282 | * @return string |
| 263 | 283 | */ |