Version Description
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.
Download this release
Release Info
Developer | NateWr |
Plugin | Restaurant Reservations |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.1
- assets/js/booking-form.js +20 -2
- includes/Booking.class.php +8 -1
- includes/Settings.class.php +96 -31
- includes/template-functions.php +9 -9
- lib/simple-admin-pages/lib/pickadate/translations/ar.js +1 -1
- readme.txt +15 -4
- restaurant-reservations.php +20 -2
assets/js/booking-form.js
CHANGED
@@ -28,8 +28,17 @@ jQuery(document).ready(function ($) {
|
|
28 |
// Declare datepicker
|
29 |
var $date_input = $( '#rtb-date' ).pickadate({
|
30 |
format: rtb_pickadate.date_format,
|
|
|
|
|
31 |
min: true,
|
32 |
container: 'body',
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
});
|
34 |
|
35 |
// Declare timepicker
|
@@ -39,7 +48,7 @@ jQuery(document).ready(function ($) {
|
|
39 |
|
40 |
var datepicker = $date_input.pickadate( 'picker' );
|
41 |
var timepicker = $time_input.pickatime( 'picker' );
|
42 |
-
|
43 |
if ( typeof datepicker == 'undefined' ) {
|
44 |
return;
|
45 |
}
|
@@ -48,6 +57,10 @@ jQuery(document).ready(function ($) {
|
|
48 |
if ( rtb_pickadate.disable_dates.length ) {
|
49 |
datepicker.set( 'disable', rtb_pickadate.disable_dates );
|
50 |
}
|
|
|
|
|
|
|
|
|
51 |
|
52 |
// Update timepicker on pageload and whenever the datepicker is closed
|
53 |
rtb_update_timepicker_range();
|
@@ -65,7 +78,12 @@ jQuery(document).ready(function ($) {
|
|
65 |
timepicker.set( 'enable', false );
|
66 |
timepicker.set( 'disable', false );
|
67 |
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
69 |
var selected_date_year = selected_date.getFullYear();
|
70 |
var selected_date_month = selected_date.getMonth();
|
71 |
var selected_date_date = selected_date.getDate();
|
28 |
// Declare datepicker
|
29 |
var $date_input = $( '#rtb-date' ).pickadate({
|
30 |
format: rtb_pickadate.date_format,
|
31 |
+
formatSubmit: 'yyyy/mm/dd',
|
32 |
+
hiddenName: true,
|
33 |
min: true,
|
34 |
container: 'body',
|
35 |
+
// this prevents translations from overwriting the start of the
|
36 |
+
// week. ideally, in the future, support for this can be added, but
|
37 |
+
// at the moment I can't figure out how to check the datepicker's
|
38 |
+
// firstDay setting and update my disabled dates values
|
39 |
+
// accordingly.
|
40 |
+
// @todo support start of the week based on language file
|
41 |
+
firstDay: 0,
|
42 |
});
|
43 |
|
44 |
// Declare timepicker
|
48 |
|
49 |
var datepicker = $date_input.pickadate( 'picker' );
|
50 |
var timepicker = $time_input.pickatime( 'picker' );
|
51 |
+
|
52 |
if ( typeof datepicker == 'undefined' ) {
|
53 |
return;
|
54 |
}
|
57 |
if ( rtb_pickadate.disable_dates.length ) {
|
58 |
datepicker.set( 'disable', rtb_pickadate.disable_dates );
|
59 |
}
|
60 |
+
|
61 |
+
if ( rtb_pickadate.late_bookings === '1440' ) {
|
62 |
+
datepicker.set( 'min', 1 );
|
63 |
+
}
|
64 |
|
65 |
// Update timepicker on pageload and whenever the datepicker is closed
|
66 |
rtb_update_timepicker_range();
|
78 |
timepicker.set( 'enable', false );
|
79 |
timepicker.set( 'disable', false );
|
80 |
|
81 |
+
if ( datepicker.get() === '' ) {
|
82 |
+
timepicker.set( 'disable', true );
|
83 |
+
return;
|
84 |
+
}
|
85 |
+
|
86 |
+
selected_date = new Date( datepicker.get( 'select', 'yyyy/mm/dd' ) );
|
87 |
var selected_date_year = selected_date.getFullYear();
|
88 |
var selected_date_month = selected_date.getMonth();
|
89 |
var selected_date_date = selected_date.getDate();
|
includes/Booking.class.php
CHANGED
@@ -219,10 +219,17 @@ class rtbBooking {
|
|
219 |
} else {
|
220 |
$late_bookings_seconds = $late_bookings * 60; // Late bookings allowance in seconds
|
221 |
if ( $request->format( 'U' ) < ( current_time( 'timestamp' ) + $late_bookings_seconds ) ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
$this->validation_errors[] = array(
|
223 |
'field' => 'time',
|
224 |
'error_msg' => 'Booking request made too close to the reserved time',
|
225 |
-
'message' =>
|
226 |
);
|
227 |
}
|
228 |
}
|
219 |
} else {
|
220 |
$late_bookings_seconds = $late_bookings * 60; // Late bookings allowance in seconds
|
221 |
if ( $request->format( 'U' ) < ( current_time( 'timestamp' ) + $late_bookings_seconds ) ) {
|
222 |
+
if ( $late_bookings >= 1440 ) {
|
223 |
+
$late_bookings_message = sprintf( __( 'Sorry, bookings must be made more than %s days in advance.', RTB_TEXTDOMAIN ), $late_bookings / 1440 );
|
224 |
+
} elseif ( $late_bookings >= 60 ) {
|
225 |
+
$late_bookings_message = sprintf( __( 'Sorry, bookings must be made more than %s hours in advance.', RTB_TEXTDOMAIN ), $late_bookings / 60 );
|
226 |
+
} else {
|
227 |
+
$late_bookings_message = sprintf( __( 'Sorry, bookings must be made more than %s mings in advance.', RTB_TEXTDOMAIN ), $late_bookings );
|
228 |
+
}
|
229 |
$this->validation_errors[] = array(
|
230 |
'field' => 'time',
|
231 |
'error_msg' => 'Booking request made too close to the reserved time',
|
232 |
+
'message' => $late_bookings_message,
|
233 |
);
|
234 |
}
|
235 |
}
|
includes/Settings.class.php
CHANGED
@@ -20,6 +20,49 @@ class rtbSettings {
|
|
20 |
* @since 0.0.1
|
21 |
*/
|
22 |
public $settings = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
public function __construct() {
|
25 |
|
@@ -122,6 +165,11 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
122 |
RTB_TEXTDOMAIN
|
123 |
),
|
124 |
);
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
$this->defaults = apply_filters( 'rtb_defaults', $this->defaults );
|
127 |
}
|
@@ -171,14 +219,14 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
171 |
'parent_menu' => 'rtb-bookings',
|
172 |
'description' => '',
|
173 |
'capability' => 'manage_options',
|
174 |
-
'default_tab' => 'general',
|
175 |
)
|
176 |
);
|
177 |
|
178 |
$sap->add_section(
|
179 |
'rtb-settings',
|
180 |
array(
|
181 |
-
'id' => 'general',
|
182 |
'title' => __( 'General', RTB_TEXTDOMAIN ),
|
183 |
'is_tab' => true,
|
184 |
)
|
@@ -186,7 +234,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
186 |
|
187 |
$sap->add_setting(
|
188 |
'rtb-settings',
|
189 |
-
'general',
|
190 |
'post',
|
191 |
array(
|
192 |
'id' => 'booking-page',
|
@@ -203,7 +251,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
203 |
|
204 |
$sap->add_setting(
|
205 |
'rtb-settings',
|
206 |
-
'general',
|
207 |
'textarea',
|
208 |
array(
|
209 |
'id' => 'success-message',
|
@@ -215,7 +263,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
215 |
|
216 |
$sap->add_setting(
|
217 |
'rtb-settings',
|
218 |
-
'general',
|
219 |
'text',
|
220 |
array(
|
221 |
'id' => 'date-format',
|
@@ -227,7 +275,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
227 |
|
228 |
$sap->add_setting(
|
229 |
'rtb-settings',
|
230 |
-
'general',
|
231 |
'text',
|
232 |
array(
|
233 |
'id' => 'time-format',
|
@@ -237,10 +285,25 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
237 |
)
|
238 |
);
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
$sap->add_section(
|
241 |
'rtb-settings',
|
242 |
array(
|
243 |
-
'id' => 'schedule',
|
244 |
'title' => __( 'Booking Schedule', RTB_TEXTDOMAIN ),
|
245 |
'is_tab' => true,
|
246 |
)
|
@@ -248,7 +311,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
248 |
|
249 |
$sap->add_setting(
|
250 |
'rtb-settings',
|
251 |
-
'schedule',
|
252 |
'scheduler',
|
253 |
array(
|
254 |
'id' => 'schedule-open',
|
@@ -272,7 +335,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
272 |
|
273 |
$sap->add_setting(
|
274 |
'rtb-settings',
|
275 |
-
'schedule',
|
276 |
'scheduler',
|
277 |
array(
|
278 |
'id' => 'schedule-closed',
|
@@ -290,7 +353,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
290 |
|
291 |
$sap->add_setting(
|
292 |
'rtb-settings',
|
293 |
-
'schedule',
|
294 |
'select',
|
295 |
array(
|
296 |
'id' => 'early-bookings',
|
@@ -310,7 +373,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
310 |
|
311 |
$sap->add_setting(
|
312 |
'rtb-settings',
|
313 |
-
'schedule',
|
314 |
'select',
|
315 |
array(
|
316 |
'id' => 'late-bookings',
|
@@ -319,10 +382,12 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
319 |
'blank_option' => false,
|
320 |
'options' => array(
|
321 |
'' => __( 'Up to the last minute', RTB_TEXTDOMAIN ),
|
322 |
-
'15' => __( '
|
323 |
-
'30' => __( '
|
324 |
-
'45' => __( '
|
325 |
-
'60' => __( '
|
|
|
|
|
326 |
)
|
327 |
)
|
328 |
);
|
@@ -330,7 +395,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
330 |
$sap->add_section(
|
331 |
'rtb-settings',
|
332 |
array(
|
333 |
-
'id' => 'notifications',
|
334 |
'title' => __( 'Notifications', RTB_TEXTDOMAIN ),
|
335 |
'is_tab' => true,
|
336 |
)
|
@@ -338,7 +403,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
338 |
|
339 |
$sap->add_setting(
|
340 |
'rtb-settings',
|
341 |
-
'notifications',
|
342 |
'text',
|
343 |
array(
|
344 |
'id' => 'reply-to-name',
|
@@ -350,7 +415,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
350 |
|
351 |
$sap->add_setting(
|
352 |
'rtb-settings',
|
353 |
-
'notifications',
|
354 |
'text',
|
355 |
array(
|
356 |
'id' => 'reply-to-address',
|
@@ -362,7 +427,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
362 |
|
363 |
$sap->add_setting(
|
364 |
'rtb-settings',
|
365 |
-
'notifications',
|
366 |
'toggle',
|
367 |
array(
|
368 |
'id' => 'admin-email-option',
|
@@ -373,7 +438,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
373 |
|
374 |
$sap->add_setting(
|
375 |
'rtb-settings',
|
376 |
-
'notifications',
|
377 |
'text',
|
378 |
array(
|
379 |
'id' => 'admin-email-address',
|
@@ -386,9 +451,9 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
386 |
$sap->add_section(
|
387 |
'rtb-settings',
|
388 |
array(
|
389 |
-
'id' => 'notifications-templates',
|
390 |
'title' => __( 'Email Templates', RTB_TEXTDOMAIN ),
|
391 |
-
'tab' => 'notifications',
|
392 |
'description' => 'Adjust the messages that are emailed to users and admins during the booking process.',
|
393 |
)
|
394 |
);
|
@@ -397,7 +462,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
397 |
// can easily add/edit without conflicting with each other.
|
398 |
$sap->add_setting(
|
399 |
'rtb-settings',
|
400 |
-
'notifications-templates',
|
401 |
'html',
|
402 |
array(
|
403 |
'id' => 'template-tags-description',
|
@@ -436,7 +501,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
436 |
|
437 |
$sap->add_setting(
|
438 |
'rtb-settings',
|
439 |
-
'notifications-templates',
|
440 |
'text',
|
441 |
array(
|
442 |
'id' => 'subject-booking-admin',
|
@@ -448,7 +513,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
448 |
|
449 |
$sap->add_setting(
|
450 |
'rtb-settings',
|
451 |
-
'notifications-templates',
|
452 |
'editor',
|
453 |
array(
|
454 |
'id' => 'template-booking-admin',
|
@@ -460,7 +525,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
460 |
|
461 |
$sap->add_setting(
|
462 |
'rtb-settings',
|
463 |
-
'notifications-templates',
|
464 |
'text',
|
465 |
array(
|
466 |
'id' => 'subject-booking-user',
|
@@ -472,7 +537,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
472 |
|
473 |
$sap->add_setting(
|
474 |
'rtb-settings',
|
475 |
-
'notifications-templates',
|
476 |
'editor',
|
477 |
array(
|
478 |
'id' => 'template-booking-user',
|
@@ -484,7 +549,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
484 |
|
485 |
$sap->add_setting(
|
486 |
'rtb-settings',
|
487 |
-
'notifications-templates',
|
488 |
'text',
|
489 |
array(
|
490 |
'id' => 'subject-confirmed-user',
|
@@ -496,7 +561,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
496 |
|
497 |
$sap->add_setting(
|
498 |
'rtb-settings',
|
499 |
-
'notifications-templates',
|
500 |
'editor',
|
501 |
array(
|
502 |
'id' => 'template-confirmed-user',
|
@@ -508,7 +573,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
508 |
|
509 |
$sap->add_setting(
|
510 |
'rtb-settings',
|
511 |
-
'notifications-templates',
|
512 |
'text',
|
513 |
array(
|
514 |
'id' => 'subject-rejected-user',
|
@@ -520,7 +585,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
|
|
520 |
|
521 |
$sap->add_setting(
|
522 |
'rtb-settings',
|
523 |
-
'notifications-templates',
|
524 |
'editor',
|
525 |
array(
|
526 |
'id' => 'template-rejected-user',
|
20 |
* @since 0.0.1
|
21 |
*/
|
22 |
public $settings = array();
|
23 |
+
|
24 |
+
/**
|
25 |
+
*
|
26 |
+
*/
|
27 |
+
public $supported_i8n = array(
|
28 |
+
'ar' => 'ar',
|
29 |
+
'bg_BG' => 'bg_BG',
|
30 |
+
'bs_BA' => 'bs_BA',
|
31 |
+
'ca_ES' => 'ca_ES',
|
32 |
+
'cs_CZ' => 'cs_CZ',
|
33 |
+
'da_DK' => 'da_DK',
|
34 |
+
'de_DE' => 'de_DE',
|
35 |
+
'el_GR' => 'el_GR',
|
36 |
+
'es_ES' => 'es_ES',
|
37 |
+
'et_EE' => 'et_EE',
|
38 |
+
'eu_ES' => 'eu_ES',
|
39 |
+
'fi_FI' => 'fi_FI',
|
40 |
+
'fr_FR' => 'fr_FR',
|
41 |
+
'gl_ES' => 'gl_ES',
|
42 |
+
'he_IL' => 'he_IL',
|
43 |
+
'hr_HR' => 'hr_HR',
|
44 |
+
'hu_HU' => 'hu_HU',
|
45 |
+
'id_ID' => 'id_ID',
|
46 |
+
'is_IS' => 'is_IS',
|
47 |
+
'it_IT' => 'it_IT',
|
48 |
+
'ja_JP' => 'ja_JP',
|
49 |
+
'ko_KR' => 'ko_KR',
|
50 |
+
'nl_NL' => 'nl_NL',
|
51 |
+
'no_NO' => 'no_NO',
|
52 |
+
'pl_PL' => 'pl_PL',
|
53 |
+
'pt_BR' => 'pt_BR',
|
54 |
+
'pt_PT' => 'pt_PT',
|
55 |
+
'ro_RO' => 'ro_RO',
|
56 |
+
'ru_RU' => 'ru_RU',
|
57 |
+
'sk_SK' => 'sk_SK',
|
58 |
+
'sl_SI' => 'sl_SI',
|
59 |
+
'sv_SE' => 'sv_SE',
|
60 |
+
'th_TH' => 'th_TH',
|
61 |
+
'tr_TR' => 'tr_TR',
|
62 |
+
'uk_UA' => 'uk_UA',
|
63 |
+
'zh_CN' => 'zh_CN',
|
64 |
+
'zh_TW' => 'zh_TW',
|
65 |
+
);
|
66 |
|
67 |
public function __construct() {
|
68 |
|
165 |
RTB_TEXTDOMAIN
|
166 |
),
|
167 |
);
|
168 |
+
|
169 |
+
$i8n = get_bloginfo( 'language' );
|
170 |
+
if ( array_key_exists( $i8n, $this->supported_i8n ) ) {
|
171 |
+
$this->defaults['i8n'] = $i8n;
|
172 |
+
}
|
173 |
|
174 |
$this->defaults = apply_filters( 'rtb_defaults', $this->defaults );
|
175 |
}
|
219 |
'parent_menu' => 'rtb-bookings',
|
220 |
'description' => '',
|
221 |
'capability' => 'manage_options',
|
222 |
+
'default_tab' => 'rtb-general',
|
223 |
)
|
224 |
);
|
225 |
|
226 |
$sap->add_section(
|
227 |
'rtb-settings',
|
228 |
array(
|
229 |
+
'id' => 'rtb-general',
|
230 |
'title' => __( 'General', RTB_TEXTDOMAIN ),
|
231 |
'is_tab' => true,
|
232 |
)
|
234 |
|
235 |
$sap->add_setting(
|
236 |
'rtb-settings',
|
237 |
+
'rtb-general',
|
238 |
'post',
|
239 |
array(
|
240 |
'id' => 'booking-page',
|
251 |
|
252 |
$sap->add_setting(
|
253 |
'rtb-settings',
|
254 |
+
'rtb-general',
|
255 |
'textarea',
|
256 |
array(
|
257 |
'id' => 'success-message',
|
263 |
|
264 |
$sap->add_setting(
|
265 |
'rtb-settings',
|
266 |
+
'rtb-general',
|
267 |
'text',
|
268 |
array(
|
269 |
'id' => 'date-format',
|
275 |
|
276 |
$sap->add_setting(
|
277 |
'rtb-settings',
|
278 |
+
'rtb-general',
|
279 |
'text',
|
280 |
array(
|
281 |
'id' => 'time-format',
|
285 |
)
|
286 |
);
|
287 |
|
288 |
+
// Add i8n setting for pickadate if the frontend assets are to be loaded
|
289 |
+
if ( RTB_LOAD_FRONTEND_ASSETS ) {
|
290 |
+
$sap->add_setting(
|
291 |
+
'rtb-settings',
|
292 |
+
'rtb-general',
|
293 |
+
'select',
|
294 |
+
array(
|
295 |
+
'id' => 'i8n',
|
296 |
+
'title' => __( 'Language', RTB_TEXTDOMAIN ),
|
297 |
+
'description' => __( 'Select a language to use for the booking form datepicker if it is different than your WordPress language setting.', RTB_TEXTDOMAIN ),
|
298 |
+
'options' => $this->supported_i8n,
|
299 |
+
)
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
$sap->add_section(
|
304 |
'rtb-settings',
|
305 |
array(
|
306 |
+
'id' => 'rtb-schedule',
|
307 |
'title' => __( 'Booking Schedule', RTB_TEXTDOMAIN ),
|
308 |
'is_tab' => true,
|
309 |
)
|
311 |
|
312 |
$sap->add_setting(
|
313 |
'rtb-settings',
|
314 |
+
'rtb-schedule',
|
315 |
'scheduler',
|
316 |
array(
|
317 |
'id' => 'schedule-open',
|
335 |
|
336 |
$sap->add_setting(
|
337 |
'rtb-settings',
|
338 |
+
'rtb-schedule',
|
339 |
'scheduler',
|
340 |
array(
|
341 |
'id' => 'schedule-closed',
|
353 |
|
354 |
$sap->add_setting(
|
355 |
'rtb-settings',
|
356 |
+
'rtb-schedule',
|
357 |
'select',
|
358 |
array(
|
359 |
'id' => 'early-bookings',
|
373 |
|
374 |
$sap->add_setting(
|
375 |
'rtb-settings',
|
376 |
+
'rtb-schedule',
|
377 |
'select',
|
378 |
array(
|
379 |
'id' => 'late-bookings',
|
382 |
'blank_option' => false,
|
383 |
'options' => array(
|
384 |
'' => __( 'Up to the last minute', RTB_TEXTDOMAIN ),
|
385 |
+
'15' => __( 'At least 15 minutes in advance', RTB_TEXTDOMAIN ),
|
386 |
+
'30' => __( 'At least 30 minutes in advance', RTB_TEXTDOMAIN ),
|
387 |
+
'45' => __( 'At least 45 minutes in advance', RTB_TEXTDOMAIN ),
|
388 |
+
'60' => __( 'At least 1 hour in advance', RTB_TEXTDOMAIN ),
|
389 |
+
'240' => __( 'At least 4 hours in advance', RTB_TEXTDOMAIN ),
|
390 |
+
'1440' => __( 'At least 1 day in advance', RTB_TEXTDOMAIN ),
|
391 |
)
|
392 |
)
|
393 |
);
|
395 |
$sap->add_section(
|
396 |
'rtb-settings',
|
397 |
array(
|
398 |
+
'id' => 'rtb-notifications',
|
399 |
'title' => __( 'Notifications', RTB_TEXTDOMAIN ),
|
400 |
'is_tab' => true,
|
401 |
)
|
403 |
|
404 |
$sap->add_setting(
|
405 |
'rtb-settings',
|
406 |
+
'rtb-notifications',
|
407 |
'text',
|
408 |
array(
|
409 |
'id' => 'reply-to-name',
|
415 |
|
416 |
$sap->add_setting(
|
417 |
'rtb-settings',
|
418 |
+
'rtb-notifications',
|
419 |
'text',
|
420 |
array(
|
421 |
'id' => 'reply-to-address',
|
427 |
|
428 |
$sap->add_setting(
|
429 |
'rtb-settings',
|
430 |
+
'rtb-notifications',
|
431 |
'toggle',
|
432 |
array(
|
433 |
'id' => 'admin-email-option',
|
438 |
|
439 |
$sap->add_setting(
|
440 |
'rtb-settings',
|
441 |
+
'rtb-notifications',
|
442 |
'text',
|
443 |
array(
|
444 |
'id' => 'admin-email-address',
|
451 |
$sap->add_section(
|
452 |
'rtb-settings',
|
453 |
array(
|
454 |
+
'id' => 'rtb-notifications-templates',
|
455 |
'title' => __( 'Email Templates', RTB_TEXTDOMAIN ),
|
456 |
+
'tab' => 'rtb-notifications',
|
457 |
'description' => 'Adjust the messages that are emailed to users and admins during the booking process.',
|
458 |
)
|
459 |
);
|
462 |
// can easily add/edit without conflicting with each other.
|
463 |
$sap->add_setting(
|
464 |
'rtb-settings',
|
465 |
+
'rtb-notifications-templates',
|
466 |
'html',
|
467 |
array(
|
468 |
'id' => 'template-tags-description',
|
501 |
|
502 |
$sap->add_setting(
|
503 |
'rtb-settings',
|
504 |
+
'rtb-notifications-templates',
|
505 |
'text',
|
506 |
array(
|
507 |
'id' => 'subject-booking-admin',
|
513 |
|
514 |
$sap->add_setting(
|
515 |
'rtb-settings',
|
516 |
+
'rtb-notifications-templates',
|
517 |
'editor',
|
518 |
array(
|
519 |
'id' => 'template-booking-admin',
|
525 |
|
526 |
$sap->add_setting(
|
527 |
'rtb-settings',
|
528 |
+
'rtb-notifications-templates',
|
529 |
'text',
|
530 |
array(
|
531 |
'id' => 'subject-booking-user',
|
537 |
|
538 |
$sap->add_setting(
|
539 |
'rtb-settings',
|
540 |
+
'rtb-notifications-templates',
|
541 |
'editor',
|
542 |
array(
|
543 |
'id' => 'template-booking-user',
|
549 |
|
550 |
$sap->add_setting(
|
551 |
'rtb-settings',
|
552 |
+
'rtb-notifications-templates',
|
553 |
'text',
|
554 |
array(
|
555 |
'id' => 'subject-confirmed-user',
|
561 |
|
562 |
$sap->add_setting(
|
563 |
'rtb-settings',
|
564 |
+
'rtb-notifications-templates',
|
565 |
'editor',
|
566 |
array(
|
567 |
'id' => 'template-confirmed-user',
|
573 |
|
574 |
$sap->add_setting(
|
575 |
'rtb-settings',
|
576 |
+
'rtb-notifications-templates',
|
577 |
'text',
|
578 |
array(
|
579 |
'id' => 'subject-rejected-user',
|
585 |
|
586 |
$sap->add_setting(
|
587 |
'rtb-settings',
|
588 |
+
'rtb-notifications-templates',
|
589 |
'editor',
|
590 |
array(
|
591 |
'id' => 'template-rejected-user',
|
includes/template-functions.php
CHANGED
@@ -167,15 +167,15 @@ function rtb_enqueue_assets() {
|
|
167 |
|
168 |
wp_enqueue_style( 'rtb-booking-form' );
|
169 |
|
170 |
-
wp_enqueue_style( 'pickadate-default'
|
171 |
-
wp_enqueue_style( 'pickadate-date'
|
172 |
-
wp_enqueue_style( 'pickadate-time'
|
173 |
-
wp_enqueue_script( 'pickadate'
|
174 |
-
wp_enqueue_script( 'pickadate-date'
|
175 |
-
wp_enqueue_script( 'pickadate-time'
|
176 |
-
wp_enqueue_script( 'pickadate-legacy'
|
177 |
-
|
178 |
-
|
179 |
|
180 |
wp_enqueue_script( 'rtb-booking-form' );
|
181 |
|
167 |
|
168 |
wp_enqueue_style( 'rtb-booking-form' );
|
169 |
|
170 |
+
wp_enqueue_style( 'pickadate-default' );
|
171 |
+
wp_enqueue_style( 'pickadate-date' );
|
172 |
+
wp_enqueue_style( 'pickadate-time' );
|
173 |
+
wp_enqueue_script( 'pickadate' );
|
174 |
+
wp_enqueue_script( 'pickadate-date' );
|
175 |
+
wp_enqueue_script( 'pickadate-time' );
|
176 |
+
wp_enqueue_script( 'pickadate-legacy' );
|
177 |
+
wp_enqueue_script( 'pickadate-i8n' ); // only registered if needed
|
178 |
+
wp_enqueue_style( 'pickadate-rtl' ); // only registered if needed
|
179 |
|
180 |
wp_enqueue_script( 'rtb-booking-form' );
|
181 |
|
lib/simple-admin-pages/lib/pickadate/translations/ar.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
jQuery.extend(jQuery.fn.pickadate.defaults,{monthsFull:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],monthsShort:["يناير","فبراير","مارس","ابريل","مايو","يونيو","يوليو","اغسطس","سبتمبر","اكتوبر","نوفمبر","ديسمبر"],weekdaysFull:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],weekdaysShort:["الاحد","الاثنين","الثلاثاء","الاربعاء","الخميس","الجمعة","السبت"],today:"اليوم",clear:"مسح",format:"yyyy mmmm dd",formatSubmit:"yyyy/mm/dd"});
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: NateWr
|
|
3 |
Author URI: https://github.com/NateWr
|
4 |
Plugin URL: http://themeofthecrop.com
|
5 |
Requires at Least: 3.8
|
6 |
-
Tested Up To: 3.9
|
7 |
Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
|
8 |
-
Stable tag: 1.
|
9 |
License: GPLv2 or later
|
10 |
Donate link: http://themeofthecrop.com
|
11 |
|
@@ -23,11 +23,13 @@ Accept restaurant reservations and table bookings online. Quickly confirm or rej
|
|
23 |
* Add your booking form to any page, post or widget area
|
24 |
* Customize all notification messages, and date and time formats
|
25 |
|
26 |
-
|
|
|
|
|
27 |
|
28 |
= How to use =
|
29 |
|
30 |
-
There is a short guide to using the plugin in the /docs/ folder. It can be accessed by following the Help link listed under the plugin on the Plugins page in your WordPress admin area. Not sure where that is? One of the screenshots for this plugin will show you where to find it.
|
31 |
|
32 |
= Developers =
|
33 |
|
@@ -54,6 +56,12 @@ This plugin is packed with hooks so you can extend it, customize it and rebrand
|
|
54 |
|
55 |
== Changelog ==
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
= 1.0.2 (2014-05-08) =
|
58 |
* Remove development tool from codebase
|
59 |
|
@@ -65,5 +73,8 @@ This plugin is packed with hooks so you can extend it, customize it and rebrand
|
|
65 |
|
66 |
== Upgrade Notice ==
|
67 |
|
|
|
|
|
|
|
68 |
= 1.0.2 =
|
69 |
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.
|
3 |
Author URI: https://github.com/NateWr
|
4 |
Plugin URL: http://themeofthecrop.com
|
5 |
Requires at Least: 3.8
|
6 |
+
Tested Up To: 3.9.1
|
7 |
Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
|
8 |
+
Stable tag: 1.1
|
9 |
License: GPLv2 or later
|
10 |
Donate link: http://themeofthecrop.com
|
11 |
|
23 |
* Add your booking form to any page, post or widget area
|
24 |
* Customize all notification messages, and date and time formats
|
25 |
|
26 |
+
More features will be added to this plugin and addons will be created which extend the functionality or integrate with third-party services. Follow future developments at [Theme of the Crop](http://themeofthecrop.com/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations) or read the Upgrade Notices when you see updates for this plugin in your WordPress admin panel.
|
27 |
+
|
28 |
+
This plugin is part of a group of plugins in development for restaurants. Check out the [Food and Drink Menu](http://wordpress.org/plugins/food-and-drink-menu/) plugin as well.
|
29 |
|
30 |
= How to use =
|
31 |
|
32 |
+
There is a short guide to using the plugin in the /docs/ folder. It can be accessed by following the Help link listed under the plugin on the Plugins page in your WordPress admin area. Not sure where that is? One of the [screenshots](http://wordpress.org/plugins/restaurant-reservations/screenshots/) for this plugin will show you where to find it.
|
33 |
|
34 |
= Developers =
|
35 |
|
56 |
|
57 |
== Changelog ==
|
58 |
|
59 |
+
= 1.1 (2014-05-12) =
|
60 |
+
* Attempt to load the correct language for the datepicker from the WordPress settings
|
61 |
+
* Add support for choosing a language for the datepicker if different from WordPress settings
|
62 |
+
* Allow late bookings to be blocked 4 hours and 1 day in advance
|
63 |
+
* Fix: don't show settings under WordPress's core General settings page
|
64 |
+
|
65 |
= 1.0.2 (2014-05-08) =
|
66 |
* Remove development tool from codebase
|
67 |
|
73 |
|
74 |
== Upgrade Notice ==
|
75 |
|
76 |
+
= 1.1 =
|
77 |
+
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.
|
78 |
+
|
79 |
= 1.0.2 =
|
80 |
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
@@ -3,13 +3,13 @@
|
|
3 |
* Plugin Name: Restaurant Reservations
|
4 |
* Plugin URI: http://themeofthecrop.com
|
5 |
* Description: Accept restaurant reservations and bookings online.
|
6 |
-
* Version: 1.
|
7 |
* Author: Theme of the Crop
|
8 |
* Author URI: http://themeofthecrop.com
|
9 |
* License: GNU General Public License v2.0 or later
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Requires at least: 3.8
|
12 |
-
* Tested up to: 3.9
|
13 |
*
|
14 |
* Text Domain: rtbdomain
|
15 |
* Domain Path: /languages/
|
@@ -237,6 +237,24 @@ class rtbInit {
|
|
237 |
return;
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
wp_register_style( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/css/booking-form.css' );
|
241 |
wp_register_script( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/js/booking-form.js', array( 'jquery' ) );
|
242 |
}
|
3 |
* Plugin Name: Restaurant Reservations
|
4 |
* Plugin URI: http://themeofthecrop.com
|
5 |
* Description: Accept restaurant reservations and bookings online.
|
6 |
+
* Version: 1.1
|
7 |
* Author: Theme of the Crop
|
8 |
* Author URI: http://themeofthecrop.com
|
9 |
* License: GNU General Public License v2.0 or later
|
10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
* Requires at least: 3.8
|
12 |
+
* Tested up to: 3.9.1
|
13 |
*
|
14 |
* Text Domain: rtbdomain
|
15 |
* Domain Path: /languages/
|
237 |
return;
|
238 |
}
|
239 |
|
240 |
+
wp_register_style( 'pickadate-default', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.css' );
|
241 |
+
wp_register_style( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.date.css' );
|
242 |
+
wp_register_style( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/default.time.css' );
|
243 |
+
wp_register_script( 'pickadate', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.js', array( 'jquery' ), '', true );
|
244 |
+
wp_register_script( 'pickadate-date', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.date.js', array( 'jquery' ), '', true );
|
245 |
+
wp_register_script( 'pickadate-time', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/picker.time.js', array( 'jquery' ), '', true );
|
246 |
+
wp_register_script( 'pickadate-legacy', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/legacy.js', array( 'jquery' ), '', true );
|
247 |
+
|
248 |
+
$i8n = $this->settings->get_setting( 'i8n' );
|
249 |
+
if ( !empty( $i8n ) ) {
|
250 |
+
wp_register_script( 'pickadate-i8n', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/translations/' . esc_attr( $i8n ) . '.js', array( 'jquery' ), '', true );
|
251 |
+
|
252 |
+
// Arabic and Hebrew are right-to-left languages
|
253 |
+
if ( $i8n == 'ar' || $i8n == 'he_IL' ) {
|
254 |
+
wp_register_style( 'pickadate-rtl', RTB_PLUGIN_URL . '/lib/simple-admin-pages/lib/pickadate/themes/rtl.css' );
|
255 |
+
}
|
256 |
+
}
|
257 |
+
|
258 |
wp_register_style( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/css/booking-form.css' );
|
259 |
wp_register_script( 'rtb-booking-form', RTB_PLUGIN_URL . '/assets/js/booking-form.js', array( 'jquery' ) );
|
260 |
}
|