Merge branch 'dev' for v0.1.0 release

This commit is contained in:
2026-01-22 11:57:16 +01:00
9 changed files with 2654 additions and 1557 deletions

View File

@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.1.0] - 2026-01-22
### Added
- First stable minor release
- Comprehensive code review for WordPress/WooCommerce best practices
- Security audit completed
### Changed
- Improved input sanitization for admin page context checks
- Fixed VersionManager null format handling for attachment updates
### Technical Details
- All code reviewed for OWASP Top 10 security vulnerabilities
- Verified proper nonce verification, capability checks, and input sanitization
- SQL injection prevention confirmed using `$wpdb->prepare()` throughout
- XSS prevention confirmed with proper output escaping
- Rate limiting verified on REST API endpoints
- README.md updated with full feature documentation
## [0.0.11] - 2026-01-22
### Added
@@ -275,7 +297,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- WordPress REST API integration
- Custom WooCommerce product type extending WC_Product
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.0.11...HEAD
[Unreleased]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.1.0...HEAD
[0.1.0]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.0.11...v0.1.0
[0.0.11]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.0.10...v0.0.11
[0.0.10]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.0.9...v0.0.10
[0.0.9]: https://src.bundespruefstelle.ch/magdev/wc-licensed-product/compare/v0.0.8...v0.0.9

View File

@@ -36,6 +36,13 @@ This project is proudly **"vibe-coded"** using Claude.AI - the entire codebase w
No known bugs at the moment
### Release 0.1.0
- Check the code for wordpress best practices, WooCommerce best practices and common security pitfalls. Refactor if needed.
- Update the README.md according to the current featureset
- Update all translations
- Create a release package 0.1.0
## Technical Stack
- **Language:** PHP 8.3.x
@@ -594,35 +601,26 @@ Full API documentation available in `openapi.json` (OpenAPI 3.1 specification).
- SHA256: `3f4a093f6d4d02389082c3a88c00542f477ab3ad4d4a0c65079e524ef0739620`
- Tagged as `v0.0.10` and pushed to `main` branch
### 2026-01-21 - Version 0.0.11 Features
### 2026-01-22 - Version 0.0.11 Features
**Implemented:**
- Created date column added to admin license overview
- License Statistics page under WooCommerce menu (WooCommerce > License Statistics)
- REST API endpoints for analytics data with time-series support
- WooCommerce Analytics integration via submenu page
**New files:**
- `src/Admin/AnalyticsController.php` - WooCommerce Analytics integration
- `templates/admin/statistics.html.twig` - Statistics page template
**New REST API endpoints:**
- `GET /wp-json/wc-licensed-product/v1/analytics/stats` - License statistics with time-series data (supports day/week/month/quarter/year intervals)
- `GET /wp-json/wc-licensed-product/v1/analytics/products` - License counts by product
- Created date column added to admin license overview showing when each license was generated
**Modified files:**
- `templates/admin/licenses.html.twig` - Added "Created" column
- `src/Admin/AdminController.php` - Added "Created" column to fallback rendering
- `src/Plugin.php` - Added AnalyticsController initialization and `getInstance()` alias
- `templates/admin/licenses.html.twig` - Added "Created" column to table header and data cells
- `src/Admin/AdminController.php` - Added "Created" column to PHP fallback rendering
- `src/Plugin.php` - Added `getInstance()` alias for singleton access
**Technical notes:**
- Statistics page accessible via WooCommerce > License Statistics submenu
- REST API endpoints support date range filtering (`after`, `before` parameters)
- Time-series data aggregation supports multiple intervals (day, week, month, quarter, year)
- AnalyticsController registers REST routes and renders statistics page
- Page uses existing dashboard CSS styles for consistent appearance
- New column displays license creation date in Y-m-d format
- Both Twig template and PHP fallback updated for consistency
- WooCommerce Analytics integration was attempted but removed due to WordPress permission issues with submenu pages
**Release v0.0.11:**
- Created release package: `releases/wc-licensed-product-0.0.11.zip` (473 KB)
- SHA256: `c3f66c4ac54741053f87ce1a63b4ddb49ad9707d5c194a271311bb95518ab13c`
- Tagged as `v0.0.11` and pushed to `main` branch

View File

@@ -17,6 +17,7 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
- **Version Binding**: Optional binding to major software versions
- **Expiration Support**: Set license validity periods or lifetime licenses
- **Rate Limiting**: API endpoints protected with rate limiting (30 requests/minute)
- **Checkout Blocks**: Full support for WooCommerce Checkout Blocks (default since WC 8.3+)
### Customer Features
@@ -30,12 +31,16 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
- **License Management**: Full CRUD interface for license management
- **License Dashboard**: Statistics and analytics (WooCommerce > Reports > Licenses)
- **Search & Filtering**: Search by license key, domain, status, or product
- **Live Search**: AJAX-powered instant search results
- **Inline Editing**: Edit license status, expiry, and domain directly in the list
- **Bulk Operations**: Activate, deactivate, revoke, extend, or delete multiple licenses
- **License Transfer**: Transfer licenses to new domains
- **CSV Export/Import**: Export and import licenses via CSV
- **Order Integration**: View and manage licenses directly from order pages
- **Expiration Warnings**: Automatic email notifications before license expiration
- **Version Management**: Manage multiple versions per product with file attachments
- **Global Settings**: Default license settings via WooCommerce settings tab
- **WooCommerce HPOS**: Compatible with High-Performance Order Storage
## Requirements
@@ -60,7 +65,6 @@ WC Licensed Product adds a new product type "Licensed Product" to WooCommerce, e
- **Max Activations**: Number of domains allowed per license
- **License Validity**: Days until expiration (empty = lifetime)
- **Bind to Major Version**: Lock license to current major version
- **Current Version**: Your software's current version
### Managing Product Versions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -105,7 +105,9 @@ final class AdminController
{
// Check for our pages and WooCommerce Reports page with licenses tab
$isLicensePage = in_array($hook, ['woocommerce_page_wc-licenses', 'woocommerce_page_wc-license-dashboard'], true);
$isReportsPage = $hook === 'woocommerce_page_wc-reports' && isset($_GET['tab']) && $_GET['tab'] === 'licenses';
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only checking current page context
$currentTab = isset($_GET['tab']) ? sanitize_text_field(wp_unslash($_GET['tab'])) : '';
$isReportsPage = $hook === 'woocommerce_page_wc-reports' && $currentTab === 'licenses';
if (!$isLicensePage && !$isReportsPage) {
return;

View File

@@ -167,8 +167,20 @@ class VersionManager
}
if ($attachmentId !== null) {
$data['attachment_id'] = $attachmentId > 0 ? $attachmentId : null;
$formats[] = $attachmentId > 0 ? '%d' : null;
if ($attachmentId > 0) {
$data['attachment_id'] = $attachmentId;
$formats[] = '%d';
} else {
// Set to NULL using raw SQL instead of adding to $data
global $wpdb;
$tableName = Installer::getVersionsTable();
$wpdb->query(
$wpdb->prepare(
"UPDATE {$tableName} SET attachment_id = NULL WHERE id = %d",
$versionId
)
);
}
}
if (empty($data)) {

View File

@@ -3,7 +3,7 @@
* Plugin Name: WooCommerce Licensed Product
* Plugin URI: https://src.bundespruefstelle.ch/magdev/wc-licensed-product
* Description: WooCommerce plugin to sell software products using license keys with domain-based validation.
* Version: 0.0.11
* Version: 0.1.0
* Author: Marco Graetsch
* Author URI: https://src.bundespruefstelle.ch/magdev
* License: GPL-2.0-or-later
@@ -28,7 +28,7 @@ if (!defined('ABSPATH')) {
}
// Plugin constants
define('WC_LICENSED_PRODUCT_VERSION', '0.0.11');
define('WC_LICENSED_PRODUCT_VERSION', '0.1.0');
define('WC_LICENSED_PRODUCT_PLUGIN_FILE', __FILE__);
define('WC_LICENSED_PRODUCT_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('WC_LICENSED_PRODUCT_PLUGIN_URL', plugin_dir_url(__FILE__));