Version Description
(2019-11-26) = - Fixes issue that was causing an error and/or incorrect display of the plugin dashboard for certain languages
Download this release
Release Info
Developer | Rustaurius |
Plugin | Restaurant Reservations |
Version | 2.0.10 |
Comparing to | |
See all releases |
Code changes from version 2.0.9 to 2.0.10
- includes/CustomFields.class.php +193 -193
- includes/Dashboard.class.php +41 -7
- includes/Import.class.php +279 -279
- readme.txt +598 -595
- restaurant-reservations.php +443 -443
includes/CustomFields.class.php
CHANGED
@@ -1,193 +1,193 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* A class that handles the main custom field functions
|
4 |
-
*/
|
5 |
-
if ( ! defined( 'ABSPATH' ) )
|
6 |
-
exit;
|
7 |
-
|
8 |
-
if ( !class_exists( 'rtbCustomFields' ) ) {
|
9 |
-
class rtbCustomFields {
|
10 |
-
|
11 |
-
/**
|
12 |
-
* Option name for storing modified default fields
|
13 |
-
*
|
14 |
-
* @since 0.1
|
15 |
-
*/
|
16 |
-
public $modified_option_key;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Common string tacked onto the end of error messages
|
20 |
-
*
|
21 |
-
* @since 0.1
|
22 |
-
*/
|
23 |
-
public $common_error_msg;
|
24 |
-
|
25 |
-
/**
|
26 |
-
* Initialize the plugin and register hooks
|
27 |
-
*
|
28 |
-
* @since 0.1
|
29 |
-
*/
|
30 |
-
public function __construct() {
|
31 |
-
|
32 |
-
// Option key where information about default fields that have
|
33 |
-
// been modified and disabled is stored in the database
|
34 |
-
$this->modified_option_key = apply_filters( 'cffrtb_modified_fields_option_key', 'cffrtb_modified_fields' );
|
35 |
-
|
36 |
-
// Common string tacked onto the end of error messages
|
37 |
-
$this->common_error_msg = sprintf( _x( 'Please try again. If the problem persists, you may need to refresh the page. If that does not solve the problem, please %scontact support%s for help.', 'A common phrase added to the end of error messages', 'custom-fields-for-rtb' ), '<a href="http://fivestarplugins.com/contact-us/">', '</a>' );
|
38 |
-
|
39 |
-
// Validate user input for custom fields
|
40 |
-
add_action( 'rtb_validate_booking_submission', array( $this, 'validate_custom_fields_input' ) );
|
41 |
-
|
42 |
-
// Filter required phone setting when phone field is disabled
|
43 |
-
add_filter( 'rtb-setting-require-phone', array( $this, 'never_require_phone' ) );
|
44 |
-
|
45 |
-
// Insert/load custom field input with booking metadata
|
46 |
-
add_filter( 'rtb_insert_booking_metadata', array( $this, 'insert_booking_metadata' ), 10, 2 );
|
47 |
-
add_action( 'rtb_booking_load_post_data', array( $this, 'load_booking_meta_data' ), 10, 2 );
|
48 |
-
|
49 |
-
// Print custom fields in notification template tags
|
50 |
-
add_filter( 'rtb_notification_template_tags', array( $this, 'add_notification_template_tags' ), 10, 2 );
|
51 |
-
add_filter( 'rtb_notification_template_tag_descriptions', array( $this, 'add_notification_template_tag_descriptions' ) );
|
52 |
-
|
53 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
54 |
-
}
|
55 |
-
|
56 |
-
public function enqueue_scripts() {
|
57 |
-
$currentScreen = get_current_screen();
|
58 |
-
if ( $currentScreen->id == 'bookings_page_cffrtb-editor' ) {
|
59 |
-
wp_enqueue_style( 'rtb-admin', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
60 |
-
wp_enqueue_script( 'rtb-admin-js', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
61 |
-
}
|
62 |
-
}
|
63 |
-
|
64 |
-
/**
|
65 |
-
* Validate user input for custom fields
|
66 |
-
*
|
67 |
-
* @since 0.1
|
68 |
-
*/
|
69 |
-
public function validate_custom_fields_input( $booking ) {
|
70 |
-
|
71 |
-
$fields = rtb_get_custom_fields();
|
72 |
-
|
73 |
-
if ( !count( $fields ) ) {
|
74 |
-
return;
|
75 |
-
}
|
76 |
-
|
77 |
-
foreach( $fields as $field ) {
|
78 |
-
$validation = $field->validate_input( $booking );
|
79 |
-
}
|
80 |
-
}
|
81 |
-
|
82 |
-
/**
|
83 |
-
* Add custom fields to metadata when a booking is saved
|
84 |
-
*
|
85 |
-
* @since 0.1
|
86 |
-
*/
|
87 |
-
public function insert_booking_metadata( $meta, $booking ) {
|
88 |
-
|
89 |
-
if ( empty( $booking->custom_fields ) ) {
|
90 |
-
return $meta;
|
91 |
-
}
|
92 |
-
|
93 |
-
if ( !is_array( $meta ) ) {
|
94 |
-
$meta = array();
|
95 |
-
}
|
96 |
-
|
97 |
-
if ( !isset( $meta['custom_fields'] ) ) {
|
98 |
-
$meta['custom_fields'] = array();
|
99 |
-
}
|
100 |
-
|
101 |
-
$meta['custom_fields'] = $booking->custom_fields;
|
102 |
-
|
103 |
-
return $meta;
|
104 |
-
}
|
105 |
-
|
106 |
-
/**
|
107 |
-
* Add custom fields to metadata when booking is loaded
|
108 |
-
*
|
109 |
-
* @since 0.1
|
110 |
-
*/
|
111 |
-
public function load_booking_meta_data( $booking, $post ) {
|
112 |
-
|
113 |
-
$meta = get_post_meta( $booking->ID, 'rtb', true );
|
114 |
-
|
115 |
-
if ( empty( $meta['custom_fields'] ) ) {
|
116 |
-
return;
|
117 |
-
}
|
118 |
-
|
119 |
-
$booking->custom_fields = $meta['custom_fields'];
|
120 |
-
}
|
121 |
-
|
122 |
-
/**
|
123 |
-
* Add custom fields as notification template tags
|
124 |
-
*
|
125 |
-
* @since 0.1
|
126 |
-
*/
|
127 |
-
public function add_notification_template_tags( $tags, $notification ) {
|
128 |
-
global $rtb_controller;
|
129 |
-
|
130 |
-
$fields = rtb_get_custom_fields();
|
131 |
-
|
132 |
-
$cf = isset( $notification->booking->custom_fields ) ? $notification->booking->custom_fields : array();
|
133 |
-
$checkbox_icon = apply_filters( 'cffrtb_checkbox_icon_notification', '', $notification );
|
134 |
-
|
135 |
-
foreach( $fields as $field ) {
|
136 |
-
|
137 |
-
if ( $field->type == 'fieldset' ) {
|
138 |
-
continue;
|
139 |
-
}
|
140 |
-
|
141 |
-
if ( isset( $cf[ $field->slug ] ) ) {
|
142 |
-
$display_val = apply_filters( 'cffrtb_display_value_notification', $rtb_controller->fields->get_display_value( $cf[ $field->slug ], $field, $checkbox_icon ), $cf[ $field->slug ], $field, $notification );
|
143 |
-
} else {
|
144 |
-
$display_val = '';
|
145 |
-
}
|
146 |
-
$tags[ '{cf-' . esc_attr( $field->slug ) . '}' ] = $display_val;
|
147 |
-
}
|
148 |
-
|
149 |
-
return $tags;
|
150 |
-
}
|
151 |
-
|
152 |
-
/**
|
153 |
-
* Add custom field notification template tag descriptions
|
154 |
-
*
|
155 |
-
* @since 0.1
|
156 |
-
*/
|
157 |
-
public function add_notification_template_tag_descriptions( $tags ) {
|
158 |
-
|
159 |
-
$fields = rtb_get_custom_fields();
|
160 |
-
|
161 |
-
foreach( $fields as $field ) {
|
162 |
-
|
163 |
-
if ( $field->type == 'fieldset' ) {
|
164 |
-
continue;
|
165 |
-
}
|
166 |
-
|
167 |
-
$tags[ '{cf-' . esc_attr( $field->slug ) . '}' ] = esc_html( $field->title );
|
168 |
-
}
|
169 |
-
|
170 |
-
return $tags;
|
171 |
-
}
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Override the required phone setting when the phone field has been
|
175 |
-
* disabled.
|
176 |
-
*
|
177 |
-
* @param string $value The value of the setting
|
178 |
-
* @since 1.2.3
|
179 |
-
*/
|
180 |
-
public function never_require_phone( $value ) {
|
181 |
-
global $rtb_controller;
|
182 |
-
|
183 |
-
$modified = get_option( $rtb_controller->custom_fields->modified_option_key );
|
184 |
-
|
185 |
-
if ( $modified && isset( $modified['phone'] ) && !empty( $modified['phone']['disabled'] ) ) {
|
186 |
-
return '';
|
187 |
-
}
|
188 |
-
|
189 |
-
return $value;
|
190 |
-
}
|
191 |
-
|
192 |
-
}
|
193 |
-
} // endif;
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* A class that handles the main custom field functions
|
4 |
+
*/
|
5 |
+
if ( ! defined( 'ABSPATH' ) )
|
6 |
+
exit;
|
7 |
+
|
8 |
+
if ( !class_exists( 'rtbCustomFields' ) ) {
|
9 |
+
class rtbCustomFields {
|
10 |
+
|
11 |
+
/**
|
12 |
+
* Option name for storing modified default fields
|
13 |
+
*
|
14 |
+
* @since 0.1
|
15 |
+
*/
|
16 |
+
public $modified_option_key;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Common string tacked onto the end of error messages
|
20 |
+
*
|
21 |
+
* @since 0.1
|
22 |
+
*/
|
23 |
+
public $common_error_msg;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* Initialize the plugin and register hooks
|
27 |
+
*
|
28 |
+
* @since 0.1
|
29 |
+
*/
|
30 |
+
public function __construct() {
|
31 |
+
|
32 |
+
// Option key where information about default fields that have
|
33 |
+
// been modified and disabled is stored in the database
|
34 |
+
$this->modified_option_key = apply_filters( 'cffrtb_modified_fields_option_key', 'cffrtb_modified_fields' );
|
35 |
+
|
36 |
+
// Common string tacked onto the end of error messages
|
37 |
+
$this->common_error_msg = sprintf( _x( 'Please try again. If the problem persists, you may need to refresh the page. If that does not solve the problem, please %scontact support%s for help.', 'A common phrase added to the end of error messages', 'custom-fields-for-rtb' ), '<a href="http://fivestarplugins.com/contact-us/">', '</a>' );
|
38 |
+
|
39 |
+
// Validate user input for custom fields
|
40 |
+
add_action( 'rtb_validate_booking_submission', array( $this, 'validate_custom_fields_input' ) );
|
41 |
+
|
42 |
+
// Filter required phone setting when phone field is disabled
|
43 |
+
add_filter( 'rtb-setting-require-phone', array( $this, 'never_require_phone' ) );
|
44 |
+
|
45 |
+
// Insert/load custom field input with booking metadata
|
46 |
+
add_filter( 'rtb_insert_booking_metadata', array( $this, 'insert_booking_metadata' ), 10, 2 );
|
47 |
+
add_action( 'rtb_booking_load_post_data', array( $this, 'load_booking_meta_data' ), 10, 2 );
|
48 |
+
|
49 |
+
// Print custom fields in notification template tags
|
50 |
+
add_filter( 'rtb_notification_template_tags', array( $this, 'add_notification_template_tags' ), 10, 2 );
|
51 |
+
add_filter( 'rtb_notification_template_tag_descriptions', array( $this, 'add_notification_template_tag_descriptions' ) );
|
52 |
+
|
53 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
|
54 |
+
}
|
55 |
+
|
56 |
+
public function enqueue_scripts() {
|
57 |
+
$currentScreen = get_current_screen();
|
58 |
+
if ( $currentScreen->id == 'bookings_page_cffrtb-editor' ) {
|
59 |
+
wp_enqueue_style( 'rtb-admin-css', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
60 |
+
wp_enqueue_script( 'rtb-admin-js', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Validate user input for custom fields
|
66 |
+
*
|
67 |
+
* @since 0.1
|
68 |
+
*/
|
69 |
+
public function validate_custom_fields_input( $booking ) {
|
70 |
+
|
71 |
+
$fields = rtb_get_custom_fields();
|
72 |
+
|
73 |
+
if ( !count( $fields ) ) {
|
74 |
+
return;
|
75 |
+
}
|
76 |
+
|
77 |
+
foreach( $fields as $field ) {
|
78 |
+
$validation = $field->validate_input( $booking );
|
79 |
+
}
|
80 |
+
}
|
81 |
+
|
82 |
+
/**
|
83 |
+
* Add custom fields to metadata when a booking is saved
|
84 |
+
*
|
85 |
+
* @since 0.1
|
86 |
+
*/
|
87 |
+
public function insert_booking_metadata( $meta, $booking ) {
|
88 |
+
|
89 |
+
if ( empty( $booking->custom_fields ) ) {
|
90 |
+
return $meta;
|
91 |
+
}
|
92 |
+
|
93 |
+
if ( !is_array( $meta ) ) {
|
94 |
+
$meta = array();
|
95 |
+
}
|
96 |
+
|
97 |
+
if ( !isset( $meta['custom_fields'] ) ) {
|
98 |
+
$meta['custom_fields'] = array();
|
99 |
+
}
|
100 |
+
|
101 |
+
$meta['custom_fields'] = $booking->custom_fields;
|
102 |
+
|
103 |
+
return $meta;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Add custom fields to metadata when booking is loaded
|
108 |
+
*
|
109 |
+
* @since 0.1
|
110 |
+
*/
|
111 |
+
public function load_booking_meta_data( $booking, $post ) {
|
112 |
+
|
113 |
+
$meta = get_post_meta( $booking->ID, 'rtb', true );
|
114 |
+
|
115 |
+
if ( empty( $meta['custom_fields'] ) ) {
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
$booking->custom_fields = $meta['custom_fields'];
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Add custom fields as notification template tags
|
124 |
+
*
|
125 |
+
* @since 0.1
|
126 |
+
*/
|
127 |
+
public function add_notification_template_tags( $tags, $notification ) {
|
128 |
+
global $rtb_controller;
|
129 |
+
|
130 |
+
$fields = rtb_get_custom_fields();
|
131 |
+
|
132 |
+
$cf = isset( $notification->booking->custom_fields ) ? $notification->booking->custom_fields : array();
|
133 |
+
$checkbox_icon = apply_filters( 'cffrtb_checkbox_icon_notification', '', $notification );
|
134 |
+
|
135 |
+
foreach( $fields as $field ) {
|
136 |
+
|
137 |
+
if ( $field->type == 'fieldset' ) {
|
138 |
+
continue;
|
139 |
+
}
|
140 |
+
|
141 |
+
if ( isset( $cf[ $field->slug ] ) ) {
|
142 |
+
$display_val = apply_filters( 'cffrtb_display_value_notification', $rtb_controller->fields->get_display_value( $cf[ $field->slug ], $field, $checkbox_icon ), $cf[ $field->slug ], $field, $notification );
|
143 |
+
} else {
|
144 |
+
$display_val = '';
|
145 |
+
}
|
146 |
+
$tags[ '{cf-' . esc_attr( $field->slug ) . '}' ] = $display_val;
|
147 |
+
}
|
148 |
+
|
149 |
+
return $tags;
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* Add custom field notification template tag descriptions
|
154 |
+
*
|
155 |
+
* @since 0.1
|
156 |
+
*/
|
157 |
+
public function add_notification_template_tag_descriptions( $tags ) {
|
158 |
+
|
159 |
+
$fields = rtb_get_custom_fields();
|
160 |
+
|
161 |
+
foreach( $fields as $field ) {
|
162 |
+
|
163 |
+
if ( $field->type == 'fieldset' ) {
|
164 |
+
continue;
|
165 |
+
}
|
166 |
+
|
167 |
+
$tags[ '{cf-' . esc_attr( $field->slug ) . '}' ] = esc_html( $field->title );
|
168 |
+
}
|
169 |
+
|
170 |
+
return $tags;
|
171 |
+
}
|
172 |
+
|
173 |
+
/**
|
174 |
+
* Override the required phone setting when the phone field has been
|
175 |
+
* disabled.
|
176 |
+
*
|
177 |
+
* @param string $value The value of the setting
|
178 |
+
* @since 1.2.3
|
179 |
+
*/
|
180 |
+
public function never_require_phone( $value ) {
|
181 |
+
global $rtb_controller;
|
182 |
+
|
183 |
+
$modified = get_option( $rtb_controller->custom_fields->modified_option_key );
|
184 |
+
|
185 |
+
if ( $modified && isset( $modified['phone'] ) && !empty( $modified['phone']['disabled'] ) ) {
|
186 |
+
return '';
|
187 |
+
}
|
188 |
+
|
189 |
+
return $value;
|
190 |
+
}
|
191 |
+
|
192 |
+
}
|
193 |
+
} // endif;
|
includes/Dashboard.class.php
CHANGED
@@ -37,6 +37,9 @@ class rtbDashboard {
|
|
37 |
Â
// Create a new sub-menu in the order that we want
|
38 |
Â
$new_submenu = array();
|
39 |
Â
$menu_item_count = 3;
|
Â
|
|
Â
|
|
Â
|
|
40 |
Â
foreach ( $submenu['rtb-bookings'] as $key => $sub_item ) {
|
41 |
Â
if ( $sub_item[0] == 'Dashboard' ) { $new_submenu[0] = $sub_item; }
|
42 |
Â
elseif ( $sub_item[0] == 'Bookings' ) { $new_submenu[1] = $sub_item; }
|
@@ -58,9 +61,11 @@ class rtbDashboard {
|
|
58 |
Â
|
59 |
Â
// Enqueues the admin script so that our hacky sub-menu opening function can run
|
60 |
Â
public function enqueue_scripts() {
|
Â
|
|
Â
|
|
61 |
Â
$currentScreen = get_current_screen();
|
62 |
-
if ( $currentScreen->id == '
|
63 |
-
wp_enqueue_style( 'rtb-admin', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
64 |
Â
wp_enqueue_script( 'rtb-admin-js', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
65 |
Â
}
|
66 |
Â
}
|
@@ -108,7 +113,8 @@ class rtbDashboard {
|
|
108 |
Â
update_option("RTB_Trial_Happening", "No");
|
109 |
Â
delete_option("RTB_Trial_Expiry_Time");
|
110 |
Â
|
111 |
-
update_option( "rtb-permission-level",
|
Â
|
|
112 |
Â
$rtb_controller->permissions->update_permissions();
|
113 |
Â
}
|
114 |
Â
}
|
@@ -121,8 +127,35 @@ class rtbDashboard {
|
|
121 |
Â
|
122 |
Â
if ( get_option("RTB_Trial_Happening") == "Yes" and get_option( 'RTB_Trial_Expiry_Time' ) < time() ) {
|
123 |
Â
update_option( 'RTB_Trial_Happening', 'No');
|
124 |
-
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
125 |
Â
|
Â
|
|
126 |
Â
$rtb_controller->permissions->update_permissions();
|
127 |
Â
}
|
128 |
Â
}
|
@@ -131,19 +164,20 @@ class rtbDashboard {
|
|
131 |
Â
global $rtb_controller;
|
132 |
Â
|
133 |
Â
$permission = $rtb_controller->permissions->check_permission( 'styling' );
|
Â
|
|
134 |
Â
|
135 |
Â
?>
|
136 |
Â
<div id="rtb-dashboard-content-area">
|
137 |
Â
|
138 |
Â
<div id="rtb-dashboard-content-left">
|
139 |
Â
|
140 |
-
<?php if ( ! $permission or get_option("RTB_Trial_Happening") == "Yes") { ?>
|
141 |
Â
<div class="rtb-dashboard-new-widget-box ewd-widget-box-full">
|
142 |
Â
<div class="rtb-dashboard-new-widget-box-top">
|
143 |
Â
<form method="post" action="admin.php?page=rtb-dashboard" class="rtb-dashboard-key-widget">
|
144 |
Â
<input class="rtb-dashboard-key-widget-input" name="Key" type="text" placeholder="<?php _e('Enter License Key Here', 'restaurant-reservations'); ?>">
|
145 |
-
<input class="rtb-dashboard-key-widget-submit" name="RTB_Upgrade_To_Full" type="submit" value="<?php
|
146 |
-
<div class="rtb-dashboard-key-widget-text">Don't have a key? <a href="https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1" target="_blank">Upgrade Now</a> to unlock all premium features.</div>
|
147 |
Â
</form>
|
148 |
Â
</div>
|
149 |
Â
</div>
|
37 |
Â
// Create a new sub-menu in the order that we want
|
38 |
Â
$new_submenu = array();
|
39 |
Â
$menu_item_count = 3;
|
40 |
+
|
41 |
+
if ( ! is_array($submenu['rtb-bookings']) ) { $submenu['rtb-bookings'] = array(); }
|
42 |
+
|
43 |
Â
foreach ( $submenu['rtb-bookings'] as $key => $sub_item ) {
|
44 |
Â
if ( $sub_item[0] == 'Dashboard' ) { $new_submenu[0] = $sub_item; }
|
45 |
Â
elseif ( $sub_item[0] == 'Bookings' ) { $new_submenu[1] = $sub_item; }
|
61 |
Â
|
62 |
Â
// Enqueues the admin script so that our hacky sub-menu opening function can run
|
63 |
Â
public function enqueue_scripts() {
|
64 |
+
global $admin_page_hooks;
|
65 |
+
|
66 |
Â
$currentScreen = get_current_screen();
|
67 |
+
if ( $currentScreen->id == $admin_page_hooks['rtb-bookings'] . '_page_rtb-dashboard' ) {
|
68 |
+
wp_enqueue_style( 'rtb-admin-css', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
69 |
Â
wp_enqueue_script( 'rtb-admin-js', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
70 |
Â
}
|
71 |
Â
}
|
113 |
Â
update_option("RTB_Trial_Happening", "No");
|
114 |
Â
delete_option("RTB_Trial_Expiry_Time");
|
115 |
Â
|
116 |
+
if ( is_array($Response) and isset($Response['Permission_Level']) and $Response['Permission_Level'] == 3 ) { update_option( "rtb-permission-level", 3 ); }
|
117 |
+
else { update_option( "rtb-permission-level", 2 ); }
|
118 |
Â
$rtb_controller->permissions->update_permissions();
|
119 |
Â
}
|
120 |
Â
}
|
127 |
Â
|
128 |
Â
if ( get_option("RTB_Trial_Happening") == "Yes" and get_option( 'RTB_Trial_Expiry_Time' ) < time() ) {
|
129 |
Â
update_option( 'RTB_Trial_Happening', 'No');
|
130 |
+
|
131 |
+
$rtb_controller->settings->set_setting( 'view-bookings-page', '' );
|
132 |
+
$rtb_controller->settings->set_setting( 'rtb-enable-max-tables', false );
|
133 |
+
$rtb_controller->settings->set_setting( 'auto-confirm-max-reservations', '' );
|
134 |
+
$rtb_controller->settings->set_setting( 'auto-confirm-max-seats', '' );
|
135 |
+
$rtb_controller->settings->set_setting( 'mc-lists', '' );
|
136 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-layout', 'default' );
|
137 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-title-font-family', '' );
|
138 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-title-font-size', '' );
|
139 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-title-color', '' );
|
140 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-background-color', '' );
|
141 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-border-size', '' );
|
142 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-section-border-color', '' );
|
143 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-label-font-family', '' );
|
144 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-label-font-size', '' );
|
145 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-label-color', '' );
|
146 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-add-message-button-background-color', '' );
|
147 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-add-message-button-background-hover-color', '' );
|
148 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-add-message-button-text-color', '' );
|
149 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-add-message-button-text-hover-color', '' );
|
150 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-request-booking-button-background-color', '' );
|
151 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-request-booking-button-background-hover-color', '' );
|
152 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-request-booking-button-text-color', '' );
|
153 |
+
$rtb_controller->settings->set_setting( 'rtb-styling-request-booking-button-text-hover-color', '' );
|
154 |
+
$rtb_controller->settings->save_settings();
|
155 |
+
|
156 |
+
ajax_reset_all( true );
|
157 |
Â
|
158 |
+
update_option( 'rtb-permission-level', get_option( 'rtb-pre-permission-level' ) );
|
159 |
Â
$rtb_controller->permissions->update_permissions();
|
160 |
Â
}
|
161 |
Â
}
|
164 |
Â
global $rtb_controller;
|
165 |
Â
|
166 |
Â
$permission = $rtb_controller->permissions->check_permission( 'styling' );
|
167 |
+
$ultimate = $rtb_controller->permissions->check_permission( 'payments' );
|
168 |
Â
|
169 |
Â
?>
|
170 |
Â
<div id="rtb-dashboard-content-area">
|
171 |
Â
|
172 |
Â
<div id="rtb-dashboard-content-left">
|
173 |
Â
|
174 |
+
<?php if ( ! $permission or ! $ultimate or get_option("RTB_Trial_Happening") == "Yes") { ?>
|
175 |
Â
<div class="rtb-dashboard-new-widget-box ewd-widget-box-full">
|
176 |
Â
<div class="rtb-dashboard-new-widget-box-top">
|
177 |
Â
<form method="post" action="admin.php?page=rtb-dashboard" class="rtb-dashboard-key-widget">
|
178 |
Â
<input class="rtb-dashboard-key-widget-input" name="Key" type="text" placeholder="<?php _e('Enter License Key Here', 'restaurant-reservations'); ?>">
|
179 |
+
<input class="rtb-dashboard-key-widget-submit" name="RTB_Upgrade_To_Full" type="submit" value="<?php echo ( ! $permission ? __('UNLOCK PREMIUM', 'restaurant-reservations') : __('UNLOCK ULTIMATE', 'restaurant-reservations') ) ?>">
|
180 |
+
<div class="rtb-dashboard-key-widget-text">Don't have a key? <a href="https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1" target="_blank">Upgrade Now</a> to unlock all <?php echo (! $permission ? 'premium' : 'ultimate'); ?> features.</div>
|
181 |
Â
</form>
|
182 |
Â
</div>
|
183 |
Â
</div>
|
includes/Import.class.php
CHANGED
@@ -1,279 +1,279 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Class to import bookings from a spreadsheet
|
5 |
-
*/
|
6 |
-
|
7 |
-
if ( !defined( 'ABSPATH' ) )
|
8 |
-
exit;
|
9 |
-
|
10 |
-
if (!class_exists('ComposerAutoloaderInit4618f5c41cf5e27cc7908556f031e4d4')) {require_once FDM_PLUGIN_DIR . '/lib/PHPSpreadsheet/vendor/autoload.php';}
|
11 |
-
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
12 |
-
class rtbImport {
|
13 |
-
|
14 |
-
/**
|
15 |
-
* Hook suffix for the page
|
16 |
-
*
|
17 |
-
* @since 0.1
|
18 |
-
*/
|
19 |
-
public $hook_suffix;
|
20 |
-
|
21 |
-
/**
|
22 |
-
* The success/error message content
|
23 |
-
*
|
24 |
-
* @since 0.1
|
25 |
-
*/
|
26 |
-
public $status;
|
27 |
-
|
28 |
-
/**
|
29 |
-
* Whether the operation was a success or not
|
30 |
-
*
|
31 |
-
* @since 0.1
|
32 |
-
*/
|
33 |
-
public $message;
|
34 |
-
|
35 |
-
public function __construct() {
|
36 |
-
add_action( 'admin_menu', array($this, 'register_install_screen' ));
|
37 |
-
|
38 |
-
if ( isset( $_POST['rtbImport'] ) ) { add_action( 'admin_init', array($this, 'import_bookings' )); }
|
39 |
-
|
40 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_import_scripts' ) );
|
41 |
-
}
|
42 |
-
|
43 |
-
public function register_install_screen() {
|
44 |
-
$this->hook_suffix = add_submenu_page(
|
45 |
-
'rtb-bookings',
|
46 |
-
_x( 'Import', 'Title of the Imports page', 'restaurant-reservations' ),
|
47 |
-
_x( 'Import', 'Title of Imports link in the admin menu', 'restaurant-reservations' ),
|
48 |
-
'manage_options',
|
49 |
-
'rtb-imports',
|
50 |
-
array( $this, 'display_editor_page' )
|
51 |
-
);
|
52 |
-
|
53 |
-
// Print the error modal and enqueue assets
|
54 |
-
add_action( 'load-' . $this->hook_suffix, array( $this, 'enqueue_admin_assets' ) );
|
55 |
-
}
|
56 |
-
|
57 |
-
public function display_import_screen() {
|
58 |
-
global $rtb_controller;
|
59 |
-
|
60 |
-
$import_permission = $rtb_controller->permissions->check_permission( 'import' );
|
61 |
-
?>
|
62 |
-
<div class='wrap'>
|
63 |
-
<h2>Import</h2>
|
64 |
-
<?php if ( $import_permission ) { ?>
|
65 |
-
<form method='post' enctype="multipart/form-data">
|
66 |
-
<p>
|
67 |
-
<label for="rtb_bookings_spreadsheet"><?php _e("Spreadsheet Containing Bookings", 'restaurant-reservations') ?></label><br />
|
68 |
-
<input name="rtb_bookings_spreadsheet" type="file" value=""/>
|
69 |
-
</p>
|
70 |
-
<input type='submit' name='rtbImport' value='Import Bookings' class='button button-primary' />
|
71 |
-
</form>
|
72 |
-
<?php } else { ?>
|
73 |
-
<div class='rtb-premium-locked'>
|
74 |
-
<a href="https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1" target="_blank">Upgrade</a> to the premium version to use this feature
|
75 |
-
</div>
|
76 |
-
<?php } ?>
|
77 |
-
</div>
|
78 |
-
<?php }
|
79 |
-
|
80 |
-
public function import_bookings() {
|
81 |
-
global $rtb_controller;
|
82 |
-
|
83 |
-
$fields = $rtb_controller->settings->get_booking_form_fields();
|
84 |
-
|
85 |
-
$update = $this->handle_spreadsheet_upload();
|
86 |
-
|
87 |
-
if ( $update['message_type'] != 'Success' ) :
|
88 |
-
$this->status = false;
|
89 |
-
$this->message = $update['message'];
|
90 |
-
|
91 |
-
add_action( 'admin_notices', array( $this, 'display_notice' ) );
|
92 |
-
|
93 |
-
return;
|
94 |
-
endif;
|
95 |
-
|
96 |
-
$excel_url = RTB_PLUGIN_DIR . '/user-sheets/' . $update['filename'];
|
97 |
-
|
98 |
-
// Build the workbook object out of the uploaded spreadsheet
|
99 |
-
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($excel_url);
|
100 |
-
|
101 |
-
// Create a worksheet object out of the product sheet in the workbook
|
102 |
-
$sheet = $spreadsheet->getActiveSheet();
|
103 |
-
|
104 |
-
$allowable_fields = array();
|
105 |
-
foreach ($fields as $field) {$allowable_fields[] = $field->name;}
|
106 |
-
//List of fields that can be accepted via upload
|
107 |
-
//$allowed_fields = array("ID", "Title", "Description", "Price", "Sections");
|
108 |
-
|
109 |
-
|
110 |
-
// Get column names
|
111 |
-
$highest_column = $sheet->getHighestColumn();
|
112 |
-
$highest_column_index = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highest_column);
|
113 |
-
for ($column = 1; $column <= $highest_column_index; $column++) {
|
114 |
-
/*if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "ID") {$ID_column = $column;}
|
115 |
-
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Title") {$title_column = $column;}
|
116 |
-
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Description") {$description_column = $column;}
|
117 |
-
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Price") {$price_column = $column;}
|
118 |
-
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Sections") {$sections_column = $column;}*/
|
119 |
-
|
120 |
-
foreach ($fields as $key => $field) {
|
121 |
-
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == $field->name) {$field->column = $column;}
|
122 |
-
}
|
123 |
-
}
|
124 |
-
|
125 |
-
|
126 |
-
// Put the spreadsheet data into a multi-dimensional array to facilitate processing
|
127 |
-
$highest_row = $sheet->getHighestRow();
|
128 |
-
for ($row = 2; $row <= $highest_row; $row++) {
|
129 |
-
for ($column = 1; $column <= $highest_column_index; $column++) {
|
130 |
-
$data[$row][$column] = $sheet->getCellByColumnAndRow($column, $row)->getValue();
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
// Create the query to insert the products one at a time into the database and then run it
|
135 |
-
foreach ($data as $booking) {
|
136 |
-
// Create an array of the values that are being inserted for each order,
|
137 |
-
// edit if it's a current order, otherwise add it
|
138 |
-
foreach ($booking as $col_index => $value) {
|
139 |
-
if ($col_index == $ID_column and $ID_column !== null) {$post['ID'] = esc_sql($value);}
|
140 |
-
if ($col_index == $title_column and $title_column !== null) {$post['post_title'] = esc_sql($value);}
|
141 |
-
if ($col_index == $description_column and $description_column !== null) {$post['post_content'] = esc_sql($value);}
|
142 |
-
if ($col_index == $price_column and $price_column !== null) {$post_prices = explode(",", esc_sql($value));}
|
143 |
-
if (isset($sections_column) and $col_index == $sections_column and $sections_column !== null) {$post_sections = explode(",", esc_sql($value));}
|
144 |
-
}
|
145 |
-
|
146 |
-
if (!is_array($post_prices)) {$post_prices = array();}
|
147 |
-
if (!is_array($post_sections)) {$post_sections = array();}
|
148 |
-
|
149 |
-
if ($post['post_title'] == '') {continue;}
|
150 |
-
|
151 |
-
$post['post_status'] = 'publish';
|
152 |
-
$post['post_type'] = 'fdm-menu-item';
|
153 |
-
|
154 |
-
if ( isset( $post['ID'] ) and $post['ID'] != '') { $post_id = wp_update_post($post); }
|
155 |
-
else { $post_id = wp_insert_post($post); }
|
156 |
-
|
157 |
-
if ( $post_id != 0 ) {
|
158 |
-
foreach ( $post_sections as $section ) {
|
159 |
-
$menu_section = term_exists($section, 'fdm-menu-section');
|
160 |
-
if ( $menu_section !== 0 && $menu_section !== null ) { $menu_section_ids[] = (int) $menu_section['term_id']; }
|
161 |
-
}
|
162 |
-
if ( isset($menu_section_ids) and is_array($menu_section_ids) ) { wp_set_object_terms($post_id, $menu_section_ids, 'fdm-menu-section'); }
|
163 |
-
|
164 |
-
update_post_meta( $post_id, 'fdm_item_price', implode(",", $post_prices) );
|
165 |
-
|
166 |
-
$field_values = array();
|
167 |
-
foreach ( $fields as $field ) {
|
168 |
-
if (isset($field->column) and isset($menu_item[$field->column])) {
|
169 |
-
$field_values[$field->slug] = esc_sql($menu_item[$field->column]);
|
170 |
-
|
171 |
-
}
|
172 |
-
}
|
173 |
-
update_post_meta($post_id, '_fdm_menu_item_custom_fields', $field_values);
|
174 |
-
}
|
175 |
-
|
176 |
-
unset($post);
|
177 |
-
unset($post_sections);
|
178 |
-
unset($menu_section_ids);
|
179 |
-
unset($post_prices);
|
180 |
-
unset($field_values);
|
181 |
-
}
|
182 |
-
|
183 |
-
$this->status = true;
|
184 |
-
$this->message = __("Menu items added successfully.", 'food-and-drink-menu');
|
185 |
-
|
186 |
-
add_action( 'admin_notices', array( $this, 'display_notice' ) );
|
187 |
-
}
|
188 |
-
|
189 |
-
function handle_spreadsheet_upload() {
|
190 |
-
/* Test if there is an error with the uploaded spreadsheet and return that error if there is */
|
191 |
-
if (!empty($_FILES['fdm_menu_items_spreadsheet']['error']))
|
192 |
-
{
|
193 |
-
switch($_FILES['fdm_menu_items_spreadsheet']['error'])
|
194 |
-
{
|
195 |
-
|
196 |
-
case '1':
|
197 |
-
$error = __('The uploaded file exceeds the upload_max_filesize directive in php.ini', 'food-and-drink-menu');
|
198 |
-
break;
|
199 |
-
case '2':
|
200 |
-
$error = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 'food-and-drink-menu');
|
201 |
-
break;
|
202 |
-
case '3':
|
203 |
-
$error = __('The uploaded file was only partially uploaded', 'food-and-drink-menu');
|
204 |
-
break;
|
205 |
-
case '4':
|
206 |
-
$error = __('No file was uploaded.', 'food-and-drink-menu');
|
207 |
-
break;
|
208 |
-
|
209 |
-
case '6':
|
210 |
-
$error = __('Missing a temporary folder', 'food-and-drink-menu');
|
211 |
-
break;
|
212 |
-
case '7':
|
213 |
-
$error = __('Failed to write file to disk', 'food-and-drink-menu');
|
214 |
-
break;
|
215 |
-
case '8':
|
216 |
-
$error = __('File upload stopped by extension', 'food-and-drink-menu');
|
217 |
-
break;
|
218 |
-
case '999':
|
219 |
-
default:
|
220 |
-
$error = __('No error code avaiable', 'food-and-drink-menu');
|
221 |
-
}
|
222 |
-
}
|
223 |
-
/* Make sure that the file exists */
|
224 |
-
elseif (empty($_FILES['fdm_menu_items_spreadsheet']['tmp_name']) || $_FILES['fdm_menu_items_spreadsheet']['tmp_name'] == 'none') {
|
225 |
-
$error = __('No file was uploaded here..', 'food-and-drink-menu');
|
226 |
-
}
|
227 |
-
/* Move the file and store the URL to pass it onwards*/
|
228 |
-
/* Check that it is a .xls or .xlsx file */
|
229 |
-
if(!isset($_FILES['fdm_menu_items_spreadsheet']['name']) or (!preg_match("/\.(xls.?)$/", $_FILES['fdm_menu_items_spreadsheet']['name']) and !preg_match("/\.(csv.?)$/", $_FILES['fdm_menu_items_spreadsheet']['name']))) {
|
230 |
-
$error = __('File must be .csv, .xls or .xlsx', 'food-and-drink-menu');
|
231 |
-
}
|
232 |
-
else {
|
233 |
-
$filename = basename( $_FILES['fdm_menu_items_spreadsheet']['name']);
|
234 |
-
$filename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
|
235 |
-
$filename = mb_ereg_replace("([\.]{2,})", '', $filename);
|
236 |
-
|
237 |
-
//for security reason, we force to remove all uploaded file
|
238 |
-
$target_path = FDM_PLUGIN_DIR . "/user-sheets/";
|
239 |
-
|
240 |
-
$target_path = $target_path . $filename;
|
241 |
-
|
242 |
-
if (!move_uploaded_file($_FILES['fdm_menu_items_spreadsheet']['tmp_name'], $target_path)) {
|
243 |
-
$error .= "There was an error uploading the file, please try again!";
|
244 |
-
}
|
245 |
-
else {
|
246 |
-
$excel_file_name = $filename;
|
247 |
-
}
|
248 |
-
}
|
249 |
-
|
250 |
-
/* Pass the data to the appropriate function in Update_Admin_Databases.php to create the products */
|
251 |
-
if (!isset($error)) {
|
252 |
-
$update = array("message_type" => "Success", "filename" => $excel_file_name);
|
253 |
-
}
|
254 |
-
else {
|
255 |
-
$update = array("message_type" => "Error", "message" => $error);
|
256 |
-
}
|
257 |
-
return $update;
|
258 |
-
}
|
259 |
-
|
260 |
-
public function enqueue_import_scripts() {
|
261 |
-
$screen = get_current_screen();
|
262 |
-
if($screen->id == 'fdm-menu_page_fdm-import'){
|
263 |
-
wp_enqueue_style( 'fdm-admin', FDM_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
264 |
-
wp_enqueue_script( 'fdm-admin-js', FDM_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
265 |
-
}
|
266 |
-
}
|
267 |
-
|
268 |
-
public function display_notice() {
|
269 |
-
if ( $this->status ) {
|
270 |
-
echo "<div class='updated'><p>" . $this->message . "</p></div>";
|
271 |
-
}
|
272 |
-
else {
|
273 |
-
echo "<div class='error'><p>" . $this->message . "</p></div>";
|
274 |
-
}
|
275 |
-
}
|
276 |
-
|
277 |
-
}
|
278 |
-
|
279 |
-
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class to import bookings from a spreadsheet (not working atm)
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( !defined( 'ABSPATH' ) )
|
8 |
+
exit;
|
9 |
+
|
10 |
+
if (!class_exists('ComposerAutoloaderInit4618f5c41cf5e27cc7908556f031e4d4')) {require_once FDM_PLUGIN_DIR . '/lib/PHPSpreadsheet/vendor/autoload.php';}
|
11 |
+
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
12 |
+
class rtbImport {
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Hook suffix for the page
|
16 |
+
*
|
17 |
+
* @since 0.1
|
18 |
+
*/
|
19 |
+
public $hook_suffix;
|
20 |
+
|
21 |
+
/**
|
22 |
+
* The success/error message content
|
23 |
+
*
|
24 |
+
* @since 0.1
|
25 |
+
*/
|
26 |
+
public $status;
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Whether the operation was a success or not
|
30 |
+
*
|
31 |
+
* @since 0.1
|
32 |
+
*/
|
33 |
+
public $message;
|
34 |
+
|
35 |
+
public function __construct() {
|
36 |
+
add_action( 'admin_menu', array($this, 'register_install_screen' ));
|
37 |
+
|
38 |
+
if ( isset( $_POST['rtbImport'] ) ) { add_action( 'admin_init', array($this, 'import_bookings' )); }
|
39 |
+
|
40 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_import_scripts' ) );
|
41 |
+
}
|
42 |
+
|
43 |
+
public function register_install_screen() {
|
44 |
+
$this->hook_suffix = add_submenu_page(
|
45 |
+
'rtb-bookings',
|
46 |
+
_x( 'Import', 'Title of the Imports page', 'restaurant-reservations' ),
|
47 |
+
_x( 'Import', 'Title of Imports link in the admin menu', 'restaurant-reservations' ),
|
48 |
+
'manage_options',
|
49 |
+
'rtb-imports',
|
50 |
+
array( $this, 'display_editor_page' )
|
51 |
+
);
|
52 |
+
|
53 |
+
// Print the error modal and enqueue assets
|
54 |
+
add_action( 'load-' . $this->hook_suffix, array( $this, 'enqueue_admin_assets' ) );
|
55 |
+
}
|
56 |
+
|
57 |
+
public function display_import_screen() {
|
58 |
+
global $rtb_controller;
|
59 |
+
|
60 |
+
$import_permission = $rtb_controller->permissions->check_permission( 'import' );
|
61 |
+
?>
|
62 |
+
<div class='wrap'>
|
63 |
+
<h2>Import</h2>
|
64 |
+
<?php if ( $import_permission ) { ?>
|
65 |
+
<form method='post' enctype="multipart/form-data">
|
66 |
+
<p>
|
67 |
+
<label for="rtb_bookings_spreadsheet"><?php _e("Spreadsheet Containing Bookings", 'restaurant-reservations') ?></label><br />
|
68 |
+
<input name="rtb_bookings_spreadsheet" type="file" value=""/>
|
69 |
+
</p>
|
70 |
+
<input type='submit' name='rtbImport' value='Import Bookings' class='button button-primary' />
|
71 |
+
</form>
|
72 |
+
<?php } else { ?>
|
73 |
+
<div class='rtb-premium-locked'>
|
74 |
+
<a href="https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1" target="_blank">Upgrade</a> to the premium version to use this feature
|
75 |
+
</div>
|
76 |
+
<?php } ?>
|
77 |
+
</div>
|
78 |
+
<?php }
|
79 |
+
|
80 |
+
public function import_bookings() {
|
81 |
+
global $rtb_controller;
|
82 |
+
|
83 |
+
$fields = $rtb_controller->settings->get_booking_form_fields();
|
84 |
+
|
85 |
+
$update = $this->handle_spreadsheet_upload();
|
86 |
+
|
87 |
+
if ( $update['message_type'] != 'Success' ) :
|
88 |
+
$this->status = false;
|
89 |
+
$this->message = $update['message'];
|
90 |
+
|
91 |
+
add_action( 'admin_notices', array( $this, 'display_notice' ) );
|
92 |
+
|
93 |
+
return;
|
94 |
+
endif;
|
95 |
+
|
96 |
+
$excel_url = RTB_PLUGIN_DIR . '/user-sheets/' . $update['filename'];
|
97 |
+
|
98 |
+
// Build the workbook object out of the uploaded spreadsheet
|
99 |
+
$spreadsheet = \PhpOffice\PhpSpreadsheet\IOFactory::load($excel_url);
|
100 |
+
|
101 |
+
// Create a worksheet object out of the product sheet in the workbook
|
102 |
+
$sheet = $spreadsheet->getActiveSheet();
|
103 |
+
|
104 |
+
$allowable_fields = array();
|
105 |
+
foreach ($fields as $field) {$allowable_fields[] = $field->name;}
|
106 |
+
//List of fields that can be accepted via upload
|
107 |
+
//$allowed_fields = array("ID", "Title", "Description", "Price", "Sections");
|
108 |
+
|
109 |
+
|
110 |
+
// Get column names
|
111 |
+
$highest_column = $sheet->getHighestColumn();
|
112 |
+
$highest_column_index = \PhpOffice\PhpSpreadsheet\Cell\Coordinate::columnIndexFromString($highest_column);
|
113 |
+
for ($column = 1; $column <= $highest_column_index; $column++) {
|
114 |
+
/*if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "ID") {$ID_column = $column;}
|
115 |
+
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Title") {$title_column = $column;}
|
116 |
+
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Description") {$description_column = $column;}
|
117 |
+
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Price") {$price_column = $column;}
|
118 |
+
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == "Sections") {$sections_column = $column;}*/
|
119 |
+
|
120 |
+
foreach ($fields as $key => $field) {
|
121 |
+
if (trim($sheet->getCellByColumnAndRow($column, 1)->getValue()) == $field->name) {$field->column = $column;}
|
122 |
+
}
|
123 |
+
}
|
124 |
+
|
125 |
+
|
126 |
+
// Put the spreadsheet data into a multi-dimensional array to facilitate processing
|
127 |
+
$highest_row = $sheet->getHighestRow();
|
128 |
+
for ($row = 2; $row <= $highest_row; $row++) {
|
129 |
+
for ($column = 1; $column <= $highest_column_index; $column++) {
|
130 |
+
$data[$row][$column] = $sheet->getCellByColumnAndRow($column, $row)->getValue();
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
// Create the query to insert the products one at a time into the database and then run it
|
135 |
+
foreach ($data as $booking) {
|
136 |
+
// Create an array of the values that are being inserted for each order,
|
137 |
+
// edit if it's a current order, otherwise add it
|
138 |
+
foreach ($booking as $col_index => $value) {
|
139 |
+
if ($col_index == $ID_column and $ID_column !== null) {$post['ID'] = esc_sql($value);}
|
140 |
+
if ($col_index == $title_column and $title_column !== null) {$post['post_title'] = esc_sql($value);}
|
141 |
+
if ($col_index == $description_column and $description_column !== null) {$post['post_content'] = esc_sql($value);}
|
142 |
+
if ($col_index == $price_column and $price_column !== null) {$post_prices = explode(",", esc_sql($value));}
|
143 |
+
if (isset($sections_column) and $col_index == $sections_column and $sections_column !== null) {$post_sections = explode(",", esc_sql($value));}
|
144 |
+
}
|
145 |
+
|
146 |
+
if (!is_array($post_prices)) {$post_prices = array();}
|
147 |
+
if (!is_array($post_sections)) {$post_sections = array();}
|
148 |
+
|
149 |
+
if ($post['post_title'] == '') {continue;}
|
150 |
+
|
151 |
+
$post['post_status'] = 'publish';
|
152 |
+
$post['post_type'] = 'fdm-menu-item';
|
153 |
+
|
154 |
+
if ( isset( $post['ID'] ) and $post['ID'] != '') { $post_id = wp_update_post($post); }
|
155 |
+
else { $post_id = wp_insert_post($post); }
|
156 |
+
|
157 |
+
if ( $post_id != 0 ) {
|
158 |
+
foreach ( $post_sections as $section ) {
|
159 |
+
$menu_section = term_exists($section, 'fdm-menu-section');
|
160 |
+
if ( $menu_section !== 0 && $menu_section !== null ) { $menu_section_ids[] = (int) $menu_section['term_id']; }
|
161 |
+
}
|
162 |
+
if ( isset($menu_section_ids) and is_array($menu_section_ids) ) { wp_set_object_terms($post_id, $menu_section_ids, 'fdm-menu-section'); }
|
163 |
+
|
164 |
+
update_post_meta( $post_id, 'fdm_item_price', implode(",", $post_prices) );
|
165 |
+
|
166 |
+
$field_values = array();
|
167 |
+
foreach ( $fields as $field ) {
|
168 |
+
if (isset($field->column) and isset($menu_item[$field->column])) {
|
169 |
+
$field_values[$field->slug] = esc_sql($menu_item[$field->column]);
|
170 |
+
|
171 |
+
}
|
172 |
+
}
|
173 |
+
update_post_meta($post_id, '_fdm_menu_item_custom_fields', $field_values);
|
174 |
+
}
|
175 |
+
|
176 |
+
unset($post);
|
177 |
+
unset($post_sections);
|
178 |
+
unset($menu_section_ids);
|
179 |
+
unset($post_prices);
|
180 |
+
unset($field_values);
|
181 |
+
}
|
182 |
+
|
183 |
+
$this->status = true;
|
184 |
+
$this->message = __("Menu items added successfully.", 'food-and-drink-menu');
|
185 |
+
|
186 |
+
add_action( 'admin_notices', array( $this, 'display_notice' ) );
|
187 |
+
}
|
188 |
+
|
189 |
+
function handle_spreadsheet_upload() {
|
190 |
+
/* Test if there is an error with the uploaded spreadsheet and return that error if there is */
|
191 |
+
if (!empty($_FILES['fdm_menu_items_spreadsheet']['error']))
|
192 |
+
{
|
193 |
+
switch($_FILES['fdm_menu_items_spreadsheet']['error'])
|
194 |
+
{
|
195 |
+
|
196 |
+
case '1':
|
197 |
+
$error = __('The uploaded file exceeds the upload_max_filesize directive in php.ini', 'food-and-drink-menu');
|
198 |
+
break;
|
199 |
+
case '2':
|
200 |
+
$error = __('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 'food-and-drink-menu');
|
201 |
+
break;
|
202 |
+
case '3':
|
203 |
+
$error = __('The uploaded file was only partially uploaded', 'food-and-drink-menu');
|
204 |
+
break;
|
205 |
+
case '4':
|
206 |
+
$error = __('No file was uploaded.', 'food-and-drink-menu');
|
207 |
+
break;
|
208 |
+
|
209 |
+
case '6':
|
210 |
+
$error = __('Missing a temporary folder', 'food-and-drink-menu');
|
211 |
+
break;
|
212 |
+
case '7':
|
213 |
+
$error = __('Failed to write file to disk', 'food-and-drink-menu');
|
214 |
+
break;
|
215 |
+
case '8':
|
216 |
+
$error = __('File upload stopped by extension', 'food-and-drink-menu');
|
217 |
+
break;
|
218 |
+
case '999':
|
219 |
+
default:
|
220 |
+
$error = __('No error code avaiable', 'food-and-drink-menu');
|
221 |
+
}
|
222 |
+
}
|
223 |
+
/* Make sure that the file exists */
|
224 |
+
elseif (empty($_FILES['fdm_menu_items_spreadsheet']['tmp_name']) || $_FILES['fdm_menu_items_spreadsheet']['tmp_name'] == 'none') {
|
225 |
+
$error = __('No file was uploaded here..', 'food-and-drink-menu');
|
226 |
+
}
|
227 |
+
/* Move the file and store the URL to pass it onwards*/
|
228 |
+
/* Check that it is a .xls or .xlsx file */
|
229 |
+
if(!isset($_FILES['fdm_menu_items_spreadsheet']['name']) or (!preg_match("/\.(xls.?)$/", $_FILES['fdm_menu_items_spreadsheet']['name']) and !preg_match("/\.(csv.?)$/", $_FILES['fdm_menu_items_spreadsheet']['name']))) {
|
230 |
+
$error = __('File must be .csv, .xls or .xlsx', 'food-and-drink-menu');
|
231 |
+
}
|
232 |
+
else {
|
233 |
+
$filename = basename( $_FILES['fdm_menu_items_spreadsheet']['name']);
|
234 |
+
$filename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
|
235 |
+
$filename = mb_ereg_replace("([\.]{2,})", '', $filename);
|
236 |
+
|
237 |
+
//for security reason, we force to remove all uploaded file
|
238 |
+
$target_path = FDM_PLUGIN_DIR . "/user-sheets/";
|
239 |
+
|
240 |
+
$target_path = $target_path . $filename;
|
241 |
+
|
242 |
+
if (!move_uploaded_file($_FILES['fdm_menu_items_spreadsheet']['tmp_name'], $target_path)) {
|
243 |
+
$error .= "There was an error uploading the file, please try again!";
|
244 |
+
}
|
245 |
+
else {
|
246 |
+
$excel_file_name = $filename;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
|
250 |
+
/* Pass the data to the appropriate function in Update_Admin_Databases.php to create the products */
|
251 |
+
if (!isset($error)) {
|
252 |
+
$update = array("message_type" => "Success", "filename" => $excel_file_name);
|
253 |
+
}
|
254 |
+
else {
|
255 |
+
$update = array("message_type" => "Error", "message" => $error);
|
256 |
+
}
|
257 |
+
return $update;
|
258 |
+
}
|
259 |
+
|
260 |
+
public function enqueue_import_scripts() {
|
261 |
+
$screen = get_current_screen();
|
262 |
+
if($screen->id == 'fdm-menu_page_fdm-import'){
|
263 |
+
wp_enqueue_style( 'fdm-admin', FDM_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
264 |
+
wp_enqueue_script( 'fdm-admin-js', FDM_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), RTB_VERSION, true );
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
+
public function display_notice() {
|
269 |
+
if ( $this->status ) {
|
270 |
+
echo "<div class='updated'><p>" . $this->message . "</p></div>";
|
271 |
+
}
|
272 |
+
else {
|
273 |
+
echo "<div class='error'><p>" . $this->message . "</p></div>";
|
274 |
+
}
|
275 |
+
}
|
276 |
+
|
277 |
+
}
|
278 |
+
|
279 |
+
|
readme.txt
CHANGED
@@ -1,595 +1,598 @@
|
|
1 |
-
=== Five Star Restaurant Reservations ===
|
2 |
-
Contributors: FiveStarPlugins
|
3 |
-
Requires at Least: 4.4
|
4 |
-
Tested Up To: 5.
|
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 |
-
License: GPLv3
|
7 |
-
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
-
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
9 |
-
|
10 |
-
Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
11 |
-
|
12 |
-
== Description ==
|
13 |
-
|
14 |
-
Restaurant reservations made easy. Accept reservations and table bookings online. Quickly confirm or reject restaurant reservations, send out custom email notifications, restrict booking times and more.
|
15 |
-
|
16 |
-
<strong>Includes Gutenberg restaurant block for displaying your reservation form!</strong> You can also use the handy restaurant reservation shortcode or set the reservation page directly in the plugin settings.
|
17 |
-
|
18 |
-
= Key Features =
|
19 |
-
|
20 |
-
* Create a customized restaurant reservation form
|
21 |
-
* Responsive booking form layout that looks great for mobile reservations and on all devices
|
22 |
-
* Add your reservation form to any page via the included Gutenberg restaurant booking block or shortcode, or just choose your reservation page in the settings
|
23 |
-
* Quickly [confirm or reject](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/confirm-reject-bookings) a booking
|
24 |
-
* Notify a customer by email when their request is confirmed or rejected
|
25 |
-
* Receive an [email notification](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/email-notifications) when a booking request is made
|
26 |
-
|
27 |
-
Create a five star restaurant reservation experience by tailoring your form to yours and your customers' specific needs. With options to set minimum and maxium party sizes, to require a phone number, to change the date and time format and to write a custom message after a successful online restaurant booking, you can create a familiar and comfortable atmosphere and make the reservation process as easy and effortless as possible.
|
28 |
-
|
29 |
-
= Additional Restaurant Reservation Features =
|
30 |
-
|
31 |
-
Our customizable restaurant reservations plugin comes with several additional features that will help ensure you're able to set it up not only easily, but with all the options you need. It will also allow you to deliver the best and easiest online restaurant booking system for your visitors. These features include:
|
32 |
-
|
33 |
-
* Add and edit bookings directly from the plugin admin panel
|
34 |
-
* Set up a specific restaurant schedule by defining the times and dates available for reservation and even add exceptions
|
35 |
-
* Support for multiple booking locations when using [Business Profile](https://wordpress.org/plugins/business-profile/)
|
36 |
-
* Send customers [an email](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/send-emails) about their booking from the admin panel
|
37 |
-
* Customize all [notification messages](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/email-notifications#understanding-the-template-tags), and date and time formats
|
38 |
-
* Custom user role to manage bookings
|
39 |
-
* Automatically [block bookings](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/schedule#scheduling-exceptions) when you're closed, including holidays and one-off openings
|
40 |
-
* [Ban abusive customers](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/ban-customers) to save money on no-shows
|
41 |
-
* Change the language of the datepicker feature
|
42 |
-
|
43 |
-
With our reservation system, you can set up the booking schedule for you restaurant. Our settings allow you to be as broad or specific as you want with this, with options for setting the open times, the interval between booking slots, booking in advance, and even the ability to add exceptions to these options.
|
44 |
-
|
45 |
-
= Premium Restaurant Reservations =
|
46 |
-
|
47 |
-
With the premium version of our restaurant reservations plugin, you can extend the functionality of your booking form to offer your customers the best possible experience. Premium features include:
|
48 |
-
|
49 |
-
* Stylish New Layout Options: Choose from multiple modern form layouts to find the one that best suits your site.
|
50 |
-
* Custom Fields: Plan your dinner service better by asking for special seating requests, dietary needs and more when customers book online. Similar to open table, this allows you to customize the reservation system to have any field you want, allowing you to gather all the info you need to offer the best experience to your customers. This feature also allows you to modify the existing default fields.
|
51 |
-
* Email Templates and Designer: Send beautiful email notifications with your own logo and brand colors when your customers make a reservation.
|
52 |
-
* Export Bookings: Easily print your restaurant bookings via PDF or export them to an Excel/CSV file so you can analyze patterns, gather customer data and import bookings into other services.
|
53 |
-
* Import Bookings: This new features allows you to quickly modify, in bulk, bookings that you have exported and import them back into the plugin. It's also great if you use a separate reservation system and/or take reservations offline, and quickly want to get those reservations into the plugin.
|
54 |
-
* MailChimp Integration: Subscribe new reservation requests to your MailChimp mailing list and watch your subscription rates grow effortlessly.
|
55 |
-
* Reservation Restrictions: Easily set the desired dining block length as well as a maximum number of reservations.
|
56 |
-
* Automatic Reservation Confirmation: Enable automatic confirmation of a reservation request if that date/time is currently below the maximum reservation or seat number.
|
57 |
-
* Styling Options: Many styling options are included that let you set the color, font-size, borders, etc. for the different elements of the form.
|
58 |
-
|
59 |
-
For further information and purchasing options, please visit our <a href="https://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/" target="_blank">WordPress restaurant reservations</a> homepage.
|
60 |
-
|
61 |
-
This easy restaurant booking system is one part of our suite of plugins designed to give you the best WordPress restaurant experience. Check out the powerful [Restaurant Menu](https://wordpress.org/plugins/food-and-drink-menu/) plugin and let your customers view your full menu directly on your site. With its intuitive and easy-to-use interface, you'll be sure to not lose out on business to your competitors.
|
62 |
-
|
63 |
-
= For help and support, please see: =
|
64 |
-
|
65 |
-
* Our FAQ page, here: https://wordpress.org/plugins/restaurant-reservations/faq/
|
66 |
-
* Our installation guide, here: https://wordpress.org/plugins/restaurant-reservations/installation/
|
67 |
-
* Our documentation and user guide, here: http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations
|
68 |
-
* The Restaurant Menu support forum, here: https://wordpress.org/support/plugin/restaurant-reservations/
|
69 |
-
|
70 |
-
This plugin also comes with hooks that developers can use to extend and customize it. Take a look at the [Developer Documentation](http://doc.fivestarplugins.com/plugins/restaurant-reservations/developer/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations).
|
71 |
-
|
72 |
-
== Installation ==
|
73 |
-
|
74 |
-
1. Upload the 'restaurant-reservations' folder to the '/wp-content/plugins/' directory
|
75 |
-
2. Activate the plugin through the 'Plugins' menu in WordPress
|
76 |
-
|
77 |
-
or
|
78 |
-
|
79 |
-
1. Go to the 'Plugins' menu in WordPress and click 'Add New'
|
80 |
-
2. Search for 'Five Star Restaurant Reservations' and select 'Install Now'
|
81 |
-
3. Activate the plugin when prompted
|
82 |
-
|
83 |
-
= Getting Started =
|
84 |
-
|
85 |
-
1. To place your restaurant booking form on a page:
|
86 |
-
* Option 1: Go to the 'General' tab in the plugin settings and use the Booking Page dropdown to select the page on which you want your reservation form to appear.
|
87 |
-
* Option 2: Place the included reservations Gutenberg block on the page on which you want your reservation form to appear.
|
88 |
-
* Option 3: Place the [booking-form] shortcode on the page on which you want your reservation form to appear.
|
89 |
-
|
90 |
-
2. To customize the form:
|
91 |
-
* Go to the Settings area of the plugin admin and click the 'General' tab. There you'll be able to set the min and max party size, the successful booking message, the date and time format and make use of our security and privacy features.
|
92 |
-
* Also in the Settings area, go to the 'Booking Schedule' tab. There you'll be able to set your restaurant's schedule, the interval between booking slots, earliest and latest bookings and also create exceptions for the schedule.
|
93 |
-
|
94 |
-
3. To set up notifications.
|
95 |
-
* Go to the 'Notifications' tab in the settings.
|
96 |
-
* Use the Subject and Email fields there to craft your message for each different circumstance
|
97 |
-
* There is also a list of template tags there that you can include in your messages to display reservation-specific messages about the table reserved.
|
98 |
-
|
99 |
-
4. To view and manage your bookings:
|
100 |
-
* Go to the 'Bookings' area of the plugin admin.
|
101 |
-
* There you'll be able to view and modify any bookings that have been placed on your site.
|
102 |
-
* You'll also be able to manually create a new restaurant reservation (e.g. a reservation you took over the phone).
|
103 |
-
|
104 |
-
For a list of specific features, see the Restaurant Menu description page here: https://wordpress.org/plugins/restaurant-reservations/.
|
105 |
-
|
106 |
-
For help and support, please see:
|
107 |
-
|
108 |
-
* Our FAQ page, here: https://wordpress.org/plugins/restaurant-reservations/faq/
|
109 |
-
* Our documentation and user guide, here: http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations
|
110 |
-
* The Restaurant Menu support forum, here: https://wordpress.org/support/plugin/restaurant-reservations/
|
111 |
-
|
112 |
-
== Frequently Asked Questions ==
|
113 |
-
|
114 |
-
= Is there a shortcode to print the booking form? =
|
115 |
-
|
116 |
-
Yes, use the `[booking-form]` shortcode.
|
117 |
-
|
118 |
-
= Can I change the format of the date or time? =
|
119 |
-
|
120 |
-
Yes, set the format for the datepicker in *Bookings > Settings*. The format used in the backend will depend on the date and time formats in your WordPress settings.
|
121 |
-
|
122 |
-
= The datepicker or timepicker is not working. =
|
123 |
-
|
124 |
-
If you load up the form and no date or time picker is popping up when you select those fields, this is likely caused by a Javascript error from another plugin or theme. You can find the problematic plugin by deactivating other plugins you're using one-by-one. Test after each deactivation to see if the date and time pickers work.
|
125 |
-
|
126 |
-
If you have deactivated all other plugins and still have a problem, try switching to a default theme (one of the TwentySomething themes).
|
127 |
-
|
128 |
-
= I'm not receiving notification emails for new bookings. =
|
129 |
-
|
130 |
-
This is almost always the result of issues with your server and can be caused by a number of things. Before posting a support request, please run through the following checklist:
|
131 |
-
|
132 |
-
1. Double-check that the notification email in *Bookings > Settings > Notifications* is correct.
|
133 |
-
2. Make sure that WordPress is able to send emails. The admin email address in the WordPress settings page should receive notifications of new users.
|
134 |
-
3. If you're not able to receive regular WordPress emails, contact your web host and ask them for help sorting it out.
|
135 |
-
4. If you're able to receive regular WordPress emails but not booking notifications, check your spam filters or junk mail folders.
|
136 |
-
5. If you still haven't found the emails, contact your web host and let them know the date, time and email address where you expected to receive a booking. They should be able to check their logs to see what is happening to the email.
|
137 |
-
|
138 |
-
= Can I make the phone number required? =
|
139 |
-
|
140 |
-
This is a common request so I have written a small addon to do this for you. [Learn more](https://fivestarplugins.com/2015/01/08/simple-phone-validation-restaurant-reservations/).
|
141 |
-
|
142 |
-
= Can I translate the booking form? =
|
143 |
-
|
144 |
-
Yes, everything in this plugin can be translated using the standard translation process and software like PoEdit. If you're not familiar with that process, I'd recommend you take a look at the [Loco Translate](https://wordpress.org/plugins/loco-translate/) plugin, which provides a simple interface in your WordPress admin area for translating themes and plugins.
|
145 |
-
|
146 |
-
= I set Early or Late Bookings restrictions, but I scan still book during that time =
|
147 |
-
Users with the Administrator and Booking Manager roles are exempt from these restrictions. This is so that they can make last-minute changes to bookings as needed. If you want to test the Early or Late Bookings restrictions, try logging out and testing.
|
148 |
-
|
149 |
-
= I want to add a field to the form. Can I do that? =
|
150 |
-
|
151 |
-
The premium version does indeed come with a custom fields feature that lets you add new fields and modify existing ones.
|
152 |
-
|
153 |
-
= More questions and answers =
|
154 |
-
|
155 |
-
Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/faq?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations).
|
156 |
-
|
157 |
-
== Screenshots ==
|
158 |
-
|
159 |
-
1. Booking form with the Contemporary layout.
|
160 |
-
2. Booking form with the Columns layout.
|
161 |
-
3. Booking form with the default layout.
|
162 |
-
4. Great, mobile-friendly date picker to make it easy for your customers.
|
163 |
-
5. Great, mobile-friendly time picker to make it easy for your customers.
|
164 |
-
6. Easily manage bookings. View today's bookings or upcoming bookings at-a-glance. Confirm or reject bookings quickly.
|
165 |
-
7. The Booking Schedule area of the Settings page.
|
166 |
-
8. The Basic area of the Settings page.
|
167 |
-
9. The Notifications area of the Settings page.
|
168 |
-
10. The Premium area of the Settings page.
|
169 |
-
11. The Styling area of the Settings page.
|
170 |
-
12. The custom fields editor.
|
171 |
-
13. Add and edit bookings from an admin panel.
|
172 |
-
14. Quickly find bookings before or after a date. You can also filter by status or view just Today's bookings.
|
173 |
-
15. It also integrates with the Business Profile plugin to support booking for multiple locations.
|
174 |
-
16. Access a short guide from your Plugins list to help you get started quickly.
|
175 |
-
|
176 |
-
== Changelog ==
|
177 |
-
|
178 |
-
= 2.0.
|
179 |
-
- Fixes
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
-
|
184 |
-
|
185 |
-
= 2.0.
|
186 |
-
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
-
|
191 |
-
|
192 |
-
= 2.0.
|
193 |
-
- Corrects
|
194 |
-
|
195 |
-
= 2.0.
|
196 |
-
- Corrects an error
|
197 |
-
|
198 |
-
= 2.0.
|
199 |
-
-
|
200 |
-
|
201 |
-
= 2.0.
|
202 |
-
-
|
203 |
-
|
204 |
-
= 2.0.
|
205 |
-
-
|
206 |
-
|
207 |
-
= 2.0.
|
208 |
-
-
|
209 |
-
|
210 |
-
|
211 |
-
-
|
212 |
-
-
|
213 |
-
- Added in
|
214 |
-
- Added in the
|
215 |
-
- Added in a "
|
216 |
-
- Added in
|
217 |
-
- Added in
|
218 |
-
- Added in
|
219 |
-
-
|
220 |
-
-
|
221 |
-
-
|
222 |
-
- Updated the
|
223 |
-
-
|
224 |
-
-
|
225 |
-
-
|
226 |
-
|
227 |
-
|
228 |
-
-
|
229 |
-
|
230 |
-
= 1.
|
231 |
-
-
|
232 |
-
|
233 |
-
= 1.8.
|
234 |
-
- Fix:
|
235 |
-
|
236 |
-
= 1.8 (2018-12-
|
237 |
-
-
|
238 |
-
|
239 |
-
= 1.
|
240 |
-
- Add:
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
* Fix:
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
*
|
255 |
-
|
256 |
-
|
257 |
-
* Add:
|
258 |
-
|
259 |
-
|
260 |
-
*
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
*
|
266 |
-
|
267 |
-
|
268 |
-
*
|
269 |
-
|
270 |
-
|
271 |
-
*
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
*
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
*
|
281 |
-
|
282 |
-
|
283 |
-
* Add:
|
284 |
-
* Add:
|
285 |
-
*
|
286 |
-
*
|
287 |
-
*
|
288 |
-
*
|
289 |
-
|
290 |
-
|
291 |
-
*
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
*
|
296 |
-
|
297 |
-
= 1.6.
|
298 |
-
* Fix:
|
299 |
-
|
300 |
-
|
301 |
-
*
|
302 |
-
*
|
303 |
-
*
|
304 |
-
|
305 |
-
|
306 |
-
*
|
307 |
-
|
308 |
-
|
309 |
-
*
|
310 |
-
*
|
311 |
-
|
312 |
-
|
313 |
-
*
|
314 |
-
|
315 |
-
|
316 |
-
*
|
317 |
-
*
|
318 |
-
*
|
319 |
-
|
320 |
-
|
321 |
-
*
|
322 |
-
|
323 |
-
= 1.5.
|
324 |
-
* Fix:
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
* Fix:
|
329 |
-
|
330 |
-
|
331 |
-
*
|
332 |
-
*
|
333 |
-
|
334 |
-
|
335 |
-
*
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
*
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
* Add:
|
345 |
-
|
346 |
-
|
347 |
-
*
|
348 |
-
*
|
349 |
-
*
|
350 |
-
*
|
351 |
-
|
352 |
-
|
353 |
-
*
|
354 |
-
|
355 |
-
|
356 |
-
*
|
357 |
-
*
|
358 |
-
*
|
359 |
-
|
360 |
-
|
361 |
-
*
|
362 |
-
|
363 |
-
|
364 |
-
*
|
365 |
-
*
|
366 |
-
*
|
367 |
-
|
368 |
-
|
369 |
-
*
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
*
|
374 |
-
|
375 |
-
= 1.4.
|
376 |
-
*
|
377 |
-
|
378 |
-
|
379 |
-
*
|
380 |
-
* Fix:
|
381 |
-
*
|
382 |
-
*
|
383 |
-
|
384 |
-
|
385 |
-
*
|
386 |
-
|
387 |
-
= 1.4.
|
388 |
-
*
|
389 |
-
|
390 |
-
|
391 |
-
* Add:
|
392 |
-
* Add:
|
393 |
-
*
|
394 |
-
*
|
395 |
-
|
396 |
-
|
397 |
-
*
|
398 |
-
|
399 |
-
|
400 |
-
*
|
401 |
-
|
402 |
-
|
403 |
-
*
|
404 |
-
|
405 |
-
|
406 |
-
* Add
|
407 |
-
*
|
408 |
-
*
|
409 |
-
*
|
410 |
-
* Change
|
411 |
-
*
|
412 |
-
*
|
413 |
-
*
|
414 |
-
*
|
415 |
-
*
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
* Add
|
423 |
-
*
|
424 |
-
*
|
425 |
-
*
|
426 |
-
|
427 |
-
|
428 |
-
* Fix:
|
429 |
-
|
430 |
-
|
431 |
-
*
|
432 |
-
*
|
433 |
-
|
434 |
-
|
435 |
-
*
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
*
|
440 |
-
|
441 |
-
|
442 |
-
*
|
443 |
-
*
|
444 |
-
|
445 |
-
|
446 |
-
*
|
447 |
-
|
448 |
-
|
449 |
-
* Add
|
450 |
-
|
451 |
-
|
452 |
-
*
|
453 |
-
|
454 |
-
= 1.1.
|
455 |
-
*
|
456 |
-
|
457 |
-
= 1.1.
|
458 |
-
* Update Simple Admin Pages library to fix
|
459 |
-
|
460 |
-
= 1.1 (2014-05-
|
461 |
-
*
|
462 |
-
|
463 |
-
|
464 |
-
*
|
465 |
-
|
466 |
-
|
467 |
-
*
|
468 |
-
|
469 |
-
= 1.0.
|
470 |
-
*
|
471 |
-
|
472 |
-
= 1.0 (2014-05-
|
473 |
-
*
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
= 1.8.
|
481 |
-
This update fixes
|
482 |
-
|
483 |
-
= 1.8 =
|
484 |
-
This update
|
485 |
-
|
486 |
-
= 1.
|
487 |
-
This update
|
488 |
-
|
489 |
-
= 1.7.
|
490 |
-
This update
|
491 |
-
|
492 |
-
= 1.7.
|
493 |
-
This update adds
|
494 |
-
|
495 |
-
= 1.7.
|
496 |
-
This update
|
497 |
-
|
498 |
-
= 1.7.
|
499 |
-
This
|
500 |
-
|
501 |
-
= 1.7.
|
502 |
-
This minor maintenance update
|
503 |
-
|
504 |
-
= 1.7.
|
505 |
-
This update fixes a
|
506 |
-
|
507 |
-
= 1.7 =
|
508 |
-
This update
|
509 |
-
|
510 |
-
= 1.
|
511 |
-
This update
|
512 |
-
|
513 |
-
= 1.6.
|
514 |
-
This
|
515 |
-
|
516 |
-
= 1.6 =
|
517 |
-
This
|
518 |
-
|
519 |
-
= 1.
|
520 |
-
This
|
521 |
-
|
522 |
-
= 1.5.
|
523 |
-
This update fixes a bug
|
524 |
-
|
525 |
-
= 1.5.
|
526 |
-
This update
|
527 |
-
|
528 |
-
= 1.5 =
|
529 |
-
This update
|
530 |
-
|
531 |
-
= 1.
|
532 |
-
This update
|
533 |
-
|
534 |
-
= 1.4.
|
535 |
-
This update
|
536 |
-
|
537 |
-
= 1.4.
|
538 |
-
This update fixes a bug that
|
539 |
-
|
540 |
-
= 1.4.
|
541 |
-
This update fixes a bug that prevented bookings from
|
542 |
-
|
543 |
-
= 1.4.
|
544 |
-
This update
|
545 |
-
|
546 |
-
= 1.4.
|
547 |
-
This update fixes
|
548 |
-
|
549 |
-
= 1.4.
|
550 |
-
This update fixes a
|
551 |
-
|
552 |
-
= 1.4.
|
553 |
-
This update
|
554 |
-
|
555 |
-
= 1.4.
|
556 |
-
This update
|
557 |
-
|
558 |
-
= 1.4.
|
559 |
-
This update is a maintenance release that fixes a couple minor issues, adds French and Italian translations, and includes some under-the-hood changes to support upcoming extensions.
|
560 |
-
|
561 |
-
= 1.4 =
|
562 |
-
|
563 |
-
|
564 |
-
= 1.
|
565 |
-
|
566 |
-
|
567 |
-
= 1.
|
568 |
-
This update adds
|
569 |
-
|
570 |
-
= 1.2.
|
571 |
-
This update adds
|
572 |
-
|
573 |
-
= 1.2.
|
574 |
-
This
|
575 |
-
|
576 |
-
= 1.2 =
|
577 |
-
This
|
578 |
-
|
579 |
-
= 1.
|
580 |
-
This
|
581 |
-
|
582 |
-
= 1.1.
|
583 |
-
This
|
584 |
-
|
585 |
-
= 1.1.
|
586 |
-
This update fixes an error
|
587 |
-
|
588 |
-
= 1.1.
|
589 |
-
This update fixes
|
590 |
-
|
591 |
-
= 1.1 =
|
592 |
-
This update
|
593 |
-
|
594 |
-
= 1.
|
595 |
-
This update
|
Â
|
|
Â
|
|
Â
|
1 |
+
=== Five Star Restaurant Reservations ===
|
2 |
+
Contributors: FiveStarPlugins
|
3 |
+
Requires at Least: 4.4
|
4 |
+
Tested Up To: 5.3
|
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 |
+
License: GPLv3
|
7 |
+
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
8 |
+
Donate Link: https://www.etoilewebdesign.com/plugin-donations/
|
9 |
+
|
10 |
+
Restaurant reservations made easy. Accept bookings online. Quickly confirm or reject reservations, send email notifications, set booking times and more.
|
11 |
+
|
12 |
+
== Description ==
|
13 |
+
|
14 |
+
Restaurant reservations made easy. Accept reservations and table bookings online. Quickly confirm or reject restaurant reservations, send out custom email notifications, restrict booking times and more.
|
15 |
+
|
16 |
+
<strong>Includes Gutenberg restaurant block for displaying your reservation form!</strong> You can also use the handy restaurant reservation shortcode or set the reservation page directly in the plugin settings.
|
17 |
+
|
18 |
+
= Key Features =
|
19 |
+
|
20 |
+
* Create a customized restaurant reservation form
|
21 |
+
* Responsive booking form layout that looks great for mobile reservations and on all devices
|
22 |
+
* Add your reservation form to any page via the included Gutenberg restaurant booking block or shortcode, or just choose your reservation page in the settings
|
23 |
+
* Quickly [confirm or reject](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/confirm-reject-bookings) a booking
|
24 |
+
* Notify a customer by email when their request is confirmed or rejected
|
25 |
+
* Receive an [email notification](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/email-notifications) when a booking request is made
|
26 |
+
|
27 |
+
Create a five star restaurant reservation experience by tailoring your form to yours and your customers' specific needs. With options to set minimum and maxium party sizes, to require a phone number, to change the date and time format and to write a custom message after a successful online restaurant booking, you can create a familiar and comfortable atmosphere and make the reservation process as easy and effortless as possible.
|
28 |
+
|
29 |
+
= Additional Restaurant Reservation Features =
|
30 |
+
|
31 |
+
Our customizable restaurant reservations plugin comes with several additional features that will help ensure you're able to set it up not only easily, but with all the options you need. It will also allow you to deliver the best and easiest online restaurant booking system for your visitors. These features include:
|
32 |
+
|
33 |
+
* Add and edit bookings directly from the plugin admin panel
|
34 |
+
* Set up a specific restaurant schedule by defining the times and dates available for reservation and even add exceptions
|
35 |
+
* Support for multiple booking locations when using [Business Profile](https://wordpress.org/plugins/business-profile/)
|
36 |
+
* Send customers [an email](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/send-emails) about their booking from the admin panel
|
37 |
+
* Customize all [notification messages](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/email-notifications#understanding-the-template-tags), and date and time formats
|
38 |
+
* Custom user role to manage bookings
|
39 |
+
* Automatically [block bookings](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/config/schedule#scheduling-exceptions) when you're closed, including holidays and one-off openings
|
40 |
+
* [Ban abusive customers](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/manage/ban-customers) to save money on no-shows
|
41 |
+
* Change the language of the datepicker feature
|
42 |
+
|
43 |
+
With our reservation system, you can set up the booking schedule for you restaurant. Our settings allow you to be as broad or specific as you want with this, with options for setting the open times, the interval between booking slots, booking in advance, and even the ability to add exceptions to these options.
|
44 |
+
|
45 |
+
= Premium Restaurant Reservations =
|
46 |
+
|
47 |
+
With the premium version of our restaurant reservations plugin, you can extend the functionality of your booking form to offer your customers the best possible experience. Premium features include:
|
48 |
+
|
49 |
+
* Stylish New Layout Options: Choose from multiple modern form layouts to find the one that best suits your site.
|
50 |
+
* Custom Fields: Plan your dinner service better by asking for special seating requests, dietary needs and more when customers book online. Similar to open table, this allows you to customize the reservation system to have any field you want, allowing you to gather all the info you need to offer the best experience to your customers. This feature also allows you to modify the existing default fields.
|
51 |
+
* Email Templates and Designer: Send beautiful email notifications with your own logo and brand colors when your customers make a reservation.
|
52 |
+
* Export Bookings: Easily print your restaurant bookings via PDF or export them to an Excel/CSV file so you can analyze patterns, gather customer data and import bookings into other services.
|
53 |
+
* Import Bookings: This new features allows you to quickly modify, in bulk, bookings that you have exported and import them back into the plugin. It's also great if you use a separate reservation system and/or take reservations offline, and quickly want to get those reservations into the plugin.
|
54 |
+
* MailChimp Integration: Subscribe new reservation requests to your MailChimp mailing list and watch your subscription rates grow effortlessly.
|
55 |
+
* Reservation Restrictions: Easily set the desired dining block length as well as a maximum number of reservations.
|
56 |
+
* Automatic Reservation Confirmation: Enable automatic confirmation of a reservation request if that date/time is currently below the maximum reservation or seat number.
|
57 |
+
* Styling Options: Many styling options are included that let you set the color, font-size, borders, etc. for the different elements of the form.
|
58 |
+
|
59 |
+
For further information and purchasing options, please visit our <a href="https://www.fivestarplugins.com/plugins/five-star-restaurant-reservations/" target="_blank">WordPress restaurant reservations</a> homepage.
|
60 |
+
|
61 |
+
This easy restaurant booking system is one part of our suite of plugins designed to give you the best WordPress restaurant experience. Check out the powerful [Restaurant Menu](https://wordpress.org/plugins/food-and-drink-menu/) plugin and let your customers view your full menu directly on your site. With its intuitive and easy-to-use interface, you'll be sure to not lose out on business to your competitors.
|
62 |
+
|
63 |
+
= For help and support, please see: =
|
64 |
+
|
65 |
+
* Our FAQ page, here: https://wordpress.org/plugins/restaurant-reservations/faq/
|
66 |
+
* Our installation guide, here: https://wordpress.org/plugins/restaurant-reservations/installation/
|
67 |
+
* Our documentation and user guide, here: http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations
|
68 |
+
* The Restaurant Menu support forum, here: https://wordpress.org/support/plugin/restaurant-reservations/
|
69 |
+
|
70 |
+
This plugin also comes with hooks that developers can use to extend and customize it. Take a look at the [Developer Documentation](http://doc.fivestarplugins.com/plugins/restaurant-reservations/developer/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations).
|
71 |
+
|
72 |
+
== Installation ==
|
73 |
+
|
74 |
+
1. Upload the 'restaurant-reservations' folder to the '/wp-content/plugins/' directory
|
75 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
76 |
+
|
77 |
+
or
|
78 |
+
|
79 |
+
1. Go to the 'Plugins' menu in WordPress and click 'Add New'
|
80 |
+
2. Search for 'Five Star Restaurant Reservations' and select 'Install Now'
|
81 |
+
3. Activate the plugin when prompted
|
82 |
+
|
83 |
+
= Getting Started =
|
84 |
+
|
85 |
+
1. To place your restaurant booking form on a page:
|
86 |
+
* Option 1: Go to the 'General' tab in the plugin settings and use the Booking Page dropdown to select the page on which you want your reservation form to appear.
|
87 |
+
* Option 2: Place the included reservations Gutenberg block on the page on which you want your reservation form to appear.
|
88 |
+
* Option 3: Place the [booking-form] shortcode on the page on which you want your reservation form to appear.
|
89 |
+
|
90 |
+
2. To customize the form:
|
91 |
+
* Go to the Settings area of the plugin admin and click the 'General' tab. There you'll be able to set the min and max party size, the successful booking message, the date and time format and make use of our security and privacy features.
|
92 |
+
* Also in the Settings area, go to the 'Booking Schedule' tab. There you'll be able to set your restaurant's schedule, the interval between booking slots, earliest and latest bookings and also create exceptions for the schedule.
|
93 |
+
|
94 |
+
3. To set up notifications.
|
95 |
+
* Go to the 'Notifications' tab in the settings.
|
96 |
+
* Use the Subject and Email fields there to craft your message for each different circumstance
|
97 |
+
* There is also a list of template tags there that you can include in your messages to display reservation-specific messages about the table reserved.
|
98 |
+
|
99 |
+
4. To view and manage your bookings:
|
100 |
+
* Go to the 'Bookings' area of the plugin admin.
|
101 |
+
* There you'll be able to view and modify any bookings that have been placed on your site.
|
102 |
+
* You'll also be able to manually create a new restaurant reservation (e.g. a reservation you took over the phone).
|
103 |
+
|
104 |
+
For a list of specific features, see the Restaurant Menu description page here: https://wordpress.org/plugins/restaurant-reservations/.
|
105 |
+
|
106 |
+
For help and support, please see:
|
107 |
+
|
108 |
+
* Our FAQ page, here: https://wordpress.org/plugins/restaurant-reservations/faq/
|
109 |
+
* Our documentation and user guide, here: http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations
|
110 |
+
* The Restaurant Menu support forum, here: https://wordpress.org/support/plugin/restaurant-reservations/
|
111 |
+
|
112 |
+
== Frequently Asked Questions ==
|
113 |
+
|
114 |
+
= Is there a shortcode to print the booking form? =
|
115 |
+
|
116 |
+
Yes, use the `[booking-form]` shortcode.
|
117 |
+
|
118 |
+
= Can I change the format of the date or time? =
|
119 |
+
|
120 |
+
Yes, set the format for the datepicker in *Bookings > Settings*. The format used in the backend will depend on the date and time formats in your WordPress settings.
|
121 |
+
|
122 |
+
= The datepicker or timepicker is not working. =
|
123 |
+
|
124 |
+
If you load up the form and no date or time picker is popping up when you select those fields, this is likely caused by a Javascript error from another plugin or theme. You can find the problematic plugin by deactivating other plugins you're using one-by-one. Test after each deactivation to see if the date and time pickers work.
|
125 |
+
|
126 |
+
If you have deactivated all other plugins and still have a problem, try switching to a default theme (one of the TwentySomething themes).
|
127 |
+
|
128 |
+
= I'm not receiving notification emails for new bookings. =
|
129 |
+
|
130 |
+
This is almost always the result of issues with your server and can be caused by a number of things. Before posting a support request, please run through the following checklist:
|
131 |
+
|
132 |
+
1. Double-check that the notification email in *Bookings > Settings > Notifications* is correct.
|
133 |
+
2. Make sure that WordPress is able to send emails. The admin email address in the WordPress settings page should receive notifications of new users.
|
134 |
+
3. If you're not able to receive regular WordPress emails, contact your web host and ask them for help sorting it out.
|
135 |
+
4. If you're able to receive regular WordPress emails but not booking notifications, check your spam filters or junk mail folders.
|
136 |
+
5. If you still haven't found the emails, contact your web host and let them know the date, time and email address where you expected to receive a booking. They should be able to check their logs to see what is happening to the email.
|
137 |
+
|
138 |
+
= Can I make the phone number required? =
|
139 |
+
|
140 |
+
This is a common request so I have written a small addon to do this for you. [Learn more](https://fivestarplugins.com/2015/01/08/simple-phone-validation-restaurant-reservations/).
|
141 |
+
|
142 |
+
= Can I translate the booking form? =
|
143 |
+
|
144 |
+
Yes, everything in this plugin can be translated using the standard translation process and software like PoEdit. If you're not familiar with that process, I'd recommend you take a look at the [Loco Translate](https://wordpress.org/plugins/loco-translate/) plugin, which provides a simple interface in your WordPress admin area for translating themes and plugins.
|
145 |
+
|
146 |
+
= I set Early or Late Bookings restrictions, but I scan still book during that time =
|
147 |
+
Users with the Administrator and Booking Manager roles are exempt from these restrictions. This is so that they can make last-minute changes to bookings as needed. If you want to test the Early or Late Bookings restrictions, try logging out and testing.
|
148 |
+
|
149 |
+
= I want to add a field to the form. Can I do that? =
|
150 |
+
|
151 |
+
The premium version does indeed come with a custom fields feature that lets you add new fields and modify existing ones.
|
152 |
+
|
153 |
+
= More questions and answers =
|
154 |
+
|
155 |
+
Find answers to even more questions in the [FAQ](http://doc.fivestarplugins.com/plugins/restaurant-reservations/user/faq?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations).
|
156 |
+
|
157 |
+
== Screenshots ==
|
158 |
+
|
159 |
+
1. Booking form with the Contemporary layout.
|
160 |
+
2. Booking form with the Columns layout.
|
161 |
+
3. Booking form with the default layout.
|
162 |
+
4. Great, mobile-friendly date picker to make it easy for your customers.
|
163 |
+
5. Great, mobile-friendly time picker to make it easy for your customers.
|
164 |
+
6. Easily manage bookings. View today's bookings or upcoming bookings at-a-glance. Confirm or reject bookings quickly.
|
165 |
+
7. The Booking Schedule area of the Settings page.
|
166 |
+
8. The Basic area of the Settings page.
|
167 |
+
9. The Notifications area of the Settings page.
|
168 |
+
10. The Premium area of the Settings page.
|
169 |
+
11. The Styling area of the Settings page.
|
170 |
+
12. The custom fields editor.
|
171 |
+
13. Add and edit bookings from an admin panel.
|
172 |
+
14. Quickly find bookings before or after a date. You can also filter by status or view just Today's bookings.
|
173 |
+
15. It also integrates with the Business Profile plugin to support booking for multiple locations.
|
174 |
+
16. Access a short guide from your Plugins list to help you get started quickly.
|
175 |
+
|
176 |
+
== Changelog ==
|
177 |
+
|
178 |
+
= 2.0.10 (2019-11-26) =
|
179 |
+
- Fixes issue that was causing an error and/or incorrect display of the plugin dashboard for certain languages
|
180 |
+
|
181 |
+
= 2.0.9 (2019-11-04) =
|
182 |
+
- Fixes the issue with exceptions when max reservations wasn't enabled
|
183 |
+
- Fixes the ajaxurl JS error
|
184 |
+
|
185 |
+
= 2.0.8 (2019-11-01) =
|
186 |
+
- Corrects issue that was causing the array_key_exists null given error
|
187 |
+
|
188 |
+
= 2.0.7 (2019-10-31) =
|
189 |
+
- Updating version number of enqueued admin files to help with incorrect styling after update
|
190 |
+
- Correcting issue with premium license transfer
|
191 |
+
|
192 |
+
= 2.0.6 (2019-10-31) =
|
193 |
+
- Corrects a missing function issue for exporting custom fields
|
194 |
+
|
195 |
+
= 2.0.5 (2019-10-30) =
|
196 |
+
- Corrects an error with the max reservations feature when using the booking form while logged in.
|
197 |
+
|
198 |
+
= 2.0.4 (2019-10-29) =
|
199 |
+
- Corrects an error that was coming up on submission when there was a custom field in the form.
|
200 |
+
|
201 |
+
= 2.0.3 (2019-10-28) =
|
202 |
+
- Fixing a class conflict with the email designer
|
203 |
+
|
204 |
+
= 2.0.2 (2019-10-28) =
|
205 |
+
- Additional fix related to the email templates conflict
|
206 |
+
|
207 |
+
= 2.0.1 (2019-10-28) =
|
208 |
+
- Fixing an error being thrown if you tried to update while also having the email templates add-on activated
|
209 |
+
|
210 |
+
= 2.0.0 (2019-10-28) =
|
211 |
+
- <strong>This is a big update with many new features, corrections, revised admin styling, etc., so please take caution and test before updating on a live site (or wait a few days before updating in case some minor corrective updates need to be put out)</strong>
|
212 |
+
- The Options pages have a brand new and easy-to-use design, to go hand in hand with the many, many new options!
|
213 |
+
- Added in two brand new responsive reservation form layouts
|
214 |
+
- Added in a new styling options section that lets you customize the colors, fonts, borders etc. of all elements of your restaurant booking form
|
215 |
+
- Added in a new "view bookings" shortcode and page
|
216 |
+
- Added in the ability to automatically confirm reservations when less than X reservations or seats are taken during a time block
|
217 |
+
- Added in the ability to specify a dining block length
|
218 |
+
- Added in a "Max Reservations" number for a particular timeslot, so that it's not possible to book within a timeslot once that number has been reached
|
219 |
+
- Added in an option for guests to be checked in as they arrive
|
220 |
+
- Added in a walkthrough on installation to help you get going as quickly as possible
|
221 |
+
- Added in defaults for several options
|
222 |
+
- Updated the styling of certain default features to be consistent with new features
|
223 |
+
- Other styling and ease-of-use changes
|
224 |
+
- Updated the order, layout and descriptions of several options
|
225 |
+
- Updated the upgrade-to-premium process to be much quicker and easier
|
226 |
+
- Corrected issue causing the email template designer to not load properly in the customizer
|
227 |
+
- Corrected internal settings version numbering that was causing an issue with the Business Profile plugin settings
|
228 |
+
- Removed files from the plugin that were not being used/not needed
|
229 |
+
|
230 |
+
= 1.9.0 =
|
231 |
+
- Name change and new banner and icon
|
232 |
+
|
233 |
+
= 1.8.2 (2019-03-18) =
|
234 |
+
- Fix: Date and time picker in latest Chromium version
|
235 |
+
|
236 |
+
= 1.8.1 (2018-12-12) =
|
237 |
+
- Fix: Booking form block loads without correct location in editor
|
238 |
+
|
239 |
+
= 1.8 (2018-12-11) =
|
240 |
+
- Add: Gutenberg block for the booking form
|
241 |
+
|
242 |
+
= 1.7.8 (2018-09-13) =
|
243 |
+
- Add: #126 Setting to override the FROM header's email address
|
244 |
+
- Fix: #136 Preserve consent acquired state when booking is edited
|
245 |
+
- Update: German, French and Dutch translations
|
246 |
+
|
247 |
+
= 1.7.7 (2018-04-27) =
|
248 |
+
* Add: #135 Option to collect consent to store data (GDPR)
|
249 |
+
* Add: #135 Ability to delete all bookings related to an email address (GDPR)
|
250 |
+
* Fix: Some data not updated in confirm/reject emails when changed
|
251 |
+
|
252 |
+
= 1.7.6 (2017-05-15) =
|
253 |
+
* Fix: Prevent IP address from being modified after initial submission
|
254 |
+
* Fix: Schema type for Bakery used when integrating with Business Profile
|
255 |
+
|
256 |
+
= 1.7.5 (2017-03-31) =
|
257 |
+
* Add: #104 Show count of upcoming pending bookings in admin nav menu
|
258 |
+
* Add: #44 Reject invalid email addresses in booking requests
|
259 |
+
* Add: Setting to require a phone number
|
260 |
+
* Add: Recommended themes with booking form styles listed in the Addons page
|
261 |
+
|
262 |
+
= 1.7.4 (2017-03-21) =
|
263 |
+
* Fix: Wrong time restrictions for day one month in advance. See #102
|
264 |
+
* Add: Disable button when submitted to prevent duplicate submissions
|
265 |
+
* Add: Polish translation. h/t Wojciech Sadowski
|
266 |
+
|
267 |
+
= 1.7.3 (2017-03-02) =
|
268 |
+
* Fix: Apply late bookings restrictions more than 1 day to date picker
|
269 |
+
* Fix: Allow multiple email addresses for location-specific admin notifications
|
270 |
+
* Fix: Translation textdomain used for Business Profile integration
|
271 |
+
* Add: Apply early bookings restrictions to the date picker
|
272 |
+
|
273 |
+
= 1.7.2 (2017-01-12) =
|
274 |
+
* Fix: acceptsReservations schema property sometimes didn't appear in Business Profile integration
|
275 |
+
* Update: improve early bookings options language. Changed "Up to X days in advance" to "From X days in advance".
|
276 |
+
|
277 |
+
= 1.7.1 (2016-12-14) =
|
278 |
+
* Fix: Submitted by date and time in the bookings list
|
279 |
+
* Fix: Fatal error when creating a new location with the Business Profile plugin
|
280 |
+
* Fix: Remove or archive unexpected "Auto Draft" that was created in some circumstances
|
281 |
+
|
282 |
+
= 1.7 (2016-12-05) =
|
283 |
+
* Add: Allow customer banning by email and IP address
|
284 |
+
* Add: HTML5 required and aria-required attributes where appropriate
|
285 |
+
* Add: Disable times in the time picker blocked by late bookings restrictions
|
286 |
+
* Add: Option to block same-day bookings
|
287 |
+
* Add: Option for minimum party size
|
288 |
+
* Fix: Location printed twice in booking details
|
289 |
+
* Fix: Allow Bookings Managers to edit bookings in the past
|
290 |
+
* Update: Deprecated RTB_LOAD_FRONTEND_ASSETS moved `rtb-load-frontend-assets` filter
|
291 |
+
* Update: Sort bookings by latest date first when viewing All bookings
|
292 |
+
|
293 |
+
= 1.6.3 (2016-10-31) =
|
294 |
+
* Fix: Exporting bookings by location (addon). Location query args are now support for rtbQuery objects.
|
295 |
+
* Add: Option to select start of the week for the datepicker
|
296 |
+
|
297 |
+
= 1.6.2 (2016-08-20) =
|
298 |
+
* Fix: Broken time picker introduced in 1.6.1
|
299 |
+
|
300 |
+
= 1.6.1 (2016-08-19) =
|
301 |
+
* Fix: Support location post ids in booking form shortcode
|
302 |
+
* Fix: JavaScript error if the time field is hidden
|
303 |
+
* Fix: Fix booking detail popup issue when used with custom fields addon
|
304 |
+
* Add: Notification template tag for location: {location}
|
305 |
+
* Add: Russian language translation. h/t Alexandra Kuksa
|
306 |
+
* Update: Spanish language translation. h/t Matias Rodriguez
|
307 |
+
|
308 |
+
= 1.6 (2016-06-20) =
|
309 |
+
* Fix: Currently visible notice in bookings list on mobile devices
|
310 |
+
* Fix: Conflict with WooCommerce that prevented booking managers from viewing bookings
|
311 |
+
* Add: Support multi-location bookings
|
312 |
+
* Add: Add reservation schema.org markup when Business Profile used
|
313 |
+
* Add: Allow custom first day of the week for date picker
|
314 |
+
|
315 |
+
= 1.5.3 (2016-03-25) =
|
316 |
+
* Fix: no bookings found when searching by start and end dates that are the same
|
317 |
+
* Add: clarify that early/late bookings restrictions don't apply to admins
|
318 |
+
* Add: Brazilian and Norwegian translations
|
319 |
+
* Update: Dutch translation
|
320 |
+
* Update: link to new online documentation
|
321 |
+
* Other: Tested for compatibility with WP 4.5
|
322 |
+
|
323 |
+
= 1.5.2 (2016-02-29) =
|
324 |
+
* Fix: booking managers can not confirm/reject bookings
|
325 |
+
|
326 |
+
= 1.5.1 (2016-02-19) =
|
327 |
+
* Fix: increase security of the quicklink feature for confirming/rejecting bookings
|
328 |
+
* Fix: Improve wp-cli compatibility
|
329 |
+
|
330 |
+
= 1.5 (2015-12-17) =
|
331 |
+
* Fix: pickadate iOS bug
|
332 |
+
* Fix: Bookings table's Today view didn't respect WordPress timezone setting
|
333 |
+
* Add: Allow bookings table columns to be toggled on/off
|
334 |
+
* Update: Convert message column/row drop-down to a details modal for all hidden columns
|
335 |
+
* Update: Put focus into message field when expanded in booking form
|
336 |
+
|
337 |
+
= 1.4.10 (2015-10-29) =
|
338 |
+
* Fix: Allow settings page required capability to be filtered later
|
339 |
+
* Fix: Compatibility issue with old versions of jQuery
|
340 |
+
* Add: Spanish translation from Rafa dMC
|
341 |
+
|
342 |
+
= 1.4.9 (2015-10-06) =
|
343 |
+
* Fix: iOS 8 bug with date and time pickers
|
344 |
+
* Add: newsletter signup prompt to addons page
|
345 |
+
|
346 |
+
= 1.4.8 (2015-08-20) =
|
347 |
+
* Add: WPML config file for improved multi-lingual compatibility
|
348 |
+
* Add: Danish translation by Yusef Mubeen
|
349 |
+
* Fix: Allow bookings managers to bypass early/late bookings restrictions
|
350 |
+
* Fix: No times available when latest time falls between last interval and midnight
|
351 |
+
* Updated: Improve bookings message view on small screens (adapt to 4.3 style)
|
352 |
+
* Updated: Simple Admin Pages lib to v2.0.a.10
|
353 |
+
* Updated: Dutch translation h/t Roy van den Houten and Clements Tolboom
|
354 |
+
|
355 |
+
= 1.4.7 (2015-07-02) =
|
356 |
+
* Add: Spanish translation from Joaqin Sanz Boixader
|
357 |
+
* Fix: Sorting of bookings by date and name in list table broken
|
358 |
+
* Fix: Custom late bookings values more than one day aren't reflected in date picker
|
359 |
+
* Fix: Norwegian doesn't include time picker translation for some strings
|
360 |
+
* Updated: German translation from Roland Stumpp
|
361 |
+
* Updated: pickadate.js language translations
|
362 |
+
|
363 |
+
= 1.4.6 (2015-06-20) =
|
364 |
+
* Add: Remove old schedule exceptions and sort exceptions by date
|
365 |
+
* Add: CSS class indicating type of booking form field
|
366 |
+
* Fix: Extended Latin can cause Reply-To email headers to fail in some clients
|
367 |
+
* Fix: PHP Warning when performing bulk or quick action in bookings panel
|
368 |
+
* Fix: Message row lingers after booking trashed in admin panel
|
369 |
+
* Updated .pot file
|
370 |
+
|
371 |
+
= 1.4.5 (2015-04-23) =
|
372 |
+
* Fix: Loading spinner not visible due to 4.2 changes
|
373 |
+
* Add: new addon Export Bookings released
|
374 |
+
|
375 |
+
= 1.4.4 (2015-04-20) =
|
376 |
+
* Fix: low-risk XSS security vulnerability with escaped URLs on admin bookings page
|
377 |
+
|
378 |
+
= 1.4.3 (2015-04-20) =
|
379 |
+
* Add: Datepickers for start/end date filters in admin bookings list
|
380 |
+
* Fix: Disabled weekdays get offset when editing bookings
|
381 |
+
* Fix: Start/end date filters in admin bookings list
|
382 |
+
* Fix: Booking form shouldn't appear on password-protected posts
|
383 |
+
* Fix: Dutch translation
|
384 |
+
* Updated: Dutch and German translations
|
385 |
+
* Updated: pickadate.js lib now at v3.5.6
|
386 |
+
|
387 |
+
= 1.4.2 (2015-03-31) =
|
388 |
+
* Fix: Speed issue if licensed addon active
|
389 |
+
|
390 |
+
= 1.4.1 (2015-03-31) =
|
391 |
+
* Add: rtbQuery class for fetching bookings
|
392 |
+
* Add: Centralized system for handling extension licenses
|
393 |
+
* Add: Several filters for the bookings admin list table
|
394 |
+
* Add: French translation h/t I-Visio
|
395 |
+
* Add: Italian translation h/t Pierfilippo Trevisan
|
396 |
+
* Updated: German translation h/t Roland Stumpp
|
397 |
+
* Fix: Button label in send email modal
|
398 |
+
|
399 |
+
= 1.4 (2015-02-24) =
|
400 |
+
* Add: Send a custom email from the bookings list
|
401 |
+
* Add: Hebrew translation. h/t Ahrale
|
402 |
+
* Add: Default template functions for checkbox, radio and confirmation fields
|
403 |
+
* Fix: Replace dialect with more common German in translation file. h/t Roland Stumpp
|
404 |
+
|
405 |
+
= 1.3 (2015-02-03) =
|
406 |
+
* Add and edit bookings from the admin area
|
407 |
+
* Fix: date and time pickers broken on iOS 8 devices
|
408 |
+
* Add complete German translation from scolast34
|
409 |
+
* Add partial Dutch and Chilean translations
|
410 |
+
* Change Party text field to a dropdown selection
|
411 |
+
* Bookings admin panel shows upcoming bookings by default
|
412 |
+
* Use new HTML5 input types for email and phone
|
413 |
+
* Change textdomain to comply with upcoming translation standards
|
414 |
+
* Improve WPML compatibility
|
415 |
+
* New support for assigning custom classes to fields, fieldsets and legends. h/t Primoz Cigler
|
416 |
+
* New filters for email notifications
|
417 |
+
* Fix: some bookings menu pages don't load when screen names are translated
|
418 |
+
* Fix: addons list won't load if allow_url_fopen is disabled
|
419 |
+
|
420 |
+
|
421 |
+
= 1.2.3 (2014-11-04) =
|
422 |
+
* Add a {user_email} notification template tag
|
423 |
+
* Add filter to notification template tag descriptions for extensions
|
424 |
+
* Add Reply-To mail headers and use a more reliable From header
|
425 |
+
* Add filter to the datepicker rules for disabled dates
|
426 |
+
* Fix: missing "Clear" button translation in time picker for many languages
|
427 |
+
* Fix: open time picker in body container to mitigate rare positioning bugs
|
428 |
+
* Fix: don't auto-select today's date if it's not a valid date or errors are attached to the date field
|
429 |
+
|
430 |
+
= 1.2.2 (2014-08-24) =
|
431 |
+
* Fix: custom date formats can break date validation for new bookings
|
432 |
+
* Add new booking form generation hooks for easier customization
|
433 |
+
* Add support for upcoming MailChimp addon
|
434 |
+
* Add new addons page
|
435 |
+
* Update Simple Admin Pages library to v2.0.a.7
|
436 |
+
|
437 |
+
= 1.2.1 (2014-08-01) =
|
438 |
+
* Fix: bulk actions below the bookings table don't work
|
439 |
+
* Fix: PHP Notice generated during validation
|
440 |
+
|
441 |
+
= 1.2 (2014-07-17) =
|
442 |
+
* Add notification template tags for phone number and message
|
443 |
+
* Add automatic selection of date when page is loaded (option to disable this feature)
|
444 |
+
* Add option to set time interval of time picker
|
445 |
+
* Fix auto-detection of pickadate language from WordPress site language
|
446 |
+
* Fix duplicate entry in .pot file that caused PoEdit error
|
447 |
+
|
448 |
+
= 1.1.4 (2014-07-03) =
|
449 |
+
* Add a .pot file for easier translations
|
450 |
+
* Fix notifications that showed MySQL date format instead of user-selected format
|
451 |
+
* Fix Arabic translation of pickadate component
|
452 |
+
* Add support for the correct start of the week depending on language
|
453 |
+
|
454 |
+
= 1.1.3 (2014-05-22) =
|
455 |
+
* Fix an error where the wrong date would be selected when a form was reloaded with validation errors
|
456 |
+
|
457 |
+
= 1.1.2 (2014-05-14) =
|
458 |
+
* Update Simple Admin Pages library to fix an uncommon error when saving Textarea components
|
459 |
+
|
460 |
+
= 1.1.1 (2014-05-14) =
|
461 |
+
* Update Simple Admin Pages library to fix broken Scheduler in Firefox
|
462 |
+
|
463 |
+
= 1.1 (2014-05-12) =
|
464 |
+
* Attempt to load the correct language for the datepicker from the WordPress settings
|
465 |
+
* Add support for choosing a language for the datepicker if different from WordPress settings
|
466 |
+
* Allow late bookings to be blocked 4 hours and 1 day in advance
|
467 |
+
* Fix: don't show settings under WordPress's core General settings page
|
468 |
+
|
469 |
+
= 1.0.2 (2014-05-08) =
|
470 |
+
* Remove development tool from codebase
|
471 |
+
|
472 |
+
= 1.0.1 (2014-05-08) =
|
473 |
+
* Replace dashicons caret with CSS-only caret in booking form
|
474 |
+
|
475 |
+
= 1.0 (2014-05-07) =
|
476 |
+
* Initial release
|
477 |
+
|
478 |
+
== Upgrade Notice ==
|
479 |
+
|
480 |
+
= 1.8.2 =
|
481 |
+
This update fixes an issue with the date and time pickers that occurs with the latest version of the Chrome browser.
|
482 |
+
|
483 |
+
= 1.8.1 =
|
484 |
+
This update fixes a bug in the booking form block where the location would not be reloaded correctly after saving.
|
485 |
+
|
486 |
+
= 1.8 =
|
487 |
+
This update adds a block to the new Gutenberg editor for the booking form.
|
488 |
+
|
489 |
+
= 1.7.8 =
|
490 |
+
This update fixes a bug which removed the GDPR consent status for a booking when the booking was edited. It also adds an option to modify the FROM email header address and updates some translations.
|
491 |
+
|
492 |
+
= 1.7.7 =
|
493 |
+
This update adds two features to help you comply with GDPR privacy regulations in Europe: a confirmation field can be added to the booking form to collect a customer's consent to store their data. And you can delete all bookings related to an email address.
|
494 |
+
|
495 |
+
= 1.7.5 =
|
496 |
+
This update adds an option to require a phone, email address validation and a notification bubble showing the number of upcoming pending bookings in the admin area.
|
497 |
+
|
498 |
+
= 1.7.4 =
|
499 |
+
This update fixes an issue with time restrictions when applied to the same day one month in advance. It also adds a technique to attempt to prevent duplicate submissions. Adds Polish translation.
|
500 |
+
|
501 |
+
= 1.7.3 =
|
502 |
+
This minor maintenance update ensures scheduling restrictions are reflected in the date and time pickers. It also allows multiple email addresses to be used in location-specific admin notifications.
|
503 |
+
|
504 |
+
= 1.7.2 =
|
505 |
+
This minor maintenance update fixes a bug with the integration with the Business Profile plugin. It also adds the new Email Templates addon to the list of available addons.
|
506 |
+
|
507 |
+
= 1.7.1 =
|
508 |
+
This update fixes a critical bug introduced in v1.7 if you use bookings with the multi-location features of Business Profile. You are encouraged to update as soon as possible.
|
509 |
+
|
510 |
+
= 1.7 =
|
511 |
+
This update adds new features for banning bookings from no-shows and preventing blocked times from appearing in the time picker. New options for min party size and same-day bookings have been added. Bookings Managers can now edit bookings in the past.
|
512 |
+
|
513 |
+
= 1.6.2 =
|
514 |
+
This update fixes a critical error introduced in v1.6.1 which broke the time picker.
|
515 |
+
|
516 |
+
= 1.6.1 =
|
517 |
+
This maintenance update adds a {location} tag for notifications, improves the location argument in the booking form shortcode and fixes a few minor bugs.
|
518 |
+
|
519 |
+
= 1.6 =
|
520 |
+
This is a major update that adds support for accepting bookings at multiple locations. View the online documentation for further details.
|
521 |
+
|
522 |
+
= 1.5.3 =
|
523 |
+
This update fixes a minor bug when searching for bookings by date, updates compatibilty for WP v4.5, and adds links to the new online documentation.
|
524 |
+
|
525 |
+
= 1.5.2 =
|
526 |
+
This update fixes a bug introduced in the last version which prevented Booking Managers from approving/rejecting reservations.
|
527 |
+
|
528 |
+
= 1.5.1 =
|
529 |
+
This update increases security for the quick link feature to confirm/reject bookings from the admin notification email.
|
530 |
+
|
531 |
+
= 1.5 =
|
532 |
+
This update adds the ability to configure which columns are visible in the bookings table. It works with the Custom Fields addon. If you have added fields using custom code, please read the release notification at themeofthecrop.com before updating.
|
533 |
+
|
534 |
+
= 1.4.10 =
|
535 |
+
This update includes a new Spanish translation and a few minor fixes. Updating isn't necessary for most people.
|
536 |
+
|
537 |
+
= 1.4.9 =
|
538 |
+
This update fixes a bug that made it difficult for iOS 8 users to select a date and time in their bookings. I strongly recommend you update.
|
539 |
+
|
540 |
+
= 1.4.8 =
|
541 |
+
This update fixes a bug that prevented bookings managers from editing bookings within the early/late schedule restrictions. It also fixed a bug with late opening times, added a WPML config file for better multi-lingual compatibility, updated translations, and improved the mobile view of the bookings list.
|
542 |
+
|
543 |
+
= 1.4.7 =
|
544 |
+
This update fixes a bug that prevented bookings from being sorted by date or name in the admin panel. It also updates some translations and improves support for custom late bookings values.
|
545 |
+
|
546 |
+
= 1.4.6 =
|
547 |
+
This update improves compatibility with an upcoming Custom Fields addon. It also fixes some minor bugs with extended Latin characters in emails and the admin list table, and removes expired schedule exceptions.
|
548 |
+
|
549 |
+
= 1.4.5 =
|
550 |
+
This update fixes a non-critical issue with the display of the loading spinner in the upcoming 4.2 version of WordPress.
|
551 |
+
|
552 |
+
= 1.4.4 =
|
553 |
+
This update fixes a low-risk XSS security vulnerability. It is low-risk because in order to exploit this vulnerability a user would need to have access to the bookings management panel in the admin area, which only trusted users should have.
|
554 |
+
|
555 |
+
= 1.4.3 =
|
556 |
+
This update adds datepickers to the start/end date filters in the admin bookings list and fixes a small error with the filters. It also fixes an issue with disabled weekdays when editing bookings. Dutch and German translation updates.
|
557 |
+
|
558 |
+
= 1.4.2 =
|
559 |
+
This update is a maintenance release that fixes a couple minor issues, adds French and Italian translations, and includes some under-the-hood changes to support upcoming extensions. 1.4.1-1.4.2 fixes a rare but vital performance issue in the admin.
|
560 |
+
|
561 |
+
= 1.4.1 =
|
562 |
+
This update is a maintenance release that fixes a couple minor issues, adds French and Italian translations, and includes some under-the-hood changes to support upcoming extensions.
|
563 |
+
|
564 |
+
= 1.4 =
|
565 |
+
Thanks to sponsorship from Gemini Design, the plugin now supports sending an email directly to customers from the list of bookings, so you can request more details or suggest an alternative booking time. This update also improves the German translation and adds a Hebrew translation. Read the full changelog for details.
|
566 |
+
|
567 |
+
= 1.3 =
|
568 |
+
This update adds support for adding and editing bookings from the admin panel. The bookings panel now shows upcoming bookings by default. The Party field in the booking form is now a dropdown selection. Plus a bunch of new features and fixes. Read the full changelog for details.
|
569 |
+
|
570 |
+
= 1.2.3 =
|
571 |
+
This update adds a {user_email} notification template tag and improves the mail headers on notifications to mitigate spam risk. It also adds the missing translation for the Clear button in the time picker for many languages. More minor bug fixes listed in the changelog.
|
572 |
+
|
573 |
+
= 1.2.2 =
|
574 |
+
This update adds support for a new MailChimp addon that will be released soon. An addons page is now available under the Bookings menu. A bug in which custom date/time formats could cause validation errors has been fixed. New hooks are now in place so that it's easier to customize the form output.
|
575 |
+
|
576 |
+
= 1.2.1 =
|
577 |
+
This is a minor maintenance update which fixes a couple of small bugs.
|
578 |
+
|
579 |
+
= 1.2 =
|
580 |
+
This update adds new template tags for notification emails, a new option to customize the time interval and more. A new .pot file has been generated, so update your translations. Consult the changelog for further details.
|
581 |
+
|
582 |
+
= 1.1.4 =
|
583 |
+
This updated fixes an error with the format of the date in notification emails. Now it will show you the date formatted however you have chosen for it to be formatted in your WordPress installation. It also now displays the correct start of the week depending on the language selected for the datepicker. A .pot file is now included for easier translations.
|
584 |
+
|
585 |
+
= 1.1.3 =
|
586 |
+
This update fixes an error when the form had validation errors (missing fields or wrong date/time selected). Instead of loading the selected date it would load today's date. This update ensures the selected date is reloaded properly.
|
587 |
+
|
588 |
+
= 1.1.2 =
|
589 |
+
This update fixes an error some people may experience when trying to save settings. This is the second update today, so if you missed the other one please read the changelog for the 1.1.1 update as well.
|
590 |
+
|
591 |
+
= 1.1.1 =
|
592 |
+
This update fixes problems some users reported when using the Firefox browser to modify the booking schedule. This required an update to a library that is shared with another plugin, Food and Drink Menu. If you are using that plugin, please update that one as well or you may get some odd behavior. (Thanks to sangwh and bforsoft for reporting the issue.)
|
593 |
+
|
594 |
+
= 1.1 =
|
595 |
+
This update improves internationalization (i8n) by attempting to determine the appropriate language for the booking form datepicker from your WordPress settings. It also adds a setting to pick a language manually from a list of supported languages. This update also adds options to block late bookings at least 4 hours or 1 day in advance. Thanks to Remco and Roland for their early feedback.
|
596 |
+
|
597 |
+
= 1.0.2 =
|
598 |
+
This update removes a bit of code that was used for development purposes. Please update as this code could be run by any user on the frontend.
|
restaurant-reservations.php
CHANGED
@@ -1,443 +1,443 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Five Star Restaurant Reservations
|
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.0.
|
7 |
-
* Author: FiveStarPlugins
|
8 |
-
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
-
* Text Domain: restaurant-reservations
|
10 |
-
*/
|
11 |
-
if ( ! defined( 'ABSPATH' ) )
|
12 |
-
exit;
|
13 |
-
|
14 |
-
if ( !class_exists( 'rtbInit' ) ) {
|
15 |
-
class rtbInit {
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Set a flag which tracks whether the form has already been rendered on
|
19 |
-
* the page. Only one form per page for now.
|
20 |
-
* @todo support multiple forms per page
|
21 |
-
*/
|
22 |
-
public $form_rendered = false;
|
23 |
-
|
24 |
-
/**
|
25 |
-
* Set a flag which tracks whether the view bookings form has already been
|
26 |
-
* rendered on the page. Only one form per page for now.
|
27 |
-
*/
|
28 |
-
public $display_bookings_form_rendered = false;
|
29 |
-
|
30 |
-
/**
|
31 |
-
* An object which stores a booking request, or an empty object if
|
32 |
-
* no request has been processed.
|
33 |
-
*/
|
34 |
-
public $request;
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Initialize the plugin and register hooks
|
38 |
-
*/
|
39 |
-
public function __construct() {
|
40 |
-
|
41 |
-
// Common strings
|
42 |
-
define( 'RTB_VERSION', '2.0.7' );
|
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__ ) );
|
46 |
-
define( 'RTB_BOOKING_POST_TYPE', 'rtb-booking' );
|
47 |
-
define( 'RTB_BOOKING_POST_TYPE_SLUG', 'booking' );
|
48 |
-
|
49 |
-
// Initialize the plugin
|
50 |
-
add_action( 'init', array( $this, 'load_textdomain' ) );
|
51 |
-
|
52 |
-
// Set up empty request object
|
53 |
-
$this->request = new stdClass();
|
54 |
-
$this->request->request_processed = false;
|
55 |
-
$this->request->request_inserted = false;
|
56 |
-
|
57 |
-
// Load query class
|
58 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Query.class.php' );
|
59 |
-
|
60 |
-
// Add custom roles and capabilities
|
61 |
-
add_action( 'init', array( $this, 'add_roles' ) );
|
62 |
-
|
63 |
-
// Load the plugin permissions
|
64 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Permissions.class.php' );
|
65 |
-
$this->permissions = new rtbPermissions();
|
66 |
-
$this->handle_combination();
|
67 |
-
|
68 |
-
// Load custom post types
|
69 |
-
require_once( RTB_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
|
70 |
-
$this->cpts = new rtbCustomPostTypes();
|
71 |
-
|
72 |
-
// Load multiple location support
|
73 |
-
require_once( RTB_PLUGIN_DIR . '/includes/MultipleLocations.class.php' );
|
74 |
-
$this->locations = new rtbMultipleLocations();
|
75 |
-
|
76 |
-
// Flush the rewrite rules for the custom post types
|
77 |
-
register_activation_hook( __FILE__, array( $this, 'rewrite_flush' ) );
|
78 |
-
|
79 |
-
// Load the template functions which print the booking form, etc
|
80 |
-
require_once( RTB_PLUGIN_DIR . '/includes/template-functions.php' );
|
81 |
-
|
82 |
-
// Load the admin bookings page
|
83 |
-
require_once( RTB_PLUGIN_DIR . '/includes/AdminBookings.class.php' );
|
84 |
-
$this->bookings = new rtbAdminBookings();
|
85 |
-
|
86 |
-
// Load assets
|
87 |
-
add_action( 'admin_notices', array($this, 'display_header_area'));
|
88 |
-
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
|
89 |
-
add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
|
90 |
-
|
91 |
-
// Handle notifications
|
92 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Notifications.class.php' );
|
93 |
-
$this->notifications = new rtbNotifications();
|
94 |
-
|
95 |
-
// Load settings
|
96 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Settings.class.php' );
|
97 |
-
$this->settings = new rtbSettings();
|
98 |
-
|
99 |
-
// Load plugin dashboard
|
100 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Dashboard.class.php' );
|
101 |
-
new rtbDashboard();
|
102 |
-
|
103 |
-
// Load walk-through
|
104 |
-
require_once( RTB_PLUGIN_DIR . '/includes/InstallationWalkthrough.class.php' );
|
105 |
-
new rtbInstallationWalkthrough();
|
106 |
-
register_activation_hook( __FILE__, array( $this, 'run_walkthrough' ) );
|
107 |
-
|
108 |
-
// Create cron jobs for reminders and late arrivals
|
109 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Cron.class.php' );
|
110 |
-
$this->cron = new rtbCron();
|
111 |
-
register_activation_hook( __FILE__, array( $this, 'cron_schedule_events' ) );
|
112 |
-
register_deactivation_hook( __FILE__, array( $this, 'cron_unschedule_events' ) );
|
113 |
-
|
114 |
-
// Handle AJAX actions
|
115 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Ajax.class.php' );
|
116 |
-
$this->ajax = new rtbAJAX();
|
117 |
-
|
118 |
-
// Handle setting up exports
|
119 |
-
require_once( RTB_PLUGIN_DIR . '/includes/ExportHandler.class.php' );
|
120 |
-
$this->exports = new rtbExportHandler();
|
121 |
-
|
122 |
-
// Handle setting up exports
|
123 |
-
require_once( RTB_PLUGIN_DIR . '/includes/EmailTemplates.class.php' );
|
124 |
-
$this->email_templates = new rtbEmailTemplates();
|
125 |
-
|
126 |
-
// Load the custom fields
|
127 |
-
require_once( RTB_PLUGIN_DIR . '/includes/CustomFields.class.php' );
|
128 |
-
$this->custom_fields = new rtbCustomFields();
|
129 |
-
|
130 |
-
// Load in the custom fields controller
|
131 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Field.Controller.class.php' );
|
132 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Field.class.php' );
|
133 |
-
$this->fields = new rtbFieldController();
|
134 |
-
|
135 |
-
// Load the custom fields editor page
|
136 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Editor.class.php' );
|
137 |
-
$this->editor = new cffrtbEditor();
|
138 |
-
|
139 |
-
// Load MailChimp integration
|
140 |
-
require_once( RTB_PLUGIN_DIR . '/includes/MailChimp.class.php' );
|
141 |
-
$this->mailchimp = new mcfrtbInit();
|
142 |
-
|
143 |
-
// Append booking form to a post's $content variable
|
144 |
-
add_filter( 'the_content', array( $this, 'append_to_content' ) );
|
145 |
-
|
146 |
-
// Register the widget
|
147 |
-
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
148 |
-
|
149 |
-
// Add links to plugin listing
|
150 |
-
add_filter('plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2);
|
151 |
-
|
152 |
-
// Load integrations with other plugins
|
153 |
-
require_once( RTB_PLUGIN_DIR . '/includes/integrations/business-profile.php' );
|
154 |
-
require_once( RTB_PLUGIN_DIR . '/includes/integrations/woocommerce.php' );
|
155 |
-
|
156 |
-
// Load gutenberg blocks
|
157 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Blocks.class.php' );
|
158 |
-
new rtbBlocks();
|
159 |
-
|
160 |
-
// Load backwards compatibility functions
|
161 |
-
require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
|
162 |
-
new rtbCompatibility();
|
163 |
-
|
164 |
-
}
|
165 |
-
|
166 |
-
/**
|
167 |
-
* Flush the rewrite rules when this plugin is activated to update with
|
168 |
-
* custom post types
|
169 |
-
* @since 0.0.1
|
170 |
-
*/
|
171 |
-
public function rewrite_flush() {
|
172 |
-
$this->cpts->load_cpts();
|
173 |
-
flush_rewrite_rules();
|
174 |
-
}
|
175 |
-
|
176 |
-
/**
|
177 |
-
* Load the plugin textdomain for localistion
|
178 |
-
* @since 0.0.1
|
179 |
-
*/
|
180 |
-
public function load_textdomain() {
|
181 |
-
load_plugin_textdomain( 'restaurant-reservations', false, plugin_basename( dirname( __FILE__ ) ) . "/languages/" );
|
182 |
-
}
|
183 |
-
|
184 |
-
/**
|
185 |
-
* Set a transient so that the walk-through gets run
|
186 |
-
* @since 2.0
|
187 |
-
*/
|
188 |
-
public function run_walkthrough() {
|
189 |
-
set_transient('rtb-getting-started', true, 30);
|
190 |
-
}
|
191 |
-
|
192 |
-
/**
|
193 |
-
* Add a role to manage the bookings and add the capability to Editors,
|
194 |
-
* Administrators and Super Admins
|
195 |
-
* @since 0.0.1
|
196 |
-
*/
|
197 |
-
public function add_roles() {
|
198 |
-
|
199 |
-
// The booking manager should be able to access the bookings list and
|
200 |
-
// update booking statuses, but shouldn't be able to touch anything else
|
201 |
-
// in the account.
|
202 |
-
$booking_manager = add_role(
|
203 |
-
'rtb_booking_manager',
|
204 |
-
__( 'Booking Manager', 'restaurant-reservations' ),
|
205 |
-
array(
|
206 |
-
'read' => true,
|
207 |
-
'manage_bookings' => true,
|
208 |
-
)
|
209 |
-
);
|
210 |
-
|
211 |
-
$manage_bookings_roles = apply_filters(
|
212 |
-
'rtb_manage_bookings_roles',
|
213 |
-
array(
|
214 |
-
'administrator',
|
215 |
-
'editor',
|
216 |
-
)
|
217 |
-
);
|
218 |
-
|
219 |
-
global $wp_roles;
|
220 |
-
foreach ( $manage_bookings_roles as $role ) {
|
221 |
-
$wp_roles->add_cap( $role, 'manage_bookings' );
|
222 |
-
}
|
223 |
-
}
|
224 |
-
|
225 |
-
/**
|
226 |
-
* Append booking form to a post's $content variable
|
227 |
-
* @since 0.0.1
|
228 |
-
*/
|
229 |
-
function append_to_content( $content ) {
|
230 |
-
global $post;
|
231 |
-
|
232 |
-
if ( !is_main_query() || !in_the_loop() || post_password_required() ) {
|
233 |
-
return $content;
|
234 |
-
}
|
235 |
-
|
236 |
-
if ( $post->ID == $this->settings->get_setting( 'booking-page' ) ) {
|
237 |
-
return $content . rtb_print_booking_form();
|
238 |
-
}
|
239 |
-
|
240 |
-
if ( $post->ID == $this->settings->get_setting( 'view-bookings-page' ) ) {
|
241 |
-
|
242 |
-
if ( $this->settings->get_setting( 'view-bookings-private' ) and ! is_user_logged_in() ) { return $content; }
|
243 |
-
|
244 |
-
$args = array();
|
245 |
-
if ( isset($_GET['date']) ) { $args['date'] = $_GET['date']; }
|
246 |
-
|
247 |
-
return $content . rtb_print_view_bookings_form( $args );
|
248 |
-
}
|
249 |
-
$view_bookings_page = $this->settings->get_setting( 'view-bookings-page' );
|
250 |
-
|
251 |
-
return $content;
|
252 |
-
}
|
253 |
-
|
254 |
-
/**
|
255 |
-
* Adds in a menu bar for the plugin
|
256 |
-
* @since 2.0
|
257 |
-
*/
|
258 |
-
public function display_header_area() {
|
259 |
-
global $rtb_controller, $post;
|
260 |
-
|
261 |
-
$screen = get_current_screen();
|
262 |
-
$screenID = $screen->id;
|
263 |
-
|
264 |
-
if ( $screenID != '
|
265 |
-
|
266 |
-
if ( ! $rtb_controller->permissions->check_permission( 'styling' ) || get_option("RTB_Trial_Happening") == "Yes" ) {
|
267 |
-
echo "<a href='https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1' class='rtb-temp-upgrade-banner' target='_blank'>Upgrade to the Premium Version!</a>";
|
268 |
-
}
|
269 |
-
|
270 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
271 |
-
if ( get_option( 'rtb-pro-was-active' ) > time() - 7*24*3600 ) {
|
272 |
-
echo "<div class='rtb-deactivate-pro'>";
|
273 |
-
echo "<p>We've combined the code base for the free and pro versions into one plugin file for easier management.</p>";
|
274 |
-
echo "<p>You still have access to the premium features you purchased, and you can read more about why we've combined them <a href='http://www.fivestarplugins.com/2019/10/21/five-star-restaurant-reservations-new-features-more-options/'>on our blog</a></p>";
|
275 |
-
echo "</div>";
|
276 |
-
}
|
277 |
-
|
278 |
-
?>
|
279 |
-
<div class="rtb-admin-header-menu">
|
280 |
-
<h2 class="nav-tab-wrapper">
|
281 |
-
<a id="rtb-dash-mobile-menu-open" href="#" class="menu-tab nav-tab"><?php _e("MENU", 'restaurant-reservations'); ?><span id="rtb-dash-mobile-menu-down-caret"> ▼</span><span id="rtb-dash-mobile-menu-up-caret"> ▲</span></a>
|
282 |
-
<a id="dashboard-menu" href='admin.php?page=rtb-dashboard' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_rtb-dashboard') {echo 'nav-tab-active';}?>"><?php _e("Dashboard", 'restaurant-reservations'); ?></a>
|
283 |
-
<a id="bookings-menu" href='admin.php?page=rtb-bookings' class="menu-tab nav-tab <?php if ($screenID == 'toplevel_page_rtb-bookings') {echo 'nav-tab-active';}?>"><?php _e("Bookings", 'restaurant-reservations'); ?></a>
|
284 |
-
<a id="options-menu" href='admin.php?page=rtb-settings' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_rtb-settings') {echo 'nav-tab-active';}?>"><?php _e("Settings", 'restaurant-reservations'); ?></a>
|
285 |
-
<?php if ($rtb_controller->permissions->check_permission( 'custom_fields' ) ) { ?><a id="customfields-menu" href='admin.php?page=cffrtb-editor' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_cffrtb-editor') {echo 'nav-tab-active';}?>"><?php _e("Custom Fields", 'restaurant-reservations'); ?></a><?php } ?>
|
286 |
-
</h2>
|
287 |
-
</div>
|
288 |
-
<?php
|
289 |
-
}
|
290 |
-
|
291 |
-
/**
|
292 |
-
* Enqueue the admin-only CSS and Javascript
|
293 |
-
* @since 0.0.1
|
294 |
-
*/
|
295 |
-
public function enqueue_admin_assets() {
|
296 |
-
|
297 |
-
global $rtb_controller;
|
298 |
-
|
299 |
-
// Use the page reference in $admin_page_hooks because
|
300 |
-
// it changes in SOME hooks when it is translated.
|
301 |
-
// https://core.trac.wordpress.org/ticket/18857
|
302 |
-
global $admin_page_hooks;
|
303 |
-
|
304 |
-
$screen = get_current_screen();
|
305 |
-
if ( empty( $screen ) || empty( $admin_page_hooks['rtb-bookings'] ) ) {
|
306 |
-
return;
|
307 |
-
}
|
308 |
-
|
309 |
-
if ( $screen->base == 'toplevel_page_rtb-bookings' || $screen->base == $admin_page_hooks['rtb-bookings'] . '_page_rtb-settings' || $screen->base == $admin_page_hooks['rtb-bookings'] . '_page_rtb-addons' ) {
|
310 |
-
wp_enqueue_style( 'rtb-admin-css', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
311 |
-
wp_enqueue_script( 'rtb-admin', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), '', true );
|
312 |
-
wp_enqueue_style( 'rtb-spectrum-css', RTB_PLUGIN_URL . '/assets/css/spectrum.css' );
|
313 |
-
wp_enqueue_script( 'rtb-spectrum-js', RTB_PLUGIN_URL . '/assets/js/spectrum.js', array( 'jquery' ), '', true );
|
314 |
-
wp_enqueue_script( 'rtb-admin-settings-js', RTB_PLUGIN_URL . '/assets/js/admin-settings.js', array( 'jquery' ), '', true );
|
315 |
-
wp_localize_script(
|
316 |
-
'rtb-admin',
|
317 |
-
'rtb_admin',
|
318 |
-
array(
|
319 |
-
'nonce' => wp_create_nonce( 'rtb-admin' ),
|
320 |
-
'strings' => array(
|
321 |
-
'add_booking' => __( 'Add Booking', 'restaurant-reservations' ),
|
322 |
-
'edit_booking' => __( 'Edit Booking', 'restaurant-reservations' ),
|
323 |
-
'error_unspecified' => __( 'An unspecified error occurred. Please try again. If the problem persists, try logging out and logging back in.', 'restaurant-reservations' ),
|
324 |
-
),
|
325 |
-
'banned_emails' => preg_split( '/\r\n|\r|\n/', (string) $rtb_controller->settings->get_setting( 'ban-emails' ) ),
|
326 |
-
'banned_ips' => preg_split( '/\r\n|\r|\n/', (string) $rtb_controller->settings->get_setting( 'ban-ips' ) ),
|
327 |
-
'export_url' => admin_url( '?action=ebfrtb-export' )
|
328 |
-
)
|
329 |
-
);
|
330 |
-
}
|
331 |
-
|
332 |
-
// Enqueue frontend assets to add/edit bookins on the bookings page
|
333 |
-
if ( $screen->base == 'toplevel_page_rtb-bookings' ) {
|
334 |
-
$this->register_assets();
|
335 |
-
rtb_enqueue_assets();
|
336 |
-
}
|
337 |
-
}
|
338 |
-
|
339 |
-
/**
|
340 |
-
* Register the front-end CSS and Javascript for the booking form
|
341 |
-
* @since 0.0.1
|
342 |
-
*/
|
343 |
-
function register_assets() {
|
344 |
-
|
345 |
-
if ( !apply_filters( 'rtb-load-frontend-assets', true ) ) {
|
346 |
-
return;
|
347 |
-
}
|
348 |
-
|
349 |
-
wp_register_style( 'pickadate-default', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.css' );
|
350 |
-
wp_register_style( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.date.css' );
|
351 |
-
wp_register_style( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.time.css' );
|
352 |
-
wp_register_script( 'pickadate', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.js', array( 'jquery' ), '', true );
|
353 |
-
wp_register_script( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.date.js', array( 'jquery' ), '', true );
|
354 |
-
wp_register_script( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.time.js', array( 'jquery' ), '', true );
|
355 |
-
wp_register_script( 'pickadate-legacy', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/legacy.js', array( 'jquery' ), '', true );
|
356 |
-
|
357 |
-
$i8n = $this->settings->get_setting( 'i8n' );
|
358 |
-
if ( !empty( $i8n ) ) {
|
359 |
-
wp_register_script( 'pickadate-i8n', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/translations/' . esc_attr( $i8n ) . '.js', array( 'jquery' ), '', true );
|
360 |
-
|
361 |
-
// Arabic and Hebrew are right-to-left languages
|
362 |
-
if ( $i8n == 'ar' || $i8n == 'he_IL' ) {
|
363 |
-
wp_register_style( 'pickadate-rtl', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/rtl.css' );
|
364 |
-
}
|
365 |
-
}
|
366 |
-
|
367 |
-
wp_register_style( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/css/booking-form.css' );
|
368 |
-
wp_register_script( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/js/booking-form.js', array( 'jquery' ) );
|
369 |
-
}
|
370 |
-
|
371 |
-
/**
|
372 |
-
* Register the widgets
|
373 |
-
* @since 0.0.1
|
374 |
-
*/
|
375 |
-
public function register_widgets() {
|
376 |
-
require_once( RTB_PLUGIN_DIR . '/includes/WP_Widget.BookingFormWidget.class.php' );
|
377 |
-
register_widget( 'rtbBookingFormWidget' );
|
378 |
-
}
|
379 |
-
|
380 |
-
/**
|
381 |
-
* Add links to the plugin listing on the installed plugins page
|
382 |
-
* @since 0.0.1
|
383 |
-
*/
|
384 |
-
public function plugin_action_links( $links, $plugin ) {
|
385 |
-
|
386 |
-
if ( $plugin == RTB_PLUGIN_FNAME ) {
|
387 |
-
|
388 |
-
$links['help'] = '<a href="http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%Help&utm_campaign=Restaurant%20Reservations" title="' . __( 'View the help documentation for Restaurant Reservations', 'restaurant-reservations' ) . '">' . __( 'Help', 'restaurant-reservations' ) . '</a>';
|
389 |
-
}
|
390 |
-
|
391 |
-
return $links;
|
392 |
-
|
393 |
-
}
|
394 |
-
|
395 |
-
/**
|
396 |
-
* Register the cron hook that the plugin uses
|
397 |
-
* @since 2.0
|
398 |
-
*/
|
399 |
-
public function cron_schedule_events() {
|
400 |
-
$this->cron->schedule_events();
|
401 |
-
}
|
402 |
-
|
403 |
-
/**
|
404 |
-
* Unregister the cron hook that the plugin uses
|
405 |
-
* @since 2.0
|
406 |
-
*/
|
407 |
-
public function cron_unschedule_events() {
|
408 |
-
$this->cron->unschedule_events();
|
409 |
-
}
|
410 |
-
|
411 |
-
/**
|
412 |
-
* Handle the codebase combination
|
413 |
-
* @since 2.0
|
414 |
-
*/
|
415 |
-
public function handle_combination() {
|
416 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
417 |
-
|
418 |
-
if ( is_plugin_active( "custom-fields-for-rtb/custom-fields-for-rtb.php" ) ) {
|
419 |
-
update_option('rtb-pro-was-active', time());
|
420 |
-
deactivate_plugins("custom-fields-for-rtb/custom-fields-for-rtb.php");
|
421 |
-
}
|
422 |
-
|
423 |
-
if ( is_plugin_active( "email-templates-for-rtb/email-templates-for-rtb.php" ) ) {
|
424 |
-
update_option('rtb-pro-was-active', time());
|
425 |
-
deactivate_plugins("email-templates-for-rtb/email-templates-for-rtb.php");
|
426 |
-
}
|
427 |
-
|
428 |
-
if ( is_plugin_active( "export-bookings-for-rtb/export-bookings-for-rtb.php" ) ) {
|
429 |
-
update_option('rtb-pro-was-active', time());
|
430 |
-
deactivate_plugins("export-bookings-for-rtb/export-bookings-for-rtb.php");
|
431 |
-
}
|
432 |
-
|
433 |
-
if ( is_plugin_active( "mailchimp-for-rtb/mailchimp-for-rtb.php" ) ) {
|
434 |
-
update_option('rtb-pro-was-active', time());
|
435 |
-
deactivate_plugins("mailchimp-for-rtb/mailchimp-for-rtb.php");
|
436 |
-
}
|
437 |
-
}
|
438 |
-
|
439 |
-
}
|
440 |
-
} // endif;
|
441 |
-
|
442 |
-
global $rtb_controller;
|
443 |
-
$rtb_controller = new rtbInit();
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Five Star Restaurant Reservations
|
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.0.10
|
7 |
+
* Author: FiveStarPlugins
|
8 |
+
* Author URI: https://profiles.wordpress.org/fivestarplugins/
|
9 |
+
* Text Domain: restaurant-reservations
|
10 |
+
*/
|
11 |
+
if ( ! defined( 'ABSPATH' ) )
|
12 |
+
exit;
|
13 |
+
|
14 |
+
if ( !class_exists( 'rtbInit' ) ) {
|
15 |
+
class rtbInit {
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Set a flag which tracks whether the form has already been rendered on
|
19 |
+
* the page. Only one form per page for now.
|
20 |
+
* @todo support multiple forms per page
|
21 |
+
*/
|
22 |
+
public $form_rendered = false;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Set a flag which tracks whether the view bookings form has already been
|
26 |
+
* rendered on the page. Only one form per page for now.
|
27 |
+
*/
|
28 |
+
public $display_bookings_form_rendered = false;
|
29 |
+
|
30 |
+
/**
|
31 |
+
* An object which stores a booking request, or an empty object if
|
32 |
+
* no request has been processed.
|
33 |
+
*/
|
34 |
+
public $request;
|
35 |
+
|
36 |
+
/**
|
37 |
+
* Initialize the plugin and register hooks
|
38 |
+
*/
|
39 |
+
public function __construct() {
|
40 |
+
|
41 |
+
// Common strings
|
42 |
+
define( 'RTB_VERSION', '2.0.7' );
|
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__ ) );
|
46 |
+
define( 'RTB_BOOKING_POST_TYPE', 'rtb-booking' );
|
47 |
+
define( 'RTB_BOOKING_POST_TYPE_SLUG', 'booking' );
|
48 |
+
|
49 |
+
// Initialize the plugin
|
50 |
+
add_action( 'init', array( $this, 'load_textdomain' ) );
|
51 |
+
|
52 |
+
// Set up empty request object
|
53 |
+
$this->request = new stdClass();
|
54 |
+
$this->request->request_processed = false;
|
55 |
+
$this->request->request_inserted = false;
|
56 |
+
|
57 |
+
// Load query class
|
58 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Query.class.php' );
|
59 |
+
|
60 |
+
// Add custom roles and capabilities
|
61 |
+
add_action( 'init', array( $this, 'add_roles' ) );
|
62 |
+
|
63 |
+
// Load the plugin permissions
|
64 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Permissions.class.php' );
|
65 |
+
$this->permissions = new rtbPermissions();
|
66 |
+
$this->handle_combination();
|
67 |
+
|
68 |
+
// Load custom post types
|
69 |
+
require_once( RTB_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
|
70 |
+
$this->cpts = new rtbCustomPostTypes();
|
71 |
+
|
72 |
+
// Load multiple location support
|
73 |
+
require_once( RTB_PLUGIN_DIR . '/includes/MultipleLocations.class.php' );
|
74 |
+
$this->locations = new rtbMultipleLocations();
|
75 |
+
|
76 |
+
// Flush the rewrite rules for the custom post types
|
77 |
+
register_activation_hook( __FILE__, array( $this, 'rewrite_flush' ) );
|
78 |
+
|
79 |
+
// Load the template functions which print the booking form, etc
|
80 |
+
require_once( RTB_PLUGIN_DIR . '/includes/template-functions.php' );
|
81 |
+
|
82 |
+
// Load the admin bookings page
|
83 |
+
require_once( RTB_PLUGIN_DIR . '/includes/AdminBookings.class.php' );
|
84 |
+
$this->bookings = new rtbAdminBookings();
|
85 |
+
|
86 |
+
// Load assets
|
87 |
+
add_action( 'admin_notices', array($this, 'display_header_area'));
|
88 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
|
89 |
+
add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
|
90 |
+
|
91 |
+
// Handle notifications
|
92 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Notifications.class.php' );
|
93 |
+
$this->notifications = new rtbNotifications();
|
94 |
+
|
95 |
+
// Load settings
|
96 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Settings.class.php' );
|
97 |
+
$this->settings = new rtbSettings();
|
98 |
+
|
99 |
+
// Load plugin dashboard
|
100 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Dashboard.class.php' );
|
101 |
+
new rtbDashboard();
|
102 |
+
|
103 |
+
// Load walk-through
|
104 |
+
require_once( RTB_PLUGIN_DIR . '/includes/InstallationWalkthrough.class.php' );
|
105 |
+
new rtbInstallationWalkthrough();
|
106 |
+
register_activation_hook( __FILE__, array( $this, 'run_walkthrough' ) );
|
107 |
+
|
108 |
+
// Create cron jobs for reminders and late arrivals
|
109 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Cron.class.php' );
|
110 |
+
$this->cron = new rtbCron();
|
111 |
+
register_activation_hook( __FILE__, array( $this, 'cron_schedule_events' ) );
|
112 |
+
register_deactivation_hook( __FILE__, array( $this, 'cron_unschedule_events' ) );
|
113 |
+
|
114 |
+
// Handle AJAX actions
|
115 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Ajax.class.php' );
|
116 |
+
$this->ajax = new rtbAJAX();
|
117 |
+
|
118 |
+
// Handle setting up exports
|
119 |
+
require_once( RTB_PLUGIN_DIR . '/includes/ExportHandler.class.php' );
|
120 |
+
$this->exports = new rtbExportHandler();
|
121 |
+
|
122 |
+
// Handle setting up exports
|
123 |
+
require_once( RTB_PLUGIN_DIR . '/includes/EmailTemplates.class.php' );
|
124 |
+
$this->email_templates = new rtbEmailTemplates();
|
125 |
+
|
126 |
+
// Load the custom fields
|
127 |
+
require_once( RTB_PLUGIN_DIR . '/includes/CustomFields.class.php' );
|
128 |
+
$this->custom_fields = new rtbCustomFields();
|
129 |
+
|
130 |
+
// Load in the custom fields controller
|
131 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Field.Controller.class.php' );
|
132 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Field.class.php' );
|
133 |
+
$this->fields = new rtbFieldController();
|
134 |
+
|
135 |
+
// Load the custom fields editor page
|
136 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Editor.class.php' );
|
137 |
+
$this->editor = new cffrtbEditor();
|
138 |
+
|
139 |
+
// Load MailChimp integration
|
140 |
+
require_once( RTB_PLUGIN_DIR . '/includes/MailChimp.class.php' );
|
141 |
+
$this->mailchimp = new mcfrtbInit();
|
142 |
+
|
143 |
+
// Append booking form to a post's $content variable
|
144 |
+
add_filter( 'the_content', array( $this, 'append_to_content' ) );
|
145 |
+
|
146 |
+
// Register the widget
|
147 |
+
add_action( 'widgets_init', array( $this, 'register_widgets' ) );
|
148 |
+
|
149 |
+
// Add links to plugin listing
|
150 |
+
add_filter('plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2);
|
151 |
+
|
152 |
+
// Load integrations with other plugins
|
153 |
+
require_once( RTB_PLUGIN_DIR . '/includes/integrations/business-profile.php' );
|
154 |
+
require_once( RTB_PLUGIN_DIR . '/includes/integrations/woocommerce.php' );
|
155 |
+
|
156 |
+
// Load gutenberg blocks
|
157 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Blocks.class.php' );
|
158 |
+
new rtbBlocks();
|
159 |
+
|
160 |
+
// Load backwards compatibility functions
|
161 |
+
require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
|
162 |
+
new rtbCompatibility();
|
163 |
+
|
164 |
+
}
|
165 |
+
|
166 |
+
/**
|
167 |
+
* Flush the rewrite rules when this plugin is activated to update with
|
168 |
+
* custom post types
|
169 |
+
* @since 0.0.1
|
170 |
+
*/
|
171 |
+
public function rewrite_flush() {
|
172 |
+
$this->cpts->load_cpts();
|
173 |
+
flush_rewrite_rules();
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Load the plugin textdomain for localistion
|
178 |
+
* @since 0.0.1
|
179 |
+
*/
|
180 |
+
public function load_textdomain() {
|
181 |
+
load_plugin_textdomain( 'restaurant-reservations', false, plugin_basename( dirname( __FILE__ ) ) . "/languages/" );
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* Set a transient so that the walk-through gets run
|
186 |
+
* @since 2.0
|
187 |
+
*/
|
188 |
+
public function run_walkthrough() {
|
189 |
+
set_transient('rtb-getting-started', true, 30);
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* Add a role to manage the bookings and add the capability to Editors,
|
194 |
+
* Administrators and Super Admins
|
195 |
+
* @since 0.0.1
|
196 |
+
*/
|
197 |
+
public function add_roles() {
|
198 |
+
|
199 |
+
// The booking manager should be able to access the bookings list and
|
200 |
+
// update booking statuses, but shouldn't be able to touch anything else
|
201 |
+
// in the account.
|
202 |
+
$booking_manager = add_role(
|
203 |
+
'rtb_booking_manager',
|
204 |
+
__( 'Booking Manager', 'restaurant-reservations' ),
|
205 |
+
array(
|
206 |
+
'read' => true,
|
207 |
+
'manage_bookings' => true,
|
208 |
+
)
|
209 |
+
);
|
210 |
+
|
211 |
+
$manage_bookings_roles = apply_filters(
|
212 |
+
'rtb_manage_bookings_roles',
|
213 |
+
array(
|
214 |
+
'administrator',
|
215 |
+
'editor',
|
216 |
+
)
|
217 |
+
);
|
218 |
+
|
219 |
+
global $wp_roles;
|
220 |
+
foreach ( $manage_bookings_roles as $role ) {
|
221 |
+
$wp_roles->add_cap( $role, 'manage_bookings' );
|
222 |
+
}
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* Append booking form to a post's $content variable
|
227 |
+
* @since 0.0.1
|
228 |
+
*/
|
229 |
+
function append_to_content( $content ) {
|
230 |
+
global $post;
|
231 |
+
|
232 |
+
if ( !is_main_query() || !in_the_loop() || post_password_required() ) {
|
233 |
+
return $content;
|
234 |
+
}
|
235 |
+
|
236 |
+
if ( $post->ID == $this->settings->get_setting( 'booking-page' ) ) {
|
237 |
+
return $content . rtb_print_booking_form();
|
238 |
+
}
|
239 |
+
|
240 |
+
if ( $post->ID == $this->settings->get_setting( 'view-bookings-page' ) ) {
|
241 |
+
|
242 |
+
if ( $this->settings->get_setting( 'view-bookings-private' ) and ! is_user_logged_in() ) { return $content; }
|
243 |
+
|
244 |
+
$args = array();
|
245 |
+
if ( isset($_GET['date']) ) { $args['date'] = $_GET['date']; }
|
246 |
+
|
247 |
+
return $content . rtb_print_view_bookings_form( $args );
|
248 |
+
}
|
249 |
+
$view_bookings_page = $this->settings->get_setting( 'view-bookings-page' );
|
250 |
+
|
251 |
+
return $content;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Adds in a menu bar for the plugin
|
256 |
+
* @since 2.0
|
257 |
+
*/
|
258 |
+
public function display_header_area() {
|
259 |
+
global $rtb_controller, $admin_page_hooks, $post;
|
260 |
+
|
261 |
+
$screen = get_current_screen();
|
262 |
+
$screenID = $screen->id;
|
263 |
+
|
264 |
+
if ( $screenID != $admin_page_hooks['rtb-bookings'] . '_page_rtb-settings' && $screenID != 'toplevel_page_rtb-bookings' && $screenID != $admin_page_hooks['rtb-bookings'] . '_page_rtb-dashboard' && $screenID != $admin_page_hooks['rtb-bookings'] . '_page_cffrtb-editor' ) {return;}
|
265 |
+
|
266 |
+
if ( ! $rtb_controller->permissions->check_permission( 'styling' ) || get_option("RTB_Trial_Happening") == "Yes" ) {
|
267 |
+
echo "<a href='https://www.fivestarplugins.com/license-payment/?Selected=RTB&Quantity=1' class='rtb-temp-upgrade-banner' target='_blank'>Upgrade to the Premium Version!</a>";
|
268 |
+
}
|
269 |
+
|
270 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
271 |
+
if ( get_option( 'rtb-pro-was-active' ) > time() - 7*24*3600 ) {
|
272 |
+
echo "<div class='rtb-deactivate-pro'>";
|
273 |
+
echo "<p>We've combined the code base for the free and pro versions into one plugin file for easier management.</p>";
|
274 |
+
echo "<p>You still have access to the premium features you purchased, and you can read more about why we've combined them <a href='http://www.fivestarplugins.com/2019/10/21/five-star-restaurant-reservations-new-features-more-options/'>on our blog</a></p>";
|
275 |
+
echo "</div>";
|
276 |
+
}
|
277 |
+
|
278 |
+
?>
|
279 |
+
<div class="rtb-admin-header-menu">
|
280 |
+
<h2 class="nav-tab-wrapper">
|
281 |
+
<a id="rtb-dash-mobile-menu-open" href="#" class="menu-tab nav-tab"><?php _e("MENU", 'restaurant-reservations'); ?><span id="rtb-dash-mobile-menu-down-caret"> ▼</span><span id="rtb-dash-mobile-menu-up-caret"> ▲</span></a>
|
282 |
+
<a id="dashboard-menu" href='admin.php?page=rtb-dashboard' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_rtb-dashboard') {echo 'nav-tab-active';}?>"><?php _e("Dashboard", 'restaurant-reservations'); ?></a>
|
283 |
+
<a id="bookings-menu" href='admin.php?page=rtb-bookings' class="menu-tab nav-tab <?php if ($screenID == 'toplevel_page_rtb-bookings') {echo 'nav-tab-active';}?>"><?php _e("Bookings", 'restaurant-reservations'); ?></a>
|
284 |
+
<a id="options-menu" href='admin.php?page=rtb-settings' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_rtb-settings') {echo 'nav-tab-active';}?>"><?php _e("Settings", 'restaurant-reservations'); ?></a>
|
285 |
+
<?php if ($rtb_controller->permissions->check_permission( 'custom_fields' ) ) { ?><a id="customfields-menu" href='admin.php?page=cffrtb-editor' class="menu-tab nav-tab <?php if ($screenID == 'bookings_page_cffrtb-editor') {echo 'nav-tab-active';}?>"><?php _e("Custom Fields", 'restaurant-reservations'); ?></a><?php } ?>
|
286 |
+
</h2>
|
287 |
+
</div>
|
288 |
+
<?php
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* Enqueue the admin-only CSS and Javascript
|
293 |
+
* @since 0.0.1
|
294 |
+
*/
|
295 |
+
public function enqueue_admin_assets() {
|
296 |
+
|
297 |
+
global $rtb_controller;
|
298 |
+
|
299 |
+
// Use the page reference in $admin_page_hooks because
|
300 |
+
// it changes in SOME hooks when it is translated.
|
301 |
+
// https://core.trac.wordpress.org/ticket/18857
|
302 |
+
global $admin_page_hooks;
|
303 |
+
|
304 |
+
$screen = get_current_screen();
|
305 |
+
if ( empty( $screen ) || empty( $admin_page_hooks['rtb-bookings'] ) ) {
|
306 |
+
return;
|
307 |
+
}
|
308 |
+
|
309 |
+
if ( $screen->base == 'toplevel_page_rtb-bookings' || $screen->base == $admin_page_hooks['rtb-bookings'] . '_page_rtb-settings' || $screen->base == $admin_page_hooks['rtb-bookings'] . '_page_rtb-addons' ) {
|
310 |
+
wp_enqueue_style( 'rtb-admin-css', RTB_PLUGIN_URL . '/assets/css/admin.css', array(), RTB_VERSION );
|
311 |
+
wp_enqueue_script( 'rtb-admin-js', RTB_PLUGIN_URL . '/assets/js/admin.js', array( 'jquery' ), '', true );
|
312 |
+
wp_enqueue_style( 'rtb-spectrum-css', RTB_PLUGIN_URL . '/assets/css/spectrum.css' );
|
313 |
+
wp_enqueue_script( 'rtb-spectrum-js', RTB_PLUGIN_URL . '/assets/js/spectrum.js', array( 'jquery' ), '', true );
|
314 |
+
wp_enqueue_script( 'rtb-admin-settings-js', RTB_PLUGIN_URL . '/assets/js/admin-settings.js', array( 'jquery' ), '', true );
|
315 |
+
wp_localize_script(
|
316 |
+
'rtb-admin-js',
|
317 |
+
'rtb_admin',
|
318 |
+
array(
|
319 |
+
'nonce' => wp_create_nonce( 'rtb-admin' ),
|
320 |
+
'strings' => array(
|
321 |
+
'add_booking' => __( 'Add Booking', 'restaurant-reservations' ),
|
322 |
+
'edit_booking' => __( 'Edit Booking', 'restaurant-reservations' ),
|
323 |
+
'error_unspecified' => __( 'An unspecified error occurred. Please try again. If the problem persists, try logging out and logging back in.', 'restaurant-reservations' ),
|
324 |
+
),
|
325 |
+
'banned_emails' => preg_split( '/\r\n|\r|\n/', (string) $rtb_controller->settings->get_setting( 'ban-emails' ) ),
|
326 |
+
'banned_ips' => preg_split( '/\r\n|\r|\n/', (string) $rtb_controller->settings->get_setting( 'ban-ips' ) ),
|
327 |
+
'export_url' => admin_url( '?action=ebfrtb-export' )
|
328 |
+
)
|
329 |
+
);
|
330 |
+
}
|
331 |
+
|
332 |
+
// Enqueue frontend assets to add/edit bookins on the bookings page
|
333 |
+
if ( $screen->base == 'toplevel_page_rtb-bookings' ) {
|
334 |
+
$this->register_assets();
|
335 |
+
rtb_enqueue_assets();
|
336 |
+
}
|
337 |
+
}
|
338 |
+
|
339 |
+
/**
|
340 |
+
* Register the front-end CSS and Javascript for the booking form
|
341 |
+
* @since 0.0.1
|
342 |
+
*/
|
343 |
+
function register_assets() {
|
344 |
+
|
345 |
+
if ( !apply_filters( 'rtb-load-frontend-assets', true ) ) {
|
346 |
+
return;
|
347 |
+
}
|
348 |
+
|
349 |
+
wp_register_style( 'pickadate-default', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.css' );
|
350 |
+
wp_register_style( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.date.css' );
|
351 |
+
wp_register_style( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.time.css' );
|
352 |
+
wp_register_script( 'pickadate', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.js', array( 'jquery' ), '', true );
|
353 |
+
wp_register_script( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.date.js', array( 'jquery' ), '', true );
|
354 |
+
wp_register_script( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.time.js', array( 'jquery' ), '', true );
|
355 |
+
wp_register_script( 'pickadate-legacy', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/legacy.js', array( 'jquery' ), '', true );
|
356 |
+
|
357 |
+
$i8n = $this->settings->get_setting( 'i8n' );
|
358 |
+
if ( !empty( $i8n ) ) {
|
359 |
+
wp_register_script( 'pickadate-i8n', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/translations/' . esc_attr( $i8n ) . '.js', array( 'jquery' ), '', true );
|
360 |
+
|
361 |
+
// Arabic and Hebrew are right-to-left languages
|
362 |
+
if ( $i8n == 'ar' || $i8n == 'he_IL' ) {
|
363 |
+
wp_register_style( 'pickadate-rtl', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/rtl.css' );
|
364 |
+
}
|
365 |
+
}
|
366 |
+
|
367 |
+
wp_register_style( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/css/booking-form.css' );
|
368 |
+
wp_register_script( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/js/booking-form.js', array( 'jquery' ) );
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Register the widgets
|
373 |
+
* @since 0.0.1
|
374 |
+
*/
|
375 |
+
public function register_widgets() {
|
376 |
+
require_once( RTB_PLUGIN_DIR . '/includes/WP_Widget.BookingFormWidget.class.php' );
|
377 |
+
register_widget( 'rtbBookingFormWidget' );
|
378 |
+
}
|
379 |
+
|
380 |
+
/**
|
381 |
+
* Add links to the plugin listing on the installed plugins page
|
382 |
+
* @since 0.0.1
|
383 |
+
*/
|
384 |
+
public function plugin_action_links( $links, $plugin ) {
|
385 |
+
|
386 |
+
if ( $plugin == RTB_PLUGIN_FNAME ) {
|
387 |
+
|
388 |
+
$links['help'] = '<a href="http://doc.fivestarplugins.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%Help&utm_campaign=Restaurant%20Reservations" title="' . __( 'View the help documentation for Restaurant Reservations', 'restaurant-reservations' ) . '">' . __( 'Help', 'restaurant-reservations' ) . '</a>';
|
389 |
+
}
|
390 |
+
|
391 |
+
return $links;
|
392 |
+
|
393 |
+
}
|
394 |
+
|
395 |
+
/**
|
396 |
+
* Register the cron hook that the plugin uses
|
397 |
+
* @since 2.0
|
398 |
+
*/
|
399 |
+
public function cron_schedule_events() {
|
400 |
+
$this->cron->schedule_events();
|
401 |
+
}
|
402 |
+
|
403 |
+
/**
|
404 |
+
* Unregister the cron hook that the plugin uses
|
405 |
+
* @since 2.0
|
406 |
+
*/
|
407 |
+
public function cron_unschedule_events() {
|
408 |
+
$this->cron->unschedule_events();
|
409 |
+
}
|
410 |
+
|
411 |
+
/**
|
412 |
+
* Handle the codebase combination
|
413 |
+
* @since 2.0
|
414 |
+
*/
|
415 |
+
public function handle_combination() {
|
416 |
+
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
417 |
+
|
418 |
+
if ( is_plugin_active( "custom-fields-for-rtb/custom-fields-for-rtb.php" ) ) {
|
419 |
+
update_option('rtb-pro-was-active', time());
|
420 |
+
deactivate_plugins("custom-fields-for-rtb/custom-fields-for-rtb.php");
|
421 |
+
}
|
422 |
+
|
423 |
+
if ( is_plugin_active( "email-templates-for-rtb/email-templates-for-rtb.php" ) ) {
|
424 |
+
update_option('rtb-pro-was-active', time());
|
425 |
+
deactivate_plugins("email-templates-for-rtb/email-templates-for-rtb.php");
|
426 |
+
}
|
427 |
+
|
428 |
+
if ( is_plugin_active( "export-bookings-for-rtb/export-bookings-for-rtb.php" ) ) {
|
429 |
+
update_option('rtb-pro-was-active', time());
|
430 |
+
deactivate_plugins("export-bookings-for-rtb/export-bookings-for-rtb.php");
|
431 |
+
}
|
432 |
+
|
433 |
+
if ( is_plugin_active( "mailchimp-for-rtb/mailchimp-for-rtb.php" ) ) {
|
434 |
+
update_option('rtb-pro-was-active', time());
|
435 |
+
deactivate_plugins("mailchimp-for-rtb/mailchimp-for-rtb.php");
|
436 |
+
}
|
437 |
+
}
|
438 |
+
|
439 |
+
}
|
440 |
+
} // endif;
|
441 |
+
|
442 |
+
global $rtb_controller;
|
443 |
+
$rtb_controller = new rtbInit();
|