PluginProbe ʕ •ᴥ•ʔ
WP Chat App / trunk
WP Chat App vtrunk
3.8.1 3.8.2 trunk 2.6 3.4 3.4.1 3.4.2 3.4.4 3.4.5 3.4.6 3.5 3.6 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0
wp-whatsapp / vendor-prefixed / src / Registry / PluginLicenseInfo.php
wp-whatsapp / vendor-prefixed / src / Registry Last commit date
AddonBridge.php 4 months ago AddonLicenseAdapter.php 4 months ago LegacyBridge.php 4 months ago LicenseRegistry.php 3 months ago PluginLicenseInfo.php 4 months ago
PluginLicenseInfo.php
74 lines
1 <?php
2
3 namespace WhatsappScoped\YayCommerce\AdminShell\Registry;
4
5 /**
6 * Frozen data contract for a registered plugin's license state.
7 *
8 * APPEND-ONLY — existing public properties must never be renamed or removed.
9 * New properties may be added in MINOR versions; removing/renaming requires MAJOR bump.
10 * @internal
11 */
12 final class PluginLicenseInfo
13 {
14 /** Plugin slug — byte-exact wp_options prefix. */
15 public string $slug = '';
16 /** Human-readable display name. */
17 public string $name = '';
18 /** Plugin version string. */
19 public string $version = '';
20 /** WP plugin basename, e.g. 'yaymail-pro/yaymail.php'. */
21 public string $basename = '';
22 /** EDD download ID. */
23 public int $item_id = 0;
24 /** Product page URL. */
25 public string $store_link = '';
26 /**
27 * License key (raw). Redacted when serialized via toArray().
28 * Never log or expose this field directly.
29 */
30 public string $license_key = '';
31 /**
32 * License status: 'valid'|'invalid'|'expired'|'inactive'|'disabled'|'unknown'
33 */
34 public string $status = 'unknown';
35 /** Expiry in ISO 8601 format, 'lifetime', or null if not retrieved. */
36 public ?string $expires_at = null;
37 /** Number of activations used. */
38 public int $activations_used = 0;
39 /** Maximum activations allowed (0 = unlimited). */
40 public int $activations_limit = 0;
41 /** True when sourced via LegacyBridge (yaycommerce_licensing_plugins filter). */
42 public bool $is_legacy = \false;
43 /** Raw EDD response blob for debugging. Never expose to end-users. */
44 public array $raw_info = [];
45 /**
46 * Return array representation suitable for passing to JS/REST.
47 * Redacts license_key to first 8 chars + asterisks.
48 */
49 public function toArray() : array
50 {
51 $key_display = '';
52 if (!empty($this->license_key)) {
53 $visible = \substr($this->license_key, 0, 8);
54 $hidden_len = \max(0, \strlen($this->license_key) - 8);
55 $key_display = $visible . \str_repeat('*', \min($hidden_len, 20));
56 }
57 return [
58 'slug' => $this->slug,
59 'name' => $this->name,
60 'version' => $this->version,
61 'basename' => $this->basename,
62 'item_id' => $this->item_id,
63 'store_link' => $this->store_link,
64 'license_key' => $key_display,
65 // redacted
66 'status' => $this->status,
67 'expires_at' => $this->expires_at,
68 'activations_used' => $this->activations_used,
69 'activations_limit' => $this->activations_limit,
70 'is_legacy' => $this->is_legacy,
71 ];
72 }
73 }
74