EmailPatterns
10 months ago
EmailTemplates
2 months ago
PersonalizationTags
3 months ago
WCTransactionalEmails
4 weeks ago
BlockEmailRenderer.php
7 months ago
EmailApiController.php
4 weeks ago
Integration.php
4 weeks ago
Logger.php
10 months ago
Package.php
1 year ago
PageRenderer.php
10 months ago
PersonalizationTagManager.php
1 year ago
TransactionalEmailPersonalizer.php
4 months ago
WooContentProcessor.php
2 months ago
Package.php
75 lines
| 1 | <?php |
| 2 | |
| 3 | declare( strict_types=1 ); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Internal\EmailEditor; |
| 6 | |
| 7 | defined( 'ABSPATH' ) || exit; |
| 8 | |
| 9 | /** |
| 10 | * This class is used to initialize the email editor package. |
| 11 | * |
| 12 | * It is a wrapper around the Automattic\WooCommerce\EmailEditor\Package class and |
| 13 | * ensures that the email editor package is only initialized if the block editor feature flag is enabled. |
| 14 | */ |
| 15 | class Package { |
| 16 | /** |
| 17 | * Version. |
| 18 | * |
| 19 | * @var string |
| 20 | */ |
| 21 | const VERSION = \Automattic\WooCommerce\EmailEditor\Package::VERSION; |
| 22 | |
| 23 | /** |
| 24 | * Package active. |
| 25 | * |
| 26 | * @var bool |
| 27 | */ |
| 28 | private static $package_active = false; |
| 29 | |
| 30 | /** |
| 31 | * Init the package. |
| 32 | * |
| 33 | * @internal |
| 34 | */ |
| 35 | final public static function init() { |
| 36 | self::$package_active = get_option( 'woocommerce_feature_block_email_editor_enabled', 'no' ) === 'yes'; // init is called pretty early. Cant use FeaturesUtil. |
| 37 | |
| 38 | // we only want to initialize the package if the block editor feature flag is enabled. |
| 39 | if ( ! self::$package_active ) { |
| 40 | return; |
| 41 | } |
| 42 | |
| 43 | self::initialize(); |
| 44 | \Automattic\WooCommerce\EmailEditor\Package::init(); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Return the version of the package. |
| 49 | * |
| 50 | * @return string |
| 51 | */ |
| 52 | public static function get_version() { |
| 53 | return \Automattic\WooCommerce\EmailEditor\Package::get_version(); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Return the path to the package. |
| 58 | * |
| 59 | * @return string |
| 60 | */ |
| 61 | public static function get_path() { |
| 62 | return \Automattic\WooCommerce\EmailEditor\Package::get_path(); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Initialize the email editor integration by fetching the class from the container. |
| 67 | * |
| 68 | * @return void |
| 69 | */ |
| 70 | public static function initialize() { |
| 71 | $container = wc_get_container(); |
| 72 | $container->get( Integration::class ); |
| 73 | } |
| 74 | } |
| 75 |