PluginProbe
Timetics – Appointment Booking Calendar & Scheduling / 1.0.64
Timetics – Appointment Booking Calendar & Scheduling v1.0.64
1.0.64 1.0.62 1.0.63 1.0.61 1.0.60 1.0.59 1.0.58 1.0.57 1.0.56 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 All 65 releases
← All changes | core/bookings/booking-entry.php +72 -19 1.0.1 → 1.0.64 View file →
@@ -6,8 +6,10 @@
6 6 */
7 7
8 8 namespace Timetics\Core\Bookings;
9 9
10 +defined( 'ABSPATH' ) || exit;
11 +
10 12 /**
11 13 * Class Booking Entry
12 14 */
13 15 class Booking_Entry {
@@ -45,16 +47,21 @@
45 47 *
46 48 * @var array
47 49 */
48 50 private $data = [
49 - 'meeting_id' => '',
50 - 'staff_id' => '',
51 - 'customer_id' => '',
52 - 'booking_id' => '',
53 - 'booked' => '',
54 - 'date' => '',
55 - 'start' => '',
56 - 'end' => '',
51 + 'meeting_id' => '',
52 + 'event_id' => '',
53 + 'staff_id' => '',
54 + 'speaker_id' => '',
55 + 'customer_id' => '',
56 + 'booking_id' => '',
57 + 'booked' => '',
58 + 'date' => '',
59 + 'start' => '',
60 + 'end' => '',
61 + 'seats' => '',
62 + 'google_event' => '',
63 + 'zoom' => '',
57 64 ];
58 65
59 66 /**
60 67 * Constructor for Booking Entry
@@ -88,8 +95,17 @@
88 95 * @return integer
89 96 */
90 97 public function get_meeting_id() {
91 98 return $this->get_prop( 'meeting_id' );
99 + }
100 +
101 + /**
102 + * Get event id
103 + *
104 + * @return integer
105 + */
106 + public function get_event_id() {
107 + return $this->get_prop( 'event_id' );
92 108 }
93 109
94 110 /**
95 111 * Get staff id
@@ -115,9 +131,9 @@
115 131 * @return integer
116 132 */
117 133 public function get_booking_id() {
118 134 return $this->get_prop( 'booking_id' );
119 - }
135 + }
120 136
121 137 /**
122 138 * Get booked
123 139 *
@@ -154,8 +170,35 @@
154 170 return $this->get_prop( 'date' );
155 171 }
156 172
157 173 /**
174 + * Get google calender event with google meet link
175 + *
176 + * @return array
177 + */
178 + public function get_google_event() {
179 + return $this->get_prop( 'google_event' );
180 + }
181 +
182 + /**
183 + * Get zoom link
184 + *
185 + * @return array
186 + */
187 + public function get_zoom() {
188 + return $this->get_prop( 'zoom' );
189 + }
190 +
191 + /**
192 + * Get seats
193 + *
194 + * @return array
195 + */
196 + public function get_seats() {
197 + return $this->get_prop( 'seats' );
198 + }
199 +
200 + /**
158 201 * Get entry data
159 202 *
160 203 * @return array
161 204 */
@@ -164,8 +207,9 @@
164 207 'id' => $this->get_id(),
165 208 'meeting_id' => $this->get_meeting_id(),
166 209 'staff_id' => $this->get_staff_id(),
167 210 'booking_id' => $this->get_booking_id(),
211 + 'event_id' => $this->get_event_id(),
168 212 'customer_id' => $this->get_customer_id(),
169 213 'booked' => $this->get_booked(),
170 214 'date' => $this->get_date(),
171 215 'start' => $this->get_start(),
@@ -234,12 +278,12 @@
234 278 */
235 279 public function all() {
236 280 $entries = get_posts(
237 281 [
238 - 'post_type' => $this->post_type,
239 - 'post_status' => 'publish',
240 - 'numberposts' => -1,
241 - ]
282 + 'post_type' => $this->post_type,
283 + 'post_status' => 'publish',
284 + 'numberposts' => -1,
285 + ]
242 286 );
243 287
244 288 $this->entries = $entries;
245 289 $entries = $this->collection( $entries );
@@ -278,9 +322,9 @@
278 322 *
279 323 * @return array
280 324 */
281 325 private function collection( $data = [] ) {
282 - return array_map( [ $this, 'get_instance' ], $data );
326 + return array_map( [$this, 'get_instance'], $data );
283 327 }
284 328
285 329 /**
286 330 * Set entry id
@@ -304,13 +348,13 @@
304 348 $args = wp_parse_args( $args, $this->data );
305 349
306 350 $entry = wp_insert_post(
307 351 [
308 - 'post_title' => $this->post_type . $args['start'],
309 - 'post_type' => $this->post_type,
310 - 'post_status' => 'publish',
311 - 'post_author' => 1,
312 - ]
352 + 'post_title' => $this->post_type . $args['start'],
353 + 'post_type' => $this->post_type,
354 + 'post_status' => 'publish',
355 + 'post_author' => 1,
356 + ]
313 357 );
314 358
315 359 if ( ! is_wp_error( $entry ) ) {
316 360 $this->set_id( $entry );
@@ -347,6 +391,15 @@
347 391 $meta_key = $this->prefix . $key;
348 392
349 393 update_post_meta( $this->id, $meta_key, $value );
350 394 }
395 + }
396 +
397 + /**
398 + * Delete booking
399 + *
400 + * @return bool | WP_Error
401 + */
402 + public function delete() {
403 + return wp_delete_post( $this->id, true );
351 404 }
352 405 }