Version Description
(2022-01-18) = - Added a setting to specify a number of days after which booking data will be deleted. - Fixed an issue with the cancel link feature in customer email notifications. - Fixed deposit amount not showing on the deposit payment page.
Download this release
Release Info
Developer | Rustaurius |
Plugin | Restaurant Reservations |
Version | 2.4.11 |
Comparing to | |
See all releases |
Code changes from version 2.4.10 to 2.4.11
- assets/css/helper-install-notice.css +19 -0
- assets/js/helper-install-notice.js +11 -0
- includes/Ajax.class.php +21 -21
- includes/PaymentGatewayStripe.class.php +1 -1
- includes/Permissions.class.php +1 -0
- includes/Settings.class.php +11 -0
- readme.txt +6 -1
- restaurant-reservations.php +105 -2
assets/css/helper-install-notice.css
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.rtb-clear {
|
2 |
+
clear: both;
|
3 |
+
}
|
4 |
+
|
5 |
+
.rtb-helper-install-notice {
|
6 |
+
display: inline-block;
|
7 |
+
clear: both;
|
8 |
+
}
|
9 |
+
|
10 |
+
.rtb-helper-install-notice-img,
|
11 |
+
.rtb-helper-install-notice-txt
|
12 |
+
{
|
13 |
+
float: left;
|
14 |
+
padding: 8px 8px 8px 0px;
|
15 |
+
}
|
16 |
+
|
17 |
+
.rtb-helper-install-notice div img {
|
18 |
+
max-height: 36px;
|
19 |
+
}
|
assets/js/helper-install-notice.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery( document ).ready( function( $ ) {
|
2 |
+
|
3 |
+
jQuery(document).on( 'click', '.rtb-helper-install-notice .notice-dismiss', function( event ) {
|
4 |
+
var data = jQuery.param({
|
5 |
+
action: 'rtb_hide_helper_notice',
|
6 |
+
nonce: rtb_helper_notice.nonce
|
7 |
+
});
|
8 |
+
|
9 |
+
jQuery.post( ajaxurl, data, function() {} );
|
10 |
+
});
|
11 |
+
});
|
includes/Ajax.class.php
CHANGED
@@ -140,7 +140,7 @@ if ( !class_exists( 'rtbAJAX' ) ) {
|
|
140 |
public function cancel_reservation( $ajax = true ) {
|
141 |
global $rtb_controller;
|
142 |
|
143 |
-
if ( !check_ajax_referer( 'rtb-booking-form', 'nonce' ) ) {
|
144 |
rtbHelper::bad_nonce_ajax();
|
145 |
}
|
146 |
|
@@ -152,6 +152,10 @@ if ( !class_exists( 'rtbAJAX' ) ) {
|
|
152 |
require_once( RTB_PLUGIN_DIR . '/includes/Booking.class.php' );
|
153 |
|
154 |
$success = false;
|
|
|
|
|
|
|
|
|
155 |
|
156 |
$booking = new rtbBooking();
|
157 |
if ( $booking->load_post( $booking_id ) ) {
|
@@ -161,41 +165,32 @@ if ( !class_exists( 'rtbAJAX' ) ) {
|
|
161 |
$success = true;
|
162 |
}
|
163 |
else {
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
|
168 |
-
)
|
169 |
);
|
170 |
}
|
171 |
}
|
172 |
else {
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
|
177 |
-
)
|
178 |
);
|
179 |
}
|
180 |
|
181 |
if ( $ajax ) {
|
182 |
if ( $success ) {
|
183 |
-
|
184 |
$response = array( 'booking_id' => $booking_id );
|
185 |
-
|
186 |
if( '' != $cancelled_redirect ) {
|
187 |
$response['cancelled_redirect'] = $cancelled_redirect;
|
188 |
}
|
189 |
-
|
190 |
wp_send_json_success( $response );
|
191 |
}
|
192 |
else {
|
193 |
-
wp_send_json_error(
|
194 |
-
array(
|
195 |
-
'error' => 'unknown',
|
196 |
-
'msg' => __( 'Unkown error. Please try again', 'restaurant-reservations' ),
|
197 |
-
)
|
198 |
-
);
|
199 |
}
|
200 |
}
|
201 |
else {
|
@@ -216,7 +211,12 @@ if ( !class_exists( 'rtbAJAX' ) ) {
|
|
216 |
);
|
217 |
}
|
218 |
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
220 |
}
|
221 |
}
|
222 |
|
140 |
public function cancel_reservation( $ajax = true ) {
|
141 |
global $rtb_controller;
|
142 |
|
143 |
+
if ( $ajax && !check_ajax_referer( 'rtb-booking-form', 'nonce' ) ) {
|
144 |
rtbHelper::bad_nonce_ajax();
|
145 |
}
|
146 |
|
152 |
require_once( RTB_PLUGIN_DIR . '/includes/Booking.class.php' );
|
153 |
|
154 |
$success = false;
|
155 |
+
$error = array(
|
156 |
+
'error' => 'unknown',
|
157 |
+
'msg' => __( 'Unkown error. Please try again', 'restaurant-reservations' )
|
158 |
+
);
|
159 |
|
160 |
$booking = new rtbBooking();
|
161 |
if ( $booking->load_post( $booking_id ) ) {
|
165 |
$success = true;
|
166 |
}
|
167 |
else {
|
168 |
+
$error = array(
|
169 |
+
'error' => 'invalidemail',
|
170 |
+
'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
|
|
|
|
|
171 |
);
|
172 |
}
|
173 |
}
|
174 |
else {
|
175 |
+
$error = array(
|
176 |
+
'error' => 'invalidid',
|
177 |
+
'msg' => __( 'No booking matches the information that was sent.', 'restaurant-reservations' ),
|
|
|
|
|
178 |
);
|
179 |
}
|
180 |
|
181 |
if ( $ajax ) {
|
182 |
if ( $success ) {
|
183 |
+
|
184 |
$response = array( 'booking_id' => $booking_id );
|
185 |
+
|
186 |
if( '' != $cancelled_redirect ) {
|
187 |
$response['cancelled_redirect'] = $cancelled_redirect;
|
188 |
}
|
189 |
+
|
190 |
wp_send_json_success( $response );
|
191 |
}
|
192 |
else {
|
193 |
+
wp_send_json_error( $error );
|
|
|
|
|
|
|
|
|
|
|
194 |
}
|
195 |
}
|
196 |
else {
|
211 |
);
|
212 |
}
|
213 |
|
214 |
+
if( wp_redirect( $redirect_url ) ) {
|
215 |
+
exit;
|
216 |
+
}
|
217 |
+
|
218 |
+
header( "Location: {$redirect_url}", true, 302 );
|
219 |
+
exit;
|
220 |
}
|
221 |
}
|
222 |
|
includes/PaymentGatewayStripe.class.php
CHANGED
@@ -117,7 +117,7 @@ class rtbPaymentGatewayStripe implements rtbPaymentGateway {
|
|
117 |
?>
|
118 |
|
119 |
<h2>
|
120 |
-
<?php
|
121 |
</h2>
|
122 |
|
123 |
<div class='payment-errors'></div>
|
117 |
?>
|
118 |
|
119 |
<h2>
|
120 |
+
<?php echo __('Deposit Required: ', 'restaurant-reservations' ) . esc_html( $payment_amount ); ?>
|
121 |
</h2>
|
122 |
|
123 |
<div class='payment-errors'></div>
|
includes/Permissions.class.php
CHANGED
@@ -14,6 +14,7 @@ class rtbPermissions {
|
|
14 |
|
15 |
public function __construct() {
|
16 |
$this->plugin_permissions = array(
|
|
|
17 |
"styling" => 2,
|
18 |
"import" => 2,
|
19 |
"export" => 2,
|
14 |
|
15 |
public function __construct() {
|
16 |
$this->plugin_permissions = array(
|
17 |
+
"premium" => 2,
|
18 |
"styling" => 2,
|
19 |
"import" => 2,
|
20 |
"export" => 2,
|
includes/Settings.class.php
CHANGED
@@ -1324,6 +1324,17 @@ If you were not the one to cancel this booking, please contact us.
|
|
1324 |
)
|
1325 |
);
|
1326 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1327 |
$sap->add_section(
|
1328 |
'rtb-settings',
|
1329 |
array(
|
1324 |
)
|
1325 |
);
|
1326 |
|
1327 |
+
$sap->add_setting(
|
1328 |
+
'rtb-settings',
|
1329 |
+
'rtb-privacy',
|
1330 |
+
'text',
|
1331 |
+
array(
|
1332 |
+
'id' => 'delete-data-days',
|
1333 |
+
'title' => __( 'Delete Reservation Data Days', 'restaurant-reservations' ),
|
1334 |
+
'description' => __( 'Sets the approximate number of days booking data should be stored for. Leave blank to keep booking data indefinitely.', 'restaurant-reservations' ),
|
1335 |
+
)
|
1336 |
+
);
|
1337 |
+
|
1338 |
$sap->add_section(
|
1339 |
'rtb-settings',
|
1340 |
array(
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: FiveStarPlugins
|
|
3 |
Requires at Least: 4.4
|
4 |
Tested Up To: 5.8
|
5 |
Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
|
6 |
-
Stable tag: 2.4.
|
7 |
License: GPLv3
|
8 |
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
@@ -197,6 +197,11 @@ Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/
|
|
197 |
|
198 |
== Changelog ==
|
199 |
|
|
|
|
|
|
|
|
|
|
|
200 |
= 2.4.10 (2021-12-23) =
|
201 |
- Fixed issue with front-end booking cancellation.
|
202 |
|
3 |
Requires at Least: 4.4
|
4 |
Tested Up To: 5.8
|
5 |
Tags: reservation, reservations, restaurant reservations, reservation form, restaurant booking, restaurant reservation form, restaurant booking form, restaurant booking system, reservation system, online reservations, online restaurant booking, dinner reservations, restaurant form, gutenberg reservations, gutenberg restaurant reservations, gutenberg restaurant booking, mobile reservations, responsive reservations, table reservations, open table, book table, reserve table, easy reservations, simple reservations, quick restaurant reservations, custom reservation form, custom restaurant reservations
|
6 |
+
Stable tag: 2.4.11
|
7 |
License: GPLv3
|
8 |
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
9 |
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
197 |
|
198 |
== Changelog ==
|
199 |
|
200 |
+
= 2.4.11 (2022-01-18) =
|
201 |
+
- Added a setting to specify a number of days after which booking data will be deleted.
|
202 |
+
- Fixed an issue with the cancel link feature in customer email notifications.
|
203 |
+
- Fixed deposit amount not showing on the deposit payment page.
|
204 |
+
|
205 |
= 2.4.10 (2021-12-23) =
|
206 |
- Fixed issue with front-end booking cancellation.
|
207 |
|
restaurant-reservations.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
|
4 |
* Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
|
5 |
* Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
6 |
-
* Version: 2.4.
|
7 |
* Author: FiveStarPlugins
|
8 |
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
* Text Domain: restaurant-reservations
|
@@ -39,7 +39,7 @@ class rtbInit {
|
|
39 |
public function __construct() {
|
40 |
|
41 |
// Common strings
|
42 |
-
define( 'RTB_VERSION', '2.4.
|
43 |
define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
44 |
define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
45 |
define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
|
@@ -189,6 +189,14 @@ class rtbInit {
|
|
189 |
// Load backwards compatibility functions
|
190 |
require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
|
191 |
new rtbCompatibility();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
}
|
193 |
|
194 |
/**
|
@@ -301,6 +309,44 @@ class rtbInit {
|
|
301 |
return $content;
|
302 |
}
|
303 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
304 |
/**
|
305 |
* Adds in a menu bar for the plugin
|
306 |
* @since 2.0
|
@@ -361,6 +407,15 @@ class rtbInit {
|
|
361 |
|
362 |
global $rtb_controller;
|
363 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
364 |
// Use the page reference in $admin_page_hooks because
|
365 |
// it changes in SOME hooks when it is translated.
|
366 |
// https://core.trac.wordpress.org/ticket/18857
|
@@ -551,6 +606,54 @@ class rtbInit {
|
|
551 |
}
|
552 |
}
|
553 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
554 |
}
|
555 |
} // endif;
|
556 |
|
3 |
* Plugin Name: Five Star Restaurant Reservations - WordPress Booking Plugin
|
4 |
* Plugin URI: http://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/
|
5 |
* Description: Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
6 |
+
* Version: 2.4.11
|
7 |
* Author: FiveStarPlugins
|
8 |
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
* Text Domain: restaurant-reservations
|
39 |
public function __construct() {
|
40 |
|
41 |
// Common strings
|
42 |
+
define( 'RTB_VERSION', '2.4.11' );
|
43 |
define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
|
44 |
define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
|
45 |
define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
|
189 |
// Load backwards compatibility functions
|
190 |
require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
|
191 |
new rtbCompatibility();
|
192 |
+
|
193 |
+
// Delete old reservations if necessary
|
194 |
+
add_action( 'admin_init', array( $this, 'maybe_delete_older_reservations' ) );
|
195 |
+
add_filter( 'sanitize_option_rtb-settings', array( $this, 'maybe_delete_older_reservations' ), 100 );
|
196 |
+
|
197 |
+
// Handle the helper notice
|
198 |
+
add_action( 'admin_notices', array( $this, 'maybe_display_helper_notice' ) );
|
199 |
+
add_action( 'wp_ajax_rtb_hide_helper_notice', array( $this, 'hide_helper_notice' ) );
|
200 |
}
|
201 |
|
202 |
/**
|
309 |
return $content;
|
310 |
}
|
311 |
|
312 |
+
/**
|
313 |
+
* Deletes older reservations, after a user-specified number of days (return if no number specified)
|
314 |
+
* @since 2.4.11
|
315 |
+
*/
|
316 |
+
public function maybe_delete_older_reservations( $val = null ) {
|
317 |
+
global $rtb_controller;
|
318 |
+
|
319 |
+
if ( get_transient( 'rtb-delete-reservations-check' ) and empty( $val ) ) { return $val; }
|
320 |
+
|
321 |
+
set_transient( 'rtb-delete-reservations-check', true, 3600*12 );
|
322 |
+
|
323 |
+
if ( empty( $rtb_controller->settings->get_setting( 'delete-data-days' ) ) ) { return $val; }
|
324 |
+
|
325 |
+
$reservation_statuses = is_array( $rtb_controller->cpts->booking_statuses ) ? array_keys( $rtb_controller->cpts->booking_statuses ) : array();
|
326 |
+
|
327 |
+
$args = array(
|
328 |
+
'numberposts' => -1,
|
329 |
+
'post_type' => RTB_BOOKING_POST_TYPE,
|
330 |
+
'post_status' => $reservation_statuses,
|
331 |
+
'date_query' => array(
|
332 |
+
array(
|
333 |
+
'before' => date('Y-m-d h:i:s', time() - $rtb_controller->settings->get_setting( 'delete-data-days' ) * 24*3600 )
|
334 |
+
)
|
335 |
+
)
|
336 |
+
);
|
337 |
+
|
338 |
+
$query = new WP_Query( $args );
|
339 |
+
|
340 |
+
$delete_posts = $query->get_posts();
|
341 |
+
|
342 |
+
foreach ( $delete_posts as $delete_post ) {
|
343 |
+
|
344 |
+
wp_delete_post( $delete_post->ID, true );
|
345 |
+
}
|
346 |
+
|
347 |
+
return $val;
|
348 |
+
}
|
349 |
+
|
350 |
/**
|
351 |
* Adds in a menu bar for the plugin
|
352 |
* @since 2.0
|
407 |
|
408 |
global $rtb_controller;
|
409 |
|
410 |
+
wp_enqueue_script( 'rtb-helper-notice', RTB_PLUGIN_URL . '/assets/js/helper-install-notice.js', array( 'jquery' ), RTB_VERSION, true );
|
411 |
+
wp_localize_script(
|
412 |
+
'rtb-helper-notice',
|
413 |
+
'rtb_helper_notice',
|
414 |
+
array( 'nonce' => wp_create_nonce( 'rtb-helper-notice' ) )
|
415 |
+
);
|
416 |
+
|
417 |
+
wp_enqueue_style( 'rtb-helper-notice', RTB_PLUGIN_URL . '/assets/css/helper-install-notice.css', array(), RTB_VERSION );
|
418 |
+
|
419 |
// Use the page reference in $admin_page_hooks because
|
420 |
// it changes in SOME hooks when it is translated.
|
421 |
// https://core.trac.wordpress.org/ticket/18857
|
606 |
}
|
607 |
}
|
608 |
|
609 |
+
public function maybe_display_helper_notice() {
|
610 |
+
global $rtb_controller;
|
611 |
+
|
612 |
+
if ( empty( $rtb_controller->permissions->check_permission( 'premium' ) ) ) { return; }
|
613 |
+
|
614 |
+
if ( is_plugin_active( 'fsp-premium-helper/fsp-premium-helper.php' ) ) { return; }
|
615 |
+
|
616 |
+
if ( get_transient( 'fsp-helper-notice-dismissed' ) ) { return; }
|
617 |
+
|
618 |
+
?>
|
619 |
+
|
620 |
+
<div class='notice notice-error is-dismissible rtb-helper-install-notice'>
|
621 |
+
|
622 |
+
<div class='rtb-helper-install-notice-img'>
|
623 |
+
<img src='<?php echo RTB_PLUGIN_URL . '/lib/simple-admin-pages/img/options-asset-exclamation.png' ; ?>' />
|
624 |
+
</div>
|
625 |
+
|
626 |
+
<div class='rtb-helper-install-notice-txt'>
|
627 |
+
<?php _e( 'You\'re using the Five-Star Restaurant Reservations premium version, but the premium helper plugin is not active.', 'restaurant-reservations' ); ?>
|
628 |
+
<br />
|
629 |
+
<?php echo sprintf( __( 'Please re-activate the helper plugin, or <a target=\'_blank\' href=\'%s\'>download and install it</a> if the plugin is no longer installed to ensure continued access to the premium features of the plugin.', 'restaurant-reservations' ), 'https://www.fivestarplugins.com/2021/12/23/requiring-premium-helper-plugin/' ); ?>
|
630 |
+
</div>
|
631 |
+
|
632 |
+
<div class='rtb-clear'></div>
|
633 |
+
|
634 |
+
</div>
|
635 |
+
|
636 |
+
<?php
|
637 |
+
}
|
638 |
+
|
639 |
+
public function hide_helper_notice() {
|
640 |
+
|
641 |
+
// Authenticate request
|
642 |
+
if ( ! check_ajax_referer( 'rtb-helper-notice', 'nonce' ) or ! current_user_can( 'manage_options' ) ) {
|
643 |
+
|
644 |
+
wp_send_json_error(
|
645 |
+
array(
|
646 |
+
'error' => 'loggedout',
|
647 |
+
'msg' => sprintf( __( 'You have been logged out. Please %slogin again%s.', 'restaurant-reservations' ), '<a href="' . wp_login_url( admin_url( 'admin.php?page=rtb-dashboard' ) ) . '">', '</a>' ),
|
648 |
+
)
|
649 |
+
);
|
650 |
+
}
|
651 |
+
|
652 |
+
set_transient( 'fsp-helper-notice-dismissed', true, 3600*24*7 );
|
653 |
+
|
654 |
+
die();
|
655 |
+
}
|
656 |
+
|
657 |
}
|
658 |
} // endif;
|
659 |
|