PATH:
home
/
ediuae
/
petalwellnessspa.com
/
wp-content
/
plugins
/
simply-schedule-appointments
/
includes
<?php /** * Simply Schedule Appointments Developer Settings. * * @since 1.0.1 * @package Simply_Schedule_Appointments */ /** * Simply Schedule Appointments Developer Settings. * * @since 1.0.1 */ class SSA_Developer_Settings extends SSA_Settings_Schema { /** * Parent plugin class. * * @since 0.0.3 * * @var Simply_Schedule_Appointments */ protected $plugin = null; /** * Constructor. * * @since 0.0.3 * * @param Simply_Schedule_Appointments $plugin Main plugin object. */ public function __construct( $plugin ) { parent::__construct(); $this->plugin = $plugin; $this->hooks(); } /** * Initiate our hooks. * * @since 0.0.3 */ public function hooks() { // add_filter( 'update_'.$this->slug.'_settings', array( $this, 'auto_validate_api_key' ), 10, 2 ); add_action( 'ssa/settings/developer/updated', array( $this, 'maybe_update_debug_mode' ), 10, 2 ); add_action( 'ssa/settings/developer/updated', array( $this, 'maybe_invalidate_cache' ), 10, 2 ); add_action( 'ssa/settings/developer/updated', array( $this, 'maybe_invalidate_cache_for_separate_availability' ), 10, 2 ); } protected $slug = 'developer'; public function get_schema() { if ( !empty( $this->schema ) ) { return $this->schema; } // Caution: When schema modified, please modify usage in ssa_uninstall function in simply-schedule-appointments.php $this->schema = array( // YYYY-MM-DD 'version' => '2024-04-09', 'fields' => array( 'enabled' => array( 'name' => 'enabled', 'default_value' => true, ), 'enqueue_everywhere' => array( 'name' => 'enqueue_everywhere', 'default_value' => false, ), 'separate_appointment_type_availability' => array( 'name' => 'separate_appointment_type_availability', 'default_value' => apply_filters( 'ssa/get_booked_periods/should_separate_availability_for_appointment_types', false ), ), 'beta_updates' => array( 'name' => 'beta_updates', 'default_value' => false ), // Beta Features 'quick_connect_gcal_mode' => array ( 'name' => 'quick_connect_gcal_mode', 'default_value' => false, ), 'display_appointment_revisions' => array( 'name' => 'display_appointment_revisions', 'default_value' => false ), 'capacity_availability' => array( 'name' => 'capacity_availability', 'default_value' => false ), // TODO: remove cache_availability 'cache_availability' => array( 'name' => 'cache_availability', 'default_value' => false ), 'disable_availability_caching' => array( 'name' => 'disable_availability_caching', 'default_value' => false ), 'object_cache' => array( 'name' => 'object_cache', 'default_value' => false ), 'debug_mode' => array( 'name' => 'debug_mode', 'default_value' => false ), 'ssa_debug_mode' => array( 'name' => 'ssa_debug_mode', 'default_value' => false ), // hidden settings 'display_capacity_available' => array( 'name' => 'display_capacity_available', 'default_value' => false ), 'remove_data_on_uninstall' => array( 'name' => 'remove_data_on_uninstall', 'default_value' => false, ), ), ); return $this->schema; } public function validate( $new_settings, $old_settings ) { // we validate values against schema first, and return any schema mismatch errors $schema_invalid_fields = parent::validate( $new_settings, $old_settings ); if ( is_wp_error( $schema_invalid_fields ) ) { return $schema_invalid_fields; } // if SSA is currently connected to Google Calendar, prevent toggling quick connect gcal mode if ( true == $this->plugin->google_calendar->is_activated() ) { $old_settings_quick_connect_gcal_mode = isset( $old_settings[ 'quick_connect_gcal_mode' ] ) ? $old_settings['quick_connect_gcal_mode'] : false; $new_settings_quick_connect_gcal_mode = isset( $new_settings[ 'quick_connect_gcal_mode' ] ) ? $new_settings['quick_connect_gcal_mode'] : false; if ( ( bool ) $new_settings_quick_connect_gcal_mode !== ( bool ) $old_settings_quick_connect_gcal_mode ) { return new WP_Error( 'quick_connect_gcal_mode', __( 'Cannot toggle Quick Connect Google Calendar Mode while connected to Google Calendar.', 'simply-schedule-appointments' ) ); } } } public function maybe_update_debug_mode( $settings, $old_settings ) { if( ! isset( $settings['debug_mode'] ) ) { return; } if ( empty( $settings['debug_mode'] ) === empty( $old_settings['debug_mode'] ) ) { // The debug mode has not been changed return; } $config_path = ABSPATH . 'wp-config.php'; if ( ! class_exists( '\WPConfigTransformer' ) ) { require $this->plugin->dir( 'includes/lib/wp-cli/wp-config-transformer/src/WPConfigTransformer.php' ); } try{ $config_transformer = new \WPConfigTransformer( $config_path ); if( $settings['debug_mode'] ) { $config_transformer->update( 'constant', 'WP_DEBUG', 'true', array( 'raw' => true ) ); $config_transformer->update( 'constant', 'WP_DEBUG_LOG', 'true', array( 'raw' => true ) ); $config_transformer->update( 'constant', 'WP_DEBUG_DISPLAY', 'false', array( 'raw' => true ) ); } else { $config_transformer->remove( 'constant', 'WP_DEBUG' ); $config_transformer->remove( 'constant', 'WP_DEBUG_LOG' ); $config_transformer->remove( 'constant', 'WP_DEBUG_DISPLAY' ); } } catch( \Exception $e ) { ssa_debug_log( '$config_transformer', $e->getMessage() ); } } public function maybe_invalidate_cache( $settings, $old_settings ) { if( ! isset( $settings['disable_availability_caching'] ) ) { return; } if ( isset( $old_settings['disable_availability_caching'] ) && $old_settings['disable_availability_caching'] == $settings['disable_availability_caching'] ) { return; } if ( ! empty( $settings['disable_availability_caching'] ) ) { $this->plugin->availability_model->drop(); $this->plugin->availability_model->create_table(); $this->plugin->availability_cache_invalidation->increment_cache_version(); $this->plugin->google_calendar->increment_google_cache_version(); } else { $this->plugin->availability_cache_invalidation->invalidate_everything(); $this->plugin->google_calendar->increment_google_cache_version(); } } public function maybe_invalidate_cache_for_separate_availability( $settings, $old_settings ) { if( ! isset( $settings['separate_appointment_type_availability'] ) ) { return; } if ( isset( $old_settings['separate_appointment_type_availability'] ) && $old_settings['separate_appointment_type_availability'] == $settings['separate_appointment_type_availability'] ) { return; // nothing changed } $this->plugin->availability_cache_invalidation->invalidate_everything(); } }
[-] 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]