| 1 |
<?php |
| 2 |
/** |
| 3 |
* Platform contract. |
| 4 |
* |
| 5 |
* Each product (YayMail for WooCommerce, Yay WP Email Customizer) provides one |
| 6 |
* implementation and registers it with the PlatformRegistry at bootstrap. Shared |
| 7 |
* core code reads platform-specific values from the resolved platform instead of |
| 8 |
* detecting the platform inline via defined()/screen-id/'email-builder' branches. |
| 9 |
* |
| 10 |
* @package YayMail\Platform |
| 11 |
*/ |
| 12 |
|
| 13 |
namespace YayMail\Platform; |
| 14 |
|
| 15 |
defined( 'ABSPATH' ) || exit; |
| 16 |
|
| 17 |
interface PlatformInterface { |
| 18 |
|
| 19 |
/** |
| 20 |
* Stable platform key used across REST params, localize data, and lookups. |
| 21 |
* |
| 22 |
* @return string 'yaymail' | 'email-builder' |
| 23 |
*/ |
| 24 |
public function key(): string; |
| 25 |
|
| 26 |
/** |
| 27 |
* Absolute filesystem path of the plugin that hosts this platform's assets/core. |
| 28 |
* |
| 29 |
* @return string |
| 30 |
*/ |
| 31 |
public function plugin_path(): string; |
| 32 |
|
| 33 |
/** |
| 34 |
* Public URL of the plugin that hosts this platform's assets. |
| 35 |
* |
| 36 |
* @return string |
| 37 |
*/ |
| 38 |
public function plugin_url(): string; |
| 39 |
|
| 40 |
/** |
| 41 |
* WordPress admin screen id (hook suffix) of this platform's settings page. |
| 42 |
* |
| 43 |
* @return string |
| 44 |
*/ |
| 45 |
public function hook_suffix(): string; |
| 46 |
|
| 47 |
/** |
| 48 |
* Option name prefix for this platform's general attachments. |
| 49 |
* |
| 50 |
* @return string |
| 51 |
*/ |
| 52 |
public function attachment_option_name(): string; |
| 53 |
|
| 54 |
/** |
| 55 |
* Global header/footer option key for this platform. |
| 56 |
* |
| 57 |
* Literals are not derivable by a common suffix rule, so each platform returns |
| 58 |
* its own exact values. |
| 59 |
* |
| 60 |
* @param string $variant 'base' | 'enabled'. |
| 61 |
* @return string |
| 62 |
*/ |
| 63 |
public function ghf_option_key( string $variant = 'base' ): string; |
| 64 |
|
| 65 |
/** |
| 66 |
* The plugin adapter instance for this platform (license/menu config), or null. |
| 67 |
* |
| 68 |
* @return object|null |
| 69 |
*/ |
| 70 |
public function adapter(); |
| 71 |
|
| 72 |
/** |
| 73 |
* Whether this platform IS the WooCommerce product (product identity). |
| 74 |
* |
| 75 |
* Distinct from woo_available(): identity is fixed per install, availability is |
| 76 |
* a runtime capability check. |
| 77 |
* |
| 78 |
* @return bool |
| 79 |
*/ |
| 80 |
public function is_woo_product(): bool; |
| 81 |
|
| 82 |
/** |
| 83 |
* Whether WooCommerce is active at runtime (capability, not identity). |
| 84 |
* |
| 85 |
* @return bool |
| 86 |
*/ |
| 87 |
public function woo_available(): bool; |
| 88 |
} |
| 89 |
|