PluginProbe
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management / 1.6.1
SureDonation – Donation Forms, Fundraising Campaigns & Donor Management v1.6.1
1.6.1 1.6.0 1.5.1 1.5.0 1.4.0 1.3.0 trunk 0.0.1 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0
suredonation / inc / emails / email-template.php

email-template.php in SureDonation – Donation Forms, Fundraising Campaigns & Donor Management 1.6.1, at inc/emails/email-template.php

124 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Email template loader.
4 *
5 * @package SureDonation
6 */
7
8 namespace SureDonation\Inc\Emails;
9
10 use SureDonation\Inc\Traits\Get_Instance;
11
12 // Exit if accessed directly.
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Email_Template class.
19 *
20 * @since 0.0.1
21 */
22 class Email_Template {
23 use Get_Instance;
24
25 /**
26 * Class constructor.
27 *
28 * @since 0.0.1
29 * @return void
30 */
31 public function __construct() {
32 }
33
34 /**
35 * Get email header.
36 *
37 * @param string $title Document title; defaults to the notification title. Since 1.6.1.
38 * @since 0.0.1
39 * @return string
40 */
41 public function get_header( $title = '' ) {
42 $title = is_string( $title ) && '' !== $title ? $title : __( 'Donation Notification', 'suredonation' );
43 ob_start();
44 ?>
45 <!DOCTYPE html>
46 <html>
47 <head>
48 <meta charset="UTF-8">
49 <meta name="viewport" content="width=device-width, initial-scale=1.0">
50 <title><?php echo esc_html( $title ); ?></title>
51 </head>
52 <body style="margin: 0; padding: 0;">
53 <div id="sd_wrapper" dir="ltr" style="margin: 0; background-color: #F8F8FC; padding: 40px 0 0 0; width: 100%;">
54 <table border="0" cellpadding="0" cellspacing="0" width="100%">
55 <tbody>
56 <tr>
57 <td align="center" valign="top">
58 <table border="0" cellpadding="0" cellspacing="0" width="600" id="sd_template_container" style="background-color: #ffffff; border: 1px solid #dce0e6; margin-bottom: 25px;">
59 <tbody>
60 <tr>
61 <td align="center" valign="top">
62 <table border="0" cellpadding="0" cellspacing="0" width="600" id="sd_template_body">
63 <tbody>
64 <tr>
65 <td valign="top" id="sd_body_content" style="background-color: #ffffff;">
66 <table border="0" cellpadding="20" cellspacing="0" width="100%">
67 <tbody>
68 <tr>
69 <td valign="top" style="padding: 32px;">
70 <div id="sd_body_content_inner" style="color: #384860; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-size: 14px; line-height: 20px; text-align: left;">
71 <?php
72 $output = ob_get_clean();
73 return false !== $output ? $output : '';
74 }
75
76 /**
77 * Get email footer.
78 *
79 * @since 0.0.1
80 * @return string
81 */
82 public function get_footer() {
83 ob_start();
84 ?>
85 </div>
86 </td>
87 </tr>
88 </tbody>
89 </table>
90 </td>
91 </tr>
92 </tbody>
93 </table>
94 </td>
95 </tr>
96 </tbody>
97 </table>
98 </td>
99 </tr>
100 </tbody>
101 </table>
102 </div>
103 </body>
104 </html>
105 <?php
106 $output = ob_get_clean();
107 return false !== $output ? $output : '';
108 }
109
110 /**
111 * Render email template with body content.
112 *
113 * @param string $email_body Email body content.
114 * @since 0.0.1
115 * @return string Complete email HTML.
116 */
117 public function render( $email_body ) {
118 // Convert newlines to <br> tags for plain text.
119 $email_body = nl2br( $email_body );
120
121 return $this->get_header() . $email_body . $this->get_footer();
122 }
123 }
124