PATH:
home
/
ediuae
/
petalwellnessspa.com
/
wp-content
/
plugins
/
simply-schedule-appointments
/
includes
<?php /** * Simply Schedule Appointments Advanced Scheduling Availability. * * @since 3.5.3 * @package Simply_Schedule_Appointments */ use League\Period\Period; /** * Simply Schedule Appointments Advanced Scheduling Availability. * * @since 3.5.3 */ class SSA_Advanced_Scheduling_Availability { /** * Parent plugin class. * * @since 3.5.3 * * @var Simply_Schedule_Appointments */ protected $plugin = null; /** * Constructor. * * @since 3.5.3 * * @param Simply_Schedule_Appointments $plugin Main plugin object. */ public function __construct( $plugin ) { $this->plugin = $plugin; $this->hooks(); } /** * Initiate our hooks. * * @since 3.5.3 */ public function hooks() { add_action( 'init', array( $this, 'add_filters' ), 1 ); } public function add_filters() { add_filter( 'ssa/appointment_type/prepare_item_for_response', array( $this, 'maybe_return_falsey_values' ) ); $is_enabled = $this->plugin->settings_installed->is_enabled( 'advanced_scheduling' ); if ( ! $is_enabled ) { return; } add_filter( 'ssa/get_blocked_periods/blocked_periods', array( $this, 'filter_blocked_periods' ), 1, 3 ); } public function maybe_return_falsey_values( $item ) { $is_enabled = $this->plugin->settings_installed->is_enabled( 'advanced_scheduling' ); if ( $is_enabled ) { return $item; } $keys_to_redact = array( 'availability_start_date', 'availability_end_date', 'booking_start_date', 'booking_end_date', ); foreach ($keys_to_redact as $key) { if ( isset( $item[$key] ) ) { $item[$key] = ''; } } if ( isset( $item['max_booking_notice'] ) ) { $item['max_booking_notice'] = YEAR_IN_SECONDS / 60; } return $item; } public function filter_blocked_periods( $blocked_periods, $appointment_type, $args ) { if ( ! empty( $appointment_type['availability_start_date'] ) && $appointment_type['availability_start_date'] !== '0000-00-00 00:00:00' ) { $availability_start_date = $appointment_type['availability_start_date']; if ( !empty( $appointment_type['buffer_before'] ) ) { // If availability_start_date time and appointment type's start time are the same, make sure the buffer doesn't eliminate potential time slots at the start (like 9am if both start at 9am) $availability_start_date = ssa_datetime( $availability_start_date )->sub( new DateInterval( 'PT'.absint( $appointment_type['buffer_before'] ).'M' ) )->format( 'Y-m-d H:i:s' ); } $blocked_period = new Period( ssa_datetime( $availability_start_date )->sub( new DateInterval( 'P10Y' ) ), ssa_datetime( $availability_start_date ) ); $blocked_periods[] = $blocked_period; } if ( ! empty( $appointment_type['availability_end_date'] ) && $appointment_type['availability_end_date'] !== '0000-00-00 00:00:00' ) { $availability_end_date = $appointment_type['availability_end_date']; if ( !empty( $appointment_type['buffer_after'] ) ) { // If availability_end_date time and appointment type's end time are the same, make sure the buffer doesn't eliminate potential time slots at the end $availability_end_date = ssa_datetime( $availability_end_date )->add( new DateInterval( 'PT'.absint( $appointment_type['buffer_after'] ).'M' ) )->format( 'Y-m-d H:i:s' ); } $blocked_period = new Period( ssa_datetime( $availability_end_date ), ssa_datetime( $availability_end_date )->add( new DateInterval( 'P10Y' ) ) ); $blocked_periods[] = $blocked_period; } return $blocked_periods; } }
[-] class-settings.php
[edit]
[-] class-hooks.php
[edit]
[-] class-availability-query.php
[edit]
[-] class-appointment-model.php
[edit]
[-] class-beaver-builder.php
[edit]
[-] class-web-meetings.php
[edit]
[-] class-availability-model.php
[edit]
[-] class-recipient-admin.php
[edit]
[-] class-recipient-customer.php
[edit]
[-] class-constants.php
[edit]
[-] class-async-action-model.php
[edit]
[-] class-support.php
[edit]
[-] class-google-calendar-client.php
[edit]
[+]
..
[-] class-capabilities.php
[edit]
[-] class-encryption.php
[edit]
[-] class-availability-cache-invalidation.php
[edit]
[-] class-calendar-events-settings.php
[edit]
[-] class-settings-global.php
[edit]
[-] class-translation.php
[edit]
[-] class-cli.php
[edit]
[-] class-missing.php
[edit]
[-] class-action-scheduler.php
[edit]
[-] class-templates-api.php
[edit]
[-] class-blackout-dates.php
[edit]
[-] class-calendar-events-object.php
[edit]
[-] class-divi.php
[edit]
[-] class-templates.php
[edit]
[-] class-wp-admin.php
[edit]
[-] class-appointment-factory.php
[edit]
[-] class-scheduling-max-per-day.php
[edit]
[-] class-notifications-api.php
[edit]
[-] class-shortcodes.php
[edit]
[-] class-validation.php
[edit]
[-] class-resource-group-object-factory.php
[edit]
[-] class-payment-object.php
[edit]
[-] class-locale.php
[edit]
[-] class-ics-exporter.php
[edit]
[-] class-filesystem.php
[edit]
[-] class-recipient-shared.php
[edit]
[-] class-availability-schedule.php
[edit]
[-] class-block-upcoming-appointments.php
[edit]
[-] class-elementor.php
[edit]
[-] class-appointment-meta-model.php
[edit]
[-] class-revision-meta-model.php
[edit]
[+]
divi
[-] class-notifications.php
[edit]
[-] class-upgrade.php
[edit]
[-] class-utils.php
[edit]
[-] class-availability-functions.php
[edit]
[-] class-external-calendar-api.php
[edit]
[-] class-csv-exporter.php
[edit]
[-] class-external-google-calendar-api.php
[edit]
[-] class-twig-extension.php
[edit]
[-] class-bootstrap.php
[edit]
[-] class-notices.php
[edit]
[-] class-availability-schedule-factory.php
[edit]
[-] class-blackout-dates-settings.php
[edit]
[-] class-support-status.php
[edit]
[-] class-block-booking.php
[edit]
[-] class-advanced-scheduling-availability.php
[edit]
[-] class-exception.php
[edit]
[-] class-styles-settings.php
[edit]
[-] class-forms.php
[edit]
[-] class-recipient-staff.php
[edit]
[+]
beaver-builder
[-] class-users.php
[edit]
[-] class-sequence-factory.php
[edit]
[+]
third-party
[-] class-locales.php
[edit]
[-] class-db-model.php
[edit]
[-] class-db.php
[edit]
[-] class-availability-default.php
[edit]
[-] class-staff-settings.php
[edit]
[-] class-notification-model.php
[edit]
[-] class-settings-installed.php
[edit]
[-] class-appointment-object.php
[edit]
[-] class-notices-api.php
[edit]
[-] class-translation-settings.php
[edit]
[-] class-support-status-api.php
[edit]
[-] class-notices-data.php
[edit]
[-] class-appointment-type-object.php
[edit]
[-] class-appointment-type-object-factory.php
[edit]
[-] class-availability-block-factory.php
[edit]
[-] class-recipient.php
[edit]
[-] class-revision-model.php
[edit]
[-] class-customers.php
[edit]
[-] class-settings-api.php
[edit]
[-] class-cache.php
[edit]
[-] class-availability-detective-case.php
[edit]
[-] class-styles.php
[edit]
[-] class-capacity-settings.php
[edit]
[-] class-gcal-exporter.php
[edit]
[-] class-advanced-scheduling-settings.php
[edit]
[-] class-appointment-type-model.php
[edit]
[-] class-notifications-settings.php
[edit]
[-] class-period.php
[edit]
[-] class-external-api.php
[edit]
[-] class-error-notices.php
[edit]
[-] class-availability-cache.php
[edit]
[-] class-developer-settings.php
[edit]
[-] class-dashboard-upcoming-appointments-widget.php
[edit]
[-] class-availability-external-model.php
[edit]
[-] class-availability-block.php
[edit]
[-] class-customer-information.php
[edit]
[+]
elementor
[-] class-appointment-type-label-model.php
[edit]
[-] class-embed-booking-app-api.php
[edit]
[+]
lib
[-] class-sequence.php
[edit]
[-] class-debug.php
[edit]
[-] class-appointment-types-db.php
[edit]