| 1 |
<?php |
| 2 |
|
| 3 |
namespace YayMail\Templates\DefaultTemplate; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || exit; |
| 6 |
|
| 7 |
class YITHSubscription { |
| 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 |
$emailTitle = __( $emailHeading, 'woocommerce' ); |
| 27 |
$additionalContent = __( 'Thanks for reading.', 'woocommerce' ); |
| 28 |
$textShippingAddress = __( 'Shipping Address', 'woocommerce' ); |
| 29 |
$textBillingAddress = __( 'Billing Address', 'woocommerce' ); |
| 30 |
|
| 31 |
// Html |
| 32 |
$html = '<html> |
| 33 |
<head> |
| 34 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 35 |
</head> |
| 36 |
|
| 37 |
<body style="background: rgb(236, 236, 236); padding: 0;"> |
| 38 |
<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;"> |
| 39 |
<tbody> |
| 40 |
<tr> |
| 41 |
<td id="web8ffa62b5-7258-42cc-ba53-7ae69638c1fe-img" align="center" class="web-img-wrap" style="word-break: break-word; padding: 15px 50px;"> |
| 42 |
<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> |
| 43 |
</td> |
| 44 |
</tr> |
| 45 |
</tbody> |
| 46 |
</table> |
| 47 |
<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;"> |
| 48 |
<tbody> |
| 49 |
<tr> |
| 50 |
<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;"> |
| 51 |
<div> |
| 52 |
<h1 style="font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: #fff;">' . $emailTitle . '</h1></div> |
| 53 |
</td> |
| 54 |
</tr> |
| 55 |
</tbody> |
| 56 |
</table> |
| 57 |
<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;"> |
| 58 |
<tbody> |
| 59 |
<tr> |
| 60 |
<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;"> |
| 61 |
<div> |
| 62 |
<p style="margin: 0px;"><span style="color: #636363; font-size: 14px;">[yaymail_subscription_header]</span></p> |
| 63 |
</div> |
| 64 |
</td> |
| 65 |
</tr> |
| 66 |
</tbody> |
| 67 |
</table> |
| 68 |
|
| 69 |
<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;"> |
| 70 |
<tbody> |
| 71 |
<tr> |
| 72 |
<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;"> |
| 73 |
<div style="color: rgb(99, 99, 99);border-color: #e5e5e5;"> |
| 74 |
<h2 style="font-size:18px; margin-bottom: 0.83em; color:#96588a">[yaymail_subscription_table_title]</h2> |
| 75 |
<p>[yaymail_subscription_table]</p> |
| 76 |
</div> |
| 77 |
</td> |
| 78 |
</tr> |
| 79 |
</tbody> |
| 80 |
</table> |
| 81 |
|
| 82 |
<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;"> |
| 83 |
<tbody> |
| 84 |
<tr> |
| 85 |
<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;"> |
| 86 |
<div style="color: rgb(99, 99, 99);"> |
| 87 |
<p> |
| 88 |
[yaymail_billing_shipping_address] |
| 89 |
</p> |
| 90 |
</div> |
| 91 |
</td> |
| 92 |
</tr> |
| 93 |
</tbody> |
| 94 |
</table> |
| 95 |
<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;"> |
| 96 |
<tbody> |
| 97 |
<tr> |
| 98 |
<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;"> |
| 99 |
<div> |
| 100 |
<p><span style="font-size: 14px; color: #636363;">' . $additionalContent . '</span></p> |
| 101 |
</div> |
| 102 |
</td> |
| 103 |
</tr> |
| 104 |
</tbody> |
| 105 |
</table> |
| 106 |
<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;"> |
| 107 |
<tbody> |
| 108 |
<tr> |
| 109 |
<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;"> |
| 110 |
<div> |
| 111 |
<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> |
| 112 |
</div> |
| 113 |
</td> |
| 114 |
</tr> |
| 115 |
</tbody> |
| 116 |
</table> |
| 117 |
</body> |
| 118 |
|
| 119 |
</html>'; |
| 120 |
|
| 121 |
/* |
| 122 |
@@@ Elements default when reset template. |
| 123 |
@@@ Note 1: Add characters '\' before special characters in a string. |
| 124 |
@@@ example 1: "family": "\'Helvetica Neue\',Helvetica,Roboto,Arial,sans-serif", |
| 125 |
|
| 126 |
@@@ Note 2: Add characters '\' before special characters in a string. |
| 127 |
@@@ example 2: "<h1 style=\"font-family: \'Helvetica Neue\',...." |
| 128 |
*/ |
| 129 |
|
| 130 |
// Elements |
| 131 |
$elements = |
| 132 |
'[{ |
| 133 |
"id": "8ffa62b5-7258-42cc-ba53-7ae69638c1fe", |
| 134 |
"type": "Logo", |
| 135 |
"nameElement": "Logo", |
| 136 |
"settingRow": { |
| 137 |
"backgroundColor": "#ECECEC", |
| 138 |
"align": "center", |
| 139 |
"pathImg": "", |
| 140 |
"paddingTop": "15", |
| 141 |
"paddingRight": "50", |
| 142 |
"paddingBottom": "15", |
| 143 |
"paddingLeft": "50", |
| 144 |
"width": "172", |
| 145 |
"url": "#" |
| 146 |
} |
| 147 |
}, { |
| 148 |
"id": "802bfe24-7af8-48af-ac5e-6560a81345b3", |
| 149 |
"type": "ElementText", |
| 150 |
"nameElement": "Email Heading", |
| 151 |
"settingRow": { |
| 152 |
"content": "<h1 style=\"font-size: 30px; font-weight: 300; line-height: normal; margin: 0; color: inherit;\">' . $emailTitle . '</h1>", |
| 153 |
"backgroundColor": "#96588A", |
| 154 |
"textColor": "#ffffff", |
| 155 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 156 |
"paddingTop": "36", |
| 157 |
"paddingRight": "48", |
| 158 |
"paddingBottom": "36", |
| 159 |
"paddingLeft": "48" |
| 160 |
} |
| 161 |
}, { |
| 162 |
"id": "b035d1f1-0cfe-41c5-b79c-0478f144ef5f", |
| 163 |
"type": "ElementText", |
| 164 |
"nameElement": "Text", |
| 165 |
"settingRow": { |
| 166 |
"content": "<p style=\"margin: 0px;\">[yaymail_subscription_header]</p>", |
| 167 |
"backgroundColor": "#fff", |
| 168 |
"textColor": "#636363", |
| 169 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 170 |
"paddingTop": "47", |
| 171 |
"paddingRight": "50", |
| 172 |
"paddingBottom": "0", |
| 173 |
"paddingLeft": "50" |
| 174 |
} |
| 175 |
},{ |
| 176 |
"id": "yi422370-f762-4a26-92de-c4cf3878h0oi", |
| 177 |
"type": "YITHOrderSubscription", |
| 178 |
"nameElement": "Order Subscription", |
| 179 |
"settingRow": { |
| 180 |
"content": "[yaymail_subscription_table]", |
| 181 |
"contentTitle": "[yaymail_subscription_table_title]", |
| 182 |
"backgroundColor" : "#fff", |
| 183 |
"titleColor" : "#96588a", |
| 184 |
"textColor" : "#636363", |
| 185 |
"borderColor" : "#e5e5e5", |
| 186 |
"family" : "Helvetica,Roboto,Arial,sans-serif", |
| 187 |
"paddingTop" : "15", |
| 188 |
"paddingRight" : "50", |
| 189 |
"paddingBottom" : "15", |
| 190 |
"paddingLeft" : "50" |
| 191 |
} |
| 192 |
},{ |
| 193 |
"id": "de242956-a617-4213-9107-138842oi4tch", |
| 194 |
"type": "BillingAddress", |
| 195 |
"nameElement": "Billing Shipping Address", |
| 196 |
"settingRow": { |
| 197 |
"nameColumn": "BillingShippingAddress", |
| 198 |
"contentTitle": "[yaymail_billing_shipping_address_title]", |
| 199 |
"checkBillingShipping": "[yaymail_billing_shipping_address_title]", |
| 200 |
"titleBilling": "' . $textBillingAddress . '", |
| 201 |
"titleShipping": "' . $textShippingAddress . '", |
| 202 |
"content": "[yaymail_billing_shipping_address_content]", |
| 203 |
"titleColor" : "#96588a", |
| 204 |
"backgroundColor": "#fff", |
| 205 |
"borderColor": "#e5e5e5", |
| 206 |
"textColor": "#636363", |
| 207 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 208 |
"paddingTop": "15", |
| 209 |
"paddingRight": "50", |
| 210 |
"paddingBottom": "15", |
| 211 |
"paddingLeft": "50" |
| 212 |
} |
| 213 |
}, |
| 214 |
{ |
| 215 |
"id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8d", |
| 216 |
"type": "ElementText", |
| 217 |
"nameElement": "Footer", |
| 218 |
"settingRow": { |
| 219 |
"content": "<p><span style=\"font-size: 14px;\">' . $additionalContent . '</span></p>", |
| 220 |
"backgroundColor": "#fff", |
| 221 |
"textColor": "#636363", |
| 222 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 223 |
"paddingTop": "", |
| 224 |
"paddingRight": "50", |
| 225 |
"paddingBottom": "38", |
| 226 |
"paddingLeft": "50" |
| 227 |
} |
| 228 |
}, |
| 229 |
{ |
| 230 |
"id": "b39bf2e6-8c1a-4384-a5ec-37663da27c8ds", |
| 231 |
"type": "ElementText", |
| 232 |
"nameElement": "Footer", |
| 233 |
"settingRow": { |
| 234 |
"content": "<p style=\"font-size: 14px;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\">WooCommerce</a></p>", |
| 235 |
"backgroundColor": "#ececec", |
| 236 |
"textColor": "#8a8a8a", |
| 237 |
"family": "Helvetica,Roboto,Arial,sans-serif", |
| 238 |
"paddingTop": "15", |
| 239 |
"paddingRight": "50", |
| 240 |
"paddingBottom": "15", |
| 241 |
"paddingLeft": "50" |
| 242 |
} |
| 243 |
}]'; |
| 244 |
|
| 245 |
// Templates Subscription |
| 246 |
$templates = array( |
| 247 |
$customOrder => array(), |
| 248 |
); |
| 249 |
|
| 250 |
$templates[ $customOrder ]['html'] = $html; |
| 251 |
$templates[ $customOrder ]['elements'] = $elements; |
| 252 |
return $templates; |
| 253 |
} |
| 254 |
} |
| 255 |
|