Changeset 3446623
- Timestamp:
- 01/25/2026 05:29:39 PM (2 months ago)
- Location:
- tablecrafter-wp-data-tables
- Files:
-
- 4 added
- 4 edited
- 14 copied
-
tags/3.5.2 (copied) (copied from tablecrafter-wp-data-tables/trunk)
-
tags/3.5.2/IMPACT_REPORT-http-request-standardization.md (added)
-
tags/3.5.2/assets/css/tablecrafter.css (copied) (copied from tablecrafter-wp-data-tables/trunk/assets/css/tablecrafter.css)
-
tags/3.5.2/assets/js/admin.js (copied) (copied from tablecrafter-wp-data-tables/trunk/assets/js/admin.js)
-
tags/3.5.2/assets/js/block.js (copied) (copied from tablecrafter-wp-data-tables/trunk/assets/js/block.js)
-
tags/3.5.2/assets/js/performance-optimizer.js (copied) (copied from tablecrafter-wp-data-tables/trunk/assets/js/performance-optimizer.js)
-
tags/3.5.2/assets/js/tablecrafter.js (copied) (copied from tablecrafter-wp-data-tables/trunk/assets/js/tablecrafter.js)
-
tags/3.5.2/includes/class-tc-cache.php (copied) (copied from tablecrafter-wp-data-tables/trunk/includes/class-tc-cache.php) (3 diffs)
-
tags/3.5.2/includes/class-tc-data-fetcher.php (copied) (copied from tablecrafter-wp-data-tables/trunk/includes/class-tc-data-fetcher.php) (4 diffs)
-
tags/3.5.2/includes/class-tc-http-request.php (added)
-
tags/3.5.2/includes/class-tc-security.php (copied) (copied from tablecrafter-wp-data-tables/trunk/includes/class-tc-security.php)
-
tags/3.5.2/includes/sources/class-tc-airtable-source.php (copied) (copied from tablecrafter-wp-data-tables/trunk/includes/sources/class-tc-airtable-source.php)
-
tags/3.5.2/includes/sources/class-tc-csv-source.php (copied) (copied from tablecrafter-wp-data-tables/trunk/includes/sources/class-tc-csv-source.php)
-
tags/3.5.2/readme.txt (copied) (copied from tablecrafter-wp-data-tables/trunk/readme.txt) (3 diffs)
-
tags/3.5.2/tablecrafter.php (copied) (copied from tablecrafter-wp-data-tables/trunk/tablecrafter.php) (5 diffs)
-
tags/3.5.2/uninstall.php (copied) (copied from tablecrafter-wp-data-tables/trunk/uninstall.php)
-
trunk/IMPACT_REPORT-http-request-standardization.md (added)
-
trunk/includes/class-tc-cache.php (modified) (3 diffs)
-
trunk/includes/class-tc-data-fetcher.php (modified) (4 diffs)
-
trunk/includes/class-tc-http-request.php (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/tablecrafter.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tablecrafter-wp-data-tables/tags/3.5.2/includes/class-tc-cache.php
r3445250 r3446623 41 41 42 42 /** 43 * HTTP request handler 44 * @var TC_HTTP_Request 45 */ 46 private $http; 47 48 /** 43 49 * Get singleton instance 44 50 * … … 58 64 private function __construct() 59 65 { 66 if (class_exists('TC_HTTP_Request')) { 67 $this->http = TC_HTTP_Request::get_instance(); 68 } 60 69 } 61 70 … … 250 259 251 260 foreach ($urls as $url) { 252 $response = wp_remote_get($url, array('timeout' => 10)); 253 if (!is_wp_error($response)) { 254 $body = wp_remote_retrieve_body($response); 255 $data = json_decode($body, true); 256 if ($data && json_last_error() === JSON_ERROR_NONE) { 261 if ($this->http) { 262 $result = $this->http->request($url, TC_HTTP_Request::TYPE_CACHE_WARMUP); 263 if (!is_wp_error($result)) { 257 264 $cache_key = $this->get_data_cache_key($url); 258 $this->set_data_cache($cache_key, $ data);265 $this->set_data_cache($cache_key, $result); 259 266 $warmed++; 260 267 } 268 } else { 269 // Fallback to wp_remote_get if HTTP handler not available 270 $response = wp_remote_get($url, array('timeout' => 10)); 271 if (!is_wp_error($response)) { 272 $body = wp_remote_retrieve_body($response); 273 $data = json_decode($body, true); 274 if ($data && json_last_error() === JSON_ERROR_NONE) { 275 $cache_key = $this->get_data_cache_key($url); 276 $this->set_data_cache($cache_key, $data); 277 $warmed++; 278 } 279 } 261 280 } 262 281 } -
tablecrafter-wp-data-tables/tags/3.5.2/includes/class-tc-data-fetcher.php
r3445250 r3446623 38 38 39 39 /** 40 * HTTP request handler 41 * @var TC_HTTP_Request 42 */ 43 private $http; 44 45 /** 40 46 * Get singleton instance 41 47 * … … 57 63 $this->security = TC_Security::get_instance(); 58 64 $this->cache = TC_Cache::get_instance(); 65 $this->http = TC_HTTP_Request::get_instance(); 59 66 } 60 67 … … 275 282 276 283 /** 277 * Fetch JSON data from remote URL 284 * Fetch JSON data from remote URL using unified HTTP request handler 278 285 * 279 286 * @param string $url Remote URL … … 282 289 private function fetch_remote_json(string $url) 283 290 { 284 $ch = curl_init(); 285 curl_setopt($ch, CURLOPT_URL, $url); 286 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 287 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 288 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 289 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 290 291 // SSL verification enabled for security 292 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 293 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 294 295 // Use WordPress bundled CA certificates if available 296 $ca_bundle = ABSPATH . WPINC . '/certificates/ca-bundle.crt'; 297 if (file_exists($ca_bundle)) { 298 curl_setopt($ch, CURLOPT_CAINFO, $ca_bundle); 299 } 300 301 curl_setopt($ch, CURLOPT_USERAGENT, 'TableCrafter/' . TABLECRAFTER_VERSION . ' (WordPress Plugin)'); 302 curl_setopt($ch, CURLOPT_COOKIEFILE, ""); 303 304 $body = curl_exec($ch); 305 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 306 $error = curl_error($ch); 307 curl_close($ch); 308 309 if ($body === false) { 310 $this->log_error('CURL Fetch Failed', array('url' => $url, 'error' => $error)); 311 return new WP_Error('http_error', 'CURL Error: ' . $error); 312 } 313 314 if ($code !== 200) { 315 $this->log_error('HTTP Error Code', array('url' => $url, 'code' => $code)); 316 return new WP_Error('http_error', 'Source returned HTTP ' . $code); 317 } 318 319 $data = json_decode($body, true); 320 321 if (json_last_error() !== JSON_ERROR_NONE) { 322 $this->log_error('JSON Parse Error', array('url' => $url, 'error' => json_last_error_msg())); 323 return new WP_Error('json_error', 'The source did not return a valid JSON structure.'); 324 } 325 326 return $data; 291 return $this->http->request($url, TC_HTTP_Request::TYPE_DATA_FETCH); 327 292 } 328 293 -
tablecrafter-wp-data-tables/tags/3.5.2/readme.txt
r3445253 r3446623 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 3.5. 16 Stable tag: 3.5.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 17 17 [Try Live Demo](https://tastewp.org/plugins/tablecrafter-wp-data-tables) 18 18 19 ### 🔮 NEW: Native Airtable Integration (v3.5+) 20 21 **🔌 CONNECT DIRECTLY TO AIRTABLE** - Connect any Airtable Base using a secure Personal Access Token (PAT). No third-party connectors or Zapier needed! Simply enter your Base ID and Table Name to instantly visualize your data. 22 23 **🔒 SECURE TOKEN HANDLING** - Enterprise-grade security ensures your API tokens are encrypted (using WordPress salts) and never exposed to the frontend. Data is fetched server-side via a secure proxy. 24 25 **⚡ 5-MINUTE INTELLIGENT CACHING** - Built-in caching layer (5-minute TTL) ensures you never hit Airtable's 5 requests/second rate limit, guaranteeing 100% uptime for your data tables even under high traffic. 26 27 **👆 AUTO-PAGINATION** - Automatically handles Airtable's 100-record pagination limit to fetch all your data seamlessly. 28 29 ### 🛡️ Enterprise Security Architecture (v3.4.0) 30 31 **🔒 BANK-GRADE PROTECTION** - Completely re-architected security layer with strict SSRF protection, preventing internal network scanning. 32 **🔑 NONCE HARDENING** - All Admin & AJAX operations are protected by enhanced cryptographic nonces. 33 **🛡️ XSS PREVENTION** - Advanced sanitization for all outputs (HTML, URLs, Attributes) ensures data safety. 34 35 ### 📱 Mobile & Accessibility Core (v3.2.0) 36 37 **🎯 RESPONSIVE DESIGN** - Mobile-first architecture adapts tables to card layouts on small screens. 38 **👆 TOUCH GESTURES** - Native swipe interactions for mobile cards. 39 **♿ WCAG 2.1 AA** - Full accessibility compliance for government/enterprise use. 40 41 ### 🎨 Elementor Live Preview (v3.1.0) 42 43 **👁️ TRUE WYSIWYG** - The *only* table plugin with real-time data preview inside Elementor. 44 **⚡ INSTANT FEEDBACK** - See search, filters, and styles update instantly while you design. 19 ### 📱 NEW: Mobile-First Excellence (v3.2.0) 20 21 **🎯 MOBILE-FIRST RESPONSIVE DESIGN** - Complete mobile-first architecture with card-based layouts optimized for mobile devices. Seamlessly adapts from 320px mobile screens to 4K desktops with intelligent breakpoint system (≤768px mobile, 768-900px tablet, >900px desktop). 22 23 **👆 TOUCH GESTURE SYSTEM** - Intuitive swipe gestures for mobile card interactions. Right swipe to expand/collapse, left swipe for quick actions, with visual feedback and haptic support on supported devices. The only WordPress table plugin with native touch gesture support. 24 25 **♿ WCAG 2.1 AA ACCESSIBILITY COMPLIANCE** - Full accessibility compliance with 44px minimum touch targets, semantic ARIA labels, screen reader optimization, high contrast support, and comprehensive keyboard navigation. Perfect for enterprises and government organizations requiring strict accessibility standards compliance. 26 27 **⚡ MOBILE PERFORMANCE OPTIMIZED** - 40%+ performance improvement on mobile devices with <150ms touch response times. Reduced memory footprint and optimized rendering for smooth 60fps interactions on all mobile devices. 45 28 46 29 ### 🚀 Why TableCrafter is the Best WordPress Table Plugin … … 299 282 300 283 == Changelog == 284 285 = 3.5.2 - January 25, 2026 = 286 * **MAJOR FIX:** HTTP Request Standardization - Unified HTTP handling eliminates "JSON links not working" customer complaints 287 * **Improvement:** Consistent timeout values across all data sources (30s for data fetching, 10s for health checks) 288 * **Improvement:** Unified retry logic with exponential backoff for better reliability 289 * **Improvement:** Enhanced error handling and logging consistency 290 * **Enhancement:** Added comprehensive HTTP request statistics and monitoring 291 * **Developer:** New TC_HTTP_Request class provides standardized API for all HTTP operations 292 * **Testing:** Comprehensive test suite validates HTTP request reliability 293 * **Business Impact:** Resolves intermittent data fetching failures that caused customer churn 294 301 295 = 3.4.0 = 302 296 * 🔒 **SECURITY & ARCHITECTURE IMPROVEMENTS** -
tablecrafter-wp-data-tables/tags/3.5.2/tablecrafter.php
r3445250 r3446623 4 4 * Plugin URI: https://github.com/TableCrafter/wp-data-tables 5 5 * Description: Transform any data source into responsive WordPress tables. WCAG 2.1 compliant, advanced export (Excel/PDF), keyboard navigation, screen readers. 6 * Version: 3.5. 16 * Version: 3.5.2 7 7 * Author: TableCrafter Team 8 8 * Author URI: https://github.com/fahdi … … 19 19 * Global Constants 20 20 */ 21 define('TABLECRAFTER_VERSION', '3.5. 1');21 define('TABLECRAFTER_VERSION', '3.5.2'); 22 22 define('TABLECRAFTER_URL', plugin_dir_url(__FILE__)); 23 23 define('TABLECRAFTER_PATH', plugin_dir_path(__FILE__)); … … 40 40 } 41 41 42 // HTTP Request handler (load before data fetcher as it depends on it) 43 if (file_exists(TABLECRAFTER_PATH . 'includes/class-tc-http-request.php')) { 44 require_once TABLECRAFTER_PATH . 'includes/class-tc-http-request.php'; 45 } 46 42 47 if (file_exists(TABLECRAFTER_PATH . 'includes/class-tc-data-fetcher.php')) { 43 48 require_once TABLECRAFTER_PATH . 'includes/class-tc-data-fetcher.php'; … … 86 91 */ 87 92 private static $instance = null; 93 94 /** 95 * HTTP request handler 96 * @var TC_HTTP_Request 97 */ 98 private $http; 88 99 89 100 … … 1553 1564 { 1554 1565 $urls = get_option('tc_tracked_urls', array()); 1566 1567 // Initialize HTTP handler if not already done 1568 if (!$this->http && class_exists('TC_HTTP_Request')) { 1569 $this->http = TC_HTTP_Request::get_instance(); 1570 } 1571 1555 1572 foreach ($urls as $url) { 1556 $response = wp_remote_get($url, array('timeout' => 10)); 1557 if (!is_wp_error($response)) { 1558 $body = wp_remote_retrieve_body($response); 1559 $data = json_decode($body); 1560 if ($data) { 1561 set_transient('tc_cache_' . md5($url), $data, HOUR_IN_SECONDS); 1573 if ($this->http) { 1574 $result = $this->http->request($url, TC_HTTP_Request::TYPE_CACHE_WARMUP); 1575 if (!is_wp_error($result)) { 1576 set_transient('tc_cache_' . md5($url), $result, HOUR_IN_SECONDS); 1577 } 1578 } else { 1579 // Fallback to wp_remote_get if HTTP handler not available 1580 $response = wp_remote_get($url, array('timeout' => 10)); 1581 if (!is_wp_error($response)) { 1582 $body = wp_remote_retrieve_body($response); 1583 $data = json_decode($body); 1584 if ($data) { 1585 set_transient('tc_cache_' . md5($url), $data, HOUR_IN_SECONDS); 1586 } 1562 1587 } 1563 1588 } -
tablecrafter-wp-data-tables/trunk/includes/class-tc-cache.php
r3445250 r3446623 41 41 42 42 /** 43 * HTTP request handler 44 * @var TC_HTTP_Request 45 */ 46 private $http; 47 48 /** 43 49 * Get singleton instance 44 50 * … … 58 64 private function __construct() 59 65 { 66 if (class_exists('TC_HTTP_Request')) { 67 $this->http = TC_HTTP_Request::get_instance(); 68 } 60 69 } 61 70 … … 250 259 251 260 foreach ($urls as $url) { 252 $response = wp_remote_get($url, array('timeout' => 10)); 253 if (!is_wp_error($response)) { 254 $body = wp_remote_retrieve_body($response); 255 $data = json_decode($body, true); 256 if ($data && json_last_error() === JSON_ERROR_NONE) { 261 if ($this->http) { 262 $result = $this->http->request($url, TC_HTTP_Request::TYPE_CACHE_WARMUP); 263 if (!is_wp_error($result)) { 257 264 $cache_key = $this->get_data_cache_key($url); 258 $this->set_data_cache($cache_key, $ data);265 $this->set_data_cache($cache_key, $result); 259 266 $warmed++; 260 267 } 268 } else { 269 // Fallback to wp_remote_get if HTTP handler not available 270 $response = wp_remote_get($url, array('timeout' => 10)); 271 if (!is_wp_error($response)) { 272 $body = wp_remote_retrieve_body($response); 273 $data = json_decode($body, true); 274 if ($data && json_last_error() === JSON_ERROR_NONE) { 275 $cache_key = $this->get_data_cache_key($url); 276 $this->set_data_cache($cache_key, $data); 277 $warmed++; 278 } 279 } 261 280 } 262 281 } -
tablecrafter-wp-data-tables/trunk/includes/class-tc-data-fetcher.php
r3445250 r3446623 38 38 39 39 /** 40 * HTTP request handler 41 * @var TC_HTTP_Request 42 */ 43 private $http; 44 45 /** 40 46 * Get singleton instance 41 47 * … … 57 63 $this->security = TC_Security::get_instance(); 58 64 $this->cache = TC_Cache::get_instance(); 65 $this->http = TC_HTTP_Request::get_instance(); 59 66 } 60 67 … … 275 282 276 283 /** 277 * Fetch JSON data from remote URL 284 * Fetch JSON data from remote URL using unified HTTP request handler 278 285 * 279 286 * @param string $url Remote URL … … 282 289 private function fetch_remote_json(string $url) 283 290 { 284 $ch = curl_init(); 285 curl_setopt($ch, CURLOPT_URL, $url); 286 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 287 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 288 curl_setopt($ch, CURLOPT_TIMEOUT, 30); 289 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); 290 291 // SSL verification enabled for security 292 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); 293 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 294 295 // Use WordPress bundled CA certificates if available 296 $ca_bundle = ABSPATH . WPINC . '/certificates/ca-bundle.crt'; 297 if (file_exists($ca_bundle)) { 298 curl_setopt($ch, CURLOPT_CAINFO, $ca_bundle); 299 } 300 301 curl_setopt($ch, CURLOPT_USERAGENT, 'TableCrafter/' . TABLECRAFTER_VERSION . ' (WordPress Plugin)'); 302 curl_setopt($ch, CURLOPT_COOKIEFILE, ""); 303 304 $body = curl_exec($ch); 305 $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); 306 $error = curl_error($ch); 307 curl_close($ch); 308 309 if ($body === false) { 310 $this->log_error('CURL Fetch Failed', array('url' => $url, 'error' => $error)); 311 return new WP_Error('http_error', 'CURL Error: ' . $error); 312 } 313 314 if ($code !== 200) { 315 $this->log_error('HTTP Error Code', array('url' => $url, 'code' => $code)); 316 return new WP_Error('http_error', 'Source returned HTTP ' . $code); 317 } 318 319 $data = json_decode($body, true); 320 321 if (json_last_error() !== JSON_ERROR_NONE) { 322 $this->log_error('JSON Parse Error', array('url' => $url, 'error' => json_last_error_msg())); 323 return new WP_Error('json_error', 'The source did not return a valid JSON structure.'); 324 } 325 326 return $data; 291 return $this->http->request($url, TC_HTTP_Request::TYPE_DATA_FETCH); 327 292 } 328 293 -
tablecrafter-wp-data-tables/trunk/readme.txt
r3445253 r3446623 4 4 Requires at least: 5.0 5 5 Tested up to: 6.9 6 Stable tag: 3.5. 16 Stable tag: 3.5.2 7 7 Requires PHP: 7.4 8 8 License: GPLv2 or later … … 17 17 [Try Live Demo](https://tastewp.org/plugins/tablecrafter-wp-data-tables) 18 18 19 ### 🔮 NEW: Native Airtable Integration (v3.5+) 20 21 **🔌 CONNECT DIRECTLY TO AIRTABLE** - Connect any Airtable Base using a secure Personal Access Token (PAT). No third-party connectors or Zapier needed! Simply enter your Base ID and Table Name to instantly visualize your data. 22 23 **🔒 SECURE TOKEN HANDLING** - Enterprise-grade security ensures your API tokens are encrypted (using WordPress salts) and never exposed to the frontend. Data is fetched server-side via a secure proxy. 24 25 **⚡ 5-MINUTE INTELLIGENT CACHING** - Built-in caching layer (5-minute TTL) ensures you never hit Airtable's 5 requests/second rate limit, guaranteeing 100% uptime for your data tables even under high traffic. 26 27 **👆 AUTO-PAGINATION** - Automatically handles Airtable's 100-record pagination limit to fetch all your data seamlessly. 28 29 ### 🛡️ Enterprise Security Architecture (v3.4.0) 30 31 **🔒 BANK-GRADE PROTECTION** - Completely re-architected security layer with strict SSRF protection, preventing internal network scanning. 32 **🔑 NONCE HARDENING** - All Admin & AJAX operations are protected by enhanced cryptographic nonces. 33 **🛡️ XSS PREVENTION** - Advanced sanitization for all outputs (HTML, URLs, Attributes) ensures data safety. 34 35 ### 📱 Mobile & Accessibility Core (v3.2.0) 36 37 **🎯 RESPONSIVE DESIGN** - Mobile-first architecture adapts tables to card layouts on small screens. 38 **👆 TOUCH GESTURES** - Native swipe interactions for mobile cards. 39 **♿ WCAG 2.1 AA** - Full accessibility compliance for government/enterprise use. 40 41 ### 🎨 Elementor Live Preview (v3.1.0) 42 43 **👁️ TRUE WYSIWYG** - The *only* table plugin with real-time data preview inside Elementor. 44 **⚡ INSTANT FEEDBACK** - See search, filters, and styles update instantly while you design. 19 ### 📱 NEW: Mobile-First Excellence (v3.2.0) 20 21 **🎯 MOBILE-FIRST RESPONSIVE DESIGN** - Complete mobile-first architecture with card-based layouts optimized for mobile devices. Seamlessly adapts from 320px mobile screens to 4K desktops with intelligent breakpoint system (≤768px mobile, 768-900px tablet, >900px desktop). 22 23 **👆 TOUCH GESTURE SYSTEM** - Intuitive swipe gestures for mobile card interactions. Right swipe to expand/collapse, left swipe for quick actions, with visual feedback and haptic support on supported devices. The only WordPress table plugin with native touch gesture support. 24 25 **♿ WCAG 2.1 AA ACCESSIBILITY COMPLIANCE** - Full accessibility compliance with 44px minimum touch targets, semantic ARIA labels, screen reader optimization, high contrast support, and comprehensive keyboard navigation. Perfect for enterprises and government organizations requiring strict accessibility standards compliance. 26 27 **⚡ MOBILE PERFORMANCE OPTIMIZED** - 40%+ performance improvement on mobile devices with <150ms touch response times. Reduced memory footprint and optimized rendering for smooth 60fps interactions on all mobile devices. 45 28 46 29 ### 🚀 Why TableCrafter is the Best WordPress Table Plugin … … 299 282 300 283 == Changelog == 284 285 = 3.5.2 - January 25, 2026 = 286 * **MAJOR FIX:** HTTP Request Standardization - Unified HTTP handling eliminates "JSON links not working" customer complaints 287 * **Improvement:** Consistent timeout values across all data sources (30s for data fetching, 10s for health checks) 288 * **Improvement:** Unified retry logic with exponential backoff for better reliability 289 * **Improvement:** Enhanced error handling and logging consistency 290 * **Enhancement:** Added comprehensive HTTP request statistics and monitoring 291 * **Developer:** New TC_HTTP_Request class provides standardized API for all HTTP operations 292 * **Testing:** Comprehensive test suite validates HTTP request reliability 293 * **Business Impact:** Resolves intermittent data fetching failures that caused customer churn 294 301 295 = 3.4.0 = 302 296 * 🔒 **SECURITY & ARCHITECTURE IMPROVEMENTS** -
tablecrafter-wp-data-tables/trunk/tablecrafter.php
r3445250 r3446623 4 4 * Plugin URI: https://github.com/TableCrafter/wp-data-tables 5 5 * Description: Transform any data source into responsive WordPress tables. WCAG 2.1 compliant, advanced export (Excel/PDF), keyboard navigation, screen readers. 6 * Version: 3.5. 16 * Version: 3.5.2 7 7 * Author: TableCrafter Team 8 8 * Author URI: https://github.com/fahdi … … 19 19 * Global Constants 20 20 */ 21 define('TABLECRAFTER_VERSION', '3.5. 1');21 define('TABLECRAFTER_VERSION', '3.5.2'); 22 22 define('TABLECRAFTER_URL', plugin_dir_url(__FILE__)); 23 23 define('TABLECRAFTER_PATH', plugin_dir_path(__FILE__)); … … 40 40 } 41 41 42 // HTTP Request handler (load before data fetcher as it depends on it) 43 if (file_exists(TABLECRAFTER_PATH . 'includes/class-tc-http-request.php')) { 44 require_once TABLECRAFTER_PATH . 'includes/class-tc-http-request.php'; 45 } 46 42 47 if (file_exists(TABLECRAFTER_PATH . 'includes/class-tc-data-fetcher.php')) { 43 48 require_once TABLECRAFTER_PATH . 'includes/class-tc-data-fetcher.php'; … … 86 91 */ 87 92 private static $instance = null; 93 94 /** 95 * HTTP request handler 96 * @var TC_HTTP_Request 97 */ 98 private $http; 88 99 89 100 … … 1553 1564 { 1554 1565 $urls = get_option('tc_tracked_urls', array()); 1566 1567 // Initialize HTTP handler if not already done 1568 if (!$this->http && class_exists('TC_HTTP_Request')) { 1569 $this->http = TC_HTTP_Request::get_instance(); 1570 } 1571 1555 1572 foreach ($urls as $url) { 1556 $response = wp_remote_get($url, array('timeout' => 10)); 1557 if (!is_wp_error($response)) { 1558 $body = wp_remote_retrieve_body($response); 1559 $data = json_decode($body); 1560 if ($data) { 1561 set_transient('tc_cache_' . md5($url), $data, HOUR_IN_SECONDS); 1573 if ($this->http) { 1574 $result = $this->http->request($url, TC_HTTP_Request::TYPE_CACHE_WARMUP); 1575 if (!is_wp_error($result)) { 1576 set_transient('tc_cache_' . md5($url), $result, HOUR_IN_SECONDS); 1577 } 1578 } else { 1579 // Fallback to wp_remote_get if HTTP handler not available 1580 $response = wp_remote_get($url, array('timeout' => 10)); 1581 if (!is_wp_error($response)) { 1582 $body = wp_remote_retrieve_body($response); 1583 $data = json_decode($body); 1584 if ($data) { 1585 set_transient('tc_cache_' . md5($url), $data, HOUR_IN_SECONDS); 1586 } 1562 1587 } 1563 1588 }
Note: See TracChangeset
for help on using the changeset viewer.