Changeset 3436371
- Timestamp:
- 01/10/2026 03:53:19 AM (2 months ago)
- Location:
- workzen-connector/trunk
- Files:
-
- 3 edited
-
includes/class-online-booking.php (modified) (7 diffs)
-
readme.txt (modified) (1 diff)
-
workzen-connector.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
workzen-connector/trunk/includes/class-online-booking.php
r3435998 r3436371 33 33 $is_dev = defined( 'WORKZEN_DEV' ) && WORKZEN_DEV; 34 34 35 // Try to get cached data first (cache for 5 minutes, skip in dev)35 // Try to get cached data first (cache for 12 hours, skip in dev) 36 36 $cache_key = 'wzc_booking_data'; 37 if ( ! $is_dev ) { 38 $cached_data = get_transient( $cache_key ); 39 if ( false !== $cached_data ) { 40 return $cached_data; 41 } 37 $cached_data = get_transient( $cache_key ); 38 39 if ( ! $is_dev && false !== $cached_data ) { 40 return $cached_data; 42 41 } 43 42 … … 45 44 $endpoint = get_option( WZC_Constants::OPTION_ENDPOINT ); 46 45 if ( empty( $endpoint ) ) { 47 return $this->get_fallback_booking_data( );46 return $this->get_fallback_booking_data( $cached_data ); 48 47 } 49 48 … … 55 54 $integration_key = get_option( WZC_Constants::OPTION_INTEGRATION_KEY ); 56 55 if ( empty( $integration_key ) ) { 57 return $this->get_fallback_booking_data( );56 return $this->get_fallback_booking_data( $cached_data ); 58 57 } 59 58 … … 76 75 if ( is_wp_error( $response ) ) { 77 76 $this->log_error( 'Failed to fetch booking config: ' . $response->get_error_message() ); 78 return $this->get_fallback_booking_data( );77 return $this->get_fallback_booking_data( $cached_data ); 79 78 } 80 79 … … 82 81 if ( $response_code !== 200 ) { 83 82 $this->log_error( 'Booking config API returned status: ' . $response_code ); 84 return $this->get_fallback_booking_data( );83 return $this->get_fallback_booking_data( $cached_data ); 85 84 } 86 85 … … 90 89 if ( ! is_array( $data ) || ! isset( $data['work_hours'] ) || ! isset( $data['job_types'] ) ) { 91 90 $this->log_error( 'Invalid booking config response format' ); 92 return $this->get_fallback_booking_data( );91 return $this->get_fallback_booking_data( $cached_data ); 93 92 } 94 93 … … 109 108 * Get fallback booking data when API is unavailable 110 109 * 111 * @return array Default booking data structure 112 */ 113 private function get_fallback_booking_data() { 110 * If previously cached data exists, return that to preserve existing data. 111 * Only return default empty data if no cache exists. 112 * 113 * @param array|false $cached_data Previously cached data, or false if none 114 * @return array Booking data structure 115 */ 116 private function get_fallback_booking_data( $cached_data = false ) { 117 // If we have cached data, return it to preserve existing job types and work hours 118 if ( false !== $cached_data && is_array( $cached_data ) ) { 119 return $cached_data; 120 } 121 122 // Only return defaults if no cached data exists at all 114 123 return array( 115 124 'work_hours' => array( -
workzen-connector/trunk/readme.txt
r3435998 r3436371 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 1.10. 17 Stable tag: 1.10.2 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
workzen-connector/trunk/workzen-connector.php
r3435998 r3436371 3 3 * Plugin Name: WorkZen Connector 4 4 * Description: Connects WordPress forms to WorkZen CRM. Captures leads from Contact Form 7, WPForms, Gravity Forms, and other popular form plugins, sending them securely to your WorkZen account via the WorkZen API (https://api.workzen.io). Includes floating buttons with online booking functionality. 5 * Version: 1.10. 15 * Version: 1.10.2 6 6 * Author: Ika Balzam 7 7 * Author URI: https://workzen.io
Note: See TracChangeset
for help on using the changeset viewer.