PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.6.9
EmailKit – Email Customizer for WooCommerce & WP v1.6.9
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.9, at includes/Admin/TemplateList.php

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