Restaurant Reservations - Version 1.6

Version Description

This is a major update that adds support for accepting bookings at multiple locations. View the online documentation for further details.

Download this release

Release Info

Developer NateWr
Plugin Icon 128x128 Restaurant Reservations
Version 1.6
Comparing to
See all releases

Code changes from version 1.5.3 to 1.6

Gruntfile.js ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+
3
+ module.exports = function(grunt) {
4
+
5
+ // Project configuration.
6
+ grunt.initConfig({
7
+
8
+ // Configure JSHint
9
+ jshint: {
10
+ test: {
11
+ src: 'assets/js/*.js'
12
+ }
13
+ },
14
+
15
+ // Watch for changes on some files and auto-compile them
16
+ watch: {
17
+ js: {
18
+ files: ['assets/js/*.js'],
19
+ tasks: ['jshint']
20
+ },
21
+ },
22
+
23
+ // Create a .pot file
24
+ makepot: {
25
+ target: {
26
+ options: {
27
+ cwd: '', // Directory of files to internationalize.
28
+ domainPath: 'languages', // Where to save the POT file.
29
+ exclude: [], // List of files or directories to ignore.
30
+ include: [], // List of files or directories to include.
31
+ i18nToolsPath: '/media/Storage/projects/wordpress/trunk/tools/i18n', // Path to the i18n tools directory.
32
+ mainFile: 'restaurant-reservations/restaurant-reservations.php', // Main project file.
33
+ potComments: '', // The copyright at the beginning of the POT file.
34
+ potFilename: '', // Name of the POT file.
35
+ potHeaders: {
36
+ poedit: true, // Includes common Poedit headers.
37
+ 'x-poedit-keywordslist': true // Include a list of all possible gettext functions.
38
+ }, // Headers to add to the generated POT file.
39
+ processPot: null, // A callback function for manipulating the POT file.
40
+ type: 'wp-plugin', // Type of project (wp-plugin or wp-theme).
41
+ updateTimestamp: true // Whether the POT-Creation-Date should be updated without other changes.
42
+ }
43
+ }
44
+ }
45
+
46
+ });
47
+
48
+ // Load tasks
49
+ grunt.loadNpmTasks('grunt-contrib-jshint');
50
+ grunt.loadNpmTasks('grunt-contrib-watch');
51
+ grunt.loadNpmTasks('grunt-wp-i18n');
52
+
53
+ // Default task(s).
54
+ grunt.registerTask('default', ['watch']);
55
+
56
+ };
assets/css/admin.css CHANGED
@@ -10,9 +10,15 @@
10
  clear: both;
11
  }
12
 
13
- /* Bookings Table */
 
 
 
 
14
  #rtb-bookings-table .subsubsub {
15
- float: right;
 
 
16
  }
17
 
18
  #rtb-bookings-table .subsubsub .trash a {
@@ -24,27 +30,68 @@
24
  }
25
 
26
  #rtb-filters {
27
- float: left;
28
- }
29
-
30
- #rtb-filters .subsubsub {
31
- margin-bottom: 0.5em;
32
- float: none;
33
  }
34
 
35
  #rtb-filters .date-filters {
36
- clear: both;
 
 
 
37
  padding: 1em;
38
- margin: 1em 0 2em;
39
  background: #fff;
40
  -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
41
  box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
42
  }
43
 
 
 
 
 
 
 
44
  #rtb-filters .date-filters .datepicker {
45
  max-width: 10em;
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  #rtb-filters .current {
49
  font-weight: 600;
50
  color: #000;
@@ -59,6 +106,75 @@
59
  line-height: 28px;
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  #rtb-bookings-table tr.closed {
63
  opacity: 0.6;
64
  filter: opacity(alpha=60);
@@ -138,15 +254,6 @@
138
  opacity: 0.5;
139
  }
140
 
141
- #rtb-bookings-table tr.notice td {
142
- background: #2ea2cc;
143
- color: #fff;
144
- }
145
-
146
- #rtb-bookings-table tr.notice.trash td {
147
- background: #dd3d36;
148
- }
149
-
150
  #rtb-bookings-table tr ul {
151
  margin: 0;
152
  }
@@ -175,6 +282,54 @@
175
  display: block;
176
  }
177
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  @media screen and (max-width: 782px) {
179
 
180
  /* Prevent date column from being hidden in WP versions < 4.3 */
10
  clear: both;
11
  }
12
 
13
+ /* Bookings Admin List Table */
14
+ #rtb-bookings-table .rtb-primary-controls {
15
+ margin-top: 2em;
16
+ }
17
+
18
  #rtb-bookings-table .subsubsub {
19
+ float: none;
20
+ margin: 0.5em 0 1em;
21
+ text-align: left;
22
  }
23
 
24
  #rtb-bookings-table .subsubsub .trash a {
30
  }
31
 
32
  #rtb-filters {
33
+ position: relative;
 
 
 
 
 
34
  }
35
 
36
  #rtb-filters .date-filters {
37
+ position: absolute;
38
+ top: -9999px;
39
+ left: -9999px;
40
+ display: inline-block;
41
  padding: 1em;
 
42
  background: #fff;
43
  -webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
44
  box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);
45
  }
46
 
47
+ #rtb-filters.date-filters-visible .date-filters {
48
+ position: relative;
49
+ top: auto;
50
+ left: 0;
51
+ }
52
+
53
  #rtb-filters .date-filters .datepicker {
54
  max-width: 10em;
55
  }
56
 
57
+ #rtb-filters .date-filter-range {
58
+ padding: 0.25em;
59
+ }
60
+
61
+ #rtb-date-filter-link {
62
+ position: relative;
63
+ }
64
+
65
+ #rtb-date-filter-link .dashicons {
66
+ line-height: 1.5;
67
+ }
68
+
69
+ #rtb-filters .date-filter-range + #rtb-date-filter-link {
70
+ margin-left: 0.5em;
71
+ }
72
+
73
+ #rtb-date-filter-link .rtb-date-filter-label {
74
+ position: absolute;
75
+ top: -9999px;
76
+ left: -9999px;
77
+ }
78
+
79
+ #rtb-filters.date-filters-visible #rtb-date-filter-link {
80
+ color: #777;
81
+ }
82
+
83
+ #rtb-filters.date-filters-visible #rtb-date-filter-link:before {
84
+ content: '';
85
+ position: absolute;
86
+ top: 60%;
87
+ left: 50%;
88
+ margin-left: -1em;
89
+ width: 0;
90
+ height: 0;
91
+ border: 1em solid transparent;
92
+ border-bottom: 1em solid #fff;
93
+ }
94
+
95
  #rtb-filters .current {
96
  font-weight: 600;
97
  color: #000;
106
  line-height: 28px;
107
  }
108
 
109
+ #rtb-bookings-table .rtb-notice,
110
+ #rtb-bookings-table .rtb-top-actions-wrapper,
111
+ #rtb-bookings-table .rtb-table-header-controls {
112
+ margin: 1em 0;
113
+ }
114
+
115
+ #rtb-bookings-table .rtb-table-header-controls {
116
+ margin-bottom: 0;
117
+ }
118
+
119
+ #rtb-bookings-table .rtb-notice {
120
+ padding: 1em;
121
+ background: #2ea2cc;
122
+ color: #fff;
123
+ }
124
+
125
+ #rtb-bookings-table .rtb-table-header-controls {
126
+ position: relative;
127
+ top: 1px;
128
+ overflow: hidden;
129
+ margin-bottom: 0.5em;
130
+ }
131
+
132
+ #rtb-bookings-table select[name="action"],
133
+ #rtb-bookings-table select[name="action2"],
134
+ #rtb-bookings-table .rtb-location-switch select {
135
+ max-width: 120px;
136
+ }
137
+
138
+ #rtb-bookings-table .rtb-table-header-controls .bulkactions {
139
+ float: left;
140
+ }
141
+
142
+ #rtb-bookings-table .rtb-locations {
143
+ display: none;
144
+ margin: 0;
145
+ width: 9999px;
146
+ }
147
+
148
+ #rtb-bookings-table .rtb-locations li {
149
+ display: inline-block;
150
+ margin: 0;
151
+ line-height: 38px;
152
+ position: relative;
153
+ }
154
+
155
+ #rtb-bookings-table .rtb-locations a {
156
+ display: block;
157
+ padding: 0 1em;
158
+ font-weight: 700;
159
+ color: #777;
160
+ text-decoration: none;
161
+ }
162
+
163
+ #rtb-bookings-table .rtb-locations .current a {
164
+ background: #fff;
165
+ color: #333;
166
+ border: 1px solid #ddd;
167
+ border-bottom: 0;
168
+ }
169
+
170
+ #rtb-bookings-table .rtb-location-switch {
171
+ float: left;
172
+ }
173
+
174
+ #rtb-bookings-table .rtb-locations-button {
175
+ margin-bottom: 0;
176
+ }
177
+
178
  #rtb-bookings-table tr.closed {
179
  opacity: 0.6;
180
  filter: opacity(alpha=60);
254
  opacity: 0.5;
255
  }
256
 
 
 
 
 
 
 
 
 
 
257
  #rtb-bookings-table tr ul {
258
  margin: 0;
259
  }
282
  display: block;
283
  }
284
 
285
+ @media screen and (min-width: 783px) {
286
+
287
+ #rtb-bookings-table .rtb-locations li {
288
+ line-height: 32px;
289
+ }
290
+ }
291
+
292
+ @media screen and (min-width: 930px) {
293
+
294
+ #rtb-bookings-table .rtb-primary-controls {
295
+ margin-top: 0;
296
+ }
297
+
298
+ #rtb-bookings-table .rtb-views {
299
+ float: right;
300
+ width: 50%;
301
+ }
302
+
303
+ #rtb-bookings-table .rtb-views .subsubsub {
304
+ text-align: right;
305
+ }
306
+
307
+ #rtb-filters {
308
+ float: left;
309
+ width: 50%;
310
+ }
311
+
312
+ #rtb-filters .date-filters {
313
+ margin-right: 2em;
314
+ }
315
+
316
+ #rtb-bookings-table .rtb-locations {
317
+ display: block;
318
+ }
319
+
320
+ #rtb-bookings-table .rtb-table-header-controls {
321
+ margin-bottom: 0;
322
+ }
323
+
324
+ #rtb-bookings-table .rtb-location-switch {
325
+ position: absolute;
326
+ top: 0;
327
+ right: 0;
328
+ background: #eee;
329
+ padding-left: 1em;
330
+ }
331
+ }
332
+
333
  @media screen and (max-width: 782px) {
334
 
335
  /* Prevent date column from being hidden in WP versions < 4.3 */
assets/js/admin.js CHANGED
@@ -1,6 +1,11 @@
1
  /* Javascript for Restaurant Reservations admin */
2
  jQuery(document).ready(function ($) {
3
 
 
 
 
 
 
4
  // Add date picker to date filter in admin
5
  $( '#start-date, #end-date' ).each( function() {
6
  var input = $(this);
1
  /* Javascript for Restaurant Reservations admin */
2
  jQuery(document).ready(function ($) {
3
 
4
+ // Show/hide date filter in bookings list
5
+ $( '#rtb-date-filter-link' ).click( function() {
6
+ $( '#rtb-filters' ).toggleClass( 'date-filters-visible' );
7
+ });
8
+
9
  // Add date picker to date filter in admin
10
  $( '#start-date, #end-date' ).each( function() {
11
  var input = $(this);
includes/AdminBookings.class.php CHANGED
@@ -9,6 +9,18 @@ if ( !class_exists( 'rtbAdminBookings' ) ) {
9
  */
10
  class rtbAdminBookings {
11
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  public function __construct() {
13
 
14
  // Add the admin menu
@@ -63,8 +75,8 @@ class rtbAdminBookings {
63
  public function show_admin_bookings_page() {
64
 
65
  require_once( RTB_PLUGIN_DIR . '/includes/WP_List_Table.BookingsTable.class.php' );
66
- $bookings_table = new rtbBookingsTable();
67
- $bookings_table->prepare_items();
68
  ?>
69
 
70
  <div class="wrap">
@@ -78,9 +90,14 @@ class rtbAdminBookings {
78
  <input type="hidden" name="post_type" value="<?php echo RTB_BOOKING_POST_TYPE; ?>" />
79
  <input type="hidden" name="page" value="rtb-bookings">
80
 
81
- <?php $bookings_table->views(); ?>
82
- <?php $bookings_table->advanced_filters(); ?>
83
- <?php $bookings_table->display(); ?>
 
 
 
 
 
84
  </form>
85
  <?php do_action( 'rtb_bookings_table_btm' ); ?>
86
  </div>
@@ -208,9 +225,8 @@ class rtbAdminBookings {
208
  <legend><?php esc_html_e( 'Columns', 'restaurant-reservations' ); ?></legend>
209
  <ul>
210
  <?php
211
- $bookings_table = new rtbBookingsTable();
212
- $columns = $bookings_table->get_all_columns();
213
- $visible = $bookings_table->get_columns();
214
  foreach( $columns as $column => $label ) :
215
  // Don't allow these columns to be hidden
216
  if ( $column == 'cb' || $column == 'details' || $column == 'date' ) {
9
  */
10
  class rtbAdminBookings {
11
 
12
+ /**
13
+ * The bookings table
14
+ *
15
+ * This is only instantiated on the bookings admin page at the moment when
16
+ * it is generated.
17
+ *
18
+ * @see self::show_admin_bookings_page()
19
+ * @see WP_List_table.BookingsTable.class.php
20
+ * @since 1.6
21
+ */
22
+ public $booking_table;
23
+
24
  public function __construct() {
25
 
26
  // Add the admin menu
75
  public function show_admin_bookings_page() {
76
 
77
  require_once( RTB_PLUGIN_DIR . '/includes/WP_List_Table.BookingsTable.class.php' );
78
+ $this->bookings_table = new rtbBookingsTable();
79
+ $this->bookings_table->prepare_items();
80
  ?>
81
 
82
  <div class="wrap">
90
  <input type="hidden" name="post_type" value="<?php echo RTB_BOOKING_POST_TYPE; ?>" />
91
  <input type="hidden" name="page" value="rtb-bookings">
92
 
93
+ <div class="rtb-primary-controls clearfix">
94
+ <div class="rtb-views">
95
+ <?php $this->bookings_table->views(); ?>
96
+ </div>
97
+ <?php $this->bookings_table->advanced_filters(); ?>
98
+ </div>
99
+
100
+ <?php $this->bookings_table->display(); ?>
101
  </form>
102
  <?php do_action( 'rtb_bookings_table_btm' ); ?>
103
  </div>
225
  <legend><?php esc_html_e( 'Columns', 'restaurant-reservations' ); ?></legend>
226
  <ul>
227
  <?php
228
+ $columns = $this->bookings_table->get_all_columns();
229
+ $visible = $this->bookings_table->get_columns();
 
230
  foreach( $columns as $column => $label ) :
231
  // Don't allow these columns to be hidden
232
  if ( $column == 'cb' || $column == 'details' || $column == 'date' ) {
includes/Compatibility.class.php CHANGED
@@ -3,7 +3,8 @@ if ( !defined( 'ABSPATH' ) ) exit;
3
 
4
  if ( !class_exists( 'rtbCompatibility' ) ) {
5
  /**
6
- * Class to handle backwards compatibilty issues for Restaurant Reservations
 
7
  *
8
  * @since 1.3
9
  */
@@ -108,7 +109,6 @@ class rtbCompatibility {
108
 
109
  return $details;
110
  }
111
-
112
  }
113
  } // endif
114
 
3
 
4
  if ( !class_exists( 'rtbCompatibility' ) ) {
5
  /**
6
+ * Class to handle backwards compatibilty and cross-plugin compatibility issues
7
+ * for Restaurant Reservations
8
  *
9
  * @since 1.3
10
  */
109
 
110
  return $details;
111
  }
 
112
  }
113
  } // endif
114
 
includes/CustomPostTypes.class.php CHANGED
@@ -13,7 +13,7 @@ class rtbCustomPostTypes {
13
  // @sa set_booking_statuses()
14
  public $booking_statuses = array();
15
 
16
- // Cached select fields for booking stasuses
17
  public $status_select_html = array();
18
 
19
  public function __construct() {
@@ -68,6 +68,8 @@ class rtbCustomPostTypes {
68
 
69
  // Add an action so addons can hook in after the post type is registered
70
  do_action( 'rtb_booking_post_register' );
 
 
71
  }
72
 
73
  /**
13
  // @sa set_booking_statuses()
14
  public $booking_statuses = array();
15
 
16
+ // Cached select fields for booking statuses
17
  public $status_select_html = array();
18
 
19
  public function __construct() {
68
 
69
  // Add an action so addons can hook in after the post type is registered
70
  do_action( 'rtb_booking_post_register' );
71
+
72
+
73
  }
74
 
75
  /**
includes/MultipleLocations.class.php ADDED
@@ -0,0 +1,653 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Methods for handling multiple locations
4
+ *
5
+ * @package RestaurantReservations
6
+ * @copyright Copyright (c) 2016, Theme of the Crop
7
+ * @license GPL-2.0+
8
+ * @since 1.6
9
+ */
10
+ defined( 'ABSPATH' ) || exit;
11
+
12
+ if ( ! class_exists( 'rtbMultipleLocations', false ) ) {
13
+ /**
14
+ * Class to handle custom post type and post meta fields
15
+ *
16
+ * @since 1.6
17
+ */
18
+ class rtbMultipleLocations {
19
+
20
+ /**
21
+ * Post type slug where locations can be found
22
+ *
23
+ * @since 1.6
24
+ */
25
+ public $post_type = false;
26
+
27
+ /**
28
+ * Taxonomy to use when assigning bookings to locations
29
+ *
30
+ * @since 1.6
31
+ */
32
+ public $location_taxonomy = 'rtb_location';
33
+
34
+ /**
35
+ * Set the loading hook
36
+ *
37
+ * @since 1.6
38
+ */
39
+ public function __construct() {
40
+ add_action( 'plugins_loaded', array( $this, 'load' ), 100 );
41
+ }
42
+
43
+ /**
44
+ * Load locations support
45
+ *
46
+ * @since 1.6
47
+ */
48
+ public function load() {
49
+
50
+ /**
51
+ * Allow third-party plugins to enable multiple locations
52
+ *
53
+ * Expects a post type slug pointing to the locations or false if
54
+ * multiple locations are not enabled.
55
+ *
56
+ * @since 1.6
57
+ */
58
+ $this->post_type = apply_filters( 'rtb_set_locations_post_type', false );
59
+
60
+ if ( !$this->post_type ) {
61
+ return;
62
+ }
63
+
64
+ $this->hooks();
65
+ }
66
+
67
+ /**
68
+ * Set up hooks
69
+ *
70
+ * @since 1.6
71
+ */
72
+ public function hooks() {
73
+ add_action( 'init', array( $this, 'register_taxonomy' ), 1000 ); // after custom post types declared (hopefully!)
74
+ add_action( 'save_post_' . $this->post_type, array( $this, 'save_location' ), 10, 3 );
75
+ add_action( 'before_delete_post', array( $this, 'delete_location' ) );
76
+ add_action( 'rtb_booking_form_fields', array( $this, 'add_location_field' ), 10, 3 );
77
+ add_action( 'rtb_validate_booking_submission', array( $this, 'validate_location' ) );
78
+ add_action( 'rtb_insert_booking', array( $this, 'save_booking_location' ) );
79
+ add_action( 'rtb_update_booking', array( $this, 'save_booking_location' ) );
80
+ add_action( 'rtb_booking_load_post_data', array( $this, 'load_booking_location' ), 10, 2 );
81
+ add_filter( 'rtb_query_args', array( $this, 'modify_query' ), 10, 2 );
82
+ add_filter( 'rtb_bookings_all_table_columns', array( $this, 'add_location_column' ) );
83
+ add_filter( 'rtb_bookings_table_column', array( $this, 'print_location_column' ), 10, 3 );
84
+ add_filter( 'rtb_bookings_table_column_details', array( $this, 'add_details_column_items' ), 10, 2 );
85
+ add_action( 'edit_form_after_title', array( $this, 'add_meta_nonce' ) );
86
+ add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) );
87
+ add_filter( 'the_content', array( $this, 'append_to_content' ) );
88
+ add_filter( 'rtb_notification_email_to_email', array( $this, 'notification_to_email' ), 10, 2 );
89
+ add_filter( 'rtb_notification_email_from_email', array( $this, 'notification_from_email' ), 10, 2 );
90
+ add_filter( 'rtb_notification_email_from_name', array( $this, 'notification_from_name' ), 10, 2 );
91
+ }
92
+
93
+ /**
94
+ * Register the location taxonomy
95
+ *
96
+ * @since 1.6
97
+ */
98
+ public function register_taxonomy() {
99
+
100
+ $args = array(
101
+ 'label' => _x( 'Location', 'Name for grouping bookings', 'restaurant-reservations' ),
102
+ 'hierarchical' => false,
103
+ 'public' => true,
104
+ 'rewrite' => false,
105
+ );
106
+
107
+ /**
108
+ * Allow third-party plugins to modify the location taxonomy
109
+ * arguments.
110
+ *
111
+ * @since 1.6
112
+ */
113
+ $args = apply_filters( 'rtb_locations_args', $args );
114
+
115
+ register_taxonomy( $this->location_taxonomy, RTB_BOOKING_POST_TYPE, $args );
116
+ }
117
+
118
+ /**
119
+ * Generate taxonomy terms linked to locations and keep them sync'd
120
+ * with any changes
121
+ *
122
+ * @since 1.6
123
+ */
124
+ public function save_location( $post_id, $post, $update ) {
125
+
126
+
127
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
128
+ return $post_id;
129
+ }
130
+
131
+ if ( !current_user_can( 'edit_post', $post_id ) ) {
132
+ return $post_id;
133
+ }
134
+
135
+ $term_id = get_post_meta( $post_id, $this->location_taxonomy, true );
136
+
137
+ // Create a new term for this location
138
+ if ( !$term_id ) {
139
+ $term = wp_insert_term(
140
+ sanitize_text_field( $post->post_title ),
141
+ $this->location_taxonomy
142
+ );
143
+ if ( !is_a( $term, 'WP_Error' ) ) {
144
+ update_post_meta( $post_id, $this->location_taxonomy, $term['term_id'] );
145
+ }
146
+
147
+ $term_id = $term['term_id'];
148
+
149
+ // Update the term for this location
150
+ } else {
151
+ wp_update_term(
152
+ $term_id,
153
+ $this->location_taxonomy,
154
+ array(
155
+ 'name' => sanitize_text_field( $post->post_title ),
156
+ 'slug' => sanitize_text_field( $post->post_name ),
157
+ )
158
+ );
159
+ }
160
+
161
+ // Save post and and term meta data
162
+ if ( !isset( $_POST['rtb_location_meta_nonce'] ) || !wp_verify_nonce( $_POST['rtb_location_meta_nonce'], 'rtb_location_meta' ) ) {
163
+ return $post_id;
164
+ }
165
+
166
+ if ( !empty( $_POST['rtb_append_booking_form'] ) ) {
167
+ update_post_meta( $post_id, 'rtb_append_booking_form', true );
168
+ } else {
169
+ delete_post_meta( $post_id, 'rtb_append_booking_form' );
170
+ }
171
+
172
+ if ( !empty( $_POST['rtb_reply_to_name'] ) ) {
173
+ $reply_to_name = sanitize_text_field( $_POST['rtb_reply_to_name'] );
174
+ update_term_meta( $term_id, 'rtb_reply_to_name', $reply_to_name );
175
+ } else {
176
+ delete_term_meta( $term_id, 'rtb_reply_to_name' );
177
+ }
178
+
179
+ if ( !empty( $_POST['rtb_reply_to_address'] ) ) {
180
+ $reply_to_address = sanitize_email( $_POST['rtb_reply_to_address'] );
181
+ update_term_meta( $term_id, 'rtb_reply_to_address', $reply_to_address );
182
+ } else {
183
+ delete_term_meta( $term_id, 'rtb_reply_to_address' );
184
+ }
185
+
186
+ if ( !empty( $_POST['rtb_admin_email_address'] ) ) {
187
+ $email = sanitize_email( $_POST['rtb_admin_email_address'] );
188
+ update_term_meta( $term_id, 'rtb_admin_email_address', $email );
189
+ } else {
190
+ delete_term_meta( $term_id, 'rtb_admin_email_address' );
191
+ }
192
+
193
+ return $post_id;
194
+ }
195
+
196
+ /**
197
+ * Delete taxonomy terms linked to locations when a location is deleted
198
+ *
199
+ * Only does this when no bookings are associated with that term.
200
+ * Otherwise it may be important to keep the bookings grouped for
201
+ * historical data.
202
+ *
203
+ * @since 1.6
204
+ */
205
+ public function delete_location( $post_id ) {
206
+
207
+ if ( !current_user_can( 'delete_posts' ) ) {
208
+ return;
209
+ }
210
+
211
+ $term_id = get_post_meta( $post_id, $this->location_taxonomy, true );
212
+
213
+ $term = get_term( $term_id, $this->location_taxonomy );
214
+
215
+ if ( !$term || is_a( $term, 'WP_Error' ) ) {
216
+ return;
217
+ }
218
+
219
+ $query = new rtbQuery( array( 'location' => $term_id ), 'delete-location-term-check' );
220
+ $query->prepare_args();
221
+ $query->get_bookings();
222
+
223
+ // Don't delete taxonomy terms if there are bookings assigned to
224
+ // this location, so the booking associations can remain as
225
+ // historical data.
226
+ if ( count( $query->bookings ) ) {
227
+ add_term_meta( $term_id, 'rtb_location_removed', true );
228
+ return;
229
+ }
230
+
231
+ wp_delete_term( $term_id, $this->location_taxonomy );
232
+ }
233
+
234
+ /**
235
+ * Add the location selection field to the booking form
236
+ *
237
+ * @since 1.6
238
+ */
239
+ public function add_location_field( $fields, $request = null, $args = array() ) {
240
+
241
+ if ( $request === null ) {
242
+ global $rtb_controller;
243
+ $request = $rtb_controller->request;
244
+ }
245
+
246
+ // Select a fieldset in which to place the field
247
+ $placement = false;
248
+ if ( isset( $fields['reservation'] ) && isset( $fields['reservation']['fields'] ) ) {
249
+ $placement = &$fields['reservation']['fields'];
250
+ } else {
251
+ $key = key( reset( $fields ) );
252
+ if ( isset( $fields[$key]['fields'] ) ) {
253
+ $placement = &$fields[$key]['fields'];
254
+ }
255
+ }
256
+
257
+ // If we couldn't find any working fieldset, then something odd is
258
+ // going on. Just pretend we were never here.
259
+ if ( $placement === false ) {
260
+ return $fields;
261
+ }
262
+
263
+ // If the location is specified, don't add a field.
264
+ // A hidden field is added automatically in rtb_print_booking_form()
265
+ if ( !empty( $args['location'] ) && term_exists( $args['location'], $this->location_taxonomy ) ) {
266
+ return $fields;
267
+ }
268
+
269
+ $placement = array_merge(
270
+ array(
271
+ 'location' => array(
272
+ 'title' => __( 'Location', 'restaurant-reservations' ),
273
+ 'request_input' => empty( $request->location ) ? '' : $request->location,
274
+ 'callback' => 'rtb_print_form_select_field',
275
+ 'callback_args' => array(
276
+ 'options' => $this->get_location_options(),
277
+ ),
278
+ 'required' => true,
279
+ )
280
+ ),
281
+ $placement
282
+ );
283
+
284
+ return $fields;
285
+ }
286
+
287
+ /**
288
+ * Retrieve a key/value array of location terms and names
289
+ *
290
+ * @param bool $active_only Whether or not to retrieve only currently
291
+ * active locations. Default: true - don't retrieve locations that
292
+ * have been removed
293
+ * @since 1.6
294
+ */
295
+ public function get_location_options( $active_only = true ) {
296
+
297
+ $terms = get_terms(
298
+ array(
299
+ 'taxonomy' => $this->location_taxonomy,
300
+ 'hide_empty' => false,
301
+ )
302
+ );
303
+
304
+ $options = array();
305
+ foreach( $terms as $term ) {
306
+ $archived = get_term_meta( $term->term_id, 'rtb_location_removed', true );
307
+ if ( !$active_only || !$archived ) {
308
+ $options[$term->term_id] = $term->name;
309
+ }
310
+ }
311
+
312
+ return $options;
313
+ }
314
+
315
+ /**
316
+ * Validate location in post data
317
+ *
318
+ * @since 1.6
319
+ */
320
+ public function validate_location( $booking ) {
321
+
322
+ $booking->location = empty( $_POST['rtb-location'] ) ? '' : absint( $_POST['rtb-location'] );
323
+ if ( empty( $booking->location ) ) {
324
+ $booking->validation_errors[] = array(
325
+ 'field' => 'location',
326
+ 'post_variable' => $booking->location,
327
+ 'message' => __( 'Please select a location for your booking.', 'restaurant-reservations' ),
328
+ );
329
+
330
+ } elseif ( !term_exists( $booking->location, $this->location_taxonomy ) ) {
331
+ $booking->validation_errors[] = array(
332
+ 'field' => 'location',
333
+ 'post_variable' => $booking->location,
334
+ 'message' => __( 'The location you selected is not valid. Please select another location.', 'restaurant-reservations' ),
335
+ );
336
+ }
337
+ }
338
+
339
+ /**
340
+ * Save the booking location when the booking is created or updated.
341
+ *
342
+ * @since 1.6
343
+ */
344
+ public function save_booking_location( $booking ) {
345
+
346
+ if ( !empty( $booking->location ) ) {
347
+ wp_set_object_terms( $booking->ID, $booking->location, $this->location_taxonomy );
348
+ }
349
+ }
350
+
351
+ /**
352
+ * Load the booking location when teh booking is loaded
353
+ *
354
+ * @since 1.6
355
+ */
356
+ public function load_booking_location( $booking, $post ) {
357
+
358
+ $terms = wp_get_object_terms( $booking->ID, $this->location_taxonomy, array( 'fields' => 'ids' ) );
359
+
360
+ if ( is_a( $terms, 'WP_Error' ) ) {
361
+ return;
362
+ }
363
+
364
+ $booking->location = current( $terms );
365
+ }
366
+
367
+ /**
368
+ * Add location column to the list table
369
+ *
370
+ * @since 1.6
371
+ */
372
+ public function add_location_column( $columns ) {
373
+
374
+ $first = array_splice( $columns, 0, 2 );
375
+ $first['location'] = __( 'Location', 'restaurant-reservations' );
376
+
377
+ return array_merge( $first, $columns );
378
+ }
379
+
380
+ /**
381
+ * Print the value in the location column for the list table
382
+ *
383
+ * @since 1.6
384
+ */
385
+ public function print_location_column( $value, $booking, $column_name ) {
386
+
387
+ if ( $column_name !== 'location' ) {
388
+ return $value;
389
+ }
390
+
391
+ $terms = wp_get_object_terms( $booking->ID, $this->location_taxonomy );
392
+
393
+ if ( empty( $terms ) || is_a( $terms, 'WP_Error' ) ) {
394
+ return '';
395
+ }
396
+
397
+ $location = current( $terms );
398
+
399
+ return $location->name;
400
+ }
401
+
402
+ /**
403
+ * Add the location to the details column if the column has been
404
+ * hidden
405
+ *
406
+ * @since 1.6
407
+ */
408
+ public function add_details_column_items( $details, $booking ) {
409
+
410
+ global $rtb_controller;
411
+
412
+ $visible_columns = $rtb_controller->bookings->bookings_table->get_columns();
413
+ if ( !isset( $visible_columns['location'] ) ) {
414
+
415
+ $value = $rtb_controller->bookings->bookings_table->column_default( $booking, 'location' );
416
+
417
+ if ( !empty( $value ) ) {
418
+ $details[] = array(
419
+ 'label' => __( 'Location', 'restaurant-reservations' ),
420
+ 'value' => $value,
421
+ );
422
+ }
423
+ }
424
+
425
+ return $details;
426
+ }
427
+
428
+ /**
429
+ * Modify queries to add location taxonomy parameters
430
+ *
431
+ * @param array $args Array of arguments passed to rtbQuery
432
+ * @since 1.6
433
+ */
434
+ public function modify_query( $args, $context = '' ) {
435
+
436
+ global $rtb_controller;
437
+
438
+ if ( !empty( $args['location'] ) && !empty( $rtb_controller->locations->post_type ) ) {
439
+
440
+ if ( !is_array( $args['location'] ) ) {
441
+ $args['location'] = array( $args['location'] );
442
+ }
443
+
444
+ $args['tax_query'] = array(
445
+ array(
446
+ 'taxonomy' => $rtb_controller->locations->location_taxonomy,
447
+ 'field' => 'term_id',
448
+ 'terms' => $args['location'],
449
+
450
+ )
451
+ );
452
+ }
453
+
454
+ return $args;
455
+ }
456
+
457
+ /**
458
+ * Add meta box to the location post editing screen
459
+ *
460
+ * @since 1.6
461
+ */
462
+ public function add_meta_boxes() {
463
+
464
+ $meta_boxes = array(
465
+
466
+ // Metabox to enter schema type
467
+ array(
468
+ 'id' => 'rtb_location',
469
+ 'title' => __( 'Reservations', 'restaurant-reservations' ),
470
+ 'callback' => array( $this, 'print_location_metabox' ),
471
+ 'post_type' => $this->post_type,
472
+ 'context' => 'side',
473
+ 'priority' => 'default',
474
+ ),
475
+ );
476
+
477
+ // Create filter so addons can modify the metaboxes
478
+ $meta_boxes = apply_filters( 'rtb_location_metaboxes', $meta_boxes );
479
+
480
+ // Create the metaboxes
481
+ foreach ( $meta_boxes as $meta_box ) {
482
+ add_meta_box(
483
+ $meta_box['id'],
484
+ $meta_box['title'],
485
+ $meta_box['callback'],
486
+ $meta_box['post_type'],
487
+ $meta_box['context'],
488
+ $meta_box['priority']
489
+ );
490
+ }
491
+ }
492
+
493
+ /**
494
+ * Output a hidden nonce field to secure the saving of term meta
495
+ *
496
+ * @since 1.6
497
+ */
498
+ public function add_meta_nonce() {
499
+ global $post;
500
+ if ( $post->post_type == $this->post_type ) {
501
+ wp_nonce_field( 'rtb_location_meta', 'rtb_location_meta_nonce' );
502
+ }
503
+ }
504
+
505
+ /**
506
+ * Print metabox on location post editing screen
507
+ *
508
+ * @since 1.6
509
+ */
510
+ public function print_location_metabox( $post ) {
511
+
512
+ global $rtb_controller;
513
+
514
+ $notification_email = '';
515
+ $reply_to_name = '';
516
+ $reply_to_address = '';
517
+ $term_id = get_post_meta( $post->ID, $this->location_taxonomy, true );
518
+ $admin_email_option = $rtb_controller->settings->get_setting( 'admin-email-option' );
519
+ if ( $term_id ) {
520
+ $reply_to_name = get_term_meta( $term_id, 'rtb_reply_to_name', true );
521
+ $reply_to_address = get_term_meta( $term_id, 'rtb_reply_to_address', true );
522
+ if ( $admin_email_option ) {
523
+ $notification_email = get_term_meta( $term_id, 'rtb_admin_email_address', true );
524
+ }
525
+ }
526
+
527
+ $append_booking_form = get_post_meta( $post->ID, 'rtb_append_booking_form', true );
528
+
529
+ ?>
530
+
531
+ <style type="text/css">.rtb-location-meta-input + .rtb-location-meta-input { margin-top: 2em; }</style>
532
+
533
+ <div class="rtb-location-meta-input rtb-location-meta-append-form">
534
+ <label>
535
+ <input type="checkbox" name="rtb_append_booking_form" value="1"<?php if ( $append_booking_form ) : ?> checked="checked"<?php endif; ?>>
536
+ <?php esc_html_e( 'Show booking form with this location.', 'restaurant-reservations' ); ?>
537
+ </label>
538
+ </div>
539
+
540
+ <div class="rtb-location-meta-input rtb-location-meta-reply-to-name">
541
+ <label for="rtb_reply_to_name">
542
+ <?php esc_html_e( 'Reply-To Name', 'restaurant-reservations' ); ?>
543
+ </label>
544
+ <input type="text" name="rtb_reply_to_name" id="rtb_reply_to_name" value="<?php esc_attr_e( $reply_to_name ); ?>" placeholder="<?php esc_attr_e( $rtb_controller->settings->get_setting( 'reply-to-name' ) ); ?>">
545
+ <p class="description">
546
+ <?php esc_html_e( 'The name which should appear in the Reply-To field of a user notification email.', 'restaurant-reservations' ); ?>
547
+ </p>
548
+ </div>
549
+
550
+ <div class="rtb-location-meta-input rtb-location-meta-reply-to-address">
551
+ <label for="rtb_reply_to_address">
552
+ <?php esc_html_e( 'Reply-To Email Address', 'restaurant-reservations' ); ?>
553
+ </label>
554
+ <input type="text" name="rtb_reply_to_address" id="rtb_reply_to_address" value="<?php esc_attr_e( $reply_to_address ); ?>" placeholder="<?php esc_attr_e( $rtb_controller->settings->get_setting( 'reply-to-address' ) ); ?>">
555
+ <p class="description">
556
+ <?php esc_html_e( 'The email address which should appear in the Reply-To field of a user notification email.', 'restaurant-reservations' ); ?>
557
+ </p>
558
+ </div>
559
+
560
+ <?php if ( $admin_email_option ) : ?>
561
+ <div class="rtb-location-meta-input rtb-location-meta-admin-email">
562
+ <label for="rtb_admin_email_address">
563
+ <?php esc_html_e( 'Admin Notification Email Address', 'restaurant-reservations' ); ?>
564
+ </label>
565
+ <input type="text" name="rtb_admin_email_address" id="rtb_admin_email_address" value="<?php esc_attr_e( $notification_email ); ?>" placeholder="<?php esc_attr_e( $rtb_controller->settings->get_setting( 'admin-email-address' ) ); ?>">
566
+ <p class="description">
567
+ <?php esc_html_e( 'The email address where admin notifications for bookings at this location should be sent.', 'restaurant-reservations' ); ?>
568
+ </p>
569
+ </div>
570
+ <?php endif; ?>
571
+
572
+ <?php
573
+ }
574
+
575
+ /**
576
+ * Append booking form to a location's `post_content`
577
+ * @since 0.0.1
578
+ */
579
+ public function append_to_content( $content ) {
580
+
581
+ if ( !is_main_query() || !in_the_loop() || post_password_required() ) {
582
+ return $content;
583
+ }
584
+
585
+ global $post;
586
+
587
+ $append_booking_form = get_post_meta( $post->ID, 'rtb_append_booking_form', true );
588
+
589
+ if ( !$append_booking_form ) {
590
+ return $content;
591
+ }
592
+
593
+ $term_id = get_post_meta( $post->ID, $this->location_taxonomy, true );
594
+
595
+ if ( empty( $term_id ) ) {
596
+ return $content;
597
+ }
598
+
599
+ return $content . do_shortcode( '[booking-form location=' . absint( $term_id ) .']' );
600
+ }
601
+
602
+ /**
603
+ * Modify the notification email recipient for each location
604
+ *
605
+ * @since 1.6
606
+ */
607
+ public function notification_to_email( $email, $notification ) {
608
+
609
+ if ( $notification->target == 'user' || empty( $notification->booking->location ) ) {
610
+ return $email;
611
+ }
612
+
613
+ $val = get_term_meta( $notification->booking->location, 'rtb_admin_email_address', true );
614
+ $email = empty( $val ) ? $email : $val;
615
+
616
+ return $email;
617
+ }
618
+
619
+ /**
620
+ * Modify the notification email sender address for each location
621
+ *
622
+ * @since 1.6
623
+ */
624
+ public function notification_from_email( $email, $notification ) {
625
+
626
+ if ( $notification->target != 'user' || empty( $notification->booking->location ) ) {
627
+ return $email;
628
+ }
629
+
630
+ $val = get_term_meta( $notification->booking->location, 'rtb_reply_to_address', true );
631
+ $email = empty( $val ) ? $email : $val;
632
+
633
+ return $email;
634
+ }
635
+
636
+ /**
637
+ * Modify the notification email sender name for each location
638
+ *
639
+ * @since 1.6
640
+ */
641
+ public function notification_from_name( $name, $notification ) {
642
+
643
+ if ( $notification->target != 'user' || empty( $notification->booking->location ) ) {
644
+ return $name;
645
+ }
646
+
647
+ $val = get_term_meta( $notification->booking->location, 'rtb_reply_to_name', true );
648
+ $name = empty( $val ) ? $name : $val;
649
+
650
+ return $name;
651
+ }
652
+ }
653
+ }
includes/Query.class.php CHANGED
@@ -17,6 +17,15 @@ if ( !class_exists( 'rtbQuery' ) ) {
17
  */
18
  class rtbQuery {
19
 
 
 
 
 
 
 
 
 
 
20
  /**
21
  * Query args
22
  *
17
  */
18
  class rtbQuery {
19
 
20
+ /**
21
+ * Bookings
22
+ *
23
+ * Array of bookings retrieved after get_bookings() is called
24
+ *
25
+ * @since 1.4.1
26
+ */
27
+ public $bookings = array();
28
+
29
  /**
30
  * Query args
31
  *
includes/Settings.class.php CHANGED
@@ -711,9 +711,13 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
711
 
712
  /**
713
  * Retrieve form fields
 
 
 
 
714
  * @since 1.3
715
  */
716
- public function get_booking_form_fields( $request = null ) {
717
 
718
  // $request will represent a rtbBooking object with the request
719
  // details when the form is being printed and $_POST data exists
@@ -831,7 +835,7 @@ Sorry, we could not accomodate your booking request. We\'re full or not open at
831
  ),
832
  );
833
 
834
- return apply_filters( 'rtb_booking_form_fields', $fields, $request );
835
  }
836
 
837
  /**
711
 
712
  /**
713
  * Retrieve form fields
714
+ *
715
+ * @param $request rtbBooking Details of a booking request made
716
+ * @param $args array Associative array of arguments to pass to the field:
717
+ * `location` int Location post id
718
  * @since 1.3
719
  */
720
+ public function get_booking_form_fields( $request = null, $args = array() ) {
721
 
722
  // $request will represent a rtbBooking object with the request
723
  // details when the form is being printed and $_POST data exists
835
  ),
836
  );
837
 
838
+ return apply_filters( 'rtb_booking_form_fields', $fields, $request, $args );
839
  }
840
 
841
  /**
includes/WP_List_Table.BookingsTable.class.php CHANGED
@@ -58,6 +58,14 @@ class rtbBookingsTable extends WP_List_Table {
58
  public $filter_start_date = null;
59
  public $filter_end_date = null;
60
 
 
 
 
 
 
 
 
 
61
  /**
62
  * Current query string
63
  *
@@ -191,6 +199,13 @@ class rtbBookingsTable extends WP_List_Table {
191
  $this->query_string = add_query_arg( array( 'end_date' => $this->filter_end_date ), $this->query_string );
192
  }
193
 
 
 
 
 
 
 
 
194
  }
195
 
196
  /**
@@ -216,18 +231,21 @@ class rtbBookingsTable extends WP_List_Table {
216
 
217
  $views = array(
218
  'upcoming' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'paged' => FALSE ), remove_query_arg( array( 'date_range' ), $date_range_query_string ) ) ), $date_range === '' ? ' class="current"' : '', __( 'Upcoming', 'restaurant-reservations' ) ),
219
- 'today' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'date_range' => 'today', 'paged' => FALSE ), $date_range_query_string ) ), $date_range === 'today' ? ' class="current"' : '', __( 'Today', 'restaurant-reservations' ) ),
220
  'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'date_range' => 'all', 'paged' => FALSE ), $date_range_query_string ) ), $date_range == 'all' ? ' class="current"' : '', __( 'All', 'restaurant-reservations' ) ),
221
  );
222
 
223
  if ( $date_range == 'custom' ) {
224
- $views['custom'] = '<span class="current">' . $this->get_current_date_range() . '</span>';
 
 
 
225
  }
226
 
227
  $views = apply_filters( 'rtb_bookings_table_views_date_range', $views );
228
  ?>
229
 
230
- <div id="rtb-filters" class="clearfix">
231
  <ul class="subsubsub rtb-views-date_range">
232
  <li><?php echo join( ' | </li><li>', $views ); ?></li>
233
  </ul>
@@ -237,30 +255,15 @@ class rtbBookingsTable extends WP_List_Table {
237
  <input type="text" id="start-date" name="start_date" class="datepicker" value="<?php echo esc_attr( $this->filter_start_date ); ?>" placeholder="<?php _e( 'Start Date', 'restaurant-reservations' ); ?>" />
238
  <label for="end-date" class="screen-reader-text"><?php _e( 'End Date:', 'restaurant-reservations' ); ?></label>
239
  <input type="text" id="end-date" name="end_date" class="datepicker" value="<?php echo esc_attr( $this->filter_end_date ); ?>" placeholder="<?php _e( 'End Date', 'restaurant-reservations' ); ?>" />
240
- <input type="submit" class="button-secondary" value="<?php _e( 'Apply', 'restaurant-reservations' ); ?>"/>
241
- <?php if( !empty( $start_date ) || !empty( $end_date ) ) : ?>
242
- <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'clear_date_filters' ) ) ); ?>" class="button-secondary"><?php _e( 'Clear Filter', 'restaurant-reservations' ); ?></a>
243
  <?php endif; ?>
244
  </div>
245
 
246
  <?php if( !empty( $_GET['status'] ) ) : ?>
247
  <input type="hidden" name="status" value="<?php echo esc_attr( sanitize_text_field( $_GET['status'] ) ); ?>"/>
248
  <?php endif; ?>
249
-
250
- <?php
251
- // @todo Add support for the search box that uses more than just
252
- // the 's' argument in WP_Query. I need to search at least the
253
- // email post meta as well or this search box could be
254
- // misleading for people who expect to search across all
255
- // visible data
256
- // $this->search_box( __( 'Search', 'restaurant-reservations' ), 'rtb-bookings' );
257
- ?>
258
-
259
- <?php
260
- // @todo use a datepicker. need to bring in styles for jquery ui or use pickadate
261
- // wp_enqueue_script('jquery-ui-datepicker');
262
- ?>
263
-
264
  </div>
265
 
266
  <?php
@@ -285,16 +288,6 @@ class rtbBookingsTable extends WP_List_Table {
285
  return apply_filters( 'rtb_bookings_table_views_status', $views );
286
  }
287
 
288
- /**
289
- * Extra controls to be displayed between bulk actions and pagination
290
- *
291
- * @param string pos Position of this tablenav: `top` or `btm`
292
- * @since 1.4.1
293
- */
294
- public function extra_tablenav( $pos ) {
295
- do_action( 'rtb_bookings_table_actions', $pos );
296
- }
297
-
298
  /**
299
  * Generates content for a single row of the table
300
  * @since 0.0.1
@@ -329,7 +322,7 @@ class rtbBookingsTable extends WP_List_Table {
329
  return $this->visible_columns;
330
  }
331
 
332
- $all_default_columns = $this->get_all_default_columns();
333
 
334
  global $rtb_controller;
335
  $visible_columns = $rtb_controller->settings->get_setting( 'bookings-table-columns' );
@@ -671,6 +664,147 @@ class rtbBookingsTable extends WP_List_Table {
671
  endif;
672
  }
673
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
674
  /**
675
  * Retrieve the counts of bookings
676
  * @since 0.0.1
@@ -704,9 +838,15 @@ class rtbBookingsTable extends WP_List_Table {
704
  $where .= " AND p.post_date >= '" . date( 'Y-m-d H:i:s', current_time( 'timestamp' ) - 3600 ) . "'";
705
  }
706
 
 
 
 
 
 
707
 
708
  $query = "SELECT p.post_status,count( * ) AS num_posts
709
  FROM $wpdb->posts p
 
710
  $where
711
  GROUP BY p.post_status
712
  ";
@@ -744,6 +884,10 @@ class rtbBookingsTable extends WP_List_Table {
744
  $args['end_date'] = $this->filter_end_date;
745
  }
746
 
 
 
 
 
747
  $query = new rtbQuery( $args, 'bookings-table' );
748
  $query->parse_request_args();
749
  $query->prepare_args();
@@ -776,50 +920,5 @@ class rtbBookingsTable extends WP_List_Table {
776
  );
777
  }
778
 
779
- /**
780
- * Add notifications above the table to indicate which bookings are
781
- * being shown.
782
- * @since 1.3
783
- */
784
- public function display_rows_or_placeholder() {
785
-
786
- global $rtb_controller;
787
-
788
- $notifications = array();
789
-
790
- $status = '';
791
- if ( !empty( $_GET['status'] ) ) {
792
- $status = $_GET['status'];
793
- if ( $status == 'trash' ) {
794
- $notifications['status'] = __( "You're viewing bookings that have been moved to the trash.", 'restaurant-reservations' );
795
- } elseif ( !empty( $rtb_controller->cpts->booking_statuses[ $status ] ) ) {
796
- $notifications['status'] = sprintf( _x( "You're viewing bookings that have been marked as %s.", 'Indicates which booking status is currently being filtered in the list of bookings.', 'restaurant-reservations' ), $rtb_controller->cpts->booking_statuses[ $_GET['status'] ]['label'] );
797
- }
798
- }
799
-
800
- if ( !empty( $this->filter_start_date ) || !empty( $this->filter_end_date ) ) {
801
- $notifications['date'] = sprintf( _x( 'Only bookings from %s are being shown.', 'Notification of booking date range, eg - bookings from 2014-12-02-2014-12-05', 'restaurant-reservations' ), $this->get_current_date_range() );
802
- } elseif ( !empty( $_GET['date_range'] ) && $_GET['date_range'] == 'today' ) {
803
- $notifications['date'] = __( "Only today's bookings are being shown.", 'restaurant-reservations' );
804
- } elseif ( empty( $_GET['date_range'] ) ) {
805
- $notifications['date'] = __( 'Only upcoming bookings are being shown.', 'restaurant-reservations' );
806
- }
807
-
808
- $notifications = apply_filters( 'rtb_admin_bookings_table_filter_notifications', $notifications );
809
-
810
- if ( !empty( $notifications ) ) :
811
- ?>
812
-
813
- <tr class="notice <?php echo esc_attr( $status ); ?>">
814
- <td colspan="<?php echo count( $this->get_columns() ); ?>">
815
- <?php echo join( ' ', $notifications ); ?>
816
- </td>
817
- </tr>
818
-
819
- <?php
820
- endif;
821
-
822
- parent::display_rows_or_placeholder();
823
- }
824
  }
825
  } // endif;
58
  public $filter_start_date = null;
59
  public $filter_end_date = null;
60
 
61
+ /**
62
+ * Current location filter
63
+ *
64
+ * @var int
65
+ * @since 1.6
66
+ */
67
+ public $filter_location = 0;
68
+
69
  /**
70
  * Current query string
71
  *
199
  $this->query_string = add_query_arg( array( 'end_date' => $this->filter_end_date ), $this->query_string );
200
  }
201
 
202
+ $this->filter_location = !isset( $_GET['location'] ) ? 0 : absint( $_GET['location'] );
203
+ $this->filter_location = !isset( $_POST['location'] ) ? $this->filter_location : absint( $_POST['location'] );
204
+ $this->query_string = remove_query_arg( 'location', $this->query_string );
205
+ if ( !empty( $this->filter_location ) ) {
206
+ $this->query_string = add_query_arg( array( 'location' => $this->filter_location ), $this->query_string );
207
+ }
208
+
209
  }
210
 
211
  /**
231
 
232
  $views = array(
233
  'upcoming' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'paged' => FALSE ), remove_query_arg( array( 'date_range' ), $date_range_query_string ) ) ), $date_range === '' ? ' class="current"' : '', __( 'Upcoming', 'restaurant-reservations' ) ),
234
+ 'today' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'date_range' => 'today', 'paged' => FALSE ), $date_range_query_string ) ), $date_range === 'today' ? ' class="current"' : '', __( 'Today', 'restaurant-reservations' ) ),
235
  'all' => sprintf( '<a href="%s"%s>%s</a>', esc_url( add_query_arg( array( 'date_range' => 'all', 'paged' => FALSE ), $date_range_query_string ) ), $date_range == 'all' ? ' class="current"' : '', __( 'All', 'restaurant-reservations' ) ),
236
  );
237
 
238
  if ( $date_range == 'custom' ) {
239
+ $views['date'] = '<span class="date-filter-range current">' . $this->get_current_date_range() . '</span>';
240
+ $views['date'] .= '<a id="rtb-date-filter-link" href="#"><span class="dashicons dashicons-calendar"></span> <span class="rtb-date-filter-label">Change date range</span></a>';
241
+ } else {
242
+ $views['date'] = '<a id="rtb-date-filter-link" href="#">' . esc_html__( 'Between dates', 'restaurant-reservations' ) . '</a>';
243
  }
244
 
245
  $views = apply_filters( 'rtb_bookings_table_views_date_range', $views );
246
  ?>
247
 
248
+ <div id="rtb-filters">
249
  <ul class="subsubsub rtb-views-date_range">
250
  <li><?php echo join( ' | </li><li>', $views ); ?></li>
251
  </ul>
255
  <input type="text" id="start-date" name="start_date" class="datepicker" value="<?php echo esc_attr( $this->filter_start_date ); ?>" placeholder="<?php _e( 'Start Date', 'restaurant-reservations' ); ?>" />
256
  <label for="end-date" class="screen-reader-text"><?php _e( 'End Date:', 'restaurant-reservations' ); ?></label>
257
  <input type="text" id="end-date" name="end_date" class="datepicker" value="<?php echo esc_attr( $this->filter_end_date ); ?>" placeholder="<?php _e( 'End Date', 'restaurant-reservations' ); ?>" />
258
+ <input type="submit" class="button button-secondary" value="<?php _e( 'Apply', 'restaurant-reservations' ); ?>"/>
259
+ <?php if( !empty( $this->filter_start_date ) || !empty( $this->filter_end_date ) ) : ?>
260
+ <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'clear_date_filters' ) ) ); ?>" class="button button-secondary"><?php _e( 'Clear Filter', 'restaurant-reservations' ); ?></a>
261
  <?php endif; ?>
262
  </div>
263
 
264
  <?php if( !empty( $_GET['status'] ) ) : ?>
265
  <input type="hidden" name="status" value="<?php echo esc_attr( sanitize_text_field( $_GET['status'] ) ); ?>"/>
266
  <?php endif; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
267
  </div>
268
 
269
  <?php
288
  return apply_filters( 'rtb_bookings_table_views_status', $views );
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * Generates content for a single row of the table
293
  * @since 0.0.1
322
  return $this->visible_columns;
323
  }
324
 
325
+ $all_default_columns = $this->get_all_columns();
326
 
327
  global $rtb_controller;
328
  $visible_columns = $rtb_controller->settings->get_setting( 'bookings-table-columns' );
664
  endif;
665
  }
666
 
667
+ /**
668
+ * Generate the table navigation above or below the table
669
+ *
670
+ * This outputs a separate set of options above and below the table, in
671
+ * order to make room for the locations.
672
+ *
673
+ * @since 1.6
674
+ */
675
+ public function display_tablenav( $which ) {
676
+
677
+ global $rtb_controller;
678
+
679
+ // Just call the parent method if locations aren't activated
680
+ if ( 'top' === $which && empty( $rtb_controller->locations->post_type ) ) {
681
+ $this->add_notification();
682
+ parent::display_tablenav( $which );
683
+ return;
684
+ }
685
+
686
+ // Just call the parent method for the bottom nav
687
+ if ( 'bottom' == $which ) {
688
+ parent::display_tablenav( $which );
689
+ return;
690
+ }
691
+
692
+ $locations = $rtb_controller->locations->get_location_options();
693
+ $all_locations = $rtb_controller->locations->get_location_options( false );
694
+ $inactive_locations = array_diff( $all_locations, $locations );
695
+ ?>
696
+
697
+ <div class="tablenav top rtb-top-actions-wrapper">
698
+ <?php wp_nonce_field( 'bulk-' . $this->args['plural'] ); ?>
699
+ <?php $this->extra_tablenav( $which ); ?>
700
+ </div>
701
+
702
+ <?php $this->add_notification(); ?>
703
+
704
+ <div class="rtb-table-header-controls">
705
+ <?php if ( $this->has_items() ) : ?>
706
+ <div class="actions bulkactions">
707
+ <?php $this->bulk_actions( $which ); ?>
708
+ </div>
709
+ <?php endif; ?>
710
+ <ul class="rtb-locations">
711
+ <li<?php if ( empty( $this->filter_location ) ) : ?> class="current"<?php endif; ?>>
712
+ <a href="<?php echo esc_url( remove_query_arg( 'location', $this->query_string ) ); ?>"><?php esc_html_e( 'All Locations', 'restaurant-reservations' ); ?></a>
713
+ </li>
714
+ <?php
715
+ $i = 0;
716
+ foreach( $locations as $term_id => $name ) :
717
+ if ( $i > 15 ) {
718
+ break;
719
+ } else {
720
+ $i++;
721
+ }
722
+ ?>
723
+
724
+ <li<?php if ( $this->filter_location == $term_id ) : ?> class="current"<?php endif; ?>>
725
+ <a href="<?php echo esc_url( add_query_arg( 'location', $term_id, $this->query_string ) ); ?>">
726
+ <?php esc_html_e( $name ); ?>
727
+ </a>
728
+ </li>
729
+ <?php endforeach; ?>
730
+ </ul>
731
+ <div class="rtb-location-switch">
732
+ <select name="location">
733
+ <option><?php esc_attr_e( 'All Locations', 'restaurant-reservations' ); ?></option>
734
+ <?php foreach( $locations as $term_id => $name ) : ?>
735
+ <option value="<?php esc_attr_e( $term_id ); ?>"<?php if ( $this->filter_location == $term_id ) : ?> selected="selected"<?php endif; ?>>
736
+ <?php esc_attr_e( $name ); ?>
737
+ </option>
738
+ <?php endforeach; ?>
739
+ <?php if ( !empty( $inactive_locations ) ) : ?>
740
+ <optgroup label="<?php esc_attr_e( 'Inactive Locations' ); ?>">
741
+ <?php foreach( $inactive_locations as $term_id => $name ) : ?>
742
+ <option value="<?php esc_attr_e( $term_id ); ?>"<?php if ( $this->filter_location == $term_id ) : ?> selected="selected"<?php endif; ?>>
743
+ <?php esc_attr_e( $name ); ?>
744
+ </option>
745
+ <?php endforeach; ?>
746
+ </optgroup>
747
+ <?php endif; ?>
748
+ </select>
749
+ <input type="submit" class="button rtb-locations-button" value="<?php esc_attr_e( 'Switch', 'restaurant-reservations' ); ?>">
750
+ </div>
751
+ </div>
752
+
753
+ <?php
754
+ }
755
+
756
+ /**
757
+ * Extra controls to be displayed between bulk actions and pagination
758
+ *
759
+ * @param string pos Position of this tablenav: `top` or `btm`
760
+ * @since 1.4.1
761
+ */
762
+ public function extra_tablenav( $pos ) {
763
+ do_action( 'rtb_bookings_table_actions', $pos );
764
+ }
765
+
766
+ /**
767
+ * Add notifications above the table to indicate which bookings are
768
+ * being shown.
769
+ * @since 1.3
770
+ */
771
+ public function add_notification() {
772
+
773
+ global $rtb_controller;
774
+
775
+ $notifications = array();
776
+
777
+ $status = '';
778
+ if ( !empty( $_GET['status'] ) ) {
779
+ $status = $_GET['status'];
780
+ if ( $status == 'trash' ) {
781
+ $notifications['status'] = __( "You're viewing bookings that have been moved to the trash.", 'restaurant-reservations' );
782
+ } elseif ( !empty( $rtb_controller->cpts->booking_statuses[ $status ] ) ) {
783
+ $notifications['status'] = sprintf( _x( "You're viewing bookings that have been marked as %s.", 'Indicates which booking status is currently being filtered in the list of bookings.', 'restaurant-reservations' ), $rtb_controller->cpts->booking_statuses[ $_GET['status'] ]['label'] );
784
+ }
785
+ }
786
+
787
+ if ( !empty( $this->filter_start_date ) || !empty( $this->filter_end_date ) ) {
788
+ $notifications['date'] = sprintf( _x( 'Only bookings from %s are being shown.', 'Notification of booking date range, eg - bookings from 2014-12-02-2014-12-05', 'restaurant-reservations' ), $this->get_current_date_range() );
789
+ } elseif ( !empty( $_GET['date_range'] ) && $_GET['date_range'] == 'today' ) {
790
+ $notifications['date'] = __( "Only today's bookings are being shown.", 'restaurant-reservations' );
791
+ } elseif ( empty( $_GET['date_range'] ) ) {
792
+ $notifications['date'] = __( 'Only upcoming bookings are being shown.', 'restaurant-reservations' );
793
+ }
794
+
795
+ $notifications = apply_filters( 'rtb_admin_bookings_table_filter_notifications', $notifications );
796
+
797
+ if ( !empty( $notifications ) ) :
798
+ ?>
799
+
800
+ <div class="rtb-notice <?php echo esc_attr( $status ); ?>">
801
+ <?php echo join( ' ', $notifications ); ?>
802
+ </div>
803
+
804
+ <?php
805
+ endif;
806
+ }
807
+
808
  /**
809
  * Retrieve the counts of bookings
810
  * @since 0.0.1
838
  $where .= " AND p.post_date >= '" . date( 'Y-m-d H:i:s', current_time( 'timestamp' ) - 3600 ) . "'";
839
  }
840
 
841
+ $join = '';
842
+ if ( $this->filter_location ) {
843
+ $join .= " LEFT JOIN $wpdb->term_relationships t ON (t.object_id=p.ID)";
844
+ $where .= " AND t.term_taxonomy_id=" . absint( $this->filter_location );
845
+ }
846
 
847
  $query = "SELECT p.post_status,count( * ) AS num_posts
848
  FROM $wpdb->posts p
849
+ $join
850
  $where
851
  GROUP BY p.post_status
852
  ";
884
  $args['end_date'] = $this->filter_end_date;
885
  }
886
 
887
+ if ( !empty( $this->filter_location ) ) {
888
+ $args['location'] = $this->filter_location;
889
+ }
890
+
891
  $query = new rtbQuery( $args, 'bookings-table' );
892
  $query->parse_request_args();
893
  $query->prepare_args();
920
  );
921
  }
922
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
923
  }
924
  } // endif;
includes/integrations/business-profile.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( !defined( 'ABSPATH' ) ) exit;
2
+ /**
3
+ * Business Profile: Enable multi-location support in Restaurant Reservations
4
+ * when locations are activated in Business Profile
5
+ *
6
+ * @param string $post_type The post type to use for locations
7
+ * @since 1.6
8
+ */
9
+ function rtb_bp_maybe_enable_bp_locations( $post_type ) {
10
+
11
+ // Don't override a post type that's already been set
12
+ if ( $post_type ) {
13
+ return $post_type;
14
+ }
15
+
16
+ global $bpfwp_controller;
17
+ if ( isset( $bpfwp_controller ) && isset( $bpfwp_controller->cpts ) ) {
18
+ return $bpfwp_controller->cpts->location_cpt_slug;
19
+ }
20
+
21
+ return $post_type;
22
+ }
23
+ add_filter( 'rtb_set_locations_post_type', 'rtb_bp_maybe_enable_bp_locations' );
24
+
25
+ /**
26
+ * Business Profile: Add a default display setting for the booking link
27
+ *
28
+ * @param array $defaults Array of display settings
29
+ * @since 1.6
30
+ */
31
+ function rtb_bp_booking_link_default( $defaults ) {
32
+
33
+ $defaults['show_booking_link'] = true;
34
+
35
+ return $defaults;
36
+ }
37
+ add_filter( 'bpfwp_default_display_settings','rtb_bp_booking_link_default' );
38
+
39
+ /**
40
+ * Business Profile: Add callback to print the booking link in contact cards
41
+ *
42
+ * @param array $data Key/value list of callbacks for printing card details
43
+ * @since 1.6
44
+ */
45
+ function rtb_bp_add_booking_link_callback( $data ) {
46
+
47
+ global $rtb_controller;
48
+ $booking_page = $rtb_controller->settings->get_setting( 'booking-page' );
49
+
50
+ if ( !empty( $booking_page ) ) {
51
+
52
+ // Place the link at the end of other short links if they're
53
+ // displayed
54
+ if ( isset( $data['contact'] ) ) {
55
+ $pos = array_search( 'contact', array_keys( $data ) );
56
+ } elseif ( isset( $data['phone'] ) ) {
57
+ $pos = array_search( 'phone', array_keys( $data ) );
58
+ } elseif ( isset( $data['address'] ) ) {
59
+ $pos = array_search( 'address', array_keys( $data ) );
60
+ }
61
+
62
+ if ( !empty( $pos ) ) {
63
+ $a = array_slice( $data, 0, $pos );
64
+ $b = array_slice( $data, $pos );
65
+ $data = array_merge( $a, array( 'booking_page' => 'rtb_bp_print_booking_link' ), $b );
66
+ } else {
67
+ // If no short links are being displayed, just add it to the bottom.
68
+ $data['booking_page'] = 'rtb_bp_print_booking_link';
69
+ }
70
+ }
71
+
72
+ return $data;
73
+ }
74
+ add_filter( 'bpwfwp_component_callbacks', 'rtb_bp_add_booking_link_callback' );
75
+
76
+ /**
77
+ * Print the booking link
78
+ *
79
+ * @param bool|int $location Optional location post ID being displayed
80
+ * @since 1.6
81
+ */
82
+ function rtb_bp_print_booking_link( $location = false ) {
83
+
84
+ global $rtb_controller;
85
+
86
+ $booking_page = $rtb_controller->settings->get_setting( 'booking-page' );
87
+
88
+ if ( $location && get_post_meta( $location, 'rtb_append_booking_form', true ) ) {
89
+ $booking_page = $location;
90
+ }
91
+
92
+ $schema_type = 'Organization';
93
+ if ( function_exists( 'bpfwp_setting' ) ) {
94
+ $schema_type = bpfwp_setting( 'schema-type', $location );
95
+ }
96
+
97
+ if ( bpfwp_get_display( 'show_booking_link' ) ) :
98
+ ?>
99
+ <div class="bp-booking">
100
+ <a href="<?php echo esc_url( get_permalink( $booking_page ) ); ?>"<?php if ( rtb_bp_is_schema_type_compatible( $schema_type ) ) : ?> itemprop="acceptsReservations"<?php endif; ?>><?php _e( 'Book a table', 'business-profile' ); ?></a>
101
+ </div>
102
+
103
+ <?php elseif ( rtb_bp_is_schema_type_compatible( $schema_type ) ) : ?>
104
+ <meta itemprop="acceptsReservations" content="<?php echo esc_url( get_permalink( $booking_page ) ); ?>">
105
+ <?php
106
+ endif;
107
+ }
108
+
109
+ /**
110
+ * Business Profile: Add an option to the contact card widget to show/hide the
111
+ * booking link
112
+ *
113
+ * @param array $toggles Key/value list of show/hide checkbox toggles
114
+ * @since 1.6
115
+ */
116
+ function rtb_bp_add_booking_link_widget_option( $toggles ) {
117
+
118
+ // Place the option below the contact option
119
+ $pos = array_search( 'show_contact', array_keys( $toggles ) );
120
+
121
+ if ( ! empty( $pos ) ) {
122
+ $a = array_slice( $toggles, 0, $pos );
123
+ $b = array_slice( $toggles, $pos );
124
+ $toggles = array_merge( $a, array( 'show_booking_link' => __( 'Show book a table link', 'business-profile' ) ) , $b );
125
+ } else {
126
+ // If no short links are being displayed, just add it to the bottom.
127
+ $toggles['show_booking_link'] = __( 'Show book a table link', 'business-profile' );
128
+ }
129
+
130
+ return $toggles;
131
+ }
132
+ add_filter( 'bpfwp_widget_display_toggles', 'rtb_bp_add_booking_link_widget_option' );
133
+
134
+ /**
135
+ * Business Profile: Check if a given schema type supports the
136
+ *`acceptsReservations` param
137
+ *
138
+ * Only `FoodEstablishment` and child schemas of that type are allowed to use
139
+ * the `acceptsReservations` parameter.
140
+ *
141
+ * @param string $type Schema type. See: https://schema.org/docs/full.html
142
+ * @since 1.6
143
+ */
144
+ function rtb_bp_is_schema_type_compatible( $type ) {
145
+
146
+ $food_schema_types = rtb_bp_food_schema_types();
147
+
148
+ $allowed_schema_types = array_keys( $food_schema_types );
149
+ $allowed_schema_types[] = 'FoodEstablishment';
150
+
151
+ return in_array( $type, $allowed_schema_types );
152
+ }
153
+
154
+ /**
155
+ * Business Profile: Add all FoodEstablishment sub-types to the list of
156
+ * available schema
157
+ *
158
+ * @param array $schema_types Key/value with id/label of schema types
159
+ * @since 1.6
160
+ */
161
+ function rtb_bp_schema_types( $schema_types ) {
162
+
163
+ $pos = array_search( 'FoodEstablishment', array_keys( $schema_types ) ) + 1;
164
+
165
+ // Do nothing if no Food Establishment has been found
166
+ if ( empty( $pos ) ) {
167
+ return $schema_types;
168
+ }
169
+
170
+ $a = array_slice( $schema_types, 0, $pos );
171
+ $b = array_slice( $schema_types, $pos );
172
+ $schema_types = array_merge( $a, rtb_bp_food_schema_types(), $b );
173
+
174
+ return $schema_types;
175
+ }
176
+ add_filter( 'bp_schema_types', 'rtb_bp_schema_types' );
177
+
178
+ /**
179
+ * Business Profile: Get an array of all FoodEstablishment sub-types with
180
+ * labels
181
+ *
182
+ * @since 1.6
183
+ */
184
+ function rtb_bp_food_schema_types() {
185
+
186
+ return array(
187
+ 'Baker' => __( '--- Baker', 'restaurant-reservations' ),
188
+ 'BarOrPub' => __( '--- Bar or Pub', 'restaurant-reservations' ),
189
+ 'Brewery' => __( '--- Brewery', 'restaurant-reservations' ),
190
+ 'CafeOrCoffeeShop' => __( '--- Cafe or Coffee Shop', 'restaurant-reservations' ),
191
+ 'FastFoodRestaurant' => __( '--- FastFoodRestaurant', 'restaurant-reservations' ),
192
+ 'IceCreamShop' => __( '--- Ice Cream Shop', 'restaurant-reservations' ),
193
+ 'Restaurant' => __( '--- Restaurant', 'restaurant-reservations' ),
194
+ 'Winery' => __( '--- Winery', 'restaurant-reservations' ),
195
+ );
196
+ }
includes/integrations/woocommerce.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php if ( !defined( 'ABSPATH' ) ) exit;
2
+ /**
3
+ * WooCommerce: Allow booking managers to access the backend
4
+ *
5
+ * This overrides code in WooCommerce which blocks all non-WooCommerce users
6
+ * from accessing the WordPress admin. It allows bookings managers to view the
7
+ * backend.
8
+ *
9
+ * @param bool $block Whether or not to block the user
10
+ * @since 1.6
11
+ */
12
+ function rtb_woocommerce_allow_booking_managers_access( $block ) {
13
+
14
+ if ( current_user_can( 'manage_bookings' ) ) {
15
+ return false;
16
+ }
17
+
18
+ return $block;
19
+ }
20
+ add_filter( 'woocommerce_prevent_admin_access', 'rtb_woocommerce_allow_booking_managers_access' );
includes/template-functions.php CHANGED
@@ -8,8 +8,17 @@
8
  * @since 0.0.1
9
  */
10
  if ( !function_exists( 'rtb_booking_form_shortcode' ) ) {
11
- function rtb_booking_form_shortcode() {
12
- return rtb_print_booking_form();
 
 
 
 
 
 
 
 
 
13
  }
14
  add_shortcode( 'booking-form', 'rtb_booking_form_shortcode' );
15
  } // endif;
@@ -20,7 +29,7 @@ add_shortcode( 'booking-form', 'rtb_booking_form_shortcode' );
20
  * @since 0.0.1
21
  */
22
  if ( !function_exists( 'rtb_print_booking_form' ) ) {
23
- function rtb_print_booking_form() {
24
 
25
  global $rtb_controller;
26
 
@@ -31,6 +40,13 @@ function rtb_print_booking_form() {
31
  $rtb_controller->form_rendered = true;
32
  }
33
 
 
 
 
 
 
 
 
34
  // Enqueue assets for the form
35
  rtb_enqueue_assets();
36
 
@@ -58,7 +74,7 @@ function rtb_print_booking_form() {
58
  }
59
 
60
  // Retrieve the form fields
61
- $fields = $rtb_controller->settings->get_booking_form_fields( $rtb_controller->request );
62
 
63
  ob_start();
64
 
@@ -73,6 +89,10 @@ function rtb_print_booking_form() {
73
  <form method="POST" action="<?php echo esc_attr( $booking_page ); ?>">
74
  <input type="hidden" name="action" value="booking_request">
75
 
 
 
 
 
76
  <?php do_action( 'rtb_booking_form_before_fields' ); ?>
77
 
78
  <?php foreach( $fields as $fieldset => $contents ) :
8
  * @since 0.0.1
9
  */
10
  if ( !function_exists( 'rtb_booking_form_shortcode' ) ) {
11
+ function rtb_booking_form_shortcode( $args = array() ) {
12
+
13
+ $args = shortcode_atts(
14
+ array(
15
+ 'location' => 0,
16
+ ),
17
+ $args,
18
+ 'booking-form'
19
+ );
20
+
21
+ return rtb_print_booking_form( $args );
22
  }
23
  add_shortcode( 'booking-form', 'rtb_booking_form_shortcode' );
24
  } // endif;
29
  * @since 0.0.1
30
  */
31
  if ( !function_exists( 'rtb_print_booking_form' ) ) {
32
+ function rtb_print_booking_form( $args = array() ) {
33
 
34
  global $rtb_controller;
35
 
40
  $rtb_controller->form_rendered = true;
41
  }
42
 
43
+ // Sanitize incoming arguments
44
+ if ( isset( $args['location'] ) ) {
45
+ $args['location'] = absint( $args['location'] );
46
+ } else {
47
+ $args['location'] = 0;
48
+ }
49
+
50
  // Enqueue assets for the form
51
  rtb_enqueue_assets();
52
 
74
  }
75
 
76
  // Retrieve the form fields
77
+ $fields = $rtb_controller->settings->get_booking_form_fields( $rtb_controller->request, $args );
78
 
79
  ob_start();
80
 
89
  <form method="POST" action="<?php echo esc_attr( $booking_page ); ?>">
90
  <input type="hidden" name="action" value="booking_request">
91
 
92
+ <?php if ( !empty( $args['location'] ) && term_exists( $args['location'], $rtb_controller->locations->location_taxonomy ) ) : ?>
93
+ <input type="hidden" name="rtb-location" value="<?php echo absint( $args['location'] ); ?>">
94
+ <?php endif; ?>
95
+
96
  <?php do_action( 'rtb_booking_form_before_fields' ); ?>
97
 
98
  <?php foreach( $fields as $fieldset => $contents ) :
languages/restaurant-reservations.pot CHANGED
@@ -1,15 +1,15 @@
1
- # Copyright (C) 2015 Restaurant Reservations
2
  # This file is distributed under the same license as the Restaurant Reservations package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Restaurant Reservations 1.5\n"
6
  "Report-Msgid-Bugs-To: "
7
- "http://wordpress.org/support/plugin/restaurant-reservations\n"
8
- "POT-Creation-Date: 2015-12-17 15:05:31+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: grunt-wp-i18n 0.4.9\n"
@@ -26,7 +26,7 @@ msgstr ""
26
  "X-Textdomain-Support: yes\n"
27
 
28
  #: includes/Addons.class.php:101
29
- #: includes/WP_List_Table.BookingsTable.class.php:407
30
  msgid "Loading"
31
  msgstr ""
32
 
@@ -52,101 +52,101 @@ msgid ""
52
  "target=\"_blank\">support forums</a>."
53
  msgstr ""
54
 
55
- #: includes/AdminBookings.class.php:72
56
  msgid "Restaurant Bookings"
57
  msgstr ""
58
 
59
- #: includes/AdminBookings.class.php:73 includes/CustomPostTypes.class.php:42
60
  msgid "Add New"
61
  msgstr ""
62
 
63
- #: includes/AdminBookings.class.php:106 includes/AdminBookings.class.php:208
64
  msgid "Columns"
65
  msgstr ""
66
 
67
- #: includes/AdminBookings.class.php:146 restaurant-reservations.php:226
68
  msgid "Add Booking"
69
  msgstr ""
70
 
71
- #: includes/AdminBookings.class.php:149 includes/AdminBookings.class.php:190
72
- #: includes/AdminBookings.class.php:236
73
  msgid "Cancel"
74
  msgstr ""
75
 
76
- #: includes/AdminBookings.class.php:170 includes/AdminBookings.class.php:187
77
- #: includes/WP_List_Table.BookingsTable.class.php:426
78
  msgid "Send Email"
79
  msgstr ""
80
 
81
- #: includes/AdminBookings.class.php:177
82
  msgid "Subject"
83
  msgstr ""
84
 
85
- #: includes/AdminBookings.class.php:181 includes/Settings.class.php:826
86
- #: includes/WP_List_Table.BookingsTable.class.php:448
87
  msgid "Message"
88
  msgstr ""
89
 
90
- #: includes/AdminBookings.class.php:233
91
  msgid "Update"
92
  msgstr ""
93
 
94
- #: includes/AdminBookings.class.php:252 includes/AdminBookings.class.php:261
95
  msgid "Close"
96
  msgstr ""
97
 
98
- #: includes/AdminBookings.class.php:327
99
  msgid "Booking Status"
100
  msgstr ""
101
 
102
- #: includes/AdminBookings.class.php:335
103
  msgid "Send notifications"
104
  msgstr ""
105
 
106
- #: includes/AdminBookings.class.php:340
107
  msgid "Learn more"
108
  msgstr ""
109
 
110
- #: includes/AdminBookings.class.php:341
111
  msgid ""
112
  "When adding a booking or changing a booking's status with this form, no "
113
  "email notifications will be sent. Check this option if you want to send "
114
  "email notifications."
115
  msgstr ""
116
 
117
- #: includes/AdminBookings.class.php:395
118
  msgid "You have been logged out. Please %slogin again%s."
119
  msgstr ""
120
 
121
- #: includes/AdminBookings.class.php:431
122
  msgid ""
123
  "This booking has been sent to the %sTrash%s where it can not be edited. Set "
124
  "the booking to Pending or Confirmed to edit it."
125
  msgstr ""
126
 
127
- #: includes/AdminBookings.class.php:448
128
  msgid "The booking could not be retrieved. Please reload the page and try again."
129
  msgstr ""
130
 
131
- #: includes/AdminBookings.class.php:530
132
  msgid ""
133
  "Unable to trash this post. Please try again. If you continue to have "
134
  "trouble, please refresh the page."
135
  msgstr ""
136
 
137
- #: includes/AdminBookings.class.php:572
138
  msgid "Please enter a message before sending the email."
139
  msgstr ""
140
 
141
- #: includes/AdminBookings.class.php:581
142
  msgid "The email could not be sent because some critical information was missing."
143
  msgstr ""
144
 
145
- #: includes/AdminBookings.class.php:593
146
  msgid "There was an error loading the booking and the email was not sent."
147
  msgstr ""
148
 
149
- #: includes/AdminBookings.class.php:631
150
  msgid "You must select at least one column to display."
151
  msgstr ""
152
 
@@ -228,12 +228,12 @@ msgstr ""
228
 
229
  #: includes/CustomPostTypes.class.php:38 includes/CustomPostTypes.class.php:40
230
  #: includes/CustomPostTypes.class.php:41
231
- #: includes/WP_List_Table.BookingsTable.class.php:105
232
  msgid "Bookings"
233
  msgstr ""
234
 
235
  #: includes/CustomPostTypes.class.php:39
236
- #: includes/WP_List_Table.BookingsTable.class.php:104
237
  msgid "Booking"
238
  msgstr ""
239
 
@@ -241,7 +241,7 @@ msgstr ""
241
  msgid "Add New Booking"
242
  msgstr ""
243
 
244
- #: includes/CustomPostTypes.class.php:44 restaurant-reservations.php:227
245
  msgid "Edit Booking"
246
  msgstr ""
247
 
@@ -269,13 +269,13 @@ msgstr ""
269
  msgid "All Bookings"
270
  msgstr ""
271
 
272
- #: includes/CustomPostTypes.class.php:93
273
  msgid "Confirmed <span class=\"count\">(%s)</span>"
274
  msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
275
  msgstr[0] ""
276
  msgstr[1] ""
277
 
278
- #: includes/CustomPostTypes.class.php:104
279
  msgid "Closed <span class=\"count\">(%s)</span>"
280
  msgid_plural "Closed <span class=\"count\">(%s)</span>"
281
  msgstr[0] ""
@@ -310,6 +310,58 @@ msgid ""
310
  "and try again."
311
  msgstr ""
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  #: includes/Notification.class.php:88
314
  msgid "View pending bookings"
315
  msgstr ""
@@ -423,7 +475,9 @@ msgid "Early Bookings"
423
  msgstr ""
424
 
425
  #: includes/Settings.class.php:414
426
- msgid "Select how early customers can make their booking."
 
 
427
  msgstr ""
428
 
429
  #: includes/Settings.class.php:417
@@ -455,7 +509,9 @@ msgid "Late Bookings"
455
  msgstr ""
456
 
457
  #: includes/Settings.class.php:434
458
- msgid "Select how late customers can make their booking."
 
 
459
  msgstr ""
460
 
461
  #: includes/Settings.class.php:437
@@ -536,26 +592,12 @@ msgstr ""
536
  msgid "Notifications"
537
  msgstr ""
538
 
539
- #: includes/Settings.class.php:498
540
- msgid "Reply-To Name"
541
- msgstr ""
542
-
543
  #: includes/Settings.class.php:499
544
  msgid ""
545
  "The name which should appear in the Reply-To field of a user notification "
546
  "email"
547
  msgstr ""
548
 
549
- #: includes/Settings.class.php:510
550
- msgid "Reply-To Email Address"
551
- msgstr ""
552
-
553
- #: includes/Settings.class.php:511
554
- msgid ""
555
- "The email address which should appear in the Reply-To field of a user "
556
- "notification email."
557
- msgstr ""
558
-
559
  #: includes/Settings.class.php:522
560
  msgid "Admin Notification"
561
  msgstr ""
@@ -683,216 +725,234 @@ msgstr ""
683
  msgid "Any size"
684
  msgstr ""
685
 
686
- #: includes/Settings.class.php:767
 
687
  msgid "Book a table"
688
  msgstr ""
689
 
690
- #: includes/Settings.class.php:770
691
- #: includes/WP_List_Table.BookingsTable.class.php:364
692
  msgid "Date"
693
  msgstr ""
694
 
695
- #: includes/Settings.class.php:776
696
  msgid "Time"
697
  msgstr ""
698
 
699
- #: includes/Settings.class.php:782
700
- #: includes/WP_List_Table.BookingsTable.class.php:365
701
  msgid "Party"
702
  msgstr ""
703
 
704
- #: includes/Settings.class.php:795
705
  msgid "Contact Details"
706
  msgstr ""
707
 
708
- #: includes/Settings.class.php:798
709
- #: includes/WP_List_Table.BookingsTable.class.php:366
710
  msgid "Name"
711
  msgstr ""
712
 
713
- #: includes/Settings.class.php:804
714
- #: includes/WP_List_Table.BookingsTable.class.php:367
715
  msgid "Email"
716
  msgstr ""
717
 
718
- #: includes/Settings.class.php:813
719
- #: includes/WP_List_Table.BookingsTable.class.php:368
720
  msgid "Phone"
721
  msgstr ""
722
 
723
- #: includes/Settings.class.php:821
724
  msgid "Add a Message"
725
  msgstr ""
726
 
727
- #: includes/Settings.class.php:871
728
  msgid "Email of the user who made the booking"
729
  msgstr ""
730
 
731
- #: includes/Settings.class.php:872
732
  msgid "* Name of the user who made the booking"
733
  msgstr ""
734
 
735
- #: includes/Settings.class.php:873
736
  msgid "* Number of people booked"
737
  msgstr ""
738
 
739
- #: includes/Settings.class.php:874
740
  msgid "* Date and time of the booking"
741
  msgstr ""
742
 
743
- #: includes/Settings.class.php:875
744
  msgid "Phone number if supplied with the request"
745
  msgstr ""
746
 
747
- #: includes/Settings.class.php:876
748
  msgid "Message added to the request"
749
  msgstr ""
750
 
751
- #: includes/Settings.class.php:877
752
  msgid "A link to the admin panel showing pending bookings"
753
  msgstr ""
754
 
755
- #: includes/Settings.class.php:878
756
  msgid "A link to confirm this booking. Only include this in admin notifications"
757
  msgstr ""
758
 
759
- #: includes/Settings.class.php:879
760
  msgid "A link to reject this booking. Only include this in admin notifications"
761
  msgstr ""
762
 
763
- #: includes/Settings.class.php:880
764
  msgid "The name of this website"
765
  msgstr ""
766
 
767
- #: includes/Settings.class.php:881
768
  msgid "A link to this website"
769
  msgstr ""
770
 
771
- #: includes/Settings.class.php:882
772
  msgid "Current date and time"
773
  msgstr ""
774
 
775
- #: includes/WP_List_Table.BookingsTable.class.php:218
776
  msgid "Upcoming"
777
  msgstr ""
778
 
779
- #: includes/WP_List_Table.BookingsTable.class.php:219
780
  msgid "Today"
781
  msgstr ""
782
 
783
- #: includes/WP_List_Table.BookingsTable.class.php:220
784
- #: includes/WP_List_Table.BookingsTable.class.php:278
785
  msgid "All"
786
  msgstr ""
787
 
788
- #: includes/WP_List_Table.BookingsTable.class.php:236
 
 
 
 
789
  msgid "Start Date:"
790
  msgstr ""
791
 
792
- #: includes/WP_List_Table.BookingsTable.class.php:237
793
  msgid "Start Date"
794
  msgstr ""
795
 
796
- #: includes/WP_List_Table.BookingsTable.class.php:238
797
  msgid "End Date:"
798
  msgstr ""
799
 
800
- #: includes/WP_List_Table.BookingsTable.class.php:239
801
  msgid "End Date"
802
  msgstr ""
803
 
804
- #: includes/WP_List_Table.BookingsTable.class.php:240
805
  msgid "Apply"
806
  msgstr ""
807
 
808
- #: includes/WP_List_Table.BookingsTable.class.php:242
809
  msgid "Clear Filter"
810
  msgstr ""
811
 
812
- #: includes/WP_List_Table.BookingsTable.class.php:279
813
  msgid "Pending"
814
  msgstr ""
815
 
816
- #: includes/WP_List_Table.BookingsTable.class.php:280
817
  msgid "Confirmed"
818
  msgstr ""
819
 
820
- #: includes/WP_List_Table.BookingsTable.class.php:281
821
  msgid "Closed"
822
  msgstr ""
823
 
824
- #: includes/WP_List_Table.BookingsTable.class.php:282
825
- #: includes/WP_List_Table.BookingsTable.class.php:412
826
  msgid "Trash"
827
  msgstr ""
828
 
829
- #: includes/WP_List_Table.BookingsTable.class.php:369
830
  msgid "Status"
831
  msgstr ""
832
 
833
- #: includes/WP_List_Table.BookingsTable.class.php:370
834
  msgid "Details"
835
  msgstr ""
836
 
837
- #: includes/WP_List_Table.BookingsTable.class.php:411
838
  msgid "Edit"
839
  msgstr ""
840
 
841
- #: includes/WP_List_Table.BookingsTable.class.php:529
842
  msgid "Delete"
843
  msgstr ""
844
 
845
- #: includes/WP_List_Table.BookingsTable.class.php:530
846
  msgid "Set To Confirmed"
847
  msgstr ""
848
 
849
- #: includes/WP_List_Table.BookingsTable.class.php:531
850
  msgid "Set To Pending Review"
851
  msgstr ""
852
 
853
- #: includes/WP_List_Table.BookingsTable.class.php:532
854
  msgid "Set To Closed"
855
  msgstr ""
856
 
857
- #: includes/WP_List_Table.BookingsTable.class.php:646
858
  msgid "%d booking deleted successfully."
859
  msgid_plural "%d bookings deleted successfully."
860
  msgstr[0] ""
861
  msgstr[1] ""
862
 
863
- #: includes/WP_List_Table.BookingsTable.class.php:649
864
  msgid "%d booking confirmed."
865
  msgid_plural "%d bookings confirmed."
866
  msgstr[0] ""
867
  msgstr[1] ""
868
 
869
- #: includes/WP_List_Table.BookingsTable.class.php:652
870
  msgid "%d booking set to pending."
871
  msgid_plural "%d bookings set to pending."
872
  msgstr[0] ""
873
  msgstr[1] ""
874
 
875
- #: includes/WP_List_Table.BookingsTable.class.php:655
876
  msgid "%d booking closed."
877
  msgid_plural "%d bookings closed."
878
  msgstr[0] ""
879
  msgstr[1] ""
880
 
881
- #: includes/WP_List_Table.BookingsTable.class.php:667
882
  msgid "%d booking had errors and could not be processed."
883
  msgid_plural "%d bookings had errors and could not be processed."
884
  msgstr[0] ""
885
  msgstr[1] ""
886
 
887
- #: includes/WP_List_Table.BookingsTable.class.php:794
 
 
 
 
 
 
 
 
 
 
 
 
 
888
  msgid "You're viewing bookings that have been moved to the trash."
889
  msgstr ""
890
 
891
- #: includes/WP_List_Table.BookingsTable.class.php:803
892
  msgid "Only today's bookings are being shown."
893
  msgstr ""
894
 
895
- #: includes/WP_List_Table.BookingsTable.class.php:805
896
  msgid "Only upcoming bookings are being shown."
897
  msgstr ""
898
 
@@ -908,7 +968,44 @@ msgstr ""
908
  msgid "Title"
909
  msgstr ""
910
 
911
- #: includes/template-functions.php:106
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
912
  msgid "Request Booking"
913
  msgstr ""
914
 
@@ -916,21 +1013,36 @@ msgstr ""
916
  msgid "You do not have sufficient permissions to access this page."
917
  msgstr ""
918
 
919
- #: restaurant-reservations.php:157
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
920
  msgid "Booking Manager"
921
  msgstr ""
922
 
923
- #: restaurant-reservations.php:228
924
  msgid ""
925
  "An unspecified error occurred. Please try again. If the problem persists, "
926
  "try logging out and logging back in."
927
  msgstr ""
928
 
929
- #: restaurant-reservations.php:290
930
  msgid "View the help documentation for Restaurant Reservations"
931
  msgstr ""
932
 
933
- #: restaurant-reservations.php:290
934
  msgid "Help"
935
  msgstr ""
936
 
@@ -938,9 +1050,9 @@ msgstr ""
938
  msgid "Restaurant Reservations"
939
  msgstr ""
940
 
941
- #. #-#-#-#-# restaurant-reservations.pot (Restaurant Reservations 1.5) #-#-#-#-#
942
  #. Plugin URI of the plugin/theme
943
- #. #-#-#-#-# restaurant-reservations.pot (Restaurant Reservations 1.5) #-#-#-#-#
944
  #. Author URI of the plugin/theme
945
  msgid "http://themeofthecrop.com"
946
  msgstr ""
@@ -1002,36 +1114,41 @@ msgid ""
1002
  "sent to the email address you provided."
1003
  msgstr ""
1004
 
1005
- #: includes/AdminBookings.class.php:48
1006
  msgctxt "Title of admin page that lists bookings"
1007
  msgid "Bookings"
1008
  msgstr ""
1009
 
1010
- #: includes/AdminBookings.class.php:49
1011
  msgctxt "Title of bookings admin menu item"
1012
  msgid "Bookings"
1013
  msgstr ""
1014
 
1015
- #: includes/AdminBookings.class.php:173
1016
  msgctxt "Label next to the email address to which an email will be sent"
1017
  msgid "To"
1018
  msgstr ""
1019
 
1020
- #: includes/CustomPostTypes.class.php:80
1021
  msgctxt "Booking status when it is pending review"
1022
  msgid "Pending"
1023
  msgstr ""
1024
 
1025
- #: includes/CustomPostTypes.class.php:86
1026
  msgctxt "Booking status for a confirmed booking"
1027
  msgid "Confirmed"
1028
  msgstr ""
1029
 
1030
- #: includes/CustomPostTypes.class.php:97
1031
  msgctxt "Booking status for a closed booking"
1032
  msgid "Closed"
1033
  msgstr ""
1034
 
 
 
 
 
 
1035
  #: includes/Settings.class.php:93
1036
  msgctxt ""
1037
  "Default date format for display. Must match formatting rules at "
@@ -1336,32 +1453,32 @@ msgctxt "Brief default description of a scheduling exception when no times are s
1336
  msgid "Closed all day"
1337
  msgstr ""
1338
 
1339
- #: includes/WP_List_Table.BookingsTable.class.php:169
1340
- #: includes/WP_List_Table.BookingsTable.class.php:171
1341
  msgctxt ""
1342
  "No date limit in a date range, eg 2014-* would mean any date from 2014 or "
1343
  "after"
1344
  msgid "*"
1345
  msgstr ""
1346
 
1347
- #: includes/WP_List_Table.BookingsTable.class.php:170
1348
  msgctxt "Separator between two dates in a date range"
1349
  msgid "&mdash;"
1350
  msgstr ""
1351
 
1352
- #: includes/WP_List_Table.BookingsTable.class.php:437
1353
  msgctxt "Status label for bookings put in the trash"
1354
  msgid "Trash"
1355
  msgstr ""
1356
 
1357
- #: includes/WP_List_Table.BookingsTable.class.php:796
1358
  msgctxt ""
1359
  "Indicates which booking status is currently being filtered in the list of "
1360
  "bookings."
1361
  msgid "You're viewing bookings that have been marked as %s."
1362
  msgstr ""
1363
 
1364
- #: includes/WP_List_Table.BookingsTable.class.php:801
1365
  msgctxt "Notification of booking date range, eg - bookings from 2014-12-02-2014-12-05"
1366
  msgid "Only bookings from %s are being shown."
1367
  msgstr ""
1
+ # Copyright (C) 2016 Restaurant Reservations
2
  # This file is distributed under the same license as the Restaurant Reservations package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Restaurant Reservations 1.6\n"
6
  "Report-Msgid-Bugs-To: "
7
+ "https://wordpress.org/support/plugin/restaurant-reservations\n"
8
+ "POT-Creation-Date: 2016-06-20 07:16:22+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2016-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
  "X-Generator: grunt-wp-i18n 0.4.9\n"
26
  "X-Textdomain-Support: yes\n"
27
 
28
  #: includes/Addons.class.php:101
29
+ #: includes/WP_List_Table.BookingsTable.class.php:400
30
  msgid "Loading"
31
  msgstr ""
32
 
52
  "target=\"_blank\">support forums</a>."
53
  msgstr ""
54
 
55
+ #: includes/AdminBookings.class.php:84
56
  msgid "Restaurant Bookings"
57
  msgstr ""
58
 
59
+ #: includes/AdminBookings.class.php:85 includes/CustomPostTypes.class.php:42
60
  msgid "Add New"
61
  msgstr ""
62
 
63
+ #: includes/AdminBookings.class.php:123 includes/AdminBookings.class.php:225
64
  msgid "Columns"
65
  msgstr ""
66
 
67
+ #: includes/AdminBookings.class.php:163 restaurant-reservations.php:235
68
  msgid "Add Booking"
69
  msgstr ""
70
 
71
+ #: includes/AdminBookings.class.php:166 includes/AdminBookings.class.php:207
72
+ #: includes/AdminBookings.class.php:252
73
  msgid "Cancel"
74
  msgstr ""
75
 
76
+ #: includes/AdminBookings.class.php:187 includes/AdminBookings.class.php:204
77
+ #: includes/WP_List_Table.BookingsTable.class.php:419
78
  msgid "Send Email"
79
  msgstr ""
80
 
81
+ #: includes/AdminBookings.class.php:194
82
  msgid "Subject"
83
  msgstr ""
84
 
85
+ #: includes/AdminBookings.class.php:198 includes/Settings.class.php:830
86
+ #: includes/WP_List_Table.BookingsTable.class.php:441
87
  msgid "Message"
88
  msgstr ""
89
 
90
+ #: includes/AdminBookings.class.php:249
91
  msgid "Update"
92
  msgstr ""
93
 
94
+ #: includes/AdminBookings.class.php:268 includes/AdminBookings.class.php:277
95
  msgid "Close"
96
  msgstr ""
97
 
98
+ #: includes/AdminBookings.class.php:343
99
  msgid "Booking Status"
100
  msgstr ""
101
 
102
+ #: includes/AdminBookings.class.php:351
103
  msgid "Send notifications"
104
  msgstr ""
105
 
106
+ #: includes/AdminBookings.class.php:356
107
  msgid "Learn more"
108
  msgstr ""
109
 
110
+ #: includes/AdminBookings.class.php:357
111
  msgid ""
112
  "When adding a booking or changing a booking's status with this form, no "
113
  "email notifications will be sent. Check this option if you want to send "
114
  "email notifications."
115
  msgstr ""
116
 
117
+ #: includes/AdminBookings.class.php:411
118
  msgid "You have been logged out. Please %slogin again%s."
119
  msgstr ""
120
 
121
+ #: includes/AdminBookings.class.php:447
122
  msgid ""
123
  "This booking has been sent to the %sTrash%s where it can not be edited. Set "
124
  "the booking to Pending or Confirmed to edit it."
125
  msgstr ""
126
 
127
+ #: includes/AdminBookings.class.php:464
128
  msgid "The booking could not be retrieved. Please reload the page and try again."
129
  msgstr ""
130
 
131
+ #: includes/AdminBookings.class.php:546
132
  msgid ""
133
  "Unable to trash this post. Please try again. If you continue to have "
134
  "trouble, please refresh the page."
135
  msgstr ""
136
 
137
+ #: includes/AdminBookings.class.php:588
138
  msgid "Please enter a message before sending the email."
139
  msgstr ""
140
 
141
+ #: includes/AdminBookings.class.php:597
142
  msgid "The email could not be sent because some critical information was missing."
143
  msgstr ""
144
 
145
+ #: includes/AdminBookings.class.php:609
146
  msgid "There was an error loading the booking and the email was not sent."
147
  msgstr ""
148
 
149
+ #: includes/AdminBookings.class.php:647
150
  msgid "You must select at least one column to display."
151
  msgstr ""
152
 
228
 
229
  #: includes/CustomPostTypes.class.php:38 includes/CustomPostTypes.class.php:40
230
  #: includes/CustomPostTypes.class.php:41
231
+ #: includes/WP_List_Table.BookingsTable.class.php:113
232
  msgid "Bookings"
233
  msgstr ""
234
 
235
  #: includes/CustomPostTypes.class.php:39
236
+ #: includes/WP_List_Table.BookingsTable.class.php:112
237
  msgid "Booking"
238
  msgstr ""
239
 
241
  msgid "Add New Booking"
242
  msgstr ""
243
 
244
+ #: includes/CustomPostTypes.class.php:44 restaurant-reservations.php:236
245
  msgid "Edit Booking"
246
  msgstr ""
247
 
269
  msgid "All Bookings"
270
  msgstr ""
271
 
272
+ #: includes/CustomPostTypes.class.php:95
273
  msgid "Confirmed <span class=\"count\">(%s)</span>"
274
  msgid_plural "Confirmed <span class=\"count\">(%s)</span>"
275
  msgstr[0] ""
276
  msgstr[1] ""
277
 
278
+ #: includes/CustomPostTypes.class.php:106
279
  msgid "Closed <span class=\"count\">(%s)</span>"
280
  msgid_plural "Closed <span class=\"count\">(%s)</span>"
281
  msgstr[0] ""
310
  "and try again."
311
  msgstr ""
312
 
313
+ #: includes/MultipleLocations.class.php:272
314
+ #: includes/MultipleLocations.class.php:375
315
+ #: includes/MultipleLocations.class.php:419
316
+ msgid "Location"
317
+ msgstr ""
318
+
319
+ #: includes/MultipleLocations.class.php:327
320
+ msgid "Please select a location for your booking."
321
+ msgstr ""
322
+
323
+ #: includes/MultipleLocations.class.php:334
324
+ msgid "The location you selected is not valid. Please select another location."
325
+ msgstr ""
326
+
327
+ #: includes/MultipleLocations.class.php:469
328
+ msgid "Reservations"
329
+ msgstr ""
330
+
331
+ #: includes/MultipleLocations.class.php:536
332
+ msgid "Show booking form with this location."
333
+ msgstr ""
334
+
335
+ #: includes/MultipleLocations.class.php:542 includes/Settings.class.php:498
336
+ msgid "Reply-To Name"
337
+ msgstr ""
338
+
339
+ #: includes/MultipleLocations.class.php:546
340
+ msgid ""
341
+ "The name which should appear in the Reply-To field of a user notification "
342
+ "email."
343
+ msgstr ""
344
+
345
+ #: includes/MultipleLocations.class.php:552 includes/Settings.class.php:510
346
+ msgid "Reply-To Email Address"
347
+ msgstr ""
348
+
349
+ #: includes/MultipleLocations.class.php:556 includes/Settings.class.php:511
350
+ msgid ""
351
+ "The email address which should appear in the Reply-To field of a user "
352
+ "notification email."
353
+ msgstr ""
354
+
355
+ #: includes/MultipleLocations.class.php:563
356
+ msgid "Admin Notification Email Address"
357
+ msgstr ""
358
+
359
+ #: includes/MultipleLocations.class.php:567
360
+ msgid ""
361
+ "The email address where admin notifications for bookings at this location "
362
+ "should be sent."
363
+ msgstr ""
364
+
365
  #: includes/Notification.class.php:88
366
  msgid "View pending bookings"
367
  msgstr ""
475
  msgstr ""
476
 
477
  #: includes/Settings.class.php:414
478
+ msgid ""
479
+ "Select how early customers can make their booking. (Administrators and "
480
+ "Booking Managers are not restricted by this setting.)"
481
  msgstr ""
482
 
483
  #: includes/Settings.class.php:417
509
  msgstr ""
510
 
511
  #: includes/Settings.class.php:434
512
+ msgid ""
513
+ "Select how late customers can make their booking. (Administrators and "
514
+ "Booking Managers are not restricted by this setting.)"
515
  msgstr ""
516
 
517
  #: includes/Settings.class.php:437
592
  msgid "Notifications"
593
  msgstr ""
594
 
 
 
 
 
595
  #: includes/Settings.class.php:499
596
  msgid ""
597
  "The name which should appear in the Reply-To field of a user notification "
598
  "email"
599
  msgstr ""
600
 
 
 
 
 
 
 
 
 
 
 
601
  #: includes/Settings.class.php:522
602
  msgid "Admin Notification"
603
  msgstr ""
725
  msgid "Any size"
726
  msgstr ""
727
 
728
+ #: includes/Settings.class.php:771
729
+ #: includes/integrations/business-profile.php:100
730
  msgid "Book a table"
731
  msgstr ""
732
 
733
+ #: includes/Settings.class.php:774
734
+ #: includes/WP_List_Table.BookingsTable.class.php:357
735
  msgid "Date"
736
  msgstr ""
737
 
738
+ #: includes/Settings.class.php:780
739
  msgid "Time"
740
  msgstr ""
741
 
742
+ #: includes/Settings.class.php:786
743
+ #: includes/WP_List_Table.BookingsTable.class.php:358
744
  msgid "Party"
745
  msgstr ""
746
 
747
+ #: includes/Settings.class.php:799
748
  msgid "Contact Details"
749
  msgstr ""
750
 
751
+ #: includes/Settings.class.php:802
752
+ #: includes/WP_List_Table.BookingsTable.class.php:359
753
  msgid "Name"
754
  msgstr ""
755
 
756
+ #: includes/Settings.class.php:808
757
+ #: includes/WP_List_Table.BookingsTable.class.php:360
758
  msgid "Email"
759
  msgstr ""
760
 
761
+ #: includes/Settings.class.php:817
762
+ #: includes/WP_List_Table.BookingsTable.class.php:361
763
  msgid "Phone"
764
  msgstr ""
765
 
766
+ #: includes/Settings.class.php:825
767
  msgid "Add a Message"
768
  msgstr ""
769
 
770
+ #: includes/Settings.class.php:875
771
  msgid "Email of the user who made the booking"
772
  msgstr ""
773
 
774
+ #: includes/Settings.class.php:876
775
  msgid "* Name of the user who made the booking"
776
  msgstr ""
777
 
778
+ #: includes/Settings.class.php:877
779
  msgid "* Number of people booked"
780
  msgstr ""
781
 
782
+ #: includes/Settings.class.php:878
783
  msgid "* Date and time of the booking"
784
  msgstr ""
785
 
786
+ #: includes/Settings.class.php:879
787
  msgid "Phone number if supplied with the request"
788
  msgstr ""
789
 
790
+ #: includes/Settings.class.php:880
791
  msgid "Message added to the request"
792
  msgstr ""
793
 
794
+ #: includes/Settings.class.php:881
795
  msgid "A link to the admin panel showing pending bookings"
796
  msgstr ""
797
 
798
+ #: includes/Settings.class.php:882
799
  msgid "A link to confirm this booking. Only include this in admin notifications"
800
  msgstr ""
801
 
802
+ #: includes/Settings.class.php:883
803
  msgid "A link to reject this booking. Only include this in admin notifications"
804
  msgstr ""
805
 
806
+ #: includes/Settings.class.php:884
807
  msgid "The name of this website"
808
  msgstr ""
809
 
810
+ #: includes/Settings.class.php:885
811
  msgid "A link to this website"
812
  msgstr ""
813
 
814
+ #: includes/Settings.class.php:886
815
  msgid "Current date and time"
816
  msgstr ""
817
 
818
+ #: includes/WP_List_Table.BookingsTable.class.php:233
819
  msgid "Upcoming"
820
  msgstr ""
821
 
822
+ #: includes/WP_List_Table.BookingsTable.class.php:234
823
  msgid "Today"
824
  msgstr ""
825
 
826
+ #: includes/WP_List_Table.BookingsTable.class.php:235
827
+ #: includes/WP_List_Table.BookingsTable.class.php:281
828
  msgid "All"
829
  msgstr ""
830
 
831
+ #: includes/WP_List_Table.BookingsTable.class.php:242
832
+ msgid "Between dates"
833
+ msgstr ""
834
+
835
+ #: includes/WP_List_Table.BookingsTable.class.php:254
836
  msgid "Start Date:"
837
  msgstr ""
838
 
839
+ #: includes/WP_List_Table.BookingsTable.class.php:255
840
  msgid "Start Date"
841
  msgstr ""
842
 
843
+ #: includes/WP_List_Table.BookingsTable.class.php:256
844
  msgid "End Date:"
845
  msgstr ""
846
 
847
+ #: includes/WP_List_Table.BookingsTable.class.php:257
848
  msgid "End Date"
849
  msgstr ""
850
 
851
+ #: includes/WP_List_Table.BookingsTable.class.php:258
852
  msgid "Apply"
853
  msgstr ""
854
 
855
+ #: includes/WP_List_Table.BookingsTable.class.php:260
856
  msgid "Clear Filter"
857
  msgstr ""
858
 
859
+ #: includes/WP_List_Table.BookingsTable.class.php:282
860
  msgid "Pending"
861
  msgstr ""
862
 
863
+ #: includes/WP_List_Table.BookingsTable.class.php:283
864
  msgid "Confirmed"
865
  msgstr ""
866
 
867
+ #: includes/WP_List_Table.BookingsTable.class.php:284
868
  msgid "Closed"
869
  msgstr ""
870
 
871
+ #: includes/WP_List_Table.BookingsTable.class.php:285
872
+ #: includes/WP_List_Table.BookingsTable.class.php:405
873
  msgid "Trash"
874
  msgstr ""
875
 
876
+ #: includes/WP_List_Table.BookingsTable.class.php:362
877
  msgid "Status"
878
  msgstr ""
879
 
880
+ #: includes/WP_List_Table.BookingsTable.class.php:363
881
  msgid "Details"
882
  msgstr ""
883
 
884
+ #: includes/WP_List_Table.BookingsTable.class.php:404
885
  msgid "Edit"
886
  msgstr ""
887
 
888
+ #: includes/WP_List_Table.BookingsTable.class.php:522
889
  msgid "Delete"
890
  msgstr ""
891
 
892
+ #: includes/WP_List_Table.BookingsTable.class.php:523
893
  msgid "Set To Confirmed"
894
  msgstr ""
895
 
896
+ #: includes/WP_List_Table.BookingsTable.class.php:524
897
  msgid "Set To Pending Review"
898
  msgstr ""
899
 
900
+ #: includes/WP_List_Table.BookingsTable.class.php:525
901
  msgid "Set To Closed"
902
  msgstr ""
903
 
904
+ #: includes/WP_List_Table.BookingsTable.class.php:639
905
  msgid "%d booking deleted successfully."
906
  msgid_plural "%d bookings deleted successfully."
907
  msgstr[0] ""
908
  msgstr[1] ""
909
 
910
+ #: includes/WP_List_Table.BookingsTable.class.php:642
911
  msgid "%d booking confirmed."
912
  msgid_plural "%d bookings confirmed."
913
  msgstr[0] ""
914
  msgstr[1] ""
915
 
916
+ #: includes/WP_List_Table.BookingsTable.class.php:645
917
  msgid "%d booking set to pending."
918
  msgid_plural "%d bookings set to pending."
919
  msgstr[0] ""
920
  msgstr[1] ""
921
 
922
+ #: includes/WP_List_Table.BookingsTable.class.php:648
923
  msgid "%d booking closed."
924
  msgid_plural "%d bookings closed."
925
  msgstr[0] ""
926
  msgstr[1] ""
927
 
928
+ #: includes/WP_List_Table.BookingsTable.class.php:660
929
  msgid "%d booking had errors and could not be processed."
930
  msgid_plural "%d bookings had errors and could not be processed."
931
  msgstr[0] ""
932
  msgstr[1] ""
933
 
934
+ #: includes/WP_List_Table.BookingsTable.class.php:712
935
+ #: includes/WP_List_Table.BookingsTable.class.php:733
936
+ msgid "All Locations"
937
+ msgstr ""
938
+
939
+ #: includes/WP_List_Table.BookingsTable.class.php:740
940
+ msgid "Inactive Locations"
941
+ msgstr ""
942
+
943
+ #: includes/WP_List_Table.BookingsTable.class.php:749
944
+ msgid "Switch"
945
+ msgstr ""
946
+
947
+ #: includes/WP_List_Table.BookingsTable.class.php:781
948
  msgid "You're viewing bookings that have been moved to the trash."
949
  msgstr ""
950
 
951
+ #: includes/WP_List_Table.BookingsTable.class.php:790
952
  msgid "Only today's bookings are being shown."
953
  msgstr ""
954
 
955
+ #: includes/WP_List_Table.BookingsTable.class.php:792
956
  msgid "Only upcoming bookings are being shown."
957
  msgstr ""
958
 
968
  msgid "Title"
969
  msgstr ""
970
 
971
+ #: includes/integrations/business-profile.php:124
972
+ #: includes/integrations/business-profile.php:127
973
+ msgid "Show book a table link"
974
+ msgstr ""
975
+
976
+ #: includes/integrations/business-profile.php:187
977
+ msgid "--- Baker"
978
+ msgstr ""
979
+
980
+ #: includes/integrations/business-profile.php:188
981
+ msgid "--- Bar or Pub"
982
+ msgstr ""
983
+
984
+ #: includes/integrations/business-profile.php:189
985
+ msgid "--- Brewery"
986
+ msgstr ""
987
+
988
+ #: includes/integrations/business-profile.php:190
989
+ msgid "--- Cafe or Coffee Shop"
990
+ msgstr ""
991
+
992
+ #: includes/integrations/business-profile.php:191
993
+ msgid "--- FastFoodRestaurant"
994
+ msgstr ""
995
+
996
+ #: includes/integrations/business-profile.php:192
997
+ msgid "--- Ice Cream Shop"
998
+ msgstr ""
999
+
1000
+ #: includes/integrations/business-profile.php:193
1001
+ msgid "--- Restaurant"
1002
+ msgstr ""
1003
+
1004
+ #: includes/integrations/business-profile.php:194
1005
+ msgid "--- Winery"
1006
+ msgstr ""
1007
+
1008
+ #: includes/template-functions.php:126
1009
  msgid "Request Booking"
1010
  msgstr ""
1011
 
1013
  msgid "You do not have sufficient permissions to access this page."
1014
  msgstr ""
1015
 
1016
+ #: node_modules/grunt-wp-i18n/test/fixtures/basic-theme/exclude/file.php:3
1017
+ #: node_modules/grunt-wp-i18n/test/fixtures/plugin-include/plugin-include.php:6
1018
+ msgid "Exclude"
1019
+ msgstr ""
1020
+
1021
+ #: node_modules/grunt-wp-i18n/test/fixtures/plugin-include/include/file.php:2
1022
+ msgid "Include"
1023
+ msgstr ""
1024
+
1025
+ #: node_modules/grunt-wp-i18n/test/fixtures/text-domains/add-domain.php:2
1026
+ #: node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-domains.php:2
1027
+ #: node_modules/grunt-wp-i18n/test/fixtures/text-domains/update-domains.php:3
1028
+ msgid "String"
1029
+ msgstr ""
1030
+
1031
+ #: restaurant-reservations.php:166
1032
  msgid "Booking Manager"
1033
  msgstr ""
1034
 
1035
+ #: restaurant-reservations.php:237
1036
  msgid ""
1037
  "An unspecified error occurred. Please try again. If the problem persists, "
1038
  "try logging out and logging back in."
1039
  msgstr ""
1040
 
1041
+ #: restaurant-reservations.php:299
1042
  msgid "View the help documentation for Restaurant Reservations"
1043
  msgstr ""
1044
 
1045
+ #: restaurant-reservations.php:299
1046
  msgid "Help"
1047
  msgstr ""
1048
 
1050
  msgid "Restaurant Reservations"
1051
  msgstr ""
1052
 
1053
+ #. #-#-#-#-# restaurant-reservations.pot (Restaurant Reservations 1.6) #-#-#-#-#
1054
  #. Plugin URI of the plugin/theme
1055
+ #. #-#-#-#-# restaurant-reservations.pot (Restaurant Reservations 1.6) #-#-#-#-#
1056
  #. Author URI of the plugin/theme
1057
  msgid "http://themeofthecrop.com"
1058
  msgstr ""
1114
  "sent to the email address you provided."
1115
  msgstr ""
1116
 
1117
+ #: includes/AdminBookings.class.php:60
1118
  msgctxt "Title of admin page that lists bookings"
1119
  msgid "Bookings"
1120
  msgstr ""
1121
 
1122
+ #: includes/AdminBookings.class.php:61
1123
  msgctxt "Title of bookings admin menu item"
1124
  msgid "Bookings"
1125
  msgstr ""
1126
 
1127
+ #: includes/AdminBookings.class.php:190
1128
  msgctxt "Label next to the email address to which an email will be sent"
1129
  msgid "To"
1130
  msgstr ""
1131
 
1132
+ #: includes/CustomPostTypes.class.php:82
1133
  msgctxt "Booking status when it is pending review"
1134
  msgid "Pending"
1135
  msgstr ""
1136
 
1137
+ #: includes/CustomPostTypes.class.php:88
1138
  msgctxt "Booking status for a confirmed booking"
1139
  msgid "Confirmed"
1140
  msgstr ""
1141
 
1142
+ #: includes/CustomPostTypes.class.php:99
1143
  msgctxt "Booking status for a closed booking"
1144
  msgid "Closed"
1145
  msgstr ""
1146
 
1147
+ #: includes/MultipleLocations.class.php:101
1148
+ msgctxt "Name for grouping bookings"
1149
+ msgid "Location"
1150
+ msgstr ""
1151
+
1152
  #: includes/Settings.class.php:93
1153
  msgctxt ""
1154
  "Default date format for display. Must match formatting rules at "
1453
  msgid "Closed all day"
1454
  msgstr ""
1455
 
1456
+ #: includes/WP_List_Table.BookingsTable.class.php:177
1457
+ #: includes/WP_List_Table.BookingsTable.class.php:179
1458
  msgctxt ""
1459
  "No date limit in a date range, eg 2014-* would mean any date from 2014 or "
1460
  "after"
1461
  msgid "*"
1462
  msgstr ""
1463
 
1464
+ #: includes/WP_List_Table.BookingsTable.class.php:178
1465
  msgctxt "Separator between two dates in a date range"
1466
  msgid "&mdash;"
1467
  msgstr ""
1468
 
1469
+ #: includes/WP_List_Table.BookingsTable.class.php:430
1470
  msgctxt "Status label for bookings put in the trash"
1471
  msgid "Trash"
1472
  msgstr ""
1473
 
1474
+ #: includes/WP_List_Table.BookingsTable.class.php:783
1475
  msgctxt ""
1476
  "Indicates which booking status is currently being filtered in the list of "
1477
  "bookings."
1478
  msgid "You're viewing bookings that have been marked as %s."
1479
  msgstr ""
1480
 
1481
+ #: includes/WP_List_Table.BookingsTable.class.php:788
1482
  msgctxt "Notification of booking date range, eg - bookings from 2014-12-02-2014-12-05"
1483
  msgid "Only bookings from %s are being shown."
1484
  msgstr ""
package.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "restaurant-reservations",
3
+ "description": "Accept restaurant reservations and bookings online.",
4
+ "version": "1.5.3",
5
+ "author": {
6
+ "name": "Theme of the Crop",
7
+ "url": "http://themeofthecrop.com"
8
+ },
9
+ "devDependencies": {
10
+ "grunt": "~0.4.2",
11
+ "grunt-contrib-jshint": "~0.6.0",
12
+ "grunt-contrib-watch": "~0.4.3",
13
+ "grunt-wp-i18n": "~0.4.9"
14
+ }
15
+ }
readme.txt CHANGED
@@ -2,10 +2,10 @@
2
  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: 4.5
7
  Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
8
- Stable tag: 1.5.3
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
@@ -15,17 +15,18 @@ Accept restaurant reservations and table bookings online. Quickly confirm or rej
15
 
16
  Accept restaurant reservations and table bookings online. Quickly confirm or reject bookings, send out custom email notifications, restrict booking times and more.
17
 
18
- * Quickly confirm or reject a booking
19
- * Receive an email notification when a booking request is made
20
  * Notify a customer by email when their request is confirmed or rejected
21
- * Automatically block bookings when you're closed, including holidays and one-off openings
22
  * Custom user role to manage bookings
23
  * Add your booking form to any page, post or widget area
24
- * Customize all notification messages, and date and time formats
25
  * Add and edit bookings from the admin panel
 
26
  * Send customers an email about their booking from the admin panel
27
 
28
- 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.
29
 
30
  This plugin is part of a group of plugins for restaurants. Check out the [Food and Drink Menu](http://wordpress.org/plugins/food-and-drink-menu/), [Good Reviews for WordPress](http://wordpress.org/plugins/good-reviews-wp/) and [Business Profile](http://wordpress.org/plugins/business-profile/) plugins as well.
31
 
@@ -115,6 +116,13 @@ Find answers to even more questions in the [FAQ](http://doc.themeofthecrop.com/p
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
 
118
  = 1.5.3 (2016-03-25) =
119
  * Fix: no bookings found when searching by start and end dates that are the same
120
  * Add: clarify that early/late bookings restrictions don't apply to admins
@@ -280,6 +288,9 @@ Find answers to even more questions in the [FAQ](http://doc.themeofthecrop.com/p
280
 
281
  == Upgrade Notice ==
282
 
 
 
 
283
  = 1.5.3 =
284
  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.
285
 
2
  Contributors: NateWr
3
  Author URI: https://github.com/NateWr
4
  Plugin URL: http://themeofthecrop.com
5
+ Requires at Least: 4.4
6
+ Tested Up To: 4.6
7
  Tags: restaurant, reservations, bookings, table bookings, restaurant reservation, table reservation
8
+ Stable tag: 1.6
9
  License: GPLv2 or later
10
  Donate link: http://themeofthecrop.com
11
 
15
 
16
  Accept restaurant reservations and table bookings online. Quickly confirm or reject bookings, send out custom email notifications, restrict booking times and more.
17
 
18
+ * Quickly [confirm or reject](http://doc.themeofthecrop.com/plugins/restaurant-reservations/user/manage/confirm-reject-bookings) a booking
19
+ * Receive an [email notification](http://doc.themeofthecrop.com/plugins/restaurant-reservations/user/config/email-notifications) when a booking request is made
20
  * Notify a customer by email when their request is confirmed or rejected
21
+ * Automatically [block bookings](http://doc.themeofthecrop.com/plugins/restaurant-reservations/user/config/schedule#scheduling-exceptions) when you're closed, including holidays and one-off openings
22
  * Custom user role to manage bookings
23
  * Add your booking form to any page, post or widget area
24
+ * Customize all [notification messages](http://doc.themeofthecrop.com/plugins/restaurant-reservations/user/config/email-notifications#understanding-the-template-tags), and date and time formats
25
  * Add and edit bookings from the admin panel
26
+ * Take bookings for [multiple locations](http://doc.themeofthecrop.com/plugins/restaurant-reservations/user/manage/locations)
27
  * Send customers an email about their booking from the admin panel
28
 
29
+ 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.
30
 
31
  This plugin is part of a group of plugins for restaurants. Check out the [Food and Drink Menu](http://wordpress.org/plugins/food-and-drink-menu/), [Good Reviews for WordPress](http://wordpress.org/plugins/good-reviews-wp/) and [Business Profile](http://wordpress.org/plugins/business-profile/) plugins as well.
32
 
116
 
117
  == Changelog ==
118
 
119
+ = 1.6 (2016-06-20) =
120
+ * Fix: Currently visible notice in bookings list on mobile devices
121
+ * Fix: Conflict with WooCommerce that prevented booking managers from viewing bookings
122
+ * Add: Support multi-location bookings
123
+ * Add: Add reservation schema.org markup when Business Profile used
124
+ * Add: Allow custom first day of the week for date picker
125
+
126
  = 1.5.3 (2016-03-25) =
127
  * Fix: no bookings found when searching by start and end dates that are the same
128
  * Add: clarify that early/late bookings restrictions don't apply to admins
288
 
289
  == Upgrade Notice ==
290
 
291
+ = 1.6 =
292
+ This is a major update that adds support for accepting bookings at multiple locations. View the online documentation for further details.
293
+
294
  = 1.5.3 =
295
  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.
296
 
restaurant-reservations.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Restaurant Reservations
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Accept restaurant reservations and bookings online.
6
- * Version: 1.5.3
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later
@@ -47,6 +47,7 @@ class rtbInit {
47
  public function __construct() {
48
 
49
  // Common strings
 
50
  define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
51
  define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
52
  define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
@@ -72,6 +73,10 @@ class rtbInit {
72
  require_once( RTB_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
73
  $this->cpts = new rtbCustomPostTypes();
74
 
 
 
 
 
75
  // Flush the rewrite rules for the custom post types
76
  register_activation_hook( __FILE__, array( $this, 'rewrite_flush' ) );
77
 
@@ -80,7 +85,7 @@ class rtbInit {
80
 
81
  // Load the admin bookings page
82
  require_once( RTB_PLUGIN_DIR . '/includes/AdminBookings.class.php' );
83
- new rtbAdminBookings();
84
 
85
  // Load assets
86
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
@@ -118,6 +123,10 @@ class rtbInit {
118
  )
119
  );
120
 
 
 
 
 
121
  // Load backwards compatibility functions
122
  require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
123
  new rtbCompatibility();
@@ -287,7 +296,7 @@ class rtbInit {
287
 
288
  if ( $plugin == RTB_PLUGIN_FNAME ) {
289
 
290
- $links['help'] = '<a href="http://doc.themeofthecrop.com/plugins/restaurant-reservations/?utm_source=Plugin&utm_medium=Plugin%20Description&utm_campaign=Restaurant%20Reservations" title="' . __( 'View the help documentation for Restaurant Reservations', 'restaurant-reservations' ) . '">' . __( 'Help', 'restaurant-reservations' ) . '</a>';
291
  }
292
 
293
  return $links;
3
  * Plugin Name: Restaurant Reservations
4
  * Plugin URI: http://themeofthecrop.com
5
  * Description: Accept restaurant reservations and bookings online.
6
+ * Version: 1.6
7
  * Author: Theme of the Crop
8
  * Author URI: http://themeofthecrop.com
9
  * License: GNU General Public License v2.0 or later
47
  public function __construct() {
48
 
49
  // Common strings
50
+ define( 'RTB_VERSION', '1.6' );
51
  define( 'RTB_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
52
  define( 'RTB_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
53
  define( 'RTB_PLUGIN_FNAME', plugin_basename( __FILE__ ) );
73
  require_once( RTB_PLUGIN_DIR . '/includes/CustomPostTypes.class.php' );
74
  $this->cpts = new rtbCustomPostTypes();
75
 
76
+ // Load multiple location support
77
+ require_once( RTB_PLUGIN_DIR . '/includes/MultipleLocations.class.php' );
78
+ $this->locations = new rtbMultipleLocations();
79
+
80
  // Flush the rewrite rules for the custom post types
81
  register_activation_hook( __FILE__, array( $this, 'rewrite_flush' ) );
82
 
85
 
86
  // Load the admin bookings page
87
  require_once( RTB_PLUGIN_DIR . '/includes/AdminBookings.class.php' );
88
+ $this->bookings = new rtbAdminBookings();
89
 
90
  // Load assets
91
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
123
  )
124
  );
125
 
126
+ // Load integrations with other plugins
127
+ require_once( RTB_PLUGIN_DIR . '/includes/integrations/business-profile.php' );
128
+ require_once( RTB_PLUGIN_DIR . '/includes/integrations/woocommerce.php' );
129
+
130
  // Load backwards compatibility functions
131
  require_once( RTB_PLUGIN_DIR . '/includes/Compatibility.class.php' );
132
  new rtbCompatibility();
296
 
297
  if ( $plugin == RTB_PLUGIN_FNAME ) {
298
 
299
+ $links['help'] = '<a href="http://doc.themeofthecrop.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>';
300
  }
301
 
302
  return $links;