You've already forked wc-licensed-product
Dashboard widget improvements and download counter feature (v0.3.7)
- Fixed: Dashboard widget "View All Licenses" link used wrong page slug - Fixed: Download links in customer account resulted in 404 errors - Removed: Redundant "Status Breakdown" section from dashboard widget - Changed: License Types section now uses card style layout - Added: Download counter for licensed product versions - Added: Download Statistics admin dashboard widget - Updated translations (356 strings) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ class ProductVersion
|
||||
private ?string $downloadUrl;
|
||||
private ?int $attachmentId;
|
||||
private ?string $fileHash;
|
||||
private int $downloadCount;
|
||||
private bool $isActive;
|
||||
private \DateTimeInterface $releasedAt;
|
||||
private \DateTimeInterface $createdAt;
|
||||
@@ -44,6 +45,7 @@ class ProductVersion
|
||||
$version->downloadUrl = $data['download_url'] ?: null;
|
||||
$version->attachmentId = !empty($data['attachment_id']) ? (int) $data['attachment_id'] : null;
|
||||
$version->fileHash = $data['file_hash'] ?? null;
|
||||
$version->downloadCount = (int) ($data['download_count'] ?? 0);
|
||||
$version->isActive = (bool) $data['is_active'];
|
||||
$version->releasedAt = new \DateTimeImmutable($data['released_at']);
|
||||
$version->createdAt = new \DateTimeImmutable($data['created_at']);
|
||||
@@ -144,6 +146,11 @@ class ProductVersion
|
||||
return $this->fileHash;
|
||||
}
|
||||
|
||||
public function getDownloadCount(): int
|
||||
{
|
||||
return $this->downloadCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the download URL from attachment
|
||||
*/
|
||||
@@ -197,6 +204,7 @@ class ProductVersion
|
||||
'download_url' => $this->downloadUrl,
|
||||
'attachment_id' => $this->attachmentId,
|
||||
'file_hash' => $this->fileHash,
|
||||
'download_count' => $this->downloadCount,
|
||||
'is_active' => $this->isActive,
|
||||
'released_at' => $this->releasedAt->format('Y-m-d H:i:s'),
|
||||
'created_at' => $this->createdAt->format('Y-m-d H:i:s'),
|
||||
|
||||
Reference in New Issue
Block a user