Skip to content

Commit

Permalink
Update mail.php
Browse files Browse the repository at this point in the history
  • Loading branch information
takayukister committed Feb 11, 2023
1 parent e542367 commit be4bf62
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions includes/mail.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ public function name() {
return $this->name;
}


/**
* Retrieves a component from the email template.
*
* @param string $component The name of the component.
* @param bool $replace_tags Whether to replace mail-tags
* within the component.
* @return string The text representation of the email component.
*/
public function get( $component, $replace_tags = false ) {
$use_html = ( $this->use_html && 'body' == $component );
$exclude_blank = ( $this->exclude_blank && 'body' == $component );
Expand Down Expand Up @@ -107,6 +116,13 @@ function ( $matches ) {
return $component;
}


/**
* Creates HTML message body by adding the header and footer.
*
* @param string $body The body part of HTML.
* @return string Formatted HTML.
*/
private function htmlize( $body ) {
if ( $this->locale ) {
$lang_atts = sprintf( ' %s',
Expand Down Expand Up @@ -136,6 +152,12 @@ private function htmlize( $body ) {
return $html;
}


/**
* Composes an email message and attempts to send it.
*
* @param bool $send Whether to attempt to send email. Default true.
*/
private function compose( $send = true ) {
$components = array(
'subject' => $this->get( 'subject', true ),
Expand Down Expand Up @@ -236,6 +258,10 @@ function ( $attachment ) {
return wp_mail( $recipient, $subject, $body, $headers, $attachments );
}


/**
* Replaces mail-tags within the given text.
*/
public function replace_tags( $content, $args = '' ) {
if ( true === $args ) {
$args = array( 'html' => true );
Expand All @@ -249,6 +275,10 @@ public function replace_tags( $content, $args = '' ) {
return wpcf7_mail_replace_tags( $content, $args );
}


/**
* Creates an array of attachments based on uploaded files and local files.
*/
private function attachments( $template = null ) {
if ( ! $template ) {
$template = $this->get( 'attachments' );
Expand Down

0 comments on commit be4bf62

Please sign in to comment.