PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / trunk
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution vtrunk
2.4.0 2.3.0 2.2.5 2.2.0 2.1.2 2.1.1 trunk 1.10.0 1.10.01 1.10.02 1.5.0 1.5.01 1.5.02 1.5.1 1.5.10 1.5.20 1.5.21 1.5.22 1.5.23 1.5.24 1.5.25 1.6.0 1.7.0 1.7.1 1.7.2 All 33 releases
← All changes | app/Services/EditorShortCodeParser.php +20 -5 2.3.0trunk View file →
@@ -305,9 +305,9 @@
305 305 if ($key == 'form_data_html') {
306 306 return __('will be available soon', 'fluent-booking');
307 307 }
308 308
309 - return Arr::get($guest, $key, '');
309 + return self::resolveScalarAttribute($guest, $key);
310 310 }
311 311
312 312 protected static function getBookingEventData($key)
313 313 {
@@ -318,13 +318,13 @@
318 318 }
319 319
320 320 $fillables = (new CalendarSlot())->getFillable();
321 321
322 - if (in_array($key, $fillables) || isset($bookingEvent->{$key})) {
322 + if (in_array($key, $fillables)) {
323 323 return $bookingEvent->{$key};
324 324 }
325 325
326 - return '';
326 + return self::resolveScalarAttribute($bookingEvent, $key);
327 327 }
328 328
329 329 protected static function getCalendarData($key)
330 330 {
@@ -335,13 +335,28 @@
335 335 }
336 336
337 337 $fillables = (new Calendar())->getFillable();
338 338
339 - if (in_array($key, $fillables) || isset($calendar->{$key})) {
339 + if (in_array($key, $fillables)) {
340 340 return $calendar->{$key};
341 341 }
342 342
343 - return '';
343 + return self::resolveScalarAttribute($calendar, $key);
344 + }
345 +
346 + /**
347 + * Resolve a scalar attribute only; never a relation (dumps as JSON) or a
348 + * dotted hop into a relation's columns.
349 + */
350 + protected static function resolveScalarAttribute($model, $key)
351 + {
352 + if (strpos($key, '.') !== false) {
353 + return '';
354 + }
355 +
356 + $value = isset($model[$key]) ? $model[$key] : '';
357 +
358 + return is_scalar($value) ? $value : '';
344 359 }
345 360
346 361 protected static function getPaymentData($key)
347 362 {