| 1 |
<?php |
| 2 |
/** |
| 3 |
* WooCommerce platform implementation (the "yaymail" product). |
| 4 |
* |
| 5 |
* @package YayMail\Platform |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace YayMail\Platform; |
| 9 |
|
| 10 |
defined( 'ABSPATH' ) || exit; |
| 11 |
|
| 12 |
class YaymailPlatform implements PlatformInterface { |
| 13 |
|
| 14 |
public function key(): string { |
| 15 |
return 'yaymail'; |
| 16 |
} |
| 17 |
|
| 18 |
public function plugin_path(): string { |
| 19 |
return YAYMAIL_PLUGIN_PATH; |
| 20 |
} |
| 21 |
|
| 22 |
public function plugin_url(): string { |
| 23 |
return YAYMAIL_PLUGIN_URL; |
| 24 |
} |
| 25 |
|
| 26 |
public function hook_suffix(): string { |
| 27 |
$prefix = defined( 'YAYMAIL_PREFIX' ) ? YAYMAIL_PREFIX : 'yaymail'; |
| 28 |
return 'yaycommerce_page_' . $prefix . '-settings'; |
| 29 |
} |
| 30 |
|
| 31 |
public function attachment_option_name(): string { |
| 32 |
return YAYMAIL_ATTACHMENT_OPTION_NAME; |
| 33 |
} |
| 34 |
|
| 35 |
public function ghf_option_key( string $variant = 'base' ): string { |
| 36 |
return 'enabled' === $variant ? 'global_header_footer_enabled' : 'yaymail_global_header_footer'; |
| 37 |
} |
| 38 |
|
| 39 |
public function adapter() { |
| 40 |
return class_exists( 'YaymailPluginAdapter', false ) ? new \YaymailPluginAdapter() : null; |
| 41 |
} |
| 42 |
|
| 43 |
public function is_woo_product(): bool { |
| 44 |
return true; |
| 45 |
} |
| 46 |
|
| 47 |
public function woo_available(): bool { |
| 48 |
return class_exists( 'WooCommerce' ); |
| 49 |
} |
| 50 |
} |
| 51 |
|