PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.6.0
EmailKit – Email Customizer for WooCommerce & WP v1.6.0
1.6.9 1.6.8 1.6.7 trunk 1.0.0 1.2.0 1.4.0 1.4.5 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6
emailkit / includes / Admin / TemplateList.php

TemplateList.php in EmailKit – Email Customizer for WooCommerce & WP 1.6.0, at includes/Admin/TemplateList.php

673 lines 29.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace EmailKit\Admin;
3
4 use EmailKit\Admin\Emails\EmailLists;
5 Use EmailKitPro\Admin\TemplateManager;
6 defined( 'ABSPATH' ) || exit;
7
8 Class TemplateList{
9 const EMAILKIT_URL_TEMAPLTE_DIR = EMAILKIT_DIR. "includes/";
10 const EMAILKIT_URL_TEMAPLTE_URL = EMAILKIT_URL. "includes/";
11 const EMAILKIT_TEMAPLTE_DIR_PRO = EMAILKITPRO_DIR. "includes/";
12
13
14 public static function get_templates(){
15
16
17 $template_list = array_merge(
18
19 self::get_new_order_template(),
20 self::get_cancelled_order_template(),
21 self::get_failed_order_template(),
22 self::get_failed_order_template_customer(),
23 self::get_completed_order_template(),
24 self::get_processing_order_template(),
25 self::get_refunded_order_template(),
26 self::get_order_on_hold_template(),
27 self::get_customer_invoice_order_details_template(),
28 self::get_customer_note_template(),
29 self::get_new_account_template(),
30 self::get_reset_password_template(),
31 self::get_low_stock_template(),
32 self::get_no_stock_template(),
33 self::get_back_order_template(),
34 self::get_partial_refund_template(),
35 self::get_wp_new_register_template(),
36 self::get_wp_reset_password_template(),
37 self::metform_email_template(),
38
39 );
40
41 return apply_filters( 'emailkit/editor/templates', $template_list );
42 }
43
44 public static function get_new_order_template(){
45
46 return [
47 'template-1' => [
48 'id' => 1,
49 'package' => 'free',
50 'mail_type' => 'woocommerce',
51 'title' => EmailLists::NEW_ORDER,
52 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ORDER),
53 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/new-order/1/preview-thumb.svg',
54 'demo-url' => 'https://wpmet.com/',
55 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/new-order/1/content.json',
56 ],
57
58 ];
59
60
61 }
62
63 public static function get_cancelled_order_template(){
64
65 return [
66
67 'template-2' => [
68 'id' => 2,
69 'package' => 'free',
70 'mail_type' => 'woocommerce',
71 'title' => EmailLists::CANCELLED_ORDER,
72 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
73 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/1/preview-thumb.svg',
74 'demo-url' => 'https://wpmet.com/',
75 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/cancelled-order/1/content.json',
76
77 ],
78 'template-24' => [
79 'id' => 23,
80 'package' => 'pro',
81 'mail_type' => 'woocommerce',
82 'title' => EmailLists::CANCELLED_ORDER,
83 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
84 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/thumbnail/style_01.png',
85 'demo-url' => 'https://wpmet.com/',
86 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/cancelled-order/1/content.json' : ''
87 ],
88 'template-25' => [
89 'id' => 24,
90 'package' => 'pro',
91 'mail_type' => 'woocommerce',
92 'title' => EmailLists::CANCELLED_ORDER,
93 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
94 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/thumbnail/style_02.png',
95 'demo-url' => 'https://wpmet.com/',
96 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/cancelled-order/2/content.json' : ''
97 ],
98 'template-26' => [
99 'id' => 25,
100 'package' => 'pro',
101 'mail_type' => 'woocommerce',
102 'title' => EmailLists::CANCELLED_ORDER,
103 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
104 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/thumbnail/style_03.png',
105 'demo-url' => 'https://wpmet.com/',
106 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/cancelled-order/3/content.json' : ''
107 ],
108 'template-27' => [
109 'id' => 26,
110 'package' => 'pro',
111 'mail_type' => 'woocommerce',
112 'title' => EmailLists::CANCELLED_ORDER,
113 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
114 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/thumbnail/style_04.png',
115 'demo-url' => 'https://wpmet.com/',
116 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/cancelled-order/4/content.json' : ''
117 ],
118 'template-28' => [
119 'id' => 27,
120 'package' => 'pro',
121 'mail_type' => 'woocommerce',
122 'title' => EmailLists::CANCELLED_ORDER,
123 'template_title' => EmailLists::woocommerce_email(EmailLists::CANCELLED_ORDER),
124 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/cancelled-order/thumbnail/style_05.png',
125 'demo-url' => 'https://wpmet.com/',
126 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/cancelled-order/5/content.json' : ''
127 ],
128
129 ];
130 }
131
132 public static function get_failed_order_template(){
133
134 return [
135 'template-3' => [
136 'id' => 3,
137 'package' => 'free',
138 'mail_type' => 'woocommerce',
139 'title' => EmailLists::FAILED_ORDER,
140 'template_title' => EmailLists::woocommerce_email(EmailLists::FAILED_ORDER),
141 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/failed-order/1/preview-thumb.svg',
142 'demo-url' => 'https://wpmet.com/',
143 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/failed-order/1/content.json',
144 ],
145 ];
146 }
147
148 public static function get_failed_order_template_customer(){
149
150 return [
151 'template-39' => [
152 'id' => 38,
153 'package' => 'free',
154 'mail_type' => 'woocommerce',
155 'title' => EmailLists::FAILED_ORDER_CUSTOMER,
156 'template_title' => EmailLists::woocommerce_email(EmailLists::FAILED_ORDER_CUSTOMER),
157 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/failed-order-customer/1/preview-thumb.svg',
158 'demo-url' => 'https://wpmet.com/',
159 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/failed-order-customer/1/content.json',
160 ],
161 ];
162 }
163
164 public static function get_completed_order_template(){
165
166 return [
167
168 'template-6' => [
169 'id' => 6,
170 'package' => 'free',
171 'mail_type' => 'woocommerce',
172 'title' => EmailLists::COMPLETED_ORDER,
173 'template_title' => EmailLists::woocommerce_email(EmailLists::COMPLETED_ORDER),
174 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/completed-order/1/preview-thumb.svg',
175 'demo-url' => 'https://wpmet.com/',
176 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/completed-order/1/content.json'
177 ],
178
179
180
181 ];
182 }
183
184 public static function get_processing_order_template(){
185
186 return [
187 'template-5' => [
188 'id' => 5,
189 'package' => 'free',
190 'mail_type' => 'woocommerce',
191 'title' => EmailLists::PROCESSING_ORDER,
192 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
193 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/1/preview-thumb.svg',
194 'demo-url' => 'https://wpmet.com/',
195 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/processing-order/1/content.json',
196 ],
197 'template-19' => [
198 'id' => 18,
199 'package' => 'pro',
200 'mail_type' => 'woocommerce',
201 'title' => EmailLists::PROCESSING_ORDER,
202 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
203 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/thumbnail/style_01.png',
204 'demo-url' => 'https://wpmet.com/',
205 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/processing-order/1/content.json' : ''
206 ],
207
208 'template-20' => [
209 'id' => 19,
210 'package' => 'pro',
211 'mail_type' => 'woocommerce',
212 'title' => EmailLists::PROCESSING_ORDER,
213 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
214 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/thumbnail/style_02.png',
215 'demo-url' => 'https://wpmet.com/',
216 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/processing-order/2/content.json' : ''
217 ],
218
219 'template-21' => [
220 'id' => 20,
221 'package' => 'pro',
222 'mail_type' => 'woocommerce',
223 'title' => EmailLists::PROCESSING_ORDER,
224 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
225 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/thumbnail/style_03.png',
226 'demo-url' => 'https://wpmet.com/',
227 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/processing-order/3/content.json' : ''
228 ],
229 'template-22' => [
230 'id' => 21,
231 'package' => 'pro',
232 'mail_type' => 'woocommerce',
233 'title' => EmailLists::PROCESSING_ORDER,
234 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
235 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/thumbnail/style_04.png',
236 'demo-url' => 'https://wpmet.com/',
237 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/processing-order/4/content.json' : ''
238 ],
239 'template-23' => [
240 'id' => 22,
241 'package' => 'pro',
242 'mail_type' => 'woocommerce',
243 'title' => EmailLists::PROCESSING_ORDER,
244 'template_title' => EmailLists::woocommerce_email(EmailLists::PROCESSING_ORDER),
245 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/processing-order/thumbnail/style_05.png',
246 'demo-url' => 'https://wpmet.com/',
247 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/processing-order/5/content.json' : ''
248 ],
249 ];
250 }
251
252 public static function get_refunded_order_template(){
253
254 return [
255 'template-7' => [
256 'id' => 7,
257 'package' => 'free',
258 'mail_type' => 'woocommerce',
259 'title' => EmailLists::REFUNDED_ORDER,
260 'template_title' => EmailLists::woocommerce_email(EmailLists::REFUNDED_ORDER),
261 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/refunded-order/1/preview-thumb.svg',
262 'demo-url' => 'https://wpmet.com/',
263 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/refunded-order/1/content.json'
264 ],
265 ];
266
267 }
268
269 public static function get_order_on_hold_template(){
270
271 return [
272 'template-4' => [
273 'id' => 4,
274 'package' => 'free',
275 'mail_type' => 'woocommerce',
276 'title' => EmailLists::ORDER_ON_HOLD,
277 'template_title' => EmailLists::woocommerce_email(EmailLists::ORDER_ON_HOLD),
278 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/order-on-hold/1/preview-thumb.svg',
279 'demo-url' => 'https://wpmet.com/',
280 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/order-on-hold/1/content.json',
281 ],
282
283 ];
284 }
285
286 public static function get_customer_invoice_order_details_template(){
287
288 return [
289
290 'template-8' => [
291 'id' => 8,
292 'package' => 'free',
293 'mail_type' => 'woocommerce',
294 'title' => EmailLists::CUSTOMER_INVOICE_OR_ORDER_DETAILS,
295 'template_title' => EmailLists::woocommerce_email(EmailLists::CUSTOMER_INVOICE_OR_ORDER_DETAILS),
296 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/customer-invoice/1/preview-thumb.svg',
297 'demo-url' => '',
298 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/customer-invoice/1/content.json'
299 ],
300
301 ];
302
303 }
304
305 public static function get_customer_note_template(){
306
307 return [
308
309 'template-9' => [
310 'id' => 9,
311 'package' => 'free',
312 'mail_type' => 'woocommerce',
313 'title' => EmailLists::CUSTOMER_NOTE,
314 'template_title' => EmailLists::woocommerce_email(EmailLists::CUSTOMER_NOTE),
315 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/customer-note/1/preview-thumb.svg',
316 'demo-url' => 'https://wpmet.com/',
317 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/customer-note/1/content.json'
318 ],
319
320 ];
321 }
322
323 public static function get_new_account_template(){
324
325 return [
326 'template-10' => [
327 'id' => 10,
328 'package' => 'free',
329 'mail_type' => 'woocommerce',
330 'title' => EmailLists::NEW_ACCOUNT,
331 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
332 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/1/preview-thumb.svg',
333 'demo-url' => 'https://wpmet.com/',
334 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/wc-new-account/1/content.json'
335 ],
336 'template-29' => [
337 'id' => 28,
338 'package' => 'pro',
339 'mail_type' => 'woocommerce',
340 'title' => EmailLists::NEW_ACCOUNT,
341 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
342 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/thumbnail/style_01.png',
343 'demo-url' => 'https://wpmet.com/',
344 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wc-new-account/1/content.json' : ''
345 ],
346
347 'template-30' => [
348 'id' => 29,
349 'package' => 'pro',
350 'mail_type' => 'woocommerce',
351 'title' => EmailLists::NEW_ACCOUNT,
352 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
353 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/thumbnail/style_02.png',
354 'demo-url' => 'https://wpmet.com/',
355 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wc-new-account/2/content.json' : ''
356 ],
357
358 'template-31' => [
359 'id' => 30,
360 'package' => 'pro',
361 'mail_type' => 'woocommerce',
362 'title' => EmailLists::NEW_ACCOUNT,
363 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
364 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/thumbnail/style_03.png',
365 'demo-url' => 'https://wpmet.com/',
366 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wc-new-account/3/content.json' : ''
367 ],
368
369 'template-32' => [
370 'id' => 31,
371 'package' => 'pro',
372 'mail_type' => 'woocommerce',
373 'title' => EmailLists::NEW_ACCOUNT,
374 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
375 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/thumbnail/style_04.png',
376 'demo-url' => 'https://wpmet.com/',
377 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wc-new-account/4/content.json' : ''
378 ],
379
380 'template-33' => [
381 'id' => 32,
382 'package' => 'pro',
383 'mail_type' => 'woocommerce',
384 'title' => EmailLists::NEW_ACCOUNT,
385 'template_title' => EmailLists::woocommerce_email(EmailLists::NEW_ACCOUNT),
386 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-new-account/thumbnail/style_05.png',
387 'demo-url' => 'https://wpmet.com/',
388 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wc-new-account/5/content.json' : ''
389 ],
390
391 ];
392 }
393
394 public static function get_reset_password_template(){
395
396 return [
397
398 'template-11' => [
399 'id' => 11,
400 'package' => 'free',
401 'mail_type' => 'woocommerce',
402 'title' => EmailLists::RESET_PASSWORD,
403 'template_title' => EmailLists::woocommerce_email(EmailLists::RESET_PASSWORD),
404 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wc-reset-password/1/preview-thumb.svg',
405 'demo-url' => 'https://wpmet.com/',
406 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/wc-reset-password/1/content.json'
407 ],
408
409 ];
410 }
411
412 public static function get_low_stock_template(){
413
414 return [
415 'template-12' => [
416 'id' => 12,
417 'package' => 'free',
418 'mail_type' => 'woocommerce',
419 'title' => EmailLists::LOW_STOCK,
420 'template_title' => EmailLists::woocommerce_email(EmailLists::LOW_STOCK),
421 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/low-stock/1/preview-thumb.svg',
422 'demo-url' => 'https://wpmet.com/',
423 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/low-stock/1/content.json'
424 ],
425
426 ];
427 }
428
429 public static function get_no_stock_template(){
430
431 return [
432 'template-13' => [
433 'id' => 13,
434 'package' => 'free',
435 'mail_type' => 'woocommerce',
436 'title' => EmailLists::NO_STOCK,
437 'template_title' => EmailLists::woocommerce_email(EmailLists::NO_STOCK),
438 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/no-stock/1/preview-thumb.svg',
439 'demo-url' => 'https://wpmet.com/',
440 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/no-stock/1/content.json'
441 ],
442
443 ];
444
445 }
446
447 public static function get_back_order_template(){
448
449 return [
450
451 'template-14' => [
452 'id' => 14,
453 'package' => 'free',
454 'mail_type' => 'woocommerce',
455 'title' => EmailLists::BACK_ORDER,
456 'template_title' => EmailLists::woocommerce_email(EmailLists::BACK_ORDER),
457 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/back-order/1/preview-thumb.svg',
458 'demo-url' => 'https://wpmet.com/',
459 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/back-order/1/content.json'
460 ],
461
462 ];
463 }
464
465 public static function get_partial_refund_template(){
466
467 return [
468
469 'template-18' => [
470 'id' => 17,
471 'package' => 'free',
472 'mail_type' => 'woocommerce',
473 'title' => EmailLists::PARTIAL_REFUND,
474 'template_title' => EmailLists::woocommerce_email(EmailLists::PARTIAL_REFUND),
475 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/partial-refund/1/preview-thumb.svg',
476 'demo-url' => 'https://wpmet.com/',
477 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/partial-refund/1/content.json'
478 ],
479
480 ];
481
482 }
483
484 public static function get_wp_new_register_template(){
485
486 return [
487
488 'template-15' => [
489 'id' => 16,
490 'package' => 'free',
491 'mail_type' => 'wordpress',
492 'title' => EmailLists::WP_NEW_REGISTER,
493 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
494 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/1/preview-thumb.svg',
495 'demo-url' => 'https://wpmet.com/',
496 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/wp-new-register/1/content.json' ,
497 ],
498
499 'template-34' => [
500 'id' => 33,
501 'package' => 'pro',
502 'mail_type' => 'wordpress',
503 'title' => EmailLists::WP_NEW_REGISTER,
504 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
505 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/thumbnail/style_01.png',
506 'demo-url' => 'https://wpmet.com/',
507 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wp-new-register/1/content.json' : ''
508 ],
509
510 'template-35' => [
511 'id' => 34,
512 'package' => 'pro',
513 'mail_type' => 'wordpress',
514 'title' => EmailLists::WP_NEW_REGISTER,
515 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
516 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/thumbnail/style_02.png',
517 'demo-url' => 'https://wpmet.com/',
518 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wp-new-register/2/content.json' : ''
519 ],
520
521 'template-36' => [
522 'id' => 35,
523 'package' => 'pro',
524 'mail_type' => 'wordpress',
525 'title' => EmailLists::WP_NEW_REGISTER,
526 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
527 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/thumbnail/style_03.png',
528 'demo-url' => 'https://wpmet.com/',
529 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wp-new-register/3/content.json' : ''
530 ],
531
532 'template-37' => [
533 'id' => 36,
534 'package' => 'pro',
535 'mail_type' => 'wordpress',
536 'title' => EmailLists::WP_NEW_REGISTER,
537 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
538 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/thumbnail/style_04.png',
539 'demo-url' => 'https://wpmet.com/',
540 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wp-new-register/4/content.json' : ''
541 ],
542
543 'template-38' => [
544 'id' => 37,
545 'package' => 'pro',
546 'mail_type' => 'wordpress',
547 'title' => EmailLists::WP_NEW_REGISTER,
548 'template_title' => EmailLists::wordpress_email(EmailLists::WP_NEW_REGISTER),
549 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-new-register/thumbnail/style_05.png',
550 'demo-url' => 'https://wpmet.com/',
551 'file' => is_plugin_active('emailkit-pro/emailkit-pro.php') ? self::EMAILKIT_TEMAPLTE_DIR_PRO . 'Templates/wp-new-register/5/content.json' : ''
552 ],
553
554 ];
555
556 }
557
558 public static function get_wp_reset_password_template(){
559
560 return [
561
562 'template-17' => [
563 'id' => 102,
564 'package' => 'free',
565 'mail_type' => 'wordpress',
566 'title' => EmailLists::WP_RESET_PASSWORD,
567 'template_title' => EmailLists::wordpress_email(EmailLists::WP_RESET_PASSWORD),
568 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/wp-reset-password/1/preview-thumb.svg',
569 'demo-url' => 'https://wpmet.com/',
570 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/wp-reset-password/1/content.json'
571 ],
572
573 ];
574 }
575
576 public static function metform_email_template() {
577 $templates = [];
578 $metform_forms = get_posts([
579 'post_type' => 'metform-form',
580 'post_status' => 'publish',
581 'numberposts' => -1,
582 'orderby' => 'title',
583 'order' => 'ASC',
584 ]);
585
586 // 3. Create a template entry for each form with consistent "Confirmation Mail To User" title
587 foreach ($metform_forms as $form) {
588 $form_id = $form->ID;
589 $form_key = 'metform_form_' . $form_id;
590
591 $templates[$form_key] = [
592 'id' => $form_id,
593 'package' => 'free',
594 'mail_type' => 'metform',
595 'title' => $form_key,
596 'template_title' => esc_html__('Confirmation Mail To User', 'emailkit'),
597 'preview-thumb' => self::EMAILKIT_URL_TEMAPLTE_URL . 'templates/metform/1/preview-thumb.svg',
598 'demo-url' => get_permalink($form_id),
599 'file' => self::EMAILKIT_URL_TEMAPLTE_DIR . 'templates/metform/1/content.json'
600 ];
601 }
602
603 return $templates;
604 }
605
606
607
608
609
610 public static function get(){
611
612 $email_types = [
613
614 'wordpress' => __('WordPress Email', 'emailkit'),
615 ];
616
617 // Include necessary WordPress files
618 // require_once ABSPATH . 'wp-admin/includes/plugin.php';
619 // require_once ABSPATH . 'wp-includes/class-wp.php'; // Adjust the path if necessary
620
621
622 if(is_plugin_active(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php')){
623 $email_types['woocommerce'] = __('Woocommerce email', 'emailkit');
624 }
625
626 return apply_filters('emailkit_email_types',$email_types);
627 }
628
629
630 /**
631 * Get template list by form type
632 *
633 * @param string $mail_type
634 * @return array
635 */
636 public function get_templates_by_mail_type( $mail_type ) {
637 $templates_list = [];
638
639 // array filter
640 $templates_list = array_filter( $this->get_templates(), function( $template ) use ( $mail_type ) {
641 if(isset($template['mail_type'])){
642 return $template['mail_type'] === $mail_type;
643 }
644
645 return true;
646 } );
647
648 return $templates_list;
649 }
650
651 public function get_template_contents($id){
652
653 if(!array_key_exists($id, $this->get_templates()) || !file_exists($this->get_templates()[$id]['file'])){
654 return null;
655 }
656
657 $template_file_url = self::abs_path_to_url($this->get_templates()[$id]['file']);
658 $content = wp_remote_get($template_file_url, ['sslverify' => false]);
659 $content = json_decode(wp_remote_retrieve_body($content));
660
661 return (!isset($content->content)) ? null : $content->content;
662 }
663
664 public static function abs_path_to_url( $path = '' ) {
665 $url = str_replace(
666 wp_normalize_path( untrailingslashit( ABSPATH ) ),
667 site_url(),
668 wp_normalize_path( $path )
669 );
670 return esc_url_raw( $url );
671 }
672
673 }