PHP Class WC_Email

WooCommerce Emails Class which handles the sending on transactional emails and email templates
Author: WooThemes
Mostra file Open project: woocommerce/woocommerce Class Usage Examples

Public Properties

Property Type Description
$description string Description for the email.
$enabled 'yes' if the method is enabled.
$find array Strings to find in subjects/headings.
$heading string Heading for the email content.
$id String Email method ID.
$mime_boundary string Mime boundary (for multipart emails).
$mime_boundary_header string Mime boundary header (for multipart emails).
$object object | boolean Object this email is for, for example a customer, product, or email.
$plain_replace array @var array $plain_replace
$plain_search array https://raw.github.com/ushahidi/wp-silcc/master/class.html2text.inc
$recipient string Recipients for the email.
$replace array Strings to replace in subjects/headings.
$sending boolean True when email is being sent.
$subject string Subject for the email.
$template_base string Template path.
$template_html string HTML template path.
$template_plain string Plain text template path.
$title string Email method title.

Protected Properties

Property Type Description
$customer_email boolean True when the email notification is sent to customers.
$manual boolean True when the email notification is sent manually only.

Public Methods

Method Description
__construct ( ) Constructor.
admin_options ( ) Admin Options.
format_string ( mixed $string ) : string Format email string.
get_attachments ( ) : string Get email attachments.
get_blogname ( ) : string Get WordPress blog name.
get_content ( ) : string Get email content.
get_content_html ( ) : string Get the email content in HTML format.
get_content_plain ( ) : string Get the email content in plain text format.
get_content_type ( ) : string Get email content type.
get_description ( ) : string Return the email's description
get_email_type ( ) : string get_type function.
get_email_type_options ( ) : array Email type options.
get_from_address ( ) : string Get the from address for outgoing emails.
get_from_name ( ) : string Get the from name for outgoing emails.
get_headers ( ) : string Get email headers.
get_heading ( ) : string Get email heading.
get_option ( string $key, mixed $empty_value = null ) : string Proxy to parent's get_option and attempt to localize the result using gettext.
get_recipient ( ) : string Get valid recipients.
get_subject ( ) : string Get email subject.
get_template ( string $type ) : string Get template.
get_theme_template_file ( string $template ) : string Get the template file in the current theme.
get_title ( ) : string Return the email's title
handle_multipart ( PHPMailer $mailer ) : PHPMailer Handle multipart mail.
init_form_fields ( ) Initialise Settings Form Fields - these are generic email options most will use.
is_customer_email ( ) : boolean Checks if this email is customer focussed.
is_enabled ( ) : boolean Checks if this email is enabled and will be sent.
is_manual ( ) : boolean Checks if this email is manually sent
process_admin_options ( ) Admin Panel Options Processing.
send ( string $to, string $subject, string $message, string $headers, string $attachments ) : boolean Send an email.
style_inline ( string | null $content ) : string Apply inline styles to dynamic content.

Protected Methods

Method Description
admin_actions ( ) Admin actions.
delete_template_action ( string $template_type ) Delete template action.
move_template_action ( string $template_type ) Move template action.
save_template ( string $template_code, string $template_path ) Save the email templates.

Method Details

__construct() public method

Constructor.
public __construct ( )

admin_actions() protected method

Admin actions.
protected admin_actions ( )

admin_options() public method

Setup the email settings screen. Override this in your email.
Since: 1.0.0
public admin_options ( )

delete_template_action() protected method

Delete template action.
protected delete_template_action ( string $template_type )
$template_type string

format_string() public method

Format email string.
public format_string ( mixed $string ) : string
$string mixed
return string

get_attachments() public method

Get email attachments.
public get_attachments ( ) : string
return string

get_blogname() public method

Get WordPress blog name.
public get_blogname ( ) : string
return string

get_content() public method

Get email content.
public get_content ( ) : string
return string

get_content_html() public method

Get the email content in HTML format.
public get_content_html ( ) : string
return string

get_content_plain() public method

Get the email content in plain text format.
public get_content_plain ( ) : string
return string

get_content_type() public method

Get email content type.
public get_content_type ( ) : string
return string

get_description() public method

Return the email's description
public get_description ( ) : string
return string

get_email_type() public method

get_type function.
public get_email_type ( ) : string
return string

get_email_type_options() public method

Email type options.
public get_email_type_options ( ) : array
return array

get_from_address() public method

Get the from address for outgoing emails.
public get_from_address ( ) : string
return string

get_from_name() public method

Get the from name for outgoing emails.
public get_from_name ( ) : string
return string

get_headers() public method

Get email headers.
public get_headers ( ) : string
return string

get_heading() public method

Get email heading.
public get_heading ( ) : string
return string

get_option() public method

Proxy to parent's get_option and attempt to localize the result using gettext.
public get_option ( string $key, mixed $empty_value = null ) : string
$key string
$empty_value mixed
return string

get_recipient() public method

Get valid recipients.
public get_recipient ( ) : string
return string

get_subject() public method

Get email subject.
public get_subject ( ) : string
return string

get_template() public method

Get template.
public get_template ( string $type ) : string
$type string
return string

get_theme_template_file() public method

Get the template file in the current theme.
public get_theme_template_file ( string $template ) : string
$template string
return string

get_title() public method

Return the email's title
public get_title ( ) : string
return string

handle_multipart() public method

Handle multipart mail.
public handle_multipart ( PHPMailer $mailer ) : PHPMailer
$mailer PHPMailer
return PHPMailer

init_form_fields() public method

Initialise Settings Form Fields - these are generic email options most will use.
public init_form_fields ( )

is_customer_email() public method

Checks if this email is customer focussed.
public is_customer_email ( ) : boolean
return boolean

is_enabled() public method

Checks if this email is enabled and will be sent.
public is_enabled ( ) : boolean
return boolean

is_manual() public method

Checks if this email is manually sent
public is_manual ( ) : boolean
return boolean

move_template_action() protected method

Move template action.
protected move_template_action ( string $template_type )
$template_type string

process_admin_options() public method

Admin Panel Options Processing.

save_template() protected method

Save the email templates.
Since: 2.4.0
protected save_template ( string $template_code, string $template_path )
$template_code string
$template_path string

send() public method

Send an email.
public send ( string $to, string $subject, string $message, string $headers, string $attachments ) : boolean
$to string
$subject string
$message string
$headers string
$attachments string
return boolean success

style_inline() public method

Apply inline styles to dynamic content.
public style_inline ( string | null $content ) : string
$content string | null
return string

Property Details

$customer_email protected_oe property

True when the email notification is sent to customers.
protected bool $customer_email
return boolean

$description public_oe property

Description for the email.
public string $description
return string

$enabled public_oe property

'yes' if the method is enabled.
public $enabled

$find public_oe property

Strings to find in subjects/headings.
public array $find
return array

$heading public_oe property

Heading for the email content.
public string $heading
return string

$id public_oe property

Email method ID.
public String $id
return String

$manual protected_oe property

True when the email notification is sent manually only.
protected bool $manual
return boolean

$mime_boundary public_oe property

Mime boundary (for multipart emails).
public string $mime_boundary
return string

$mime_boundary_header public_oe property

Mime boundary header (for multipart emails).
public string $mime_boundary_header
return string

$object public_oe property

Object this email is for, for example a customer, product, or email.
public object|bool $object
return object | boolean

$plain_replace public_oe property

@var array $plain_replace
public array $plain_replace
return array

$recipient public_oe property

Recipients for the email.
public string $recipient
return string

$replace public_oe property

Strings to replace in subjects/headings.
public array $replace
return array

$sending public_oe property

True when email is being sent.
public bool $sending
return boolean

$subject public_oe property

Subject for the email.
public string $subject
return string

$template_base public_oe property

Template path.
public string $template_base
return string

$template_html public_oe property

HTML template path.
public string $template_html
return string

$template_plain public_oe property

Plain text template path.
public string $template_plain
return string

$title public_oe property

Email method title.
public string $title
return string