PATH:
home
/
ediuae
/
petalwellnessspa.com
/
wp-content
/
plugins
/
simply-schedule-appointments
/
includes
<?php /** * Simply Schedule Appointments Availability Default. * * @since 3.6.0 * @package Simply_Schedule_Appointments */ use League\Period\Period; /** * Simply Schedule Appointments Availability Default. * * @since 3.6.0 */ class SSA_Availability_Default { /** * Parent plugin class. * * @since 3.6.0 * * @var Simply_Schedule_Appointments */ protected $plugin = null; /** * Constructor. * * @since 3.6.0 * * @param Simply_Schedule_Appointments $plugin Main plugin object. */ public function __construct( $plugin ) { $this->plugin = $plugin; $this->hooks(); } /** * Initiate our hooks. * * @since 3.6.0 */ public function hooks() { add_action( 'admin_init', array( $this, 'debug' ) ); } public function debug() { if ( empty( $_GET['debug_availability'] ) ) { return; } $sequence = new SSA_Sequence( array( SSA_Period::create_from_appointment_id( 306 ), SSA_Period::create_from_appointment_id( 260 ), )); $filter = function ( $value ) { if ( $value->get_raw_period()->getStartDate() >= new DateTime( '2116-01-01' ) ) { return true; } return false; }; } // public function get_args( $appointment_type, $args = array() ) { // $default_args = apply_filters( 'ssa/availability/default_args', array( // 'start_date' => '', // 'duration' => '', // 'end_date' => '', // 'start_date_min' => '', // 'start_date_max' => '', // 'end_date_min' => '', // 'end_date_max' => '', // 'buffered' => false, // 'excluded_appointment_ids' => array(), // 'appointment_statuses' => SSA_Appointment_Model::get_unavailable_statuses(), // ), $appointment_type ); // $args = shortcode_atts( $default_args, $args ); // return $args; // } // public function get_available_periods( $appointment_type, $args ) { // $appointment_type = SSA_Utils::get_appointment_type( $appointment_type ); // if ( false === $appointment_type ) { // return; // } // $args = $this->get_args( $appointment_type, $args ); // $availability_home_timezone = $this->plugin->utils->get_datetimezone( $appointment_type['id'] ); // $available_periods = array(); // $start_date = ssa_datetime( $args['start_date_min'] ); // $end_date = ssa_datetime( $args['start_date_max'] ); // $start_date = $start_date->sub( new DateInterval( 'P1D' ) ); // help avoid timezone issues, our get_bookable_appointments() function will remove ones we don't need // $end_date = $end_date->add( new DateInterval( 'P1D' ) ); // help avoid timezone issues, our get_bookable_appointments() function will remove ones we don't need // $range_period = new Period( $start_date, $end_date ); // foreach ($range_period->getDatePeriod( '1 DAY' ) as $datetime) { // $day_of_week = $datetime->format( 'l' ); // if ( empty( $appointment_type['availability'][$day_of_week][0]['time_start'] ) ) { // continue; // } // foreach ($appointment_type['availability'][$day_of_week] as $time_block ) { // $start_date = SSA_Utils::get_datetime_in_utc( $datetime->format( 'Y-m-d '.$time_block['time_start'] ), $availability_home_timezone ); // $end_date = SSA_Utils::get_datetime_in_utc( $datetime->format( 'Y-m-d '.$time_block['time_end'] ), $availability_home_timezone ); // $new_period = new Period( // $start_date, // $end_date // ); // $available_periods[] = $new_period; // } // } // $available_periods = $this->plugin->availability_functions->combine_abutting_periods( $available_periods ); // return $available_periods; // } // public function cache( $appointment_type, $args ) { // $appointment_type = SSA_Utils::get_appointment_type( $appointment_type ); // if ( false === $appointment_type ) { // return; // } // $args = array_merge( array( // 'type' => 'default', // 'subtype' => 'hours', // ), $args ); // $availability_period_rows = array(); // $available_periods = $this->get_available_periods( $appointment_type, $args ); // $unavailable_periods = $this->plugin->availability_functions->get_inverse_periods( $available_periods ); // foreach ( $available_periods as $key => $available_period) { // $period_row = array( // 'appointment_type_id' => $appointment_type['id'], // 'start_date' => $available_period->getStartDate()->format( 'Y-m-d H:i:s' ), // 'end_date' => $available_period->getEndDate()->format( 'Y-m-d H:i:s' ), // 'is_available' => 1, // 'type' => 'default', // 'subtype' => 'hours', // ); // $availability_period_rows[] = $period_row; // } // foreach ( $unavailable_periods as $key => $available_period) { // $period_row = array( // 'appointment_type_id' => $appointment_type['id'], // 'start_date' => $available_period->getStartDate()->format( 'Y-m-d H:i:s' ), // 'end_date' => $available_period->getEndDate()->format( 'Y-m-d H:i:s' ), // 'is_available' => 0, // 'type' => 'default', // 'subtype' => 'hours', // ); // $availability_period_rows[] = $period_row; // } // $this->plugin->availability_model->update_rows( $availability_period_rows, $args ); // } }
[-] 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]