Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-hotel-booking/assets/dist/js/frontend/wphb-single-room.asset.php
+++ b/wp-hotel-booking/assets/dist/js/frontend/wphb-single-room.asset.php
@@ -2,5 +2,5 @@
'dependencies' => array(
),
- 'version' => '7172a90dc1bfc18f1f72'
+ 'version' => '8900cebe82950acf11b4'
);
--- a/wp-hotel-booking/assets/dist/js/frontend/wphb-single-room.min.asset.php
+++ b/wp-hotel-booking/assets/dist/js/frontend/wphb-single-room.min.asset.php
@@ -2,5 +2,5 @@
'dependencies' => array(
),
- 'version' => '3a34911642aff961cfa4'
+ 'version' => '607e28f9b66a454821f7'
);
--- a/wp-hotel-booking/includes/TemplateHooks/SingleRoomExternalLinkTemplate.php
+++ b/wp-hotel-booking/includes/TemplateHooks/SingleRoomExternalLinkTemplate.php
@@ -70,7 +70,7 @@
if ( ! isset( $external_links[ $field_id ] ) || ! $external_links[ $field_id ]['enabled'] ) {
continue;
}
- $default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-128x128.png';
+ $default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-logo.png';
$icon_id = $field['icon_id'] ? $field['icon_id'] : 0;
$title = $field['title'] ?: __( 'Wp hotel booking', 'wp-hotel-booking' );
--- a/wp-hotel-booking/includes/admin/class-wphb-admin-menu.php
+++ b/wp-hotel-booking/includes/admin/class-wphb-admin-menu.php
@@ -26,6 +26,34 @@
public function __construct() {
add_action( 'admin_menu', array( $this, 'register' ) );
add_action( 'admin_bar_menu', array( $this, 'admin_bar_menus' ), 50 );
+
+ // Enable custom admin menu ordering to keep Rooms directly below WP Hotel Booking.
+ add_filter( 'custom_menu_order', '__return_true' );
+ add_filter( 'menu_order', array( $this, 'menu_order' ), 99 );
+ }
+
+ /**
+ * Keep Rooms menu directly below WP Hotel Booking menu.
+ *
+ * @param array $menu_order
+ *
+ * @return array
+ */
+ public function menu_order( $menu_order ) {
+ if ( ! is_array( $menu_order ) ) {
+ return $menu_order;
+ }
+
+ $hb_pos = array_search( 'tp_hotel_booking', $menu_order, true );
+ $room_pos = array_search( 'edit.php?post_type=hb_room', $menu_order, true );
+
+ if ( false !== $hb_pos && false !== $room_pos && $room_pos !== $hb_pos + 1 ) {
+ array_splice( $menu_order, $room_pos, 1 );
+ $hb_pos = array_search( 'tp_hotel_booking', $menu_order, true );
+ array_splice( $menu_order, $hb_pos + 1, 0, 'edit.php?post_type=hb_room' );
+ }
+
+ return $menu_order;
}
/**
@@ -38,7 +66,7 @@
'edit_hb_bookings',
'tp_hotel_booking',
'',
- 'dashicons-calendar',
+ WPHB_PLUGIN_URL . '/assets/images/icon-logo.png', // 'dashicons-calendar',
'3.99'
);
--- a/wp-hotel-booking/includes/admin/class-wphb-admin-settings.php
+++ b/wp-hotel-booking/includes/admin/class-wphb-admin-settings.php
@@ -86,9 +86,29 @@
do_action( 'wphb_admin_settings_saved', $_POST );
+ $email_preview = array();
+ if ( function_exists( 'hb_get_email_settings_by_status' ) ) {
+ $settings = hb_settings();
+ $site_name = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
+ $admin_email = get_option( 'admin_email' );
+ $preview_subjects = array();
+
+ foreach ( array( 'completed', 'processing', 'cancelled', 'admin_new' ) as $status_key ) {
+ $status_data = hb_get_email_settings_by_status( $status_key );
+ $preview_subjects[ $status_key ] = ! empty( $status_data['subject'] ) ? $status_data['subject'] : '';
+ }
+
+ $email_preview = array(
+ 'subjects' => $preview_subjects,
+ 'from_name' => $settings->get( 'email_general_from_name' ) ? $settings->get( 'email_general_from_name' ) : $site_name,
+ 'from_email' => $settings->get( 'email_general_from_email' ) ? $settings->get( 'email_general_from_email' ) : $admin_email,
+ );
+ }
+
wp_send_json_success(
array(
- 'message' => __( 'Settings saved successfully.', 'wp-hotel-booking' ),
+ 'message' => __( 'Settings saved successfully.', 'wp-hotel-booking' ),
+ 'email_preview' => $email_preview,
)
);
}
@@ -505,7 +525,7 @@
<div class="wphb-settings-sticky-bar" id="wphb-settings-sticky-bar">
<div class="wphb-settings-sticky-bar__left">
<div class="wphb-settings-brand">
- <span class="dashicons dashicons-calendar-alt wphb-settings-brand__icon"></span>
+ <img src="<?php echo esc_url( WPHB_PLUGIN_URL . '/assets/images/icon-logo.png' ); ?>" alt="<?php esc_attr_e( 'WP Hotel Booking', 'wp-hotel-booking' ); ?>" width="33" height="33" />
<div class="wphb-settings-brand__text">
<span class="wphb-settings-brand__name"><?php esc_html_e( 'WP Hotel Booking', 'wp-hotel-booking' ); ?></span>
<span class="wphb-settings-brand__sep">/</span>
--- a/wp-hotel-booking/includes/admin/metaboxes/rooms/class-wphb-admin-metabox-rooms.php
+++ b/wp-hotel-booking/includes/admin/metaboxes/rooms/class-wphb-admin-metabox-rooms.php
@@ -398,27 +398,20 @@
continue;
}
if ( array_key_exists( $this->meta_key_prefix . $field['name'], (array) $_POST ) ) {
- $keyPost = $this->meta_key_prefix . $field['name'];
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $_POST[ $keyPost ] );
+ $keyPost = $this->meta_key_prefix . $field['name'];
- if ( in_array( $keyPost, $fieldTypeHtmlArr ) ) {
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $meta_value, 'html' );
+ if ( $keyPost === '_hb_room_preview_url' ) {
+ $raw_value = is_string( $_POST[ $keyPost ] ) ? wp_unslash( $_POST[ $keyPost ] ) : '';
+ $meta_value = hb_sanitize_video_preview( $raw_value );
+ } elseif ( $keyPost === '_hb_wphb_rule_room' || isset( $field['condition_html'] ) || in_array( $keyPost, $fieldTypeHtmlArr, true ) ) {
+ $raw_value = is_string( $_POST[ $keyPost ] ) ? wp_unslash( $_POST[ $keyPost ] ) : '';
+ $meta_value = current_user_can( 'unfiltered_html' ) ? $raw_value : hb_kses_post_with_iframe( $raw_value );
} else {
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $meta_value );
- }
- if ( $keyPost == '_hb_wphb_rule_room' ) {
- $meta_value = sanitize_post_field( '_hb_wphb_rule_room', $_POST[ $keyPost ], $post_id );
- }
- if ( isset( $field['condition_html'] ) ) {
- $meta_value = $_POST[ $keyPost ];
- }
-
- if ( $keyPost == '_hb_room_preview_url' ) {
- $meta_value = $_POST[ $keyPost ];
+ $meta_value = WPHB_Helpers::sanitize_params_submitted( $_POST[ $keyPost ] );
}
$meta_value = apply_filters( 'hb_meta_box_update_meta_value', $meta_value, $field['name'], $post_id );
- update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], $meta_value );
+ update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], wp_slash( $meta_value ) );
} else {
update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], '' );
}
--- a/wp-hotel-booking/includes/admin/metaboxes/views/meta-booking-items.php
+++ b/wp-hotel-booking/includes/admin/metaboxes/views/meta-booking-items.php
@@ -72,14 +72,25 @@
<?php foreach ( $rooms as $k => $room ) : ?>
<?php do_action( 'hotel_booking_before_room_item', $room, $hb_booking ); ?>
- <?php $room_id = apply_filters( 'hotel-booking-order-room-id', hb_get_order_item_meta( $room->order_item_id, 'product_id', true ) ); ?>
+ <?php
+ $room_id = absint( apply_filters( 'hotel-booking-order-room-id', hb_get_order_item_meta( $room->order_item_id, 'product_id', true ) ) );
+ $room_title = $room_id ? get_the_title( $room_id ) : '';
+ if ( '' === $room_title ) {
+ $room_title = $room->order_item_name;
+ }
+ $room_edit_link = $room_id ? get_edit_post_link( $room_id ) : '';
+ ?>
<tr>
<td class="center">
<input type="checkbox" name="book_item[]" value="<?php echo esc_attr( $room->order_item_id ); ?>"/>
</td>
<td class="name left">
- <a href="<?php echo esc_url( get_edit_post_link( $room_id ) ); ?>"><?php echo esc_html( get_the_title( $room_id ) ); ?></a>
+ <?php if ( $room_edit_link ) : ?>
+ <a href="<?php echo esc_url( $room_edit_link ); ?>"><?php echo esc_html( $room_title ); ?></a>
+ <?php else : ?>
+ <?php echo esc_html( $room_title ); ?>
+ <?php endif; ?>
</td>
<td class="checkin_checkout center">
<?php
--- a/wp-hotel-booking/includes/admin/metaboxes/views/tabs/meta-room-external-link.php
+++ b/wp-hotel-booking/includes/admin/metaboxes/views/tabs/meta-room-external-link.php
@@ -20,7 +20,7 @@
$hb_extenal_link_settings = WPHB_Settings::instance()->get( 'external_link_settings' );
$setting_fields = ! empty( $hb_extenal_link_settings ) ? json_decode( $hb_extenal_link_settings, true ) : array();
-$default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-128x128.png';
+$default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-logo.png';
$room_external_link_settings = get_post_meta( $post->ID, '_hb_room_external_link', true );
$room_external_link_settings_arr = ! empty( $room_external_link_settings ) ? json_decode( $room_external_link_settings, true ) : array();
--- a/wp-hotel-booking/includes/admin/settings/class-wphb-admin-setting-emails.php
+++ b/wp-hotel-booking/includes/admin/settings/class-wphb-admin-setting-emails.php
@@ -242,7 +242,7 @@
'type' => 'text',
'id' => 'tp_hotel_booking_email_cancel_booking_subject',
'title' => __( 'Subject', 'wp-hotel-booking' ),
- 'desc' => sprintf( __( 'Enter recipients (comma separated) for this email. Defaults to %s.', 'wp-hotel-booking' ), get_option( 'admin_email' ) ),
+ 'desc' => __( 'Enter the subject of this email. Available placeholders: Atomic Edge, {booking_number}, {booking_date}', 'wp-hotel-booking' ),
'default' => '[Atomic Edge] Cancelled Reservation ({booking_number}) - {booking_date}',
'placeholder' => '[Atomic Edge] Cancelled Reservation ({booking_number}) - {booking_date}',
),
@@ -490,27 +490,30 @@
function updatePreview() {
var status = $('#wphb_preview_select_status').val();
- if (subjectsMap[status]) {
+ if (typeof subjectsMap[status] !== 'undefined') {
$('#wphb_preview_header_subject').text(subjectsMap[status]);
+ $('#wphb-modal-subject-preview').text('[Test] ' + subjectsMap[status]);
}
$.ajax({
url: ajaxurl,
type: 'GET',
+ cache: false,
data: {
action: 'wphb_render_email_preview',
- status: status
+ status: status,
+ _t: Date.now()
},
success: function(html) {
if (html && html.trim() !== '0' && html.trim() !== '-1') {
$('#wphb_email_live_preview_iframe').attr('srcdoc', html);
} else {
- var url = previewBase + '?action=wphb_render_email_preview&status=' + encodeURIComponent(status);
+ var url = previewBase + '?action=wphb_render_email_preview&status=' + encodeURIComponent(status) + '&_t=' + Date.now();
$('#wphb_email_live_preview_iframe').removeAttr('srcdoc').attr('src', url);
}
},
error: function() {
- var url = previewBase + '?action=wphb_render_email_preview&status=' + encodeURIComponent(status);
+ var url = previewBase + '?action=wphb_render_email_preview&status=' + encodeURIComponent(status) + '&_t=' + Date.now();
$('#wphb_email_live_preview_iframe').removeAttr('srcdoc').attr('src', url);
}
});
@@ -521,6 +524,27 @@
updatePreview();
});
+ // Refresh Live Preview & subjects map automatically after AJAX Save Settings
+ document.addEventListener('wphb:settings-saved', function(e) {
+ var data = (e && e.detail && e.detail.email_preview) ? e.detail.email_preview : null;
+ if (data) {
+ if (data.subjects) {
+ subjectsMap = data.subjects;
+ }
+ if (typeof data.from_name !== 'undefined') {
+ defaultFromName = data.from_name;
+ var currentFromName = $('#tp_hotel_booking_email_general_from_name').val();
+ $('#wphb_preview_header_from_name').text(currentFromName ? currentFromName : defaultFromName);
+ }
+ if (typeof data.from_email !== 'undefined') {
+ defaultFromEmail = data.from_email;
+ var currentFromEmail = $('#tp_hotel_booking_email_general_from_email').val();
+ $('#wphb_preview_header_from_email').text('<' + (currentFromEmail ? currentFromEmail : defaultFromEmail) + '>');
+ }
+ }
+ updatePreview();
+ });
+
// Real-time sync for sender name and email from settings form
$('#tp_hotel_booking_email_general_from_name').on('input change', function() {
var val = $(this).val();
--- a/wp-hotel-booking/includes/admin/views/calendar-manager.php
+++ b/wp-hotel-booking/includes/admin/views/calendar-manager.php
@@ -2,7 +2,7 @@
/**
* Admin View: Calendar Manager
*
- * @version 1.0.0
+ * @version 2.3.7
* @package WP_Hotel_Booking/Views
* @category Views
* @author Thimpress, leehld
@@ -13,9 +13,26 @@
*/
defined( 'ABSPATH' ) || exit;
+$statuses = hb_get_booking_statuses();
?>
<div class="wrap" id="tp_hotel_booking_calendar_manager">
- <h2><?php esc_html_e( 'Calendar Manager', 'wp-hotel-booking' ); ?></h2>
- <div id="manager_booking"></div>
-</div>
No newline at end of file
+ <div class="wphb-cm-header">
+ <div class="wphb-cm-header__title">
+ <h1><?php esc_html_e( 'Calendar Manager', 'wp-hotel-booking' ); ?></h1>
+ <p class="wphb-cm-header__desc"><?php esc_html_e( 'Overview of all room bookings. Click on a booking to see its details.', 'wp-hotel-booking' ); ?></p>
+ </div>
+ <ul class="wphb-cm-legend">
+ <?php foreach ( $statuses as $status => $label ) : ?>
+ <li class="wphb-cm-status--<?php echo esc_attr( $status ); ?>">
+ <span class="wphb-cm-legend__dot"></span><?php echo esc_html( $label ); ?>
+ </li>
+ <?php endforeach; ?>
+ </ul>
+ </div>
+ <hr class="wp-header-end">
+
+ <div class="wphb-cm-card">
+ <div id="manager_booking"></div>
+ </div>
+</div>
--- a/wp-hotel-booking/includes/booking/wphb-booking-hooks.php
+++ b/wp-hotel-booking/includes/booking/wphb-booking-hooks.php
@@ -118,11 +118,6 @@
$format = $settings->get( 'email_new_booking_format', 'html' );
$headers = 'Content-Type: ' . ( $format == 'html' ? 'text/html' : 'text/plain' ) . "rn";
- // set mail from email
- add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
- // set mail from name
- add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
- add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
// customer place order email
$customer_email_subject = __( 'Booking pending', 'wp-hotel-booking' );
@@ -142,6 +137,12 @@
return;
}
+ add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+ if ( 'html' === $format ) {
+ add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ }
+
$customer_send = wp_mail( $booking->customer_email, $customer_email_subject, $customer_body, $headers );
// admin place order email
@@ -176,11 +177,18 @@
);
if ( ! $body ) {
+ remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
return;
}
$admin_send = wp_mail( $admin_email, $subject, $body, $headers );
+ remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+
return ( $customer_send && $admin_send );
}
}
@@ -382,8 +390,10 @@
'booking-number' => $booking->get_booking_number(),
'site-title' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
);
- $subject = str_replace( $find, $replace, $subject );
- $subject = apply_filters( 'hb_customer_processing_booking_email_subject', $subject, $booking, $to );
+ $subject = str_replace( $find, $replace, $subject );
+ $subject = apply_filters( 'hb_customer_processing_booking_email_subject', $subject, $booking, $to );
+ $heading = str_replace( $find, $replace, $heading );
+ $heading_desc = str_replace( $find, $replace, $heading_desc );
$email_content = hb_get_template_content(
'emails/booking-accepted.php',
@@ -450,7 +460,9 @@
'site-title' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
);
- $subject = str_replace( $find, $replace, $subject );
+ $subject = str_replace( $find, $replace, $subject );
+ $email_heading = str_replace( $find, $replace, $email_heading );
+ $email_heading_desc = str_replace( $find, $replace, $email_heading_desc );
$body = hb_get_template_content(
'emails/admin/admin-new-booking.php',
@@ -467,7 +479,17 @@
}
$headers = 'Content-Type: ' . ( $format == 'html' ? 'text/html' : 'text/plain' ) . "rn";
- $send = wp_mail( $to, $subject, $body, $headers );
+ add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+ if ( 'html' === $format ) {
+ add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ }
+
+ $send = wp_mail( $to, $subject, $body, $headers );
+
+ remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
return $send;
}
@@ -484,11 +506,6 @@
$email_subject = hb_settings()->get( 'email_general_subject', __( 'Reservation', 'wp-hotel-booking' ) );
$headers[] = 'Content-Type: text/html; charset=UTF-8';
- // set mail from email
- add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
- // set mail from name
- add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
- add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
$email_content = hb_get_template_content(
'emails/customer-booking.php',
@@ -513,10 +530,17 @@
$email_subject = str_replace( $find, $replace, $email_subject );
- $to = ( $recipient && is_email( $recipient ) ) ? $recipient : $booking->customer_email;
+ $to = ( $recipient && is_email( $recipient ) ) ? $recipient : $booking->customer_email;
+
+ add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+ add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+
$send = wp_mail( $to, $email_subject, stripslashes( $email_content ), $headers );
remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
return (bool) $send;
}
@@ -554,7 +578,9 @@
'site-title' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
);
- $subject = str_replace( $find, $replace, $subject );
+ $subject = str_replace( $find, $replace, $subject );
+ $email_heading = str_replace( $find, $replace, $email_heading );
+ $email_heading_desc = str_replace( $find, $replace, $email_heading_desc );
$body = hb_get_template_content(
'emails/admin/admin-cancel-booking.php',
@@ -571,7 +597,17 @@
}
$headers = 'Content-Type: ' . ( $format == 'html' ? 'text/html' : 'text/plain' ) . "rn";
- $send = wp_mail( $to, $subject, $body, $headers );
+ add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+ if ( 'html' === $format ) {
+ add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ }
+
+ $send = wp_mail( $to, $subject, $body, $headers );
+
+ remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
// if ( $fo = fopen( WPHB_PLUGIN_PATH . '/new-booking.html', 'w+' ) ) {
// fwrite( $fo, $body );
// fclose($fo);
@@ -587,9 +623,20 @@
return false;
}
- $booking = WPHB_Booking::instance( $booking_id );
- $subject = hb_settings()->get( 'email_cancel_booking_subject', 'Cancelled Reservation' );
- $find = array(
+ $settings = hb_settings();
+ $booking = WPHB_Booking::instance( $booking_id );
+ $subject = $settings->get( 'email_cancel_booking_subject', 'Cancelled Reservation' );
+ $email_heading = $settings->get( 'email_cancel_booking_heading' );
+ $email_heading_desc = $settings->get( 'email_cancel_booking_heading_desc' );
+
+ if ( empty( $email_heading ) ) {
+ $email_heading = __( 'Cancelled booking', 'wp-hotel-booking' );
+ }
+ if ( empty( $email_heading_desc ) ) {
+ $email_heading_desc = __( 'Booking has been marked cancelled', 'wp-hotel-booking' );
+ }
+
+ $find = array(
'booking-date' => '{booking_date}',
'booking-number' => '{booking_number}',
'site-title' => 'Atomic Edge',
@@ -601,30 +648,36 @@
'site-title' => wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ),
);
- $subject = str_replace( $find, $replace, $subject );
+ $subject = str_replace( $find, $replace, $subject );
+ $email_heading = str_replace( $find, $replace, $email_heading );
+ $email_heading_desc = str_replace( $find, $replace, $email_heading_desc );
$headers[] = 'Content-Type: text/html; charset=UTF-8';
- // set mail from email
- add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
- // set mail from name
- add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
- add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
$email_content = hb_get_template_content(
'emails/customer-cancelled.php',
array(
- 'booking' => $booking,
- 'options' => hb_settings(),
+ 'booking' => $booking,
+ 'options' => $settings,
+ 'email_heading' => $email_heading,
+ 'email_heading_desc' => $email_heading_desc,
)
);
- $to = ( $recipient && is_email( $recipient ) ) ? $recipient : $booking->customer_email;
+ $to = ( $recipient && is_email( $recipient ) ) ? $recipient : $booking->customer_email;
+
+ add_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ add_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
+ add_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+
$send = wp_mail( $to, $subject, stripslashes( $email_content ), $headers );
// if ( $fo = fopen( WPHB_PLUGIN_PATH . '/customer-booking.html', 'w+' ) ) {
// fwrite( $fo, $email_content );
// fclose($fo);
// }
remove_filter( 'wp_mail_content_type', 'hb_set_html_content_type' );
+ remove_filter( 'wp_mail_from', 'hb_wp_mail_from' );
+ remove_filter( 'wp_mail_from_name', 'hb_wp_mail_from_name' );
return (bool) $send;
}
@@ -698,21 +751,11 @@
case 'completed':
$subject = $settings->get( 'email_general_subject' );
if ( empty( $subject ) ) {
- $subject = $settings->get( 'email_new_booking_subject' );
- }
- if ( empty( $subject ) ) {
$subject = __( 'Reservation', 'wp-hotel-booking' );
}
- $heading = $settings->get( 'email_new_booking_heading' );
- if ( empty( $heading ) ) {
- $heading = __( 'Completed Payment', 'wp-hotel-booking' );
- }
-
- $heading_desc = $settings->get( 'email_new_booking_heading_desc' );
- if ( empty( $heading_desc ) ) {
- $heading_desc = __( 'The customer has completed the transaction', 'wp-hotel-booking' );
- }
+ $heading = __( 'Thanks for your booking', 'wp-hotel-booking' );
+ $heading_desc = __( 'Thank you for making reservation at our hotel. We will try our best to bring the best service. Good luck and see you soon!', 'wp-hotel-booking' );
break;
case 'cancelled':
@@ -952,6 +995,7 @@
$status = isset( $_REQUEST['status'] ) ? sanitize_key( $_REQUEST['status'] ) : 'processing';
$content = hb_get_sample_demo_email_content( $status );
+ nocache_headers();
header( 'Content-Type: text/html; charset=UTF-8' );
echo stripslashes( $content );
exit;
--- a/wp-hotel-booking/includes/class-wphb-helpers.php
+++ b/wp-hotel-booking/includes/class-wphb-helpers.php
@@ -26,8 +26,10 @@
* @since 1.9.10
* @version 1.0.1
*/
- public static function sanitize_params_submitted( $value, string $type_content = 'text' ) {
- $value = wp_unslash( $value );
+ public static function sanitize_params_submitted( $value, string $type_content = 'text', bool $unslash = true ) {
+ if ( $unslash ) {
+ $value = wp_unslash( $value );
+ }
if ( is_string( $value ) ) {
switch ( $type_content ) {
@@ -56,7 +58,7 @@
} elseif ( is_array( $value ) ) {
foreach ( $value as $k => $v ) {
unset( $value[ $k ] );
- $value[ sanitize_text_field( $k ) ] = self::sanitize_params_submitted( $v, $type_content );
+ $value[ sanitize_text_field( (string) $k ) ] = self::sanitize_params_submitted( $v, $type_content, false );
}
}
--- a/wp-hotel-booking/includes/class-wphb-meta-box.php
+++ b/wp-hotel-booking/includes/class-wphb-meta-box.php
@@ -99,17 +99,17 @@
if ( ! empty( $this->metabox( $post_id ) ) ) {
foreach ( $this->metabox( $post_id ) as $key => $field ) {
if ( array_key_exists( $this->meta_key_prefix . $field['name'], (array) $_POST ) ) {
- $keyPost = $this->meta_key_prefix . $field['name'];
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $_POST[ $keyPost ] );
+ $keyPost = $this->meta_key_prefix . $field['name'];
- if ( in_array( $keyPost, $fieldTypeHtmlArr ) ) {
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $meta_value, 'html' );
+ if ( in_array( $keyPost, $fieldTypeHtmlArr, true ) ) {
+ $raw_value = is_string( $_POST[ $keyPost ] ) ? wp_unslash( $_POST[ $keyPost ] ) : '';
+ $meta_value = current_user_can( 'unfiltered_html' ) ? $raw_value : hb_kses_post_with_iframe( $raw_value );
} else {
- $meta_value = WPHB_Helpers::sanitize_params_submitted( $meta_value );
+ $meta_value = WPHB_Helpers::sanitize_params_submitted( $_POST[ $keyPost ] );
}
$meta_value = apply_filters( 'hb_meta_box_update_meta_value', $meta_value, $field['name'], $post_id );
- update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], $meta_value );
+ update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], wp_slash( $meta_value ) );
} else {
update_post_meta( $post_id, $this->meta_key_prefix . $field['name'], '' );
}
--- a/wp-hotel-booking/includes/elementor/widgets/archive-room/archive-room.php
+++ b/wp-hotel-booking/includes/elementor/widgets/archive-room/archive-room.php
@@ -101,7 +101,7 @@
'type' => Controls_Manager::REPEATER,
'fields' => $repeater_header->get_controls(),
'prevent_empty'=>false,
- 'title_field' => '<span style="text-transform: capitalize;">{{{ header_key.replace("_", " ") }}}</span>',
+ 'title_field' => '<span style="text-transform: capitalize;">{{ header_key.replace("_", " ") }}</span>',
)
);
@@ -403,8 +403,8 @@
'current' => $paged,
'total' => $page_limit,
'prev_next' => $show_prev_next,
- 'prev_text' => $settings['pagination_prev_label'],
- 'next_text' => $settings['pagination_next_label'],
+ 'prev_text' => wp_kses_post( $settings['pagination_prev_label'] ),
+ 'next_text' => wp_kses_post( $settings['pagination_next_label'] ),
'show_all' => 'yes' !== $settings['pagination_numbers_shorten'],
'before_page_number' => '<span class="elementor-screen-only">' . esc_html__( 'Page', 'thim-elementor-kit' ) . '</span>',
);
@@ -452,17 +452,17 @@
$next_page = 1;
}
- $return['prev'] = sprintf( $link_template, 'prev', $this->get_wp_link_page( $next_page ), $settings['pagination_prev_label'] );
+ $return['prev'] = sprintf( $link_template, 'prev', esc_url( $this->get_wp_link_page( $next_page ) ), wp_kses_post( $settings['pagination_prev_label'] ) );
} else {
- $return['prev'] = sprintf( $disabled_template, 'prev', $settings['pagination_prev_label'] );
+ $return['prev'] = sprintf( $disabled_template, 'prev', wp_kses_post( $settings['pagination_prev_label'] ) );
}
$next_page = intval( $paged ) + 1;
if ( $next_page <= $page_limit ) {
- $return['next'] = sprintf( $link_template, 'next', $this->get_wp_link_page( $next_page ), $settings['pagination_next_label'] );
+ $return['next'] = sprintf( $link_template, 'next', esc_url( $this->get_wp_link_page( $next_page ) ), wp_kses_post( $settings['pagination_next_label'] ) );
} else {
- $return['next'] = sprintf( $disabled_template, 'next', $settings['pagination_next_label'] );
+ $return['next'] = sprintf( $disabled_template, 'next', wp_kses_post( $settings['pagination_next_label'] ) );
}
return $return;
--- a/wp-hotel-booking/includes/elementor/widgets/archive-room/list-results-room.php
+++ b/wp-hotel-booking/includes/elementor/widgets/archive-room/list-results-room.php
@@ -211,7 +211,7 @@
$this->current_permalink = get_permalink();
?>
<div class="hb-room clearfix">
- <form name="hb-page-search-results" class="hb-page-search-room-results <?php echo $class_item; ?> extra-option-loop" >
+ <form name="hb-page-search-results" class="hb-page-search-room-results <?php echo esc_attr( $class_item ); ?> extra-option-loop" >
<?php do_action( 'hotel_booking_loop_before_item', $room->ID ); ?>
<?php
Elementor::instance()->render_loop_item_content( $settings['template_id'] );
@@ -279,8 +279,8 @@
'current' => $paged,
'total' => $page_limit,
'prev_next' => $show_prev_next,
- 'prev_text' => $settings['pagination_prev_label'],
- 'next_text' => $settings['pagination_next_label'],
+ 'prev_text' => wp_kses_post( $settings['pagination_prev_label'] ),
+ 'next_text' => wp_kses_post( $settings['pagination_next_label'] ),
'show_all' => 'yes' !== $settings['pagination_numbers_shorten'],
'before_page_number' => '<span class="elementor-screen-only">' . esc_html__( 'Page', 'thim-elementor-kit' ) . '</span>',
);
@@ -328,17 +328,17 @@
$next_page = 1;
}
- $return['prev'] = sprintf( $link_template, 'prev', $this->get_wp_link_page( $next_page ), $settings['pagination_prev_label'] );
+ $return['prev'] = sprintf( $link_template, 'prev', esc_url( $this->get_wp_link_page( $next_page ) ), wp_kses_post( $settings['pagination_prev_label'] ) );
} else {
- $return['prev'] = sprintf( $disabled_template, 'prev', $settings['pagination_prev_label'] );
+ $return['prev'] = sprintf( $disabled_template, 'prev', wp_kses_post( $settings['pagination_prev_label'] ) );
}
$next_page = intval( $paged ) + 1;
if ( $next_page <= $page_limit ) {
- $return['next'] = sprintf( $link_template, 'next', $this->get_wp_link_page( $next_page ), $settings['pagination_next_label'] );
+ $return['next'] = sprintf( $link_template, 'next', esc_url( $this->get_wp_link_page( $next_page ) ), wp_kses_post( $settings['pagination_next_label'] ) );
} else {
- $return['next'] = sprintf( $disabled_template, 'next', $settings['pagination_next_label'] );
+ $return['next'] = sprintf( $disabled_template, 'next', wp_kses_post( $settings['pagination_next_label'] ) );
}
return $return;
--- a/wp-hotel-booking/includes/elementor/widgets/global/filter-room.php
+++ b/wp-hotel-booking/includes/elementor/widgets/global/filter-room.php
@@ -189,7 +189,7 @@
'meta_field' => 'rating',
],
],
- 'title_field' => '<span style="text-transform: capitalize;">{{{ meta_field.replace("_", " ") }}}</span>',
+ 'title_field' => '<span style="text-transform: capitalize;">{{ meta_field.replace("_", " ") }}</span>',
]
);
--- a/wp-hotel-booking/includes/elementor/widgets/global/search-room.php
+++ b/wp-hotel-booking/includes/elementor/widgets/global/search-room.php
@@ -189,7 +189,7 @@
'meta_field' => 'submit',
],
],
- 'title_field' => '<span style="text-transform: capitalize;">{{{ meta_field.replace("_", " ") }}}</span>',
+ 'title_field' => '<span style="text-transform: capitalize;">{{ meta_field.replace("_", " ") }}</span>',
]
);
@@ -511,7 +511,7 @@
if ( $settings['data'] ) {
?>
<div class="hotel-booking-search-el">
- <form <?php echo is_page( $page_search ) ? 'id="hb-form-search-page" ' : ''; ?> name="hb-search-form" action="<?php echo hb_get_url(); ?>" class="hb-search-form-<?php echo esc_attr($uniqid); ?>">
+ <form <?php echo is_page( $page_search ) ? 'id="hb-form-search-page" ' : ''; ?> name="hb-search-form" action="<?php echo esc_url( hb_get_url() ); ?>" class="hb-search-form-<?php echo esc_attr($uniqid); ?>">
<ul class="hb-form-table">
<?php
foreach ( $settings['data'] as $data ) {
@@ -555,8 +555,8 @@
$date_tomorrow = new WPHB_Datetime( strtotime( $date_now->get_raw_date() . ' +1 day' ) );
$check_in_date = WPHB_Helpers::get_param( 'check_in_date', $date_now->format( $format ) );
$check_out_date = WPHB_Helpers::get_param( 'check_out_date', $date_tomorrow->format( $format ) );
- $label_check_in = $settings['label_field_date'] ?? esc_html__('Check-in Date', 'wp-hotel-booking');
- $label_check_out = $settings['label_field_check_out'] ?? esc_html__('Check-out Date', 'wp-hotel-booking');
+ $label_check_in = $settings['label_field_date'] ?? __( 'Check-in Date', 'wp-hotel-booking' );
+ $label_check_out = $settings['label_field_check_out'] ?? __( 'Check-out Date', 'wp-hotel-booking' );
if ($settings['layout_date'] == 'single') {
?>
@@ -568,7 +568,7 @@
<?php if ( $settings['icons_field'] ) {
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
- <input type="text" name="check_in_date" id="check_in_date_<?php echo esc_attr($uniqid); ?>" class="hb_input_date_check" value="<?php echo esc_attr($check_in_date); ?>" placeholder="<?php echo $label_check_in; ?>" autocomplete="off" />
+ <input type="text" name="check_in_date" id="check_in_date_<?php echo esc_attr($uniqid); ?>" class="hb_input_date_check" value="<?php echo esc_attr($check_in_date); ?>" placeholder="<?php echo esc_attr( $label_check_in ); ?>" autocomplete="off" />
</div>
</li>
@@ -580,7 +580,7 @@
<?php if ( $settings['icons_field'] ) {
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
- <input type="text" name="check_out_date" id="check_out_date_<?php echo esc_attr($uniqid); ?>" class="hb_input_date_check" value="<?php echo esc_attr($check_out_date); ?>" placeholder="<?php echo $label_check_out; ?>" autocomplete="off" />
+ <input type="text" name="check_out_date" id="check_out_date_<?php echo esc_attr($uniqid); ?>" class="hb_input_date_check" value="<?php echo esc_attr($check_out_date); ?>" placeholder="<?php echo esc_attr( $label_check_out ); ?>" autocomplete="off" />
</div>
</li>
<?php
@@ -592,7 +592,7 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label_check_in != '' ) :?>
- <div class="label"><?php echo $label_check_in; ?></div>
+ <div class="label"><?php echo esc_html( $label_check_in ); ?></div>
<?php endif; ?>
<div class="hb-form-field-input hb_input_field">
<input type="text" name="check_in_date" id="check_in_date_<?php echo esc_attr($uniqid) ?>" class="check-date" value="<?php echo esc_attr($check_in_date) ?>" readonly />
@@ -607,7 +607,7 @@
protected function hb_render_adults($settings, $classes) {
$adults = hb_get_request( 'adults_capacity', hb_get_request( 'adults', 1 ) );
- $label_adults = !empty($settings['label_field']) ? $settings['label_field'] : esc_html__('Adults', 'wp-hotel-booking');
+ $label_adults = ! empty( $settings['label_field'] ) ? $settings['label_field'] : __( 'Adults', 'wp-hotel-booking' );
if ( $settings['layout_guest'] == 'select') {
?>
@@ -642,14 +642,14 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label_adults != '' ) :?>
- <div class="label"><?php echo $label_adults; ?></div>
+ <div class="label"><?php echo esc_html( $label_adults ); ?></div>
<?php endif; ?>
<div id="adults" class="hb-form-field-input hb_input_field">
<input type="text" class="adults-input" value="<?php echo esc_attr($adults) ?>" readonly />
- <span><?php echo $label_adults; ?></span>
+ <span><?php echo esc_html( $label_adults ); ?></span>
</div>
<div class="hb-form-field-list nav-adults">
- <span class="name"><?php echo $label_adults; ?></span>
+ <span class="name"><?php echo esc_html( $label_adults ); ?></span>
<div class="number-box">
<span class="number-icons goDown"><i class="fa fa-minus"></i></span>
<span class="hb-adults-field adults-number">
@@ -676,7 +676,7 @@
protected function hb_render_children($settings, $classes) {
$max_child = hb_get_request('max_child', '0');
- $label_child = !empty($settings['label_field']) ? $settings['label_field'] : esc_html__('Children', 'wp-hotel-booking');
+ $label_child = ! empty( $settings['label_field'] ) ? $settings['label_field'] : __( 'Children', 'wp-hotel-booking' );
if ( $settings['layout_guest'] == 'select') {
?>
@@ -685,7 +685,7 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label_child != '' ) :?>
- <div class="label"><?php echo $label_child; ?></div>
+ <div class="label"><?php echo esc_html( $label_child ); ?></div>
<?php endif; ?>
<div class="hb-form-field-input">
<?php
@@ -710,14 +710,14 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label_child != '' ) :?>
- <div class="label"><?php echo $label_child; ?></div>
+ <div class="label"><?php echo esc_html( $label_child ); ?></div>
<?php endif; ?>
<div id="child" class="hb-form-field-input hb_input_field">
<input type="text" class="child-input" value="<?php echo esc_attr($max_child) ?>" readonly />
- <span><?php echo $label_child; ?></span>
+ <span><?php echo esc_html( $label_child ); ?></span>
</div>
<div class="hb-form-field-list nav-children">
- <span class="name"><?php echo $label_child; ?></span>
+ <span class="name"><?php echo esc_html( $label_child ); ?></span>
<div class="number-box">
<span class="number-icons goDown"><i class="fa fa-minus"></i></span>
<span class="hb-children-field children-number">
@@ -743,7 +743,7 @@
protected function hb_render_rooms($settings, $classes) {
$quantity = hb_get_request( 'room_qty', 1, 'int' );
- $label = !empty($settings['label_field']) ? $settings['label_field'] : esc_html__('Rooms', 'wp-hotel-booking');
+ $label = ! empty( $settings['label_field'] ) ? $settings['label_field'] : __( 'Rooms', 'wp-hotel-booking' );
if ( $settings['layout_guest'] == 'select') {
?>
@@ -752,7 +752,7 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label != '' ) :?>
- <div class="label"><?php echo $label; ?></div>
+ <div class="label"><?php echo esc_html( $label ); ?></div>
<?php endif; ?>
<div class="hb-form-field-input">
<?php
@@ -777,14 +777,14 @@
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true', 'class' => 'icon-custom' ) );
} ?>
<?php if ( $label != '' ) :?>
- <div class="label"><?php echo $label; ?></div>
+ <div class="label"><?php echo esc_html( $label ); ?></div>
<?php endif; ?>
<div id="number-of-rooms" class="hb-form-field-input hb_input_field">
<input type="text" class="number-of-rooms-input" value="<?php echo esc_attr($quantity); ?>" readonly />
- <span><?php echo $label; ?></span>
+ <span><?php echo esc_html( $label ); ?></span>
</div>
<div class="hb-form-field-list nav-number-of-rooms">
- <span class="name"><?php echo $label; ?></span>
+ <span class="name"><?php echo esc_html( $label ); ?></span>
<div class="number-box">
<span class="number-icons goDown"><i class="fa fa-minus"></i></span>
@@ -817,8 +817,8 @@
<?php if ( $settings['icons_field'] ) {
Icons_Manager::render_icon( $settings['icons_field'], array( 'aria-hidden' => 'true' ) );
} ?>
- <?php if ( $settings['label_field'] != '' ) :?>
- <span class="submit-text"> <?php echo $settings['label_field']; ?> </span>
+ <?php if ( ( $settings['label_field'] ?? '' ) !== '' ) : ?>
+ <span class="submit-text"> <?php echo esc_html( $settings['label_field'] ); ?> </span>
<?php endif; ?>
</button>
</li>
--- a/wp-hotel-booking/includes/elementor/widgets/loop-item/loop-room-external-links.php
+++ b/wp-hotel-booking/includes/elementor/widgets/loop-item/loop-room-external-links.php
@@ -584,7 +584,7 @@
$global_settings = ! empty( $hb_extenal_link_settings ) ? json_decode( $hb_extenal_link_settings, true ) : array();
// Default icon URL
- $default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-128x128.png';
+ $default_icon_url = WPHB_PLUGIN_URL . '/assets/images/icon-logo.png';
$merged_data = array();
@@ -712,7 +712,7 @@
<div class="external-ota-platform-container loop-room-external-links">
<# if (settings.title) { #>
- <p class="external-ota-platform-title">{{{ settings.title }}}</p>
+ <p class="external-ota-platform-title">{{ settings.title }}</p>
<# } #>
<ul class="wphb-partner-links e-external-links">
@@ -721,7 +721,7 @@
target="_blank"
<# if (relAttributes) { #>rel="{{ relAttributes }}"<# } #>
title="Preview">
- <img src="<?php echo WPHB_PLUGIN_URL . '/assets/images/icon-128x128.png'; ?>"
+ <img src="<?php echo esc_url( WPHB_PLUGIN_URL . '/assets/images/icon-logo.png' ); ?>"
alt="Preview"
width="{{ imageWidth }}"
height="{{ imageHeight }}">
--- a/wp-hotel-booking/includes/elementor/widgets/loop-item/loop-room-info.php
+++ b/wp-hotel-booking/includes/elementor/widgets/loop-item/loop-room-info.php
@@ -143,7 +143,7 @@
),
),
),
- 'title_field' => '{{{ elementor.helpers.renderIcon( this, selected_icon, {}, "i", "panel" ) || '<i class="{{ icon }}" aria-hidden="true"></i>' }}} <span style="text-transform: capitalize;">{{{ type }}}</span>',
+ 'title_field' => '{{{ elementor.helpers.renderIcon( this, selected_icon, {}, "i", "panel" ) || '<i class="{{ icon }}" aria-hidden="true"></i>' }}} <span style="text-transform: capitalize;">{{ type }}</span>',
)
);
$this->remove_control('link_click');
@@ -316,7 +316,7 @@
$this->render_icon($repeater_item);
foreach ($terms as $term) {
- $terms_list[] = '<a href="' . esc_url(get_term_link($term)) . '" class="loop-item-term elementor-icon-list-text type-' . esc_html($term->slug) . '">' . esc_html($term->name) . '</a>';
+ $terms_list[] = '<a href="' . esc_url(get_term_link($term)) . '" class="loop-item-term elementor-icon-list-text type-' . esc_attr($term->slug) . '">' . esc_html($term->name) . '</a>';
}
if ('yes' == $repeater_item['show_one']) {
--- a/wp-hotel-booking/includes/elementor/widgets/single-room/room-infos.php
+++ b/wp-hotel-booking/includes/elementor/widgets/single-room/room-infos.php
@@ -67,7 +67,7 @@
if (!empty($infos)) {
?>
<div class="hb-room-single__additional-information">
- <?php echo wp_kses_post( $room->get_addition_information() ); ?>
+ <?php echo hb_kses_post_with_iframe( $room->get_addition_information() ); ?>
</div>
<?php
}
--- a/wp-hotel-booking/includes/elementor/widgets/single-room/room-preview.php
+++ b/wp-hotel-booking/includes/elementor/widgets/single-room/room-preview.php
@@ -75,7 +75,7 @@
$settings = $this->get_settings_for_display(); ?>
<div id="hb_room_images">
<?php if ( $hb_room->is_preview ) :
- $preview = get_post_meta( $hb_room->ID, '_hb_room_preview_url', true );
+ $preview = hb_sanitize_video_preview( get_post_meta( $hb_room->ID, '_hb_room_preview_url', true ) );
?>
<span class="room-preview" data-preview="<?php echo ! empty( $preview ) ? esc_attr( $preview ) : ''; ?>">
<?php Icons_Manager::render_icon( $settings['icon_preview'],['aria-hidden' => 'true']); ?>
--- a/wp-hotel-booking/includes/elementor/widgets/single-room/room-thumb.php
+++ b/wp-hotel-booking/includes/elementor/widgets/single-room/room-thumb.php
@@ -233,13 +233,13 @@
$images = '';
}
- echo '<li class="hb-gallery-item' . $class . '"><a href="' . esc_url( $full_url ) . '" class="gallery-img-item" data-elementor-open-lightbox="no">' . $images . '</a></li>';
+ echo '<li class="hb-gallery-item' . esc_attr( $class ) . '"><a href="' . esc_url( $full_url ) . '" class="gallery-img-item" data-elementor-open-lightbox="no">' . $images . '</a></li>';
if ( count( $galleries ) > 1 && $key == 0 ) {
echo '</ul><ul class="hb-gallery-thumbnails d-flex">';
}
}
- echo '<span class="button-gallery dynamic-gal" data-dynamicPath='. json_encode($gMoreImages).'>' . $html_icon . ' ' . esc_html__( 'Gallery', 'wp-hotel-booking' ) . '</span>';
+ echo '<span class="button-gallery dynamic-gal" data-dynamicPath="' . esc_attr( wp_json_encode( $gMoreImages ) ) . '">' . $html_icon . ' ' . esc_html__( 'Gallery', 'wp-hotel-booking' ) . '</span>';
echo '</ul>';
}
@@ -252,7 +252,7 @@
$image_url = wp_get_attachment_image_url( $image_id, 'full' );
?>
<li>
- <img src="<?php echo esc_url_raw( $image_url ); ?>"/>
+ <img src="<?php echo esc_url( $image_url ); ?>"/>
</li>
<?php } ?>
</ul>
@@ -265,7 +265,7 @@
$thumbnail_url = wp_get_attachment_image_url( $image_id, 'thumbnail' );
?>
<li>
- <img src="<?php echo esc_url_raw( $thumbnail_url ); ?>"/>
+ <img src="<?php echo esc_url( $thumbnail_url ); ?>"/>
</li>
<?php
}
@@ -286,7 +286,7 @@
$thumbnail_url = wp_get_attachment_image_url( $image_id, 'full' );
?>
<li>
- <img src="<?php echo esc_url_raw( $thumbnail_url ); ?>"/>
+ <img src="<?php echo esc_url( $thumbnail_url ); ?>"/>
</li>
<?php
}
--- a/wp-hotel-booking/includes/rest-api/v1/admin/class-wphb-admin-rooms-controller.php
+++ b/wp-hotel-booking/includes/rest-api/v1/admin/class-wphb-admin-rooms-controller.php
@@ -199,23 +199,30 @@
if ( ! empty( $order ) ) {
$rooms = hb_get_order_items( get_the_ID() );
foreach ( $rooms as $room ) {
- $data_item = hb_get_order_item_meta( $room->order_item_id );
- $status = get_post_status( $room->ID ?? 0 );
+ $data_item = hb_get_order_item_meta( $room->order_item_id );
+ $status = get_post_status( $room->ID ?? 0 );
+ $room_id = absint( apply_filters( 'hotel-booking-order-room-id', $data_item['product_id'][0] ?? 0 ) );
+ $room_title = $room_id ? get_the_title( $room_id ) : '';
+ if ( '' === $room_title ) {
+ $room_title = $room->order_item_name;
+ }
+ $room_title = html_entity_decode( (string) $room_title, ENT_QUOTES, 'UTF-8' );
// if ( $data_item['check_in_date'][0] < strtotime($start) || $data_item['check_out_date'][0] > strtotime($end) ) {
// continue;
// }
$data[] = array(
- 'title' => $room->order_item_name,
+ 'title' => $room_title,
'start' => date( 'Y-m-d', ( $data_item['check_in_date'][0] ) ),
'end' => date( 'Y-m-d', ( $data_item['check_out_date'][0] + ( 24 * 60 * 60 ) ) ),
'data_item' => $data_item,
+ 'status' => $status,
'backgroundColor' => array_key_exists( $status, $color_status ) ? $color_status[ $status ] : '#2eb0d1',
'borderColor' => array_key_exists( $status, $color_status ) ? $color_status[ $status ] : '#2eb0d1',
'data_order' => array(
'id' => $order->ID,
- 'link_edit' => get_edit_post_link( $order->ID ),
+ 'link_edit' => get_edit_post_link( $order->ID, 'raw' ),
'order_date' => gmdate( $format_time, strtotime( $order->post_date ) ),
- 'title' => $room->order_item_name,
+ 'title' => $room_title,
'total' => hb_format_price( hb_get_order_item_meta( $room->order_item_id, 'total', true ), hb_get_currency_symbol( get_option( 'tp_hotel_booking_currency', 'USD' ) ) ),
'start_date_popup' => gmdate( $format_time, $data_item['check_in_date'][0] ),
'end_date_popup' => gmdate( $format_time, $data_item['check_out_date'][0] ),
--- a/wp-hotel-booking/includes/wphb-functions.php
+++ b/wp-hotel-booking/includes/wphb-functions.php
@@ -877,13 +877,13 @@
$option_none_value = '';
extract( $args );
$titles = hb_get_common_titles();
- $output = '<select name="' . $name . '" ' . ( $required ? 'required' : '' ) . '>';
+ $output = '<select name="' . esc_attr( $name ) . '" ' . ( $required ? 'required' : '' ) . '>';
if ( $show_option_none ) {
- $output .= sprintf( '<option value="%s">%s</option>', $option_none_value, $show_option_none );
+ $output .= sprintf( '<option value="%s">%s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) );
}
if ( $titles ) {
foreach ( $titles as $slug => $title ) {
- $output .= sprintf( '<option value="%s"%s>%s</option>', $slug, $slug == $selected ? ' selected="selected"' : '', $title );
+ $output .= sprintf( '<option value="%s"%s>%s</option>', esc_attr( $slug ), $slug == $selected ? ' selected="selected"' : '', esc_html( $title ) );
}
}
$output .= '</select>';
@@ -1180,9 +1180,9 @@
extract( $args );
$id = ! empty( $id ) ? $id : '';
- $output = '<select name="' . $name . '" ' . ( $id ? 'id="' . $id . '"' : '' ) . '' . ( $class ? ' class="' . $class . '"' : '' ) . '>';
+ $output = '<select name="' . esc_attr( $name ) . '" ' . ( $id ? 'id="' . esc_attr( $id ) . '"' : '' ) . '' . ( $class ? ' class="' . esc_attr( $class ) . '"' : '' ) . '>';
if ( $show_option_none ) {
- $output .= '<option value="' . $option_none_value . '">' . $show_option_none . '</option>';
+ $output .= '<option value="' . esc_attr( $option_none_value ) . '">' . esc_html( $show_option_none ) . '</option>';
}
if ( empty( $options ) ) {
@@ -2404,7 +2404,7 @@
'required' => false,
)
);
- echo '<select name="' . $args['name'] . '"' . ( ( $args['required'] ) ? 'required' : '' ) . '>';
+ echo '<select name="' . esc_attr( $args['name'] ) . '"' . ( ( $args['required'] ) ? 'required' : '' ) . '>';
if ( $args['show_option_none'] ) {
echo '<option value="' . esc_attr( $args['option_none_value'] ) . '">' . esc_html( $args['show_option_none'] ) . '</option>';
}
@@ -2506,7 +2506,133 @@
return;
}
- echo '<label>' . sprintf( __( '%1$s', 'wp-hotel-booking' ), $text ) . '</label>';
+ echo '<label>' . esc_html( sprintf( __( '%1$s', 'wp-hotel-booking' ), $text ) ) . '</label>';
+ }
+}
+
+if ( ! function_exists( 'hb_get_allowed_iframe_html' ) ) {
+ /**
+ * Return allowed attributes for safe iframe embeds.
+ *
+ * @return array
+ */
+ function hb_get_allowed_iframe_html() {
+ return array(
+ 'iframe' => array(
+ 'id' => true,
+ 'class' => true,
+ 'src' => true,
+ 'width' => true,
+ 'height' => true,
+ 'style' => true,
+ 'frameborder' => true,
+ 'allow' => true,
+ 'allowfullscreen' => true,
+ 'title' => true,
+ 'referrerpolicy' => true,
+ 'loading' => true,
+ ),
+ );
+ }
+}
+
+if ( ! function_exists( 'hb_filter_safe_iframe_src' ) ) {
+ /**
+ * Ensure every `<iframe>` tag in kses-filtered HTML uses an explicit HTTP(S) or protocol-relative URL.
+ *
+ * @param string $html Filtered HTML string.
+ * @return string
+ */
+ function hb_filter_safe_iframe_src( $html ) {
+ if ( ! is_string( $html ) || '' === $html || stripos( $html, '<iframe' ) === false ) {
+ return $html;
+ }
+
+ if ( ! class_exists( 'WP_HTML_Tag_Processor' ) ) {
+ return $html;
+ }
+
+ $processor = new WP_HTML_Tag_Processor( $html );
+ while ( $processor->next_tag( 'iframe' ) ) {
+ $src = $processor->get_attribute( 'src' );
+ $src = is_string( $src ) ? trim( $src ) : '';
+ if (
+ '' === $src ||
+ ! preg_match( '#^(https?:)?//#i', $src ) ||
+ '' === esc_url_raw( $src, array( 'http', 'https' ) )
+ ) {
+ $processor->remove_attribute( 'src' );
+ }
+ }
+
+ return $processor->get_updated_html();
+ }
+}
+
+if ( ! function_exists( 'hb_kses_post_with_iframe' ) ) {
+ /**
+ * Sanitize post HTML while preserving safe HTTP(S) iframe embeds (e.g. Google Maps, YouTube, Vimeo).
+ *
+ * Expects unslashed data (same contract as `wp_kses_post()`).
+ *
+ * @param mixed $content Raw unslashed HTML content.
+ * @return string
+ */
+ function hb_kses_post_with_iframe( $content ) {
+ if ( ! is_scalar( $content ) ) {
+ return '';
+ }
+
+ $content = (string) $content;
+ if ( '' === $content ) {
+ return '';
+ }
+
+ // Fast path: delegate directly to WordPress core when no iframe is present.
+ if ( stripos( $content, '<iframe' ) === false ) {
+ return wp_kses_post( $content );
+ }
+
+ $allowed_html = wp_kses_allowed_html( 'post' );
+ $iframe_defaults = hb_get_allowed_iframe_html()['iframe'];
+ $allowed_html['iframe'] = isset( $allowed_html['iframe'] ) && is_array( $allowed_html['iframe'] )
+ ? array_merge( $iframe_defaults, $allowed_html['iframe'] )
+ : $iframe_defaults;
+
+ $sanitized = wp_kses( $content, $allowed_html );
+
+ return hb_filter_safe_iframe_src( $sanitized );
+ }
+}
+
+if ( ! function_exists( 'hb_sanitize_video_preview' ) ) {
+ /**
+ * Sanitize room video preview field (allows safe HTTP/HTTPS iframe embed or URL).
+ *
+ * @param mixed $value Raw unslashed preview URL or iframe HTML.
+ * @return string
+ */
+ function hb_sanitize_video_preview( $value ) {
+ if ( ! is_string( $value ) ) {
+ return '';
+ }
+
+ $value = trim( $value );
+ if ( '' === $value ) {
+ return '';
+ }
+
+ if ( stripos( $value, '<iframe' ) !== false ) {
+ $sanitized = wp_kses( $value, hb_get_allowed_iframe_html(), array( 'http', 'https' ) );
+
+ return hb_filter_safe_iframe_src( $sanitized );
+ }
+
+ if ( ! preg_match( '#^(https?:)?//#i', $value ) ) {
+ return '';
+ }
+
+ return esc_url_raw( $value, array( 'http', 'https' ) );
}
}
@@ -2983,9 +3109,9 @@
$pages = hb_get_pages();
$html = array();
- $html[] = '<select id ="' . esc_attr( $args['name'] ) . '" name="' . esc_attr( $args['name'] ) . '" data-selected ="' . esc_attr( $args['selected'] ) . '" data-placeholder="' . __( 'Select a page…', 'wp-hotel-booking' ) . '">';
- $html[] = '<option value="' . $args['option_none_value'] . '">' . esc_html( $args['show_option_none'] ) . '</option>';
- $html[] = '<option value="' . $args['add_new_value'] . '">' . esc_html( $args['add_new_title'] ) . '</option>';
+ $html[] = '<select id ="' . esc_attr( $args['name'] ) . '" name="' . esc_attr( $args['name'] ) . '" data-selected ="' . esc_attr( $args['selected'] ) . '" data-placeholder="' . esc_attr__( 'Select a page…', 'wp-hotel-booking' ) . '">';
+ $html[] = '<option value="' . esc_attr( $args['option_none_value'] ) . '">' . esc_html( $args['show_option_none'] ) . '</option>';
+ $html[] = '<option value="' . esc_attr( $args['add_new_value'] ) . '">' . esc_html( $args['add_new_title'] ) . '</option>';
foreach ( $pages as $page ) {
$html[] = '<option value="' . esc_attr( $page->ID ) . '"' . selected( $args['selected'], $page->ID, false ) . '>' . esc_html( $page->post_title ) . '</option>';
}
--- a/wp-hotel-booking/templates/checkout/customer-new.php
+++ b/wp-hotel-booking/templates/checkout/customer-new.php
@@ -6,7 +6,7 @@
*
* @author ThimPress, leehld
* @package WP-Hotel-Booking/Templates
- * @version 1.6
+ * @version 2.3.7
*/
/**
@@ -103,7 +103,7 @@
hb_dropdown_countries(
array(
'name' => 'country',
- 'show_option_none' => esc_html__( 'Country', 'wp-hotel-booking' ),
+ 'show_option_none' => __( 'Country', 'wp-hotel-booking' ),
'selected' => $customer->country,
'required' => true,
)
--- a/wp-hotel-booking/templates/checkout/thank-you.php
+++ b/wp-hotel-booking/templates/checkout/thank-you.php
@@ -6,7 +6,7 @@
*
* @author ThimPress, leehld
* @package WP-Hotel-Booking/Templates
- * @version 2.4.0
+ * @version 2.3.6
*/
/**
--- a/wp-hotel-booking/templates/emails/booking-details.php
+++ b/wp-hotel-booking/templates/emails/booking-details.php
@@ -6,7 +6,7 @@
*
* @author ThimPress, leehld
* @package WP-Hotel-Booking/Templates
- * @version 2.4.0
+ * @version 2.3.6
*/
/**
--- a/wp-hotel-booking/templates/emails/customer-cancelled.php
+++ b/wp-hotel-booking/templates/emails/customer-cancelled.php
@@ -6,7 +6,7 @@
*
* @author ThimPress, leehld
* @package WP-Hotel-Booking/Templates
- * @version 1.9
+ * @version 2.3.7
*/
/**
@@ -14,12 +14,15 @@
*/
defined( 'ABSPATH' ) || exit();
+$email_heading = ! empty( $email_heading ) ? $email_heading : __( 'Cancelled booking', 'wp-hotel-booking' );
+$email_heading_desc = ! empty( $email_heading_desc ) ? $email_heading_desc : __( 'Booking has been marked cancelled', 'wp-hotel-booking' );
+
// email heading
hb_get_template(
'emails/email-header.php',
array(
- 'email_heading' => __( 'Cancelled booking', 'wp-hotel-booking' ),
- 'email_heading_desc' => __( 'Booking has been marked cancelled', 'wp-hotel-booking' ),
+ 'email_heading' => $email_heading,
+ 'email_heading_desc' => $email_heading_desc,
)
);
--- a/wp-hotel-booking/templates/search/v2/search-form-v2.php
+++ b/wp-hotel-booking/templates/search/v2/search-form-v2.php
@@ -6,7 +6,7 @@
*
* @author ThimPress, leehld
* @package WP-Hotel-Booking/Templates
- * @version 1.9.8
+ * @version 2.3.7
*/
/**
@@ -70,7 +70,7 @@
'name' => 'adults_capacity',
'min' => 1,
'max' => 10,
- 'show_option_none' => esc_html__( 'Adults', 'wp-hotel-booking' ),
+ 'show_option_none' => __( 'Adults', 'wp-hotel-booking' ),
'selected' => $adults,
'option_none_value' => '',
'options' => hb_get_capacity_of_rooms(),
@@ -89,7 +89,7 @@
'name' => 'max_child',
'min' => 1,