| @@ -27,11 +27,11 @@ | ||
| 27 | 27 | * all legacy plugins register via yaycommerce_licensing_plugins at 100. |
| 28 | 28 | * |
| 29 | 29 | * INVARIANT: if VersionedLoader priority changes, update this priority too. |
| 30 | 30 | */ |
| 31 | - public function init() : void | |
| 31 | + public function init(): void | |
| 32 | 32 | { |
| 33 | - \add_action('plugins_loaded', [$this, 'load_legacy_plugins'], 9999); | |
| 33 | + add_action('plugins_loaded', [$this, 'load_legacy_plugins'], 9999); | |
| 34 | 34 | } |
| 35 | 35 | /** |
| 36 | 36 | * Read legacy filter and convert entries to PluginLicenseInfo stubs. |
| 37 | 37 | * |
| @@ -37,11 +37,11 @@ | ||
| 37 | 37 | * |
| 38 | 38 | * Legacy format (each entry): |
| 39 | 39 | * [ 'slug', 'basename', 'file', 'url', 'item_id', 'dir_path', 'name' ] |
| 40 | 40 | */ |
| 41 | - public function load_legacy_plugins() : void | |
| 41 | + public function load_legacy_plugins(): void | |
| 42 | 42 | { |
| 43 | - $legacy_plugins = \apply_filters('yaycommerce_licensing_plugins', []); | |
| 43 | + $legacy_plugins = apply_filters('yaycommerce_licensing_plugins', []); | |
| 44 | 44 | foreach ($legacy_plugins as $plugin) { |
| 45 | 45 | $slug = $plugin['slug'] ?? ''; |
| 46 | 46 | if (empty($slug)) { |
| 47 | 47 | continue; |
| @@ -57,16 +57,16 @@ | ||
| 57 | 57 | /** |
| 58 | 58 | * Build a PluginLicenseInfo from a legacy filter entry. |
| 59 | 59 | * Reads {slug}_license_info from wp_options to get current status. |
| 60 | 60 | */ |
| 61 | - private function build_legacy_info(array $plugin) : PluginLicenseInfo | |
| 61 | + private function build_legacy_info(array $plugin): PluginLicenseInfo | |
| 62 | 62 | { |
| 63 | 63 | $slug = $plugin['slug'] ?? ''; |
| 64 | - $raw_info = \get_option($slug . '_license_info', []); | |
| 65 | - if (\is_string($raw_info)) { | |
| 66 | - $raw_info = \json_decode($raw_info, \true) ?: []; | |
| 64 | + $raw_info = get_option($slug . '_license_info', []); | |
| 65 | + if (is_string($raw_info)) { | |
| 66 | + $raw_info = json_decode($raw_info, \true) ?: []; | |
| 67 | 67 | } |
| 68 | - $license_key = (string) \get_option($slug . '_license_key', ''); | |
| 68 | + $license_key = (string) get_option($slug . '_license_key', ''); | |
| 69 | 69 | $expires_raw = $raw_info['expires'] ?? null; |
| 70 | 70 | $status = $this->derive_status($license_key, $raw_info); |
| 71 | 71 | $info = new PluginLicenseInfo(); |
| 72 | 72 | $info->slug = $slug; |
| @@ -87,9 +87,9 @@ | ||
| 87 | 87 | } |
| 88 | 88 | /** |
| 89 | 89 | * Derive a normalized status string from legacy option data. |
| 90 | 90 | */ |
| 91 | - private function derive_status(string $license_key, array $raw_info) : string | |
| 91 | + private function derive_status(string $license_key, array $raw_info): string | |
| 92 | 92 | { |
| 93 | 93 | if (empty($license_key)) { |
| 94 | 94 | return 'inactive'; |
| 95 | 95 | } |
| @@ -94,9 +94,9 @@ | ||
| 94 | 94 | return 'inactive'; |
| 95 | 95 | } |
| 96 | 96 | $expires = $raw_info['expires'] ?? null; |
| 97 | 97 | if ($expires && 'lifetime' !== $expires && 'Not updated' !== $expires) { |
| 98 | - if (\strtotime($expires) < \time()) { | |
| 98 | + if (strtotime($expires) < time()) { | |
| 99 | 99 | return 'expired'; |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | return 'valid'; |