| 1 |
<?php |
| 2 |
|
| 3 |
namespace YayMailScoped\YayCommerce\AdminShell\Registry; |
| 4 |
|
| 5 |
use YayMailScoped\YayCommerce\AdminShell\License\Contracts\LicenseConfigAdapter; |
| 6 |
/** |
| 7 |
* Minimal LicenseConfigAdapter built from addon filter data. |
| 8 |
* Used by AddonBridge to satisfy License constructor and card templates |
| 9 |
* without requiring a full plugin adapter implementation. |
| 10 |
*/ |
| 11 |
class AddonLicenseAdapter implements LicenseConfigAdapter |
| 12 |
{ |
| 13 |
private string $slug; |
| 14 |
private string $name; |
| 15 |
private string $basename; |
| 16 |
private string $file; |
| 17 |
private string $url; |
| 18 |
private int $item_id; |
| 19 |
private string $store_url; |
| 20 |
public function __construct(array $plugin_data) |
| 21 |
{ |
| 22 |
$this->slug = $plugin_data['slug'] ?? ''; |
| 23 |
$this->name = $plugin_data['name'] ?? $this->slug; |
| 24 |
$this->basename = $plugin_data['basename'] ?? ''; |
| 25 |
$this->file = $plugin_data['file'] ?? ''; |
| 26 |
$this->url = $plugin_data['url'] ?? ''; |
| 27 |
$this->item_id = (int) ($plugin_data['item_id'] ?? 0); |
| 28 |
$this->store_url = 'https://yaycommerce.com/'; |
| 29 |
} |
| 30 |
public function get_plugin_slug(): string |
| 31 |
{ |
| 32 |
return $this->slug; |
| 33 |
} |
| 34 |
public function get_plugin_name(): string |
| 35 |
{ |
| 36 |
return $this->name; |
| 37 |
} |
| 38 |
public function get_plugin_version(): string |
| 39 |
{ |
| 40 |
return ''; |
| 41 |
} |
| 42 |
public function get_plugin_file(): string |
| 43 |
{ |
| 44 |
return $this->file; |
| 45 |
} |
| 46 |
public function get_item_id(): int |
| 47 |
{ |
| 48 |
return $this->item_id; |
| 49 |
} |
| 50 |
public function get_store_url(): string |
| 51 |
{ |
| 52 |
return $this->store_url; |
| 53 |
} |
| 54 |
public function get_store_link(): string |
| 55 |
{ |
| 56 |
return $this->url; |
| 57 |
} |
| 58 |
public function get_menu_title(): string |
| 59 |
{ |
| 60 |
return $this->name; |
| 61 |
} |
| 62 |
public function get_page_title(): string |
| 63 |
{ |
| 64 |
return $this->name; |
| 65 |
} |
| 66 |
public function get_menu_slug(): string |
| 67 |
{ |
| 68 |
return ''; |
| 69 |
} |
| 70 |
public function get_settings_page_callback(): ?callable |
| 71 |
{ |
| 72 |
return null; |
| 73 |
} |
| 74 |
public function get_settings_page_position(): ?int |
| 75 |
{ |
| 76 |
return null; |
| 77 |
} |
| 78 |
public function get_capability(): string |
| 79 |
{ |
| 80 |
return 'manage_options'; |
| 81 |
} |
| 82 |
public function get_plugin_basename(): string |
| 83 |
{ |
| 84 |
return $this->basename; |
| 85 |
} |
| 86 |
public function get_settings_label(): string |
| 87 |
{ |
| 88 |
return ''; |
| 89 |
} |
| 90 |
public function get_docs_url(): string |
| 91 |
{ |
| 92 |
return ''; |
| 93 |
} |
| 94 |
public function get_pro_url(): string |
| 95 |
{ |
| 96 |
return ''; |
| 97 |
} |
| 98 |
} |
| 99 |
|