Major improvements: Fix download limits, enhance license display, fix software filenames

🔧 Bug Fixes:
- Fixed download limits defaulting to 5 instead of 0 for unlimited downloads
- Fixed software license filename sanitization (spaces→dashes, dots→underscores, proper .zip extension)
- Software downloads now show as "Test-Plugin-v2-2-0.zip" instead of "Test Plugin v2.2.0"

 UI/UX Enhancements:
- Redesigned license key display to span full table width with FontAwesome copy icons
- Added responsive CSS styling for license key rows
- Integrated FontAwesome CDN for modern copy icons

🏗️ Architecture Improvements:
- Added comprehensive filename sanitization in both download handler and API paths
- Enhanced software license product handling for local package files
- Improved error handling and logging throughout download processes

📦 Infrastructure:
- Added Gitea workflows for automated releases on push to main
- Created comprehensive .gitignore excluding test files and browser automation
- Updated documentation with all recent improvements and technical insights

🔍 Technical Details:
- Software license products served from wp-content/uploads/wpdd-packages/
- Download flow: token → process_download_by_token() → process_download() → deliver_file()
- Dual path coverage for both API downloads and regular file delivery
- Version placeholder system for automated deployment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-09 19:16:57 -07:00
parent ce48f1615f
commit a160fe3964
28 changed files with 3709 additions and 156 deletions

View File

@@ -180,8 +180,26 @@ class WPDD_Orders {
private static function generate_download_link($order_id) {
global $wpdb;
// Get the order to find the product
$order = $wpdb->get_row($wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}wpdd_orders WHERE id = %d",
$order_id
));
if (!$order) {
return false;
}
// Get download limit from product settings
$download_limit = get_post_meta($order->product_id, '_wpdd_download_limit', true);
$download_limit = $download_limit ?: 0; // Default to 0 (unlimited) if not set
// Get download expiry from product settings
$download_expiry = get_post_meta($order->product_id, '_wpdd_download_expiry', true);
$download_expiry = $download_expiry ?: 30; // Default to 30 days if not set
$token = wp_hash(uniqid() . $order_id . time());
$expires_at = date('Y-m-d H:i:s', strtotime('+7 days'));
$expires_at = date('Y-m-d H:i:s', strtotime('+' . $download_expiry . ' days'));
$wpdb->insert(
$wpdb->prefix . 'wpdd_download_links',
@@ -189,7 +207,7 @@ class WPDD_Orders {
'order_id' => $order_id,
'token' => $token,
'expires_at' => $expires_at,
'max_downloads' => 5,
'max_downloads' => $download_limit,
'created_at' => current_time('mysql')
),
array('%d', '%s', '%s', '%d', '%s')