Helper::__construct( string $event, array $args = array() )

Description #

Initialize email class.

Parameters #

  • $event
    string (Required) Event name.
  • $args
    array (Optional) Arguments. Default value: array()

Source #

File: addons/email/class-helper.php

	public function __construct( $event, $args = [] ) {
		$this->event = $event;

		$this->args = wp_parse_args(
			$args, array(
				'users'    => [],
				'subject'  => '',
				'tags'     => array(
					'site_name'        => get_bloginfo( 'name' ),
					'site_url'         => get_bloginfo( 'url' ),
					'site_description' => get_bloginfo( 'description' ),
				),
				'template' => [],
				'headers'  => array(
					'Content-Type: text/html; charset=utf-8',
				),
			)
		);

		$this->email_headers = $this->args['headers'];
		unset( $this->args['headers'] );

		// Add template tags.
		if ( ! empty( $this->args['tags'] ) ) {
			foreach ( $this->args['tags'] as $tag => $content ) {
				$this->add_template_tag( $tag, $content );
			}
		}
	}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment