PluginProbe
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution / 1.5.21
Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution v1.5.21
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
fluent-booking / app / Services / LandingPage / LandingPageHelper.php

LandingPageHelper.php in Fluent Booking – The Ultimate Appointments Scheduling, Events Booking, Events Calendar Solution 1.5.21, at app/Services/LandingPage/LandingPageHelper.php

77 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentBooking\App\Services\LandingPage;
4
5 use FluentBooking\App\Models\Calendar;
6 use FluentBooking\App\Services\Helper;
7 use FluentBooking\Framework\Support\Arr;
8
9 class LandingPageHelper
10 {
11 public static function getSettings(Calendar $calendar, $scope = 'admin')
12 {
13 $sharingSettings = $calendar->getMeta('sharing_settings', []);
14
15 $defaults = [
16 'enabled' => 'no',
17 'enabled_slots' => [],
18 'show_type' => 'all'
19 ];
20
21 $settings = wp_parse_args($sharingSettings, $defaults);
22
23 return apply_filters('fluent_booking/calendar/sharing_settings', $settings, $calendar, $scope);
24 }
25
26 public static function updateSettings(Calendar $calendar, $settings)
27 {
28 $defaults = [
29 'enabled' => 'no',
30 'enabled_slots' => [],
31 'show_type' => 'all'
32 ];
33
34 $sharingSettings = Arr::only($settings, array_keys($defaults));
35 $sharingSettings = wp_parse_args($sharingSettings, $defaults);
36
37 if ($sharingSettings['show_type'] == 'all' || $sharingSettings['enabled'] == 'no') {
38 $sharingSettings['enabled_slots'] = [];
39 } else {
40 $sharingSettings['enabled_slots'] = array_map('intval', $sharingSettings['enabled_slots']);
41 }
42
43 $sharingSettings['enabled'] = $sharingSettings['enabled'] == 'yes' ? 'yes' : 'no';
44
45 $settings['show_type'] = sanitize_text_field($sharingSettings['show_type']);
46
47 $calendar->updateMeta('sharing_settings', $sharingSettings);
48
49 return $settings;
50 }
51
52 public static function getLandingBaseUrl()
53 {
54 if (defined('FLUENT_BOOKING_LANDING_SLUG')) {
55 return site_url(FLUENT_BOOKING_LANDING_SLUG . '/');
56 }
57
58 return site_url('/?fluent-booking=calendar');
59 }
60
61 public static function getPoweredByHtml()
62 {
63 if (defined('FLUENT_BOOKING_PRO_DIR_FILE')) {
64 return '';
65 }
66
67 $html = '<div class="fcal_powered_by">';
68 $html .= esc_html__('Powered By', 'fluent-booking');
69 $html .= ' <span><a target="_blank" href="' . esc_url(Helper::getUpgradeUrl()) . '">';
70 $html .= esc_html__('FluentBooking', 'fluent-booking');
71 $html .= '</a></span>';
72 $html .= '</div>';
73
74 return $html;
75 }
76 }
77