WC_Email::__construct
Constructor.
Method of the class: WC_Email{}
No Hooks.
Returns
null. Nothing (null).
Usage
$WC_Email = new WC_Email(); $WC_Email->__construct();
WC_Email::__construct() WC Email:: construct code WC 10.8.1
public function __construct() {
$this->email_improvements_enabled = FeaturesUtil::feature_is_enabled( 'email_improvements' );
$this->block_email_editor_enabled = FeaturesUtil::feature_is_enabled( 'block_email_editor' );
// Find/replace.
$this->placeholders = array_merge(
array(
'{site_title}' => $this->get_blogname(),
'{site_address}' => wp_parse_url( home_url(), PHP_URL_HOST ),
'{site_url}' => wp_parse_url( home_url(), PHP_URL_HOST ),
'{store_email}' => $this->get_from_address(),
),
$this->placeholders
);
// Init settings.
$this->init_form_fields();
$this->init_settings();
// Default template base if not declared in child constructor.
if ( is_null( $this->template_base ) ) {
$this->template_base = WC()->plugin_path() . '/templates/';
}
$this->email_type = $this->get_option( 'email_type' );
$this->enabled = $this->get_option( 'enabled' );
if ( FeaturesUtil::feature_is_enabled( 'email_improvements' ) ) {
$this->cc = $this->get_option( 'cc', '' );
$this->bcc = $this->get_option( 'bcc', '' );
}
if ( $this->block_email_editor_enabled ) {
$this->personalizer = wc_get_container()->get( TransactionalEmailPersonalizer::class );
}
add_action( 'phpmailer_init', array( $this, 'handle_multipart' ) );
add_action( 'woocommerce_update_options_email_' . $this->id, array( $this, 'process_admin_options' ) );
// Use priority 1 to ensure our skip classes are added before lazy loading plugins process the images.
add_filter( 'wp_get_attachment_image_attributes', array( $this, 'prevent_lazy_loading_on_attachment' ), 1, 1 );
}