PluginProbe
YayMail – WooCommerce Email Customizer / 1.9.6
YayMail – WooCommerce Email Customizer v1.9.6
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
yaymail / includes / Templates / DefaultTemplate / DefaultSubscription.php

DefaultSubscription.php in YayMail – WooCommerce Email Customizer 1.9.6, at includes/Templates/DefaultTemplate/DefaultSubscription.php

344 lines 15.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\Templates\DefaultTemplate;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class DefaultSubscription {
8
9 protected static $instance = null;
10
11 public static function getInstance() {
12 if ( null == self::$instance ) {
13 self::$instance = new self();
14 }
15
16 return self::$instance;
17 }
18
19 public static function getTemplates( $customOrder, $emailHeading ) {
20 /*
21 @@@ Html default send email.
22 @@@ Note: Add characters '\' before special characters in a string.
23 @@@ Example: font-family: \'Helvetica Neue\'...
24 */
25
26 $orderSubscription = self::orderSubscription( $customOrder );
27 $emailTitle = __( $emailHeading, 'woocommerce' );
28 $customText = '';
29 if ( 'expired_subscription' == $customOrder ) {
30 $customText = esc_html__( ' has expired.', 'woocommerce' );
31 }
32 if ( 'suspended_subscription' == $customOrder ) {
33 $customText = esc_html__( ' has been suspended by the user.', 'woocommerce' );
34 }
35 if ( 'cancelled_subscription' == $customOrder ) {
36 $customText = esc_html__( ' has been cancelled.', 'woocommerce' );
37 }
38 $emailtext = esc_html__( 'A subscription belonging to ', 'woocommerce' ) . esc_html( do_shortcode( '[yaymail_billing_first_name] [yaymail_billing_last_name]' ) ) . $customText . esc_html__( ' Their subscription\'s details are as follows:', 'woocommerce' );
39 $additionalContent = __( 'Thanks for reading.', 'woocommerce' );
40 if ( 'new_switch_order' == $customOrder ) {
41 $emailtext = esc_html__( 'Customer ', 'woocommerce' ) . esc_html( do_shortcode( '[yaymail_billing_first_name] [yaymail_billing_last_name]' ) ) . esc_html__( ' has switched 0 of their subscriptions. The details of their new subscriptions are as follows:', 'woocommerce' );
42 $additionalContent = __( 'Congratulations on the sale.', 'woocommerce' );
43 }
44 if ( 'customer_completed_switch_order' == $customOrder ) {
45 $emailtext = esc_html__( 'Hi ', 'woocommerce' ) . esc_html( do_shortcode( '[yaymail_billing_first_name]' ) . ', <br /><br/>' ) . esc_html__( 'You have successfully changed your subscription items. Your new order and subscription details are shown below for your reference:', 'woocommerce' );
46 $additionalContent = __( 'Thanks for shopping with us.', 'woocommerce' );
47 }
48 $textShippingAddress = __( 'Shipping Address', 'woocommerce' );
49 $textBillingAddress = __( 'Billing Address', 'woocommerce' );
50
51 // Html
52 $html = '<html>
53 <head>
54 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
55 </head>
56
57 <body style="background: rgb(236, 236, 236); padding: 0;">
58 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="web8ffa62b5-7258-42cc-ba53-7ae69638c1fe" class="web-main-row" style="display: table; background-color: rgb(236, 236, 236); width: 605px;">
59 <tbody>
60 <tr>
61 <td id="web8ffa62b5-7258-42cc-ba53-7ae69638c1fe-img" align="center" class="web-img-wrap" style="word-break: break-word; padding: 15px 50px;">
62 <a href="#" target="_blank" style="border: none; text-decoration: none;"><img border="0" tabindex="0" src="' . YAYMAIL_PLUGIN_URL . 'assets/dist/images/woocommerce-logo.png" class="web-img" width="172" height="auto"></a>
63 </td>
64 </tr>
65 </tbody>
66 </table>
67 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="web802bfe24-7af8-48af-ac5e-6560a81345b3" class="web-main-row" style="display: table; background-color: #96588a; width: 605px;">
68 <tbody>
69 <tr>
70 <td id="web802bfe24-7af8-48af-ac5e-6560a81345b3-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 41px 48px;">
71 <div>
72 <h1 style="font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: #fff;">' . $emailTitle . '</h1></div>
73 </td>
74 </tr>
75 </tbody>
76 </table>
77 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webb035d1f1-0cfe-41c5-b79c-0478f144ef5f" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;">
78 <tbody>
79 <tr>
80 <td id="webb035d1f1-0cfe-41c5-b79c-0478f144ef5f-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 32px 50px 0px;">
81 <div>
82 <p style="margin: 0px;"><span style="color: #636363; font-size: 14px;">' . $emailtext . '</span></p>
83 </div>
84 </td>
85 </tr>
86 </tbody>
87 </table>';
88 if ( 'suspended_subscription' == $customOrder || 'expired_subscription' == $customOrder || 'cancelled_subscription' == $customOrder ) {
89 $html .= '<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="weso422370-f762-4a26-92de-c4cf3821b8eb" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;">
90 <tbody>
91 <tr>
92 <td id="web-so422370-f762-4a26-92de-c4cf3821b8eb-order-item" align="left" class="web-order-item" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 15px 50px;">
93 <div style="color: rgb(99, 99, 99);border-color: #e5e5e5;">
94 <p></p>';
95 if ( 'suspended_subscription' == $customOrder ) {
96 $html .= '[yaymail_items_subscription_suspended]';
97 }
98 if ( 'expired_subscription' == $customOrder ) {
99 $html .= '[yaymail_items_subscription_expired]';
100 }
101 if ( 'cancelled_subscription' == $customOrder ) {
102 $html .= '[yaymail_items_subscription_cancelled]';
103 }
104 $html .= '<p></p>
105 </div>
106 </td>
107 </tr>
108 </tbody>
109 </table>';
110 }
111 $html .= '<table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webad422370-f762-4a26-92de-c4cf3821b8eb" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;">
112 <tbody>
113 <tr>
114 <td id="web-ad422370-f762-4a26-92de-c4cf3821b8eb-order-item" align="left" class="web-order-item" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 15px 50px;">
115 <div style="color: rgb(99, 99, 99);border-color: #e5e5e5;">
116 <p></p>
117 [yaymail_items_border]
118 <p></p>
119 </div>
120 </td>
121 </tr>
122 </tbody>
123 </table>
124 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webde242956-a617-4213-9107-138842cc6bff" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;">
125 <tbody>
126 <tr>
127 <td id="web-de242956-a617-4213-9107-138842cc6bff-billing-address" align="left" class="web-billing-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding: 15px 50px;">
128 <div style="color: rgb(99, 99, 99);">
129 <p>
130 [yaymail_billing_shipping_address]
131 </p>
132 </div>
133 </td>
134 </tr>
135 </tbody>
136 </table>
137 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webb39bf2e6-8c1a-4384-a5ec-37663da27c8d" class="web-main-row" style="display: table; background-color: rgb(255, 255, 255); width: 605px;">
138 <tbody>
139 <tr>
140 <td id="webb39bf2e6-8c1a-4384-a5ec-37663da27c8d-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Helvetica, Roboto, Arial, sans-serif; padding-top: 16px; padding-bottom: 50px; padding-right: 50px; padding-left: 50px;">
141 <div>
142 <p><span style="font-size: 14px; color: #636363;">' . $additionalContent . '</span></p>
143 </div>
144 </td>
145 </tr>
146 </tbody>
147 </table>
148 <table width="605px" cellspacing="0" cellpadding="0" border="0" align="center" id="webd50a08d5-e35f-41f7-951c-22b5c51fbadb" class="web-main-row" style="display: table; background-color: rgb(236, 236, 236); width: 605px;">
149 <tbody>
150 <tr>
151 <td id="webd50a08d5-e35f-41f7-951c-22b5c51fbadb-shipping-address" align="left" class="web-shipping-address" style="font-size: 13px; line-height: 22px; word-break: break-word; font-family: Verdana, Geneva, sans-serif; padding: 15px 50px;">
152 <div>
153 <p style="font-size: 14px; color: #8a8a8a; margin: 0px 0px 16px; text-align: center;">[yaymail_site_name] - Built with <a style="color: #96588a; font-weight: normal; text-decoration: underline;" href="https://woocommerce.com" target="_blank" rel="noopener" draggable="false">WooCommerce</a></p>
154 </div>
155 </td>
156 </tr>
157 </tbody>
158 </table>
159 </body>
160
161 </html>';
162
163 /*
164 @@@ Elements default when reset template.
165 @@@ Note 1: Add characters '\' before special characters in a string.
166 @@@ example 1: "family": "\'Helvetica Neue\',Helvetica,Roboto,Arial,sans-serif",
167
168 @@@ Note 2: Add characters '\' before special characters in a string.
169 @@@ example 2: "<h1 style=\"font-family: \'Helvetica Neue\',...."
170 */
171
172 // Elements
173 $elements =
174 '[{
175 "id": "8ffa62b5-7258-42cc-ba53-7ae69638c1fe",
176 "type": "Logo",
177 "nameElement": "Logo",
178 "settingRow": {
179 "backgroundColor": "#ECECEC",
180 "align": "center",
181 "pathImg": "",
182 "paddingTop": "15",
183 "paddingRight": "50",
184 "paddingBottom": "15",
185 "paddingLeft": "50",
186 "width": "172",
187 "url": "#"
188 }
189 }, {
190 "id": "802bfe24-7af8-48af-ac5e-6560a81345b3",
191 "type": "ElementText",
192 "nameElement": "Email Heading",
193 "settingRow": {
194 "content": "<h1 style=\"font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: inherit;\">' . $emailTitle . '</h1>",
195 "backgroundColor": "#96588A",
196 "textColor": "#ffffff",
197 "family": "Helvetica,Roboto,Arial,sans-serif",
198 "paddingTop": "36",
199 "paddingRight": "48",
200 "paddingBottom": "36",
201 "paddingLeft": "48"
202 }
203 }, {
204 "id": "b035d1f1-0cfe-41c5-b79c-0478f144ef5f",
205 "type": "ElementText",
206 "nameElement": "Text",
207 "settingRow": {
208 "content": "<p style=\"margin: 0px;\"><span style=\"font-size: 14px;\">' . $emailtext . '</span></p>",
209 "backgroundColor": "#fff",
210 "textColor": "#636363",
211 "family": "Helvetica,Roboto,Arial,sans-serif",
212 "paddingTop": "47",
213 "paddingRight": "50",
214 "paddingBottom": "0",
215 "paddingLeft": "50"
216 }
217 },
218 ' . $orderSubscription . '
219 {
220 "id": "ad422370-f762-4a26-92de-c4cf3878h0oi",
221 "type": "OrderItem",
222 "nameElement": "Order Item",
223 "settingRow": {
224 "contentBefore": "[yaymail_items_border_before]",
225 "contentAfter": "[yaymail_items_border_after]",
226 "contentTitle": "[yaymail_items_border_title]",
227 "content": "[yaymail_items_border_content]",
228 "backgroundColor": "#fff",
229 "titleColor" : "#96588a",
230 "textColor": "#636363",
231 "borderColor": "#e5e5e5",
232 "family": "Helvetica,Roboto,Arial,sans-serif",
233 "paddingTop": "15",
234 "paddingRight": "50",
235 "paddingBottom": "15",
236 "paddingLeft": "50"
237 }
238 },
239 {
240 "id": "de242956-a617-4213-9107-138842oi4tch",
241 "type": "BillingAddress",
242 "nameElement": "Billing Shipping Address",
243 "settingRow": {
244 "nameColumn": "BillingShippingAddress",
245 "contentTitle": "[yaymail_billing_shipping_address_title]",
246 "checkBillingShipping": "[yaymail_billing_shipping_address_title]",
247 "titleBilling": "' . $textBillingAddress . '",
248 "titleShipping": "' . $textShippingAddress . '",
249 "content": "[yaymail_billing_shipping_address_content]",
250 "titleColor" : "#96588a",
251 "backgroundColor": "#fff",
252 "borderColor": "#e5e5e5",
253 "textColor": "#636363",
254 "family": "Helvetica,Roboto,Arial,sans-serif",
255 "paddingTop": "15",
256 "paddingRight": "50",
257 "paddingBottom": "15",
258 "paddingLeft": "50"
259 }
260 },
261 {
262 "id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8d",
263 "type": "ElementText",
264 "nameElement": "Footer",
265 "settingRow": {
266 "content": "<p><span style=\"font-size: 14px;\">' . $additionalContent . '</span></p>",
267 "backgroundColor": "#fff",
268 "textColor": "#636363",
269 "family": "Helvetica,Roboto,Arial,sans-serif",
270 "paddingTop": "",
271 "paddingRight": "50",
272 "paddingBottom": "38",
273 "paddingLeft": "50"
274 }
275 },
276 {
277 "id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8ds",
278 "type": "ElementText",
279 "nameElement": "Footer",
280 "settingRow": {
281 "content": "<p style=\"font-size: 14px;margin: 0px 0px 16px; text-align: center;\">[yaymail_site_name]&nbsp;- Built with <a style=\"color: #96588a; font-weight: normal; text-decoration: underline;\" href=\"https://woocommerce.com\" target=\"_blank\" rel=\"noopener\">WooCommerce</a></p>",
282 "backgroundColor": "#ececec",
283 "textColor": "#8a8a8a",
284 "family": "Helvetica,Roboto,Arial,sans-serif",
285 "paddingTop": "15",
286 "paddingRight": "50",
287 "paddingBottom": "15",
288 "paddingLeft": "50"
289 }
290 }]';
291
292 // Templates Subscription
293 $templates = array(
294 $customOrder => array(),
295 );
296
297 $templates[ $customOrder ]['html'] = $html;
298 $templates[ $customOrder ]['elements'] = $elements;
299 return $templates;
300 }
301
302 public static function orderSubscription( $customOrder ) {
303
304 $isDisplay = false;
305 $content = '';
306 if ( 'suspended_subscription' == $customOrder ) {
307 $content = '[yaymail_items_subscription_suspended]';
308 $isDisplay = true;
309 }
310 if ( 'expired_subscription' == $customOrder ) {
311 $content = '[yaymail_items_subscription_expired]';
312 $isDisplay = true;
313 }
314 if ( 'cancelled_subscription' == $customOrder ) {
315 $content = '[yaymail_items_subscription_cancelled]';
316 $isDisplay = true;
317 }
318 $element = '{
319 "id": "ad422370-f762-4a26-92de-c4cf38",
320 "type": "OrderSubscription",
321 "nameElement": "Order Subscription",
322 "settingRow": {
323 "content" :"' . $content . '",
324 "backgroundColor": "#fff",
325 "titleColor" : "#96588a",
326 "textColor": "#636363",
327 "borderColor": "#e5e5e5",
328 "family": "Helvetica,Roboto,Arial,sans-serif",
329 "paddingTop": "15",
330 "paddingRight": "50",
331 "paddingBottom": "15",
332 "paddingLeft": "50"
333 }
334 },';
335
336 if ( $isDisplay ) {
337 return $element;
338 }
339 return '';
340 }
341
342
343 }
344