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