| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.5/wp-content/plugins/woocommerce/packages/email-editor/src/ |
Upload File : |
<?php
/**
* This file is part of the WooCommerce Email Editor package
*
* @package Automattic\WooCommerce\EmailEditor
*/
declare( strict_types = 1 );
namespace Automattic\WooCommerce\EmailEditor;
use Automattic\WooCommerce\EmailEditor\Engine\Email_Editor;
use Automattic\WooCommerce\EmailEditor\Integrations\Core\Initializer as CoreEmailEditorIntegration;
use Automattic\WooCommerce\EmailEditor\Integrations\WooCommerce\Initializer as WooCommerceEmailEditorIntegration;
/**
* Bootstrap class for initializing the Email Editor functionality.
*/
class Bootstrap {
/**
* Email editor instance.
*
* @var Email_Editor
*/
private $email_editor;
/**
* Core email editor integration instance.
*
* @var CoreEmailEditorIntegration
*/
private $core_email_editor_integration;
/**
* WooCommerce email editor integration instance.
*
* @var WooCommerceEmailEditorIntegration
*/
private $woocommerce_email_editor_integration;
/**
* Constructor.
*
* @param Email_Editor $email_editor Email editor instance.
* @param CoreEmailEditorIntegration $core_email_editor_integration Core email editor integration instance.
* @param WooCommerceEmailEditorIntegration $woocommerce_email_editor_integration WooCommerce email editor integration instance.
*/
public function __construct(
Email_Editor $email_editor,
CoreEmailEditorIntegration $core_email_editor_integration,
WooCommerceEmailEditorIntegration $woocommerce_email_editor_integration
) {
$this->email_editor = $email_editor;
$this->core_email_editor_integration = $core_email_editor_integration;
$this->woocommerce_email_editor_integration = $woocommerce_email_editor_integration;
}
/**
* Initialize the email editor functionality.
*/
public function init(): void {
add_action(
'init',
array(
$this,
'initialize',
)
);
add_filter(
'woocommerce_email_editor_initialized',
array(
$this,
'setup_email_editor_integrations',
)
);
add_filter(
'block_type_metadata_settings',
array( $this->core_email_editor_integration, 'update_block_settings' ),
10,
1
);
if ( class_exists( 'WooCommerce' ) ) {
add_filter(
'block_type_metadata_settings',
array( $this->woocommerce_email_editor_integration, 'update_block_settings' ),
10,
1
);
}
}
/**
* Initialize the email editor.
*/
public function initialize(): void {
$this->email_editor->initialize();
}
/**
* Setup email editor integrations.
*/
public function setup_email_editor_integrations(): bool {
$this->core_email_editor_integration->initialize();
return true; // PHPStan expect returning a value from the filter.
}
}