Skip to content
Snippets Groups Projects
Commit b9bf52cb authored by Piotr Potrebka's avatar Piotr Potrebka
Browse files

feat: email abstract

parent 87263a6c
No related branches found
No related tags found
1 merge request!2Devel
Pipeline #151260 passed with stages
in 56 seconds
......@@ -125,7 +125,7 @@ class EmailSender {
public function get_template( EmailInterface $email, $placeholders = [] ): string {
$content = $this->replace_placeholders( $email->get_content(), $placeholders );
$output = $this->renderer->render( 'html/email-header', [] );
$output = $this->renderer->render( 'html/email-header', [ 'heading' => $email->get_heading(), 'logo' => '' ] );
$output .= $this->renderer->render( 'html/' . $email->get_id(), [ 'content' => $content ] );
$output .= $this->renderer->render( 'html/email-footer', [] );
......@@ -149,7 +149,8 @@ class EmailSender {
*/
private function css_inline( string $content ): string {
$styles = $this->renderer->render( 'html/email-styles', [] );
$body = HTMLDecorator::style_inline( $content, $styles );
return HTMLDecorator::style_inline( $content, $styles );
}
/**
......
......@@ -40,7 +40,7 @@ defined( 'ABSPATH' ) || exit;
<table border="0" cellpadding="10" cellspacing="0" width="100%">
<tr>
<td colspan="2" valign="middle" id="credit">
<?php echo wp_kses_post( wpautop( wptexturize( apply_filters( 'woocommerce_email_footer_text', get_option( 'woocommerce_email_footer_text' ) ) ) ) ); ?>
<?php echo wp_kses_post( wpautop( wptexturize( apply_filters( 'wpdesk/wp_mail/template/footer', '' ) ) ) ); ?>
</td>
</tr>
</table>
......
......@@ -16,50 +16,52 @@
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly
}
$params = isset( $params ) ? $params : [];
?>
<!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>" />
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
</head>
<body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr>
<td align="center" valign="top">
<div id="template_header_image">
<?php
if ( $img = get_option( 'woocommerce_email_header_image' ) ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $img ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
}
?>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container">
<tr>
<td align="center" valign="top">
<!-- Header -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header">
<tr>
<td id="header_wrapper">
<h1><?php echo $email_heading; ?></h1>
</td>
</tr>
</table>
<!-- End Header -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Body -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body">
<tr>
<td valign="top" id="body_content">
<!-- Content -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td valign="top">
<div id="body_content_inner">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo( 'charset' ); ?>"/>
<title><?php echo get_bloginfo( 'name', 'display' ); ?></title>
</head>
<body <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<div id="wrapper" dir="<?php echo is_rtl() ? 'rtl' : 'ltr'; ?>">
<table border="0" cellpadding="0" cellspacing="0" height="100%" width="100%">
<tr>
<td align="center" valign="top">
<div id="template_header_image">
<?php
if ( $params['logo'] ) {
echo '<p style="margin-top:0;"><img src="' . esc_url( $params['logo'] ) . '" alt="' . get_bloginfo( 'name', 'display' ) . '" /></p>';
}
?>
</div>
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_container">
<tr>
<td align="center" valign="top">
<!-- Header -->
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="template_header">
<tr>
<td id="header_wrapper">
<h1><?php echo $params['heading']; ?></h1>
</td>
</tr>
</table>
<!-- End Header -->
</td>
</tr>
<tr>
<td align="center" valign="top">
<!-- Body -->
<table border="0" cellpadding="0" cellspacing="0" width="600" id="template_body">
<tr>
<td valign="top" id="body_content">
<!-- Content -->
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td valign="top">
<div id="body_content_inner">
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment