Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/booking/core/admin/api-settings.php
+++ b/booking/core/admin/api-settings.php
@@ -1193,7 +1193,7 @@
if ( wpbc_is_11_6_features_enabled() && wpbc_booking_resources_catalog_can_manage_settings() ) {
$is_pro_compatible = wpbc_booking_resources_catalog_is_pro_compatible();
- $description = __( 'Choose the new or legacy pages for upgraded administration catalogs, including Seasonal Availability and Searchable Resources when their new catalogs are enabled. Legacy pages remain available for compatibility.', 'booking' );
+ $description = __( 'Choose the new or legacy versions of upgraded administration pages, including Seasonal Availability, Searchable Resources, and Timeline navigation. Legacy pages remain available for compatibility.', 'booking' );
if ( ! $is_pro_compatible ) {
$pro_version = wpbc_booking_resources_catalog_get_pro_version();
@@ -1202,17 +1202,17 @@
}
/* translators: 1: Detected Booking Calendar Pro version, 2: Minimum compatible Pro version. */
- $description = sprintf( __( 'Legacy catalog mode is required because Booking Calendar Pro %1$s is active. Update Pro to %2$s or newer to use the new catalogs. Legacy pages remain available for compatibility.', 'booking' ), esc_html( $pro_version ), esc_html( wpbc_booking_resources_catalog_get_minimum_pro_version() ) );
+ $description = sprintf( __( 'Legacy page mode is required because Booking Calendar Pro %1$s is active. Update Pro to %2$s or newer to use the new pages. Legacy pages remain available for compatibility.', 'booking' ), esc_html( $pro_version ), esc_html( wpbc_booking_resources_catalog_get_minimum_pro_version() ) );
}
$this->fields['booking_resources_catalog_renderer'] = array(
'type' => 'select',
'default' => 'new',
- 'title' => __( 'Use legacy catalog pages', 'booking' ),
+ 'title' => __( 'Use legacy pages', 'booking' ),
'description' => $description,
'options' => array(
- 'new' => __( 'No — use the new catalogs', 'booking' ),
- 'legacy' => __( 'Yes — use legacy catalog pages (Deprecated)', 'booking' ),
+ 'new' => __( 'No — use the new pages', 'booking' ),
+ 'legacy' => __( 'Yes — use legacy pages (Deprecated)', 'booking' ),
),
'group' => 'advanced',
'disabled' => ! $is_pro_compatible,
--- a/booking/core/admin/page-email-approved.php
+++ b/booking/core/admin/page-email-approved.php
@@ -259,7 +259,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'approved_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/page-email-deleted.php
+++ b/booking/core/admin/page-email-deleted.php
@@ -256,7 +256,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'deleted_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/page-email-deny.php
+++ b/booking/core/admin/page-email-deny.php
@@ -259,7 +259,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'deny_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/page-email-new-admin.php
+++ b/booking/core/admin/page-email-new-admin.php
@@ -239,7 +239,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'new_admin_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/page-email-new-visitor.php
+++ b/booking/core/admin/page-email-new-visitor.php
@@ -241,7 +241,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'new_visitor_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/page-email-trash.php
+++ b/booking/core/admin/page-email-trash.php
@@ -259,7 +259,7 @@
<th scope="row">
<label class="wpbc-form-email" for="'
. esc_attr( 'trash_from' )
- . '">' . wp_kses_post( __('From' ,'booking') )
+ . '">' . wp_kses_post( _x( 'From', 'email sender', 'booking' ) )
. '</label>
</th>
<td><fieldset style="float:left;width:50%;margin-right:5%;">'
--- a/booking/core/admin/wpbc-toolbars.php
+++ b/booking/core/admin/wpbc-toolbars.php
@@ -246,7 +246,7 @@
, array( 'type' => 'link', 'title' => __('Contact Support', 'booking'), 'url' => 'mailto:support@wpbookingcalendar.com'
, 'attr' => array( 'style' => 'font-weight: 600;' ) )
, array( 'type' => 'divider' )
- , array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) ) )
+ , array( 'type' => 'link', 'title' => "What's New"/*__('Get Started')*/, 'url' => esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'admin.php' ) ) ) )
, array( 'type' => 'link', 'title' => __('About', 'booking')
// , 'url' => wpbc_up_link()
, 'url' => 'https://wpbookingcalendar.com/' //esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about-premium' ), 'index.php' ) ) )
--- a/booking/core/any/activation.php
+++ b/booking/core/any/activation.php
@@ -174,7 +174,7 @@
$links = array_merge( $links, array(
'<a class="wpbc_plugins_links__start_tour" title="' . esc_attr( sprintf( __('We'll guide you through the steps to set up WP Booking Calendar on your site.','booking'), '<strong>WP Booking Calendar</strong>' ) ) . '" href="'
. esc_url( wpbc_get_setup_wizard_page_url() )
- //. esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) )
+ //. esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'admin.php' ) ) )
. '">' . esc_attr__( 'Start Setup Wizard', 'booking' ) . '</a>'
)
);
--- a/booking/core/any/admin-bs-ui.php
+++ b/booking/core/any/admin-bs-ui.php
@@ -53,6 +53,7 @@
, 'attr' => array()
);
$item_params = wp_parse_args( $item, $default_item_params );
+ $action_link_target = wpbc_get_pseudo_action_target( $item_params['link'], $item_params['attr'] );
?><a class="button <?php
echo ( ! empty( $item_params['hint'] ) ) ? ' tooltip_' . esc_attr( $item_params['hint']['position'] ) . ' ' : '' ;
@@ -62,6 +63,9 @@
title="<?php echo esc_attr( $item_params['hint']['title'] ); ?>"
<?php } ?>
href="<?php echo esc_attr( $item_params['link'] ); ?>"
+ <?php if ( '' !== $action_link_target ) { ?>
+ target="<?php echo esc_attr( $action_link_target ); ?>"
+ <?php } ?>
<?php if ( ! empty( $item_params['action'] ) ) { ?>
onclick="javascript:<?php
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
@@ -487,7 +491,7 @@
}
}
- ?><a href="javascript:void(0)"
+ ?><a href="javascript:void(0)" target="_self"
<?php if (! $is_this_simple_list ) { ?>
onclick="javascript:jQuery('#<?php echo esc_js( $params['id'] ); ?>_container').show();"
<?php } ?>
@@ -688,9 +692,9 @@
} else {
?><li role="presentation" <?php if ( in_array( $value, $params['disabled'] ) === true ) { echo ' class="disabled"'; } ?> >
- <a role="menuitem"
+ <a role="menuitem"
tabindex="-1"
- href="javascript:void(0)"
+ href="javascript:void(0)" target="_self"
<?php
if ( in_array( $value, $params['disabled'] ) !== true ) {
--- a/booking/core/class/welcome_current.php
+++ b/booking/core/class/welcome_current.php
@@ -4,6 +4,52 @@
if ( !defined( 'ABSPATH' ) ) exit;
/**
+ * Render the Booking Calendar 12.0.1 feature introduction.
+ *
+ * @param object $obj Welcome-page renderer and image loader.
+ *
+ * @return void
+ */
+function wpbc_welcome_section_12_0_1( $obj ) {
+ $section_parameters = array( 'version_num' => '12.0.1', 'show_expand' => false );
+ $obj->expand_section_start( $section_parameters );
+ ?>
+ <div class="wpbc_wn_container">
+ <div class="wpbc_wn_section" style="gap: 10px 32px;">
+ <h2><?php esc_html_e( 'Set Check-in and Check-out Times per Resource', 'booking' ); ?></h2>
+ <div class="wpbc_wn_col" style="flex: 1 1 100%;margin: 0;">
+ <p><?php esc_html_e( 'Business Small and higher can now let each Booking Resource use the global changeover times, its own custom times, times from its Booking Form, or an inherited parent policy. The same effective times are used by booking forms, calendars, capacity checks, Google Calendar import, and availability search.', 'booking' ); ?></p>
+ <img
+ src="<?php echo esc_attr( $obj->section_img_url( '12.0.1/wp_booking_calendar__resource_changeover_times_placeholder.png' ) ); ?>"
+ width="1600"
+ height="900"
+ loading="lazy"
+ alt="<?php esc_attr_e( 'Booking Resource Inspector showing the Changeover times policy and custom check-in and check-out fields', 'booking' ); ?>"
+ style="margin:10px 0;width:98%;height:auto;"
+ />
+ </div>
+ </div>
+
+ <div class="wpbc_wn_section" style="gap: 10px 32px;">
+ <h2><?php esc_html_e( 'Cleaner Administration Page Navigation', 'booking' ); ?></h2>
+ <div class="wpbc_wn_col" style="flex: 1 1 100%;margin: 0;">
+ <p><?php esc_html_e( 'The Advanced compatibility option is now named Use legacy pages. New-page mode keeps administration navigation and the WordPress admin bar focused on Timeline New and the new Seasons page, while legacy-page mode restores the previous destinations when you need them. The admin bar also honors your default Bookings destination and the selected Appointment or Rental menu. A subtle divider now separates Setup Wizard and release information from regular administration pages in every edition. Direct legacy URLs remain available for compatibility.', 'booking' ); ?></p>
+ <img
+ src="<?php echo esc_attr( $obj->section_img_url( '12.0.1/wp_booking_calendar__legacy_pages_navigation_placeholder.png' ) ); ?>"
+ width="1600"
+ height="900"
+ loading="lazy"
+ alt="<?php esc_attr_e( 'Booking Calendar administration navigation showing Timeline New without Timeline Legacy while new pages are selected', 'booking' ); ?>"
+ style="margin:10px 0;width:98%;height:auto;"
+ />
+ </div>
+ </div>
+ </div>
+ <?php
+ $obj->expand_section_end();
+}
+
+/**
* Render the Booking Calendar 12.0 feature introduction.
*
* The release overview intentionally uses English-only strings because this
@@ -230,6 +276,7 @@
<ul>
<li><strong><?php echo esc_html( 'Use one consistent page header.' ); ?></strong> <?php echo esc_html( 'Authorized peer pages share a clear horizontal menu, current-page marker, breadcrumbs, version information, and responsive spacing without redundant one-link navigation rows.' ); ?></li>
<li><strong><?php echo esc_html( 'Reach Booking Forms quickly.' ); ?></strong> <?php echo esc_html( 'Booking Forms now appears directly in the native WordPress Booking Calendar submenu in Classic, Appointments, and Rentals, immediately before Settings.' ); ?></li>
+ <li><strong><?php echo esc_html( 'Find release highlights from the main menu.' ); ?></strong> <?php echo esc_html( 'What's New now appears after Settings and Setup Wizard with the same configured Settings access role, and remains before Upgrade to Pro in Free.' ); ?></li>
</ul>
</div>
</div>
@@ -818,7 +865,7 @@
<li><?php echo 'Manage Resource pricing from the familiar Booking Calendar > Prices page with search, filtering, sorting, paging, layouts, customizable columns, and clear pricing previews.'; ?></li>
<li><?php echo 'Expand a Resource to open direct links for Base Cost, Seasonal Rates, Duration-Based Costs, Partial Payment, Early Booking, and Last-Minute adjustments, together with owner Pricing context and authorized external settings.'; ?></li>
<li><?php echo 'The right-side inspector keeps each pricing area focused, validates current authorized values before saving, and protects changes made by another request.'; ?></li>
- <li><?php echo 'Need more time before switching? Enable Use legacy catalog pages to temporarily restore the previous Prices listing without migrating or resetting pricing data.'; ?></li>
+ <li><?php echo 'Need more time before switching? Enable Use legacy pages to temporarily restore the previous Prices listing without migrating or resetting pricing data.'; ?></li>
<li><?php echo 'Catalog previews cover Resource-owned pricing. Booking Form option costs, coupons, taxes, payment fees, additional Resources, and other later adjustments can still change the final booking total.'; ?></li>
</ul>
</div>
--- a/booking/core/class/wpbc-class-welcome.php
+++ b/booking/core/class/wpbc-class-welcome.php
@@ -16,7 +16,11 @@
class WPBC_Welcome {
/**
- * Minimum capability, such as 'read' or 'manage_options'
+ * Minimum capability required to open the What's New page.
+ *
+ * The value is resolved from the configured Settings role so the two pages
+ * retain the same WordPress access boundary.
+ *
* @var string
*/
public $minimum_capability = 'read';
@@ -31,18 +35,46 @@
* Constructor
*/
public function __construct() {
+ $this->minimum_capability = $this->get_settings_capability();
- add_action( 'admin_menu', array( $this, 'admin_menus' ) );
+ add_action( 'admin_menu', array( $this, 'admin_menus' ), 20 );
add_action( 'admin_init', array( $this, 'welcome' ) );
+ }
- add_action( 'load-dashboard_page_wpbc-about', array( $this, 'wpbc_define_page_title_about' ) );
+ /**
+ * Resolve the capability used by the native Settings menu.
+ *
+ * Settings converts the configured minimum role through the canonical
+ * WPBC_Admin_Menus role map. Reusing that map prevents the What's New page
+ * from drifting to a broader or narrower role after an administrator changes
+ * the Booking Calendar permissions setting.
+ *
+ * @return string WordPress capability required to access Settings and What's New.
+ */
+ private function get_settings_capability() {
+ $minimum_role = get_bk_option( 'booking_user_role_settings' );
+
+ if (
+ is_string( $minimum_role )
+ && class_exists( 'WPBC_Admin_Menus' )
+ && isset( WPBC_Admin_Menus::$capability[ $minimum_role ] )
+ ) {
+ return WPBC_Admin_Menus::$capability[ $minimum_role ];
+ }
+
+ return 'read';
}
+ /**
+ * Supply the browser title before WordPress renders the relocated page.
+ *
+ * @return void
+ */
public function wpbc_define_page_title_about() { // FixIn: 9.6.2.12.
global $title;
if ( ! isset( $title ) ) {
- $title = 'Welcome to Booking Calendar';
+ $title = __( 'Welcome to Booking Calendar', 'booking' );
}
}
@@ -162,15 +194,28 @@
// -----------------------------------------------------------------------------------------------------------------
// Menu
+ /**
+ * Register What's New below the native Booking Calendar parent menu.
+ *
+ * Booking Modes performs final authorized ordering later in the admin-menu
+ * lifecycle. Registering the real controller here keeps direct access,
+ * screen hooks, and WordPress capability enforcement native.
+ *
+ * @return void
+ */
public function admin_menus() {
- // What's New.
- add_dashboard_page( sprintf( 'Welcome to Booking Calendar' ), sprintf( 'What's New' ), $this->minimum_capability, 'wpbc-about', array( $this, 'content_whats_new' ) );
- remove_submenu_page( 'index.php', 'wpbc-about' );
- }
+ $page_hook = add_submenu_page(
+ 'wpbc',
+ __( 'Welcome to Booking Calendar', 'booking' ),
+ __( 'What's New', 'booking' ),
+ $this->minimum_capability,
+ 'wpbc-about',
+ array( $this, 'content_whats_new' )
+ );
- // Head.
- public function admin_head() {
- remove_submenu_page( 'index.php', 'wpbc-about' );
+ if ( false !== $page_hook ) {
+ add_action( 'load-' . $page_hook, array( $this, 'wpbc_define_page_title_about' ) );
+ }
}
// Title
@@ -184,7 +229,7 @@
echo ( 'Booking Calendar is ready to receive and manage bookings from your visitors!' );
?></div>
-
+ <?php return; ?>
<h2 class="nav-tab-wrapper">
<?php
$is_about_tab_active = $is_about_premium_tab_active = $is_getting_started_tab_active = '';
@@ -199,7 +244,7 @@
$is_getting_started_tab_active = ' nav-tab-active ';
?>
<a class="nav-tab<?php echo esc_attr( $is_about_tab_active ); ?>" href="<?php echo esc_url( admin_url( add_query_arg( array(
- 'page' => 'wpbc-about' ), 'index.php' ) ) ); ?>">
+ 'page' => 'wpbc-about' ), 'admin.php' ) ) ); ?>">
<?php echo( "What's New" ); ?>
<a class="nav-tab<?php echo esc_attr( $is_getting_started_tab_active ); ?>" href="https://wpbookingcalendar.com/faq/#using">
<?php echo( "Get Started" ); ?>
@@ -221,6 +266,21 @@
list( $display_version ) = explode( '-', WPDEV_BK_VERSION );
?>
+ <div class="notice-info notice" style="margin: 50px 0;">
+ <p>
+ <strong><?php echo( "Maintenance Release" ); ?></strong>
+ </p>
+ <p><strong><?php
+ echo wp_kses_post( sprintf( 'Version %s', $display_version ) ); ?></strong> <?php
+ echo 'addressed some minor issues and improvement in functionality'; ?>.
+ <?php
+ echo wp_kses_post( sprintf( 'For more information, see %sthe release notes%s', '<a href="https://wpbookingcalendar.com/changelog/" target="_blank">', '</a>' ) ); ?>
+ .
+ </p>
+ </div><?php
+
+ return;
+ ?>
<div class="changelog point-releases" style="margin: 40px 0 50px;">
<h3><?php
echo( "Maintenance Release" ); ?></h3>
@@ -245,32 +305,35 @@
if ( function_exists( 'wp_doing_ajax' ) && wp_doing_ajax() ) {
return;
}
+ if ( ! current_user_can( $this->minimum_capability ) ) {
+ return;
+ }
- $legacy_redirect = get_transient( '_booking_activation_redirect' );
- $redirect_intent = class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
- ? get_transient( WPBC_Setup_Wizard_First_Install_State::ACTIVATION_INTENT_TRANSIENT )
- : false;
- $is_whats_new_intent = class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
- && WPBC_Setup_Wizard_First_Install_State::is_whats_new_redirect_intent( $redirect_intent );
-
- // A genuine first-install intent belongs exclusively to the earlier Setup Wizard redirect handler.
- if (
- class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
- && WPBC_Setup_Wizard_First_Install_State::is_first_install_redirect_intent( $redirect_intent )
- ) {
- return;
- }
-
- // Bail if neither the released boolean nor a current structured intent is set.
- if ( ! $legacy_redirect && ! $is_whats_new_intent ) { // $.
- return;
- }
- if (
- $is_whats_new_intent
- && ! WPBC_Setup_Wizard_First_Install_State::is_redirect_intent_for_current_user( $redirect_intent )
- ) {
- return;
- }
+ $legacy_redirect = get_transient( '_booking_activation_redirect' );
+ $redirect_intent = class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
+ ? get_transient( WPBC_Setup_Wizard_First_Install_State::ACTIVATION_INTENT_TRANSIENT )
+ : false;
+ $is_whats_new_intent = class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
+ && WPBC_Setup_Wizard_First_Install_State::is_whats_new_redirect_intent( $redirect_intent );
+
+ // A genuine first-install intent belongs exclusively to the earlier Setup Wizard redirect handler.
+ if (
+ class_exists( 'WPBC_Setup_Wizard_First_Install_State' )
+ && WPBC_Setup_Wizard_First_Install_State::is_first_install_redirect_intent( $redirect_intent )
+ ) {
+ return;
+ }
+
+ // Bail if neither the released boolean nor a current structured intent is set.
+ if ( ! $legacy_redirect && ! $is_whats_new_intent ) { // $.
+ return;
+ }
+ if (
+ $is_whats_new_intent
+ && ! WPBC_Setup_Wizard_First_Install_State::is_redirect_intent_for_current_user( $redirect_intent )
+ ) {
+ return;
+ }
// Delete the redirect transient
delete_transient( '_booking_activation_redirect' );
@@ -300,7 +363,7 @@
else
update_bk_option( 'booking_activation_redirect_for_version', WP_BK_VERSION_NUM );
- wp_safe_redirect( admin_url( 'index.php?page=wpbc-about' ) );
+ wp_safe_redirect( admin_url( 'admin.php?page=wpbc-about' ) );
exit;
}
@@ -347,18 +410,19 @@
public function content_whats_new() {
- echo '<div class="wrap about-wrap wpbc-welcome-page">';
+ echo '<div class="wpbc-welcome-page">';
- $this->title_section();
+ $this->title_section();
- $this->show_go_links();
+ // $this->show_go_links();
$this->maintence_section();
$this->section_9_8_css();
- wpbc_welcome_section_12_0( $this );
- wpbc_welcome_section_11_9( $this );
+ // wpbc_welcome_section_12_0_1( $this );
+ wpbc_welcome_section_12_0( $this );
+ wpbc_welcome_section_11_9( $this );
wpbc_welcome_section_11_8_1( $this );
wpbc_welcome_section_11_8( $this );
wpbc_welcome_section_11_7( $this );
@@ -394,7 +458,7 @@
'.', ' ',
), '_', $section_param_arr['version_num'] ) ); ?>' ).toggle();"
>+ Show changes in version update <span
- style="font-size: 1.35em;font-weight: 600;color: #079;font-family: Consolas,Monaco,monospace;padding-left:12px;"><?php
+ style="font-size: 1.5em;font-weight: 550;font-family: Consolas,Monaco,monospace;padding-left:12px;text-decoration:none;"><?php
echo esc_html( $section_param_arr['version_num'] ); ?></span>
</a>
<div class="version_update_<?php
@@ -405,8 +469,8 @@
}
- ?><h2 style='font-size: 1.9em;text-align:left;'>What's New in Booking Calendar <span
- style="font-size: 1.1em;font-weight: 600;font-family: Consolas,Monaco,monospace;padding-left: 10px;color: #5F5F5F;"
+ ?><h2 style='font-size: 1.45em;text-align:left;'>What's New in Booking Calendar <span
+ style="font-size: 1.2em;font-weight: 600;font-family: Consolas,Monaco,monospace;padding-left: 10px;"
><?php
echo esc_html( $section_param_arr['version_num'] ); ?></span></h2><?php
@@ -429,13 +493,21 @@
function section_9_8_css(){
?><style type="text/css">
- .about-wrap.wpbc-welcome-page {
+ .wpbc-welcome-page {
position: relative;
margin: 25px 40px 0 20px;
max-width: 1050px;
font-size: 15px;
clear: both;
}
+ .wpbc_expand_section_link {
+ text-underline-offset: 4px;
+ text-decoration-style: dashed;
+ padding: 5px;
+ }
+ .wpbc-welcome-page p {
+ font-size: 16px;
+ }
.wpbc_wn_container{
margin: 24px auto;
overflow: hidden;
--- a/booking/core/sync/wpbc-gcal-class.php
+++ b/booking/core/sync/wpbc-gcal-class.php
@@ -364,6 +364,16 @@
//debuge($range_dates, $range_time);
$bktype = $this->getResource();
+ $previous_active_user = -1;
+ // MultiUser options and Resource policy must be read in the Resource owner's context.
+ if ( class_exists( 'wpdev_bk_multiuser' ) ) {
+ $user_bk_id = apply_bk_filter( 'get_user_of_this_bk_resource', false, $bktype );
+ if ( ( false !== $user_bk_id ) && ( $this->getUserID() != $user_bk_id ) ) {
+ $previous_active_user = apply_bk_filter( 'get_client_side_active_params_of_user' );
+ make_bk_action( 'check_multiuser_params_for_client_side_by_user_id', $user_bk_id );
+ }
+ }
+
// FixIn: 8.6.1.4.
// if ( ( class_exists( 'wpdev_bk_biz_s' ) )
// && ( get_bk_option( 'booking_range_selection_time_is_active') == 'On' )
@@ -388,35 +398,15 @@
// FixIn: 8.6.1.1.
if ( empty( $range_time ) ) {
- if ( ( class_exists( 'wpdev_bk_biz_s' ) )
- && ( get_bk_option( 'booking_range_selection_time_is_active') == 'On' )
- && ( get_bk_option( 'booking_ics_import_add_change_over_time' ) !== 'Off' )
- ) { // FixIn: 2.0.5.1.
- //Add check in/out times to full day events
- $wpbc_check_in = get_bk_option( 'booking_range_selection_start_time' );// . ':01'; // ' 14:00:01'
- $wpbc_check_out = get_bk_option( 'booking_range_selection_end_time' ); // . ':02'; // ' 10:00:02';
- $range_time = $wpbc_check_in . ' - ' . $wpbc_check_out;
- $range_time = "selectbox-one^rangetime{$bktype}^{$range_time}~";
+ if ( class_exists( 'wpdev_bk_biz_s' ) && ( get_bk_option( 'booking_ics_import_add_change_over_time' ) !== 'Off' ) ) { // FixIn: 2.0.5.1.
+ $changeover_contract = wpbc_get_changeover_time_field_contract_compat( $bktype, 'wpbc-gcal-import' );
+ if ( ! empty( $changeover_contract['is_active'] ) && ! empty( $changeover_contract['is_valid'] ) ) {
+ $range_time = $changeover_contract['start_time'] . ' - ' . $changeover_contract['end_time'];
+ $range_time = "selectbox-one^rangetime{$bktype}^{$range_time}~";
+ }
}
}
//debuge($range_dates, $range_time); // array( [0] => 07.08.2017, 08.08.2017, [1] => selectbox-one^rangetime4^03:00 - 07:00~ )
-
- $previous_active_user = -1;
- // MU
- if ( class_exists('wpdev_bk_multiuser') ) {
- // Get the owner of this booking resource
- $user_bk_id = apply_bk_filter('get_user_of_this_bk_resource', false, $bktype );
-
- // Check if its different user
- if ( ($user_bk_id !== false) && ($this->getUserID() != $user_bk_id) ){
- // Get possible other active user settings
- $previous_active_user = apply_bk_filter('get_client_side_active_params_of_user');
-
- // Set active user of that specific booking resource
- make_bk_action('check_multiuser_params_for_client_side_by_user_id', $user_bk_id);
-
- }
- }
$booking_gcal_events_form_fields = get_bk_option( 'booking_gcal_events_form_fields');
if ( is_serialized( $booking_gcal_events_form_fields ) )
--- a/booking/core/wpbc-activation.php
+++ b/booking/core/wpbc-activation.php
@@ -95,7 +95,7 @@
, 'link_settings' => '<a class="wpbc_plugins_links__settings" href="' . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-settings' ), 'admin.php' ) ) )
. '">'. "Settings" .'</a>'
, 'link_whats_new' => '<a title="'. "Check new functionality in this plugin update." .'" href="'
- . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'index.php' ) ) )
+ . esc_url( admin_url( add_query_arg( array( 'page' => 'wpbc-about' ), 'admin.php' ) ) )
.'">'. "What's New".'</a>'
, 'link_faq' => '<a title="FAQ" href="https://wpbookingcalendar.com/faq/">FAQ</a>'
, 'link_up' => '<a title="Check Pro functionality" href="https://wpbookingcalendar.com/features/#link_up" style="color: rgb(0, 163, 42);font-weight:700;">Get Pro</a>'
@@ -1019,7 +1019,7 @@
$mu_option4delete[]='booking_form_custom_button_border_radius';
$default_options['booking_is_use_captcha'] = 'Off';
$mu_option4delete[]='booking_is_use_captcha';
- $default_options['booking_frontend_messages'] = array( 'version' => 1, 'messages' => array(), 'enabled' => array() );
+ $default_options['booking_frontend_messages'] = array( 'version' => 1, 'messages' => array(), 'enabled' => array(), 'error_message_duration' => 10 );
$mu_option4delete[]='booking_frontend_messages';
$default_options['booking_is_show_legend'] = 'On';
$mu_option4delete[]='booking_is_show_legend';
--- a/booking/core/wpbc-css.php
+++ b/booking/core/wpbc-css.php
@@ -80,12 +80,12 @@
$wpbc_inline_css = '';
if ( wpbc_mu__is_simulated_login_as_user() ) {
// Mark last item in menu as a button.
- $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { font-weight: 600;background-color: #075c00;color: #fff;margin: 10px 10px 0;display: block;text-align: center;border-radius: 3px;transition: all .3s;box-shadow: none; } ';
- $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) { margin-top: 10px;border-top: 1px solid #535454; } ';
+ $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { background-color: #42464f; color: #fff; margin: 15px 5px 5px; display: block; text-align: center; border-radius: 3px; transition: all .3s; box-shadow: none; font-size: 0.9em; } ';
+ // $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) { margin-top: 10px;border-top: 1px solid rgba(255, 255, 255, 0.18); } ';
} else {
// Horizontal Lines in Menu. // FixIn: 10.1.3.1.
- $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-child(4) a { border-top: 1px solid #535454;padding-top: 10px;margin-top: 6px; } ';
- $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { border-top: 1px solid #535454;padding-top: 10px;margin-top: 6px; } ';
+ // $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-child(4) a { border-top: 1px solid rgba(255, 255, 255, 0.18);padding-top: 10px;margin-top: 6px; } ';
+ // $wpbc_inline_css .= ' #adminmenu #toplevel_page_wpbc .wp-submenu li:nth-last-child(1) a { border-top: 1px solid #535454;padding-top: 10px;margin-top: 6px; } ';
}
wp_add_inline_style( 'wpbc-admin-pages', $wpbc_inline_css );
}
--- a/booking/core/wpbc-dates.php
+++ b/booking/core/wpbc-dates.php
@@ -1007,7 +1007,7 @@
( ! class_exists( 'wpdev_bk_biz_l' ) )
|| ( ( class_exists( 'wpdev_bk_biz_l' ) ) && ( ! wpbc_is_this_parent_resource( $resource_id ) ) )
){ // FixIn: 9.1.2.7.
- list( $blocked_days_range, $prior_check_out_date ) = apply_filters( 'wpbc_get_extended_block_dates_filter', array( $blocked_days_range, $prior_check_out_date ) );
+ list( $blocked_days_range, $prior_check_out_date ) = apply_filters( 'wpbc_get_extended_block_dates_filter', array( $blocked_days_range, $prior_check_out_date, absint( $resource_id ) ) );
}
foreach ( $blocked_days_range as $date_ymd_his ) {
--- a/booking/core/wpbc-frontend-messages.php
+++ b/booking/core/wpbc-frontend-messages.php
@@ -209,6 +209,57 @@
}
/**
+ * Get the supported booking-form error-message duration limits.
+ *
+ * The default preserves the historical ten-second transient-message behavior.
+ * Zero is intentionally supported so administrators can keep validation
+ * messages visible without automatic dismissal.
+ *
+ * @return array{minimum:int,maximum:int,default:int} Duration limits in seconds.
+ */
+function wpbc_frontend_messages__get_error_duration_limits() {
+ return array(
+ 'minimum' => 0,
+ 'maximum' => 3600,
+ 'default' => 10,
+ );
+}
+
+/**
+ * Validate a booking-form error-message duration.
+ *
+ * @param mixed $raw_duration Raw duration value in seconds.
+ * @return int|WP_Error Validated duration in seconds, or an error for malformed or out-of-range input.
+ */
+function wpbc_frontend_messages__validate_error_duration( $raw_duration ) {
+ $limits = wpbc_frontend_messages__get_error_duration_limits();
+
+ if ( ! is_int( $raw_duration ) && ! is_string( $raw_duration ) ) {
+ return new WP_Error( 'invalid_error_message_duration', __( 'Error message duration must be a whole number of seconds.', 'booking' ) );
+ }
+
+ $duration_string = trim( wp_unslash( (string) $raw_duration ) );
+ if ( '' === $duration_string || ! preg_match( '/^d+$/', $duration_string ) ) {
+ return new WP_Error( 'invalid_error_message_duration', __( 'Error message duration must be a whole number of seconds.', 'booking' ) );
+ }
+
+ $duration = (int) $duration_string;
+ if ( $duration < $limits['minimum'] || $duration > $limits['maximum'] ) {
+ return new WP_Error(
+ 'error_message_duration_out_of_range',
+ sprintf(
+ /* translators: 1: Minimum number of seconds. 2: Maximum number of seconds. */
+ __( 'Error message duration must be between %1$d and %2$d seconds.', 'booking' ),
+ $limits['minimum'],
+ $limits['maximum']
+ )
+ );
+ }
+
+ return $duration;
+}
+
+/**
* Get normalized saved message settings.
*
* @return array
@@ -226,14 +277,35 @@
$settings = array( 'version' => 1, 'messages' => $flat, 'enabled' => array() );
}
+ $duration_limits = wpbc_frontend_messages__get_error_duration_limits();
+ $error_duration = isset( $settings['error_message_duration'] )
+ ? wpbc_frontend_messages__validate_error_duration( $settings['error_message_duration'] )
+ : $duration_limits['default'];
+
+ if ( is_wp_error( $error_duration ) ) {
+ $error_duration = $duration_limits['default'];
+ }
+
return array(
- 'version' => 1,
- 'messages' => ( isset( $settings['messages'] ) && is_array( $settings['messages'] ) ) ? $settings['messages'] : array(),
- 'enabled' => ( isset( $settings['enabled'] ) && is_array( $settings['enabled'] ) ) ? $settings['enabled'] : array(),
+ 'version' => 1,
+ 'messages' => ( isset( $settings['messages'] ) && is_array( $settings['messages'] ) ) ? $settings['messages'] : array(),
+ 'enabled' => ( isset( $settings['enabled'] ) && is_array( $settings['enabled'] ) ) ? $settings['enabled'] : array(),
+ 'error_message_duration' => $error_duration,
);
}
/**
+ * Get the configured transient booking-form error-message duration.
+ *
+ * @return int Duration in seconds. Zero disables automatic dismissal.
+ */
+function wpbc_frontend_messages__get_error_duration() {
+ $settings = wpbc_frontend_messages__get_settings();
+
+ return $settings['error_message_duration'];
+}
+
+/**
* Resolve a message for the active Booking Calendar locale.
*
* @param string $message_key Stable registry key.
--- a/booking/core/wpbc-js-vars.php
+++ b/booking/core/wpbc-js-vars.php
@@ -159,6 +159,7 @@
foreach ( array_keys( wpbc_frontend_messages__get_registry() ) as $message_key ) {
$script .= '_wpbc.set_message( ' . wp_json_encode( $message_key ) . ', ' . wp_json_encode( wpbc_frontend_messages__get( $message_key ) ) . ' ); ';
}
+ $script .= "_wpbc.set_other_param( 'booking_form_error_message_duration', " . wp_json_encode( wpbc_frontend_messages__get_error_duration() ) . ' ); ';
// Internal/admin progress messages remain gettext-controlled and cannot be customized from the booking-form page.
$script .= "_wpbc.set_message( 'message_processing', " . wp_json_encode( __( 'Processing', 'booking' ) ) . " ); ";
--- a/booking/core/wpbc_functions.php
+++ b/booking/core/wpbc_functions.php
@@ -15,6 +15,56 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
/**
+ * Determine whether a link value represents an in-page user-interface action.
+ *
+ * Pseudo-action links must remain in the current browsing context when a host
+ * document defines a different default target, as WordPress Playground may do.
+ * Real HTTP, email, telephone, and other protocol links are not action links.
+ *
+ * @param mixed $href Link value to classify.
+ *
+ * @return bool True for an empty, fragment, or JavaScript action link.
+ */
+ function wpbc_is_pseudo_action_href( $href ) {
+
+ if ( ! is_scalar( $href ) ) {
+ return false;
+ }
+
+ $normalized_href = strtolower( trim( (string) $href ) );
+
+ return '' === $normalized_href
+ || 0 === strpos( $normalized_href, '#' )
+ || 0 === strpos( $normalized_href, 'javascript:' );
+ }
+
+ /**
+ * Return the safe browsing-context target for a generated action link.
+ *
+ * Existing explicit targets remain authoritative for backward compatibility.
+ * Otherwise, pseudo-action links receive `_self` before browser event dispatch,
+ * preventing an embedding document's default target from opening another page.
+ *
+ * @param mixed $href Link value to classify.
+ * @param array $attributes Optional attributes already supplied by the caller.
+ *
+ * @return string `_self` for an un-targeted pseudo-action link, otherwise empty.
+ */
+ function wpbc_get_pseudo_action_target( $href, $attributes = array() ) {
+
+ if (
+ is_array( $attributes )
+ && isset( $attributes['target'] )
+ && is_scalar( $attributes['target'] )
+ && '' !== trim( (string) $attributes['target'] )
+ ) {
+ return '';
+ }
+
+ return wpbc_is_pseudo_action_href( $href ) ? '_self' : '';
+ }
+
+ /**
* Get Logo for conversation.
*
* @param string $svg_color - main color.
--- a/booking/includes/_capacity/create_booking.php
+++ b/booking/includes/_capacity/create_booking.php
@@ -1285,8 +1285,9 @@
if( 'On' === get_bk_option( 'booking_last_checkout_day_available' )){
$error_message .= '<br>' . 'You have enabled <strong>"Set check out date as available"</strong> option at Booking > Settings General page in "Calendar" section. ';
}
- if ( 'On' === get_bk_option( 'booking_range_selection_time_is_active' ) ){
- $error_message .= '<br>' . 'You have enabled <strong>"Use changeover days"</strong> option at Booking > Settings General page in "Calendar" section with check-in/out times: ' . get_bk_option( 'booking_range_selection_start_time' ) . '/' . get_bk_option( 'booking_range_selection_end_time' );
+ $changeover_contract = wpbc_get_changeover_time_field_contract_compat( absint( $create_params['resource_id'] ), false );
+ if ( ! empty( $changeover_contract['is_active'] ) && ! empty( $changeover_contract['is_valid'] ) ) {
+ $error_message .= '<br>' . 'You have enabled <strong>"Use changeover days"</strong> option at Booking > Settings General page in "Calendar" section with effective check-in/out times: ' . esc_html( $changeover_contract['start_time'] ) . '/' . esc_html( $changeover_contract['end_time'] );
}
if ( $create_params['is_use_booking_recurrent_time'] ) {
$error_message .= '<br>' . 'You have enabled <strong>"Use time selections as recurrent time slots"</strong> option at Booking > Settings General page in "Calendar" section. ';
--- a/booking/includes/_front_end/class-fe-render-form-body.php
+++ b/booking/includes/_front_end/class-fe-render-form-body.php
@@ -54,6 +54,7 @@
* @type string $selected_dates_without_calendar Preselected dates string (legacy format).
* @type int $cal_count Number of months to show in calendar.
* @type mixed $shortcode_param__options Shortcode options string (legacy: options="...") or array.
+ * @type array $edit_form_identity Pre-resolved authorized visitor-edit form context.
* @type wpdev_booking $legacy_instance Legacy plugin booking object (Phase #1/compat).
* }
*
@@ -69,6 +70,7 @@
'cal_count' => 1,
'shortcode_param__options' => '',
'booking_hash' => '',
+ 'edit_form_identity' => array(),
'legacy_instance' => null,
);
@@ -80,6 +82,7 @@
$cal_count = (int) $args['cal_count'];
$shortcode_param__options = $args['shortcode_param__options'];
$booking_hash = sanitize_text_field( wp_unslash( (string) $args['booking_hash'] ) );
+ $edit_form_identity = is_array( $args['edit_form_identity'] ) ? $args['edit_form_identity'] : array();
$legacy_instance = $args['legacy_instance'];
$form_status = isset( $args['form_status'] ) ? (string) $args['form_status'] : 'published';
@@ -89,7 +92,7 @@
$calendar_html = WPBC_FE_Calendar_Markup::build( $resource_id, $cal_count, $shortcode_param__options, $selected_dates_without_calendar );
- $source_res = WPBC_FE_Form_Source::get_form_body_html( $resource_id, $custom_booking_form, $form_status, $custom_params, $legacy_instance, $booking_hash );
+ $source_res = WPBC_FE_Form_Source::get_form_body_html( $resource_id, $custom_booking_form, $form_status, $custom_params, $legacy_instance, $booking_hash, $edit_form_identity );
$form_html = $source_res['body_html'];
@@ -223,6 +226,96 @@
class WPBC_FE_Form_Source {
/**
+ * Resolve the authoritative Booking Form identity for visitor editing.
+ *
+ * The booking hash authorizes one booking and Resource. The booking's stored
+ * form marker takes precedence over the shortcode default, while an existing
+ * legacy `booking_form` override remains supported only when the canonical
+ * form-source resolver can load it for the effective Resource owner. Missing,
+ * deleted, foreign-owner, or otherwise unavailable forms follow that
+ * resolver's established Standard-form fallback.
+ *
+ * This method is read-only. It loads booking details and form metadata but
+ * does not update booking data, settings, hashes, or Form Builder records.
+ *
+ * @param int $render_resource_id Resource ID used by the rendered calendar, which may be a parent Resource.
+ * @param string $requested_form_slug Form selected by the shortcode or calling component.
+ * @param string $form_status Requested Form Builder status, normally `published`.
+ * @param array $custom_params Parsed shortcode parameters used by form-source filters.
+ * @param string $booking_hash Authorized visitor-edit booking credential.
+ * @param mixed $legacy_instance Legacy booking instance supplied to source-resolution filters.
+ *
+ * @return array<string,mixed> Resolved identity containing the effective form, booking, and source resolution.
+ */
+ public static function resolve_booking_form_identity( $render_resource_id, $requested_form_slug, $form_status, $custom_params, $booking_hash, $legacy_instance = null ) {
+
+ $render_resource_id = absint( $render_resource_id );
+ $requested_form_slug = sanitize_text_field( wp_unslash( (string) $requested_form_slug ) );
+ $form_status = sanitize_key( (string) $form_status );
+ $custom_params = is_array( $custom_params ) ? $custom_params : array();
+ $booking_hash = sanitize_text_field( wp_unslash( (string) $booking_hash ) );
+
+ if ( '' === $requested_form_slug ) {
+ $requested_form_slug = 'standard';
+ }
+
+ $identity = array(
+ 'booking_id' => 0,
+ 'booking_resource_id' => 0,
+ 'render_resource_id' => $render_resource_id,
+ 'form_slug' => $requested_form_slug,
+ 'current_edit_booking' => false,
+ 'source_resolution' => array(),
+ );
+
+ $booking_scope = self::maybe_check_if_booking_edit( $booking_hash );
+ if ( false === $booking_scope ) {
+ return $identity;
+ }
+
+ $current_edit_booking = self::get_booking_data( $booking_scope['booking_id'] );
+ if ( false === $current_edit_booking ) {
+ return $identity;
+ }
+
+ $booking_resource_id = absint( $booking_scope['resource_id'] );
+ $form_slug = $requested_form_slug;
+ $override_form_slug = WPBC_GET_Request::has_non_empty_get( 'booking_form' )
+ ? WPBC_GET_Request::get_sanitized( 'booking_form' )
+ : '';
+ $stored_form_key = 'wpbc_custom_booking_form' . $booking_resource_id;
+
+ if ( '' !== $override_form_slug ) {
+ $form_slug = $override_form_slug;
+ } elseif ( ! empty( $current_edit_booking['parsed_form'][ $stored_form_key ]['value'] ) ) {
+ $form_slug = sanitize_text_field( (string) $current_edit_booking['parsed_form'][ $stored_form_key ]['value'] );
+ }
+
+ $source_request = array(
+ 'resource_id' => $render_resource_id,
+ 'form_slug' => $form_slug,
+ 'form_status' => $form_status,
+ 'custom_params' => $custom_params,
+ 'legacy_instance' => $legacy_instance,
+ );
+ $source_resolution = WPBC_FE_Form_Source_Resolver::resolve( $source_request );
+ if (
+ 'bfb_db' === ( isset( $source_resolution['engine'] ) ? $source_resolution['engine'] : '' )
+ && ! empty( $source_resolution['bfb_loader_args']['form_slug'] )
+ ) {
+ $form_slug = sanitize_text_field( (string) $source_resolution['bfb_loader_args']['form_slug'] );
+ }
+
+ $identity['booking_id'] = absint( $booking_scope['booking_id'] );
+ $identity['booking_resource_id'] = $booking_resource_id;
+ $identity['form_slug'] = '' === $form_slug ? 'standard' : $form_slug;
+ $identity['current_edit_booking'] = $current_edit_booking;
+ $identity['source_resolution'] = $source_resolution;
+
+ return $identity;
+ }
+
+ /**
* Check if the booking editing, and return -> [ 'booking_id': booking_id, 'resource_id': resource_id] otherwise -> false
*
* @param string $booking_hash__usualy_from_get optional. - hash of the booking. If missed, then system check $_GET['booking_hash'].
@@ -372,16 +465,18 @@
* @param array $custom_params
* @param wpdev_booking $legacy_instance
* @param string $booking_hash
+ * @param array $edit_form_identity Pre-resolved visitor-edit form context.
*
* @return array
*/
- public static function get_form_body_html( $resource_id, $custom_booking_form, $form_status, $custom_params, $legacy_instance, $booking_hash = '' ) {
+ public static function get_form_body_html( $resource_id, $custom_booking_form, $form_status, $custom_params, $legacy_instance, $booking_hash = '', $edit_form_identity = array() ) {
$resource_id = (int) $resource_id;
$custom_booking_form = (string) $custom_booking_form;
$form_status = (string) $form_status;
$custom_params = ( is_array( $custom_params ) ) ? $custom_params : array();
$booking_hash = sanitize_text_field( wp_unslash( (string) $booking_hash ) );
+ $edit_form_identity = is_array( $edit_form_identity ) ? $edit_form_identity : array();
$req = array(
'resource_id' => $resource_id,
@@ -399,7 +494,16 @@
// == If Booking Edit ? ==
// =============================================================================================================
// Maybe get the "custom booking form" and child "booking resource ID", if the booking edited. And this booking was created in custom booking form.
- $maybe_edited__booking_id__resource_id = self::maybe_check_if_booking_edit( $booking_hash );
+ if ( empty( $edit_form_identity ) && '' !== $booking_hash ) {
+ $edit_form_identity = self::resolve_booking_form_identity( $resource_id, $custom_booking_form, $form_status, $custom_params, $booking_hash );
+ }
+
+ $maybe_edited__booking_id__resource_id = ! empty( $edit_form_identity['booking_id'] ) && ! empty( $edit_form_identity['booking_resource_id'] )
+ ? array(
+ 'booking_id' => absint( $edit_form_identity['booking_id'] ),
+ 'resource_id' => absint( $edit_form_identity['booking_resource_id'] ),
+ )
+ : self::maybe_check_if_booking_edit( $booking_hash );
if ( ! empty( $maybe_edited__booking_id__resource_id ) ) {
@@ -409,22 +513,12 @@
$req['current_edit_booking_id'] = $maybe_edited__booking_id__resource_id['booking_id'];
// Parsed booking form values.
- $req['current_edit_booking'] = self::get_booking_data( $maybe_edited__booking_id__resource_id['booking_id'] );
-
- // -- Is use custom form ? ---------------------------------------------------------------------------------
+ $req['current_edit_booking'] = ! empty( $edit_form_identity['current_edit_booking'] )
+ ? $edit_form_identity['current_edit_booking']
+ : self::get_booking_data( $maybe_edited__booking_id__resource_id['booking_id'] );
- // Get 'custom booking form name' from URL.
- // phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.NonceVerification.Missing, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
- $my_booking_form = ( ( isset( $_GET['booking_form'] ) ) ? sanitize_text_field( wp_unslash( $_GET['booking_form'] ) ) : '' );
-
- // Otherwise get 'custom booking form name' from EDIT booking details.
- if ( ( empty( $my_booking_form ) ) && ( ! empty( $req['current_edit_booking']['parsed_form'][ 'wpbc_custom_booking_form' . $req['resource_id'] ] ) ) ) {
- $my_booking_form = $req['current_edit_booking']['parsed_form'][ 'wpbc_custom_booking_form' . $req['resource_id'] ]['value'];
- }
-
- // If not '' then OVVERIDE.
- if ( ! empty( $my_booking_form ) ) {
- $req['form_slug'] = $my_booking_form;
+ if ( ! empty( $edit_form_identity['form_slug'] ) ) {
+ $req['form_slug'] = $edit_form_identity['form_slug'];
}
@@ -477,7 +571,9 @@
* 'bfb_loader_args' : array()
* 'fallback_chain' : array()
*/
- $resolved = WPBC_FE_Form_Source_Resolver::resolve( $req );
+ $resolved = ! empty( $edit_form_identity['source_resolution'] )
+ ? $edit_form_identity['source_resolution']
+ : WPBC_FE_Form_Source_Resolver::resolve( $req );
// -----------------------------------------------------------------
// BFB DB engine (only if resolver decided it).
@@ -595,7 +691,13 @@
if ( '' === $bfb_form_html ) {
- $render_args = array_merge( $custom_params, array( 'booking_type' => (int) $resource_id ) );
+ $render_args = array_merge(
+ $custom_params,
+ array(
+ 'booking_type' => (int) $resource_id,
+ 'custom_params' => $custom_params,
+ )
+ );
/*
* Do not pass the complete Builder form through wpbc_lang(). Builder
@@ -607,13 +709,6 @@
*/
$bfb_source = (string) $bfb_source;
- // Replace custom params in the source (legacy behavior).
- if ( ! empty( $custom_params ) ) {
- foreach ( $custom_params as $custom_params_key => $custom_params_value ) {
- $bfb_source = str_replace( $custom_params_key, $custom_params_value, $bfb_source );
- }
- }
-
$bfb_source = wpbc_bf__replace_custom_html_shortcodes( $bfb_source );
$bfb_form_html = wpbc_render_booking_form_shortcodes( $bfb_source, $render_args, $req );
--- a/booking/includes/_front_end/class-fe-render.php
+++ b/booking/includes/_front_end/class-fe-render.php
@@ -121,6 +121,28 @@
return self::echo_or_return( $my_result, $is_echo );
}
+
+ // Resolve visitor-edit Booking Form identity before signing the calendar
+ // context. The form body must not be the first layer to discover the form
+ // saved with the authorized booking, because calendar and submission AJAX
+ // requests use this signed value before the body is rendered.
+ $edit_form_identity = array();
+ if ( '' !== (string) $params_arr['booking_hash'] && method_exists( 'WPBC_FE_Form_Source', 'resolve_booking_form_identity' ) ) {
+ $custom_params = WPBC_FE_Options_Parser::parse_for_parameter__in_shortcode_options( $params_arr['shortcode_param__options'] );
+ $edit_legacy_instance = wpbc_get_legacy_booking_instance();
+ $edit_form_identity = WPBC_FE_Form_Source::resolve_booking_form_identity(
+ $params_arr['resource_id'],
+ $params_arr['custom_booking_form'],
+ $params_arr['form_status'],
+ $custom_params,
+ $params_arr['booking_hash'],
+ $edit_legacy_instance
+ );
+
+ if ( ! empty( $edit_form_identity['form_slug'] ) ) {
+ $params_arr['custom_booking_form'] = $edit_form_identity['form_slug'];
+ }
+ }
// ---------------------------------------------------------------------
// Normalize calendar_dates_start/end.
@@ -194,6 +216,7 @@
'cal_count' => $params_arr['cal_count'],
'shortcode_param__options' => $params_arr['shortcode_param__options'],
'booking_hash' => $params_arr['booking_hash'],
+ 'edit_form_identity' => $edit_form_identity,
'legacy_instance' => $legacy,
)
);
--- a/booking/includes/_front_end/class-fe-shortcode-params.php
+++ b/booking/includes/_front_end/class-fe-shortcode-params.php
@@ -440,6 +440,10 @@
);
}
+ // Keep the verified credential in the normalized render contract so later
+ // layers do not need to read request globals independently.
+ $params_arr['booking_hash'] = $get_booking_hash;
+
// If booking_hash exists and this is calendar-only, show warning.
if ( 'calendar' === $context ) {
$is_error = '<div class="wpbc_after_booking_thank_you_section"><div class="wpbc_ty__container"><div class="wpbc_ty__header"><strong>'
@@ -560,6 +564,29 @@
class WPBC_FE_Options_Parser {
/**
+ * Validate a custom parameter name used by the booking-form shortcode engine.
+ *
+ * Parameter names are identifiers, not arbitrary form-source search strings.
+ * Keeping this contract narrow prevents a shortcode author from selecting HTML
+ * fragments while preserving established names such as `guest_name`,
+ * `bfb_form_id`, and `service-code`.
+ *
+ * @param mixed $parameter_name Raw parameter name from the shortcode options attribute.
+ *
+ * @return string Validated parameter name, or an empty string when invalid.
+ */
+ public static function sanitize_parameter_name( $parameter_name ) {
+
+ $parameter_name = is_scalar( $parameter_name ) ? trim( (string) $parameter_name ) : '';
+
+ if ( ! preg_match( '/^[A-Za-z0-9_][A-Za-z0-9_.:-]{0,127}$/', $parameter_name ) ) {
+ return '';
+ }
+
+ return $parameter_name;
+ }
+
+ /**
* Parse shortcode options parameter. e.g. - {parameter name="..." value="..."}
*
* Paramaters defined in the Booking Calendar shortcode, like this:
@@ -602,8 +629,10 @@
$value = (string) $m2[2];
}
+ $name = self::sanitize_parameter_name( $name );
+
if ( ( '' !== $name ) && ( '' !== $value ) ) {
- $custom_params[ sanitize_text_field( (string) $name ) ] = sanitize_text_field( (string) $value );
+ $custom_params[ $name ] = sanitize_text_field( (string) $value );
}
}
--- a/booking/includes/_functions/admin_top_bar.php
+++ b/booking/includes/_functions/admin_top_bar.php
@@ -20,6 +20,195 @@
+/**
+ * Resolve one canonical administration route for the WordPress admin bar.
+ *
+ * Canonical references centralize stable page identities without granting
+ * access or registering controllers. Callers remain responsible for the same
+ * role, edition, ownership, and mode gates that protect each menu item.
+ *
+ * @param string $canonical_page_id Canonical Booking Modes page identifier.
+ * @param string $fallback_url Established compatibility URL.
+ *
+ * @return string Canonical URL when registered, otherwise the fallback URL.
+ */
+function wpbc_admin_top_bar_get_canonical_route_url( $canonical_page_id, $fallback_url ) {
+ $canonical_url = '';
+
+ if ( function_exists( 'wpbc_booking_modes_get_canonical_page_url' ) ) {
+ $canonical_url = wpbc_booking_modes_get_canonical_page_url( $canonical_page_id );
+ }
+
+ return is_string( $canonical_url ) && '' !== $canonical_url ? $canonical_url : $fallback_url;
+}
+
+/**
+ * Resolve one canonical Bookings-area route for the WordPress admin bar.
+ *
+ * Booking Modes owns stable route identities. The explicit fallback preserves
+ * compatibility when the canonical registry is unavailable in an old