Major improvements: Fix download limits, enhance license display, fix software filenames
Some checks failed
Create Release / build (push) Failing after 3s

🔧 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 6d86d5ef4f
commit 4731637f33
28 changed files with 3709 additions and 156 deletions

View File

@@ -3,7 +3,7 @@
* Plugin Name: WP Digital Download
* Plugin URI: https://example.com/wp-digital-download
* Description: A comprehensive digital download marketplace plugin allowing creators to sell digital products with PayPal integration
* Version: 1.0.0
* Version: {auto_update_value_on_deploy}
* Author: Josh Knapp
* License: GPL v2 or later
* Text Domain: wp-digital-download
@@ -14,7 +14,7 @@ if (!defined('ABSPATH')) {
exit;
}
define('WPDD_VERSION', '1.0.2');
define('WPDD_VERSION', '{auto_update_value_on_deploy}');
define('WPDD_PLUGIN_URL', plugin_dir_url(__FILE__));
define('WPDD_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('WPDD_PLUGIN_BASENAME', plugin_basename(__FILE__));
@@ -54,7 +54,9 @@ final class WP_Digital_Download {
'includes/class-wpdd-watermark.php',
'includes/class-wpdd-ajax.php',
'includes/class-wpdd-creator.php',
'includes/class-wpdd-paypal-payouts.php'
'includes/class-wpdd-earnings-processor.php',
'includes/class-wpdd-paypal-payouts.php',
'includes/class-wpdd-email.php'
);
foreach ($files as $file) {
@@ -70,7 +72,8 @@ final class WP_Digital_Download {
$admin_files = array(
'admin/class-wpdd-admin.php',
'admin/class-wpdd-settings.php',
'admin/class-wpdd-admin-payouts.php'
'admin/class-wpdd-admin-payouts.php',
'admin/class-wpdd-order-manager.php'
);
foreach ($admin_files as $file) {
@@ -88,8 +91,7 @@ final class WP_Digital_Download {
register_activation_hook(__FILE__, array('WPDD_Install', 'activate'));
register_deactivation_hook(__FILE__, array('WPDD_Install', 'deactivate'));
// Initialize sessions for PayPal integration (must be early priority)
add_action('init', array($this, 'start_session'), 1);
// Sessions will be started only when needed (in PayPal class)
add_action('init', array($this, 'init'));
add_action('wp_enqueue_scripts', array($this, 'enqueue_scripts'));
@@ -183,6 +185,18 @@ final class WP_Digital_Download {
error_log('WPDD Error: WPDD_API class not found');
}
if (class_exists('WPDD_Earnings_Processor')) {
WPDD_Earnings_Processor::init();
} else {
error_log('WPDD Error: WPDD_Earnings_Processor class not found');
}
if (class_exists('WPDD_Email')) {
WPDD_Email::init();
} else {
error_log('WPDD Error: WPDD_Email class not found');
}
if (is_admin()) {
if (class_exists('WPDD_Setup')) {
WPDD_Setup::init();
@@ -201,17 +215,53 @@ final class WP_Digital_Download {
} else {
error_log('WPDD Error: WPDD_Settings class not found');
}
if (class_exists('WPDD_Order_Manager')) {
WPDD_Order_Manager::init();
} else {
error_log('WPDD Error: WPDD_Order_Manager class not found');
}
// Include tools page
require_once WPDD_PLUGIN_PATH . 'admin/wpdd-tools.php';
// Run database migration if needed
if (file_exists(WPDD_PLUGIN_PATH . 'admin/wpdd-db-migrate.php')) {
require_once WPDD_PLUGIN_PATH . 'admin/wpdd-db-migrate.php';
wpdd_migrate_database();
}
// Initialize transaction history
if (file_exists(WPDD_PLUGIN_PATH . 'admin/class-wpdd-transaction-history.php')) {
require_once WPDD_PLUGIN_PATH . 'admin/class-wpdd-transaction-history.php';
if (class_exists('WPDD_Transaction_History')) {
WPDD_Transaction_History::init();
}
}
}
}
/**
* Initialize PHP sessions for PayPal order data persistence
* Called early in WordPress init to ensure sessions work properly
* Safely start session if needed
* Returns true if session is available, false otherwise
*/
public function start_session() {
if (!session_id()) {
session_start();
public static function ensure_session() {
// Don't start sessions in admin or CLI
if (is_admin() || defined('WP_CLI')) {
return false;
}
// Don't start if headers already sent
if (headers_sent()) {
return false;
}
// Start session if we don't have one
if (session_status() === PHP_SESSION_NONE) {
return session_start();
}
return true;
}
public function enqueue_scripts() {
@@ -231,6 +281,14 @@ final class WP_Digital_Download {
$frontend_css_ver
);
// Enqueue FontAwesome for copy icons
wp_enqueue_style(
'font-awesome',
'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css',
array(),
'6.0.0'
);
wp_enqueue_script(
'wpdd-frontend',
WPDD_PLUGIN_URL . 'assets/js/frontend.js',
@@ -248,8 +306,9 @@ final class WP_Digital_Download {
public function admin_enqueue_scripts($hook) {
global $post;
if (($hook == 'post.php' || $hook == 'post-new.php') &&
isset($post) && $post->post_type == 'wpdd_product') {
if ((($hook == 'post.php' || $hook == 'post-new.php') &&
isset($post) && $post->post_type == 'wpdd_product') ||
($hook == 'edit.php' && isset($_GET['post_type']) && $_GET['post_type'] == 'wpdd_product')) {
// Use file modification time for cache busting
$admin_css_ver = file_exists(WPDD_PLUGIN_PATH . 'assets/css/admin.css')