PluginProbe
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification / 5.6.1
Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification v5.6.1
5.6.2 5.6.3 5.6.1 5.6.0 5.5.0 5.4.0 5.3.2 5.3.1 5.1.6 5.1.5 trunk 2.1.5 2.11 2.12 2.13 2.15 3.0.0 3.0.1 3.0.2 3.0.3 3.0.5 3.0.51 3.0.60 3.0.61 3.0.62 All 38 releases
double-opt-in / src / EmailTemplates / EmailTemplatePresets.php

EmailTemplatePresets.php in Double Opt-In for Contact Form 7 – Secure, GDPR-Compliant Email Verification 5.6.1, at src/EmailTemplates/EmailTemplatePresets.php

724 lines 21.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Email Template Presets
4 *
5 * Provides predefined template presets based on the legacy HTML templates.
6 *
7 * @package Forge12\DoubleOptIn\EmailTemplates
8 * @since 4.0.0
9 */
10
11 namespace Forge12\DoubleOptIn\EmailTemplates;
12
13 if ( ! defined( 'ABSPATH' ) ) {
14 exit;
15 }
16
17 /**
18 * Class EmailTemplatePresets
19 *
20 * Contains predefined email template presets that users can choose as starting points.
21 */
22 class EmailTemplatePresets {
23
24 /**
25 * Get all available presets.
26 *
27 * @return array
28 */
29 public static function getAll(): array {
30 return array(
31 self::getBlankPreset(),
32 self::getDarkPreset(),
33 self::getYellowBlackPreset(),
34 self::getMinimalPreset(),
35 self::getOptOutPreset(),
36 );
37 }
38
39 /**
40 * Get a preset by ID.
41 *
42 * @param string $presetId Preset ID.
43 * @return array|null
44 */
45 public static function getById( string $presetId ): ?array {
46 $presets = self::getAll();
47 foreach ( $presets as $preset ) {
48 if ( $preset['id'] === $presetId ) {
49 return $preset;
50 }
51 }
52 return null;
53 }
54
55 /**
56 * Blank preset - empty template.
57 *
58 * @return array
59 */
60 private static function getBlankPreset(): array {
61 return array(
62 'id' => 'blank',
63 'name' => __( 'Blank Template', 'double-opt-in' ),
64 'description' => __( 'Start from scratch with an empty template.', 'double-opt-in' ),
65 'thumbnail' => 'blank',
66 'category' => 'basic',
67 'blocks' => array(),
68 'globalStyles' => array(
69 'fontFamily' => 'Arial, Helvetica, sans-serif',
70 'fontSize' => '16px',
71 'lineHeight' => '1.5',
72 'backgroundColor' => '#f4f4f4',
73 'contentWidth' => '600',
74 'primaryColor' => '#0073aa',
75 'textColor' => '#333333',
76 'linkColor' => '#0073aa',
77 ),
78 );
79 }
80
81 /**
82 * Dark theme preset (based on newsletter_en.html).
83 *
84 * @return array
85 */
86 private static function getDarkPreset(): array {
87 return array(
88 'id' => 'dark-professional',
89 'name' => __( 'Dark Professional', 'double-opt-in' ),
90 'description' => __( 'A professional dark-themed template with a red accent color.', 'double-opt-in' ),
91 'thumbnail' => 'dark-professional',
92 'category' => 'professional',
93 'blocks' => array(
94 // Email Wrapper
95 array(
96 'type' => 'email-wrapper',
97 'attributes' => array(
98 'backgroundColor' => '#2d2d31',
99 'padding' => '30px',
100 ),
101 'children' => array(
102 // Header Row (wrapping columns-2 inside a row)
103 array(
104 'type' => 'row',
105 'attributes' => array(
106 'backgroundColor' => '#2d2d31',
107 'padding' => '20px 0',
108 ),
109 'children' => array(
110 array(
111 'type' => 'columns-2',
112 'attributes' => array(
113 'backgroundColor' => 'transparent',
114 ),
115 'children' => array(
116 // Logo Column
117 array(
118 'type' => 'image',
119 'attributes' => array(
120 'src' => '',
121 'alt' => 'Logo',
122 'width' => '150',
123 'align' => 'left',
124 '_columnIndex' => 0,
125 ),
126 ),
127 // Navigation Link Column
128 array(
129 'type' => 'text',
130 'attributes' => array(
131 'content' => '<a href="#" style="color:#ffffff;text-decoration:underline;text-transform:uppercase;font-size:11px;">GO TO THE WEBSITE</a>',
132 'align' => 'right',
133 'color' => '#ffffff',
134 '_columnIndex' => 1,
135 ),
136 ),
137 ),
138 ),
139 ),
140 ),
141 // Spacer
142 array(
143 'type' => 'spacer',
144 'attributes' => array(
145 'height' => '20',
146 ),
147 ),
148 // Main Content Row
149 array(
150 'type' => 'row',
151 'attributes' => array(
152 'backgroundColor' => '#2d2d31',
153 'padding' => '30px',
154 ),
155 'children' => array(
156 // Heading
157 array(
158 'type' => 'heading',
159 'attributes' => array(
160 'content' => __( 'Please confirm your Registration', 'double-opt-in' ),
161 'level' => 'h2',
162 'align' => 'center',
163 'color' => '#f6f6f6',
164 ),
165 ),
166 // Spacer
167 array(
168 'type' => 'spacer',
169 'attributes' => array(
170 'height' => '20',
171 ),
172 ),
173 // Text Content
174 array(
175 'type' => 'text',
176 'attributes' => array(
177 'content' => __( 'Dear Mr./Mrs.,<br><br>This email address was just used ([doubleoptin_form_date], [doubleoptin_form_time]) to request our newsletter on [doubleoptin_form_url]. If you did not submit this request, please ignore this email and we apologize for disturbing you.<br><br>If you would like to receive our newsletter by email, please confirm your request by clicking on the link below. We will then add you to our newsletter mailing list. You can unsubscribe at any time in the future from our newsletter.<br><br>By clicking on this link, you confirm your registration for our newsletter.', 'double-opt-in' ),
178 'align' => 'left',
179 'color' => '#b6b6b6',
180 ),
181 ),
182 // Spacer
183 array(
184 'type' => 'spacer',
185 'attributes' => array(
186 'height' => '25',
187 ),
188 ),
189 // Confirm Button
190 array(
191 'type' => 'button',
192 'attributes' => array(
193 'text' => __( 'CONFIRM', 'double-opt-in' ),
194 'url' => '[doubleoptinlink]',
195 'backgroundColor' => '#ed5258',
196 'textColor' => '#ffffff',
197 'align' => 'center',
198 'borderRadius' => '0',
199 'padding' => '12px 24px',
200 ),
201 ),
202 // Spacer
203 array(
204 'type' => 'spacer',
205 'attributes' => array(
206 'height' => '25',
207 ),
208 ),
209 // Alternative Link Text
210 array(
211 'type' => 'text',
212 'attributes' => array(
213 'content' => __( 'If you have trouble clicking on the button above please copy the following link into your internet browser:<br>[doubleoptinlink]', 'double-opt-in' ),
214 'align' => 'left',
215 'color' => '#b6b6b6',
216 'fontSize' => '14px',
217 ),
218 ),
219 // Spacer
220 array(
221 'type' => 'spacer',
222 'attributes' => array(
223 'height' => '20',
224 ),
225 ),
226 // Closing Text
227 array(
228 'type' => 'text',
229 'attributes' => array(
230 'content' => __( 'Thank you for registering.<br>Kind regards,<br>Your Newsletter Team', 'double-opt-in' ),
231 'align' => 'left',
232 'color' => '#b6b6b6',
233 ),
234 ),
235 ),
236 ),
237 // Footer Divider
238 array(
239 'type' => 'spacer',
240 'attributes' => array(
241 'height' => '60',
242 'backgroundColor' => '#ed5258',
243 ),
244 ),
245 // Footer
246 array(
247 'type' => 'footer',
248 'attributes' => array(
249 'content' => __( 'Copyright &copy; 2024 Your Company Name', 'double-opt-in' ),
250 'backgroundColor' => '#ed5258',
251 'textColor' => '#ffffff',
252 'padding' => '20px',
253 'align' => 'center',
254 ),
255 ),
256 ),
257 ),
258 ),
259 'globalStyles' => array(
260 'fontFamily' => 'Arial, Helvetica, sans-serif',
261 'fontSize' => '14px',
262 'lineHeight' => '1.5',
263 'backgroundColor' => '#ffffff',
264 'contentWidth' => '650',
265 'primaryColor' => '#ed5258',
266 'textColor' => '#b6b6b6',
267 'linkColor' => '#ffffff',
268 ),
269 );
270 }
271
272 /**
273 * Yellow/Black theme preset (based on newsletter_en_2.html).
274 *
275 * @return array
276 */
277 private static function getYellowBlackPreset(): array {
278 return array(
279 'id' => 'yellow-bold',
280 'name' => __( 'Yellow Bold', 'double-opt-in' ),
281 'description' => __( 'A bold design with yellow accents on a dark background.', 'double-opt-in' ),
282 'thumbnail' => 'yellow-bold',
283 'category' => 'creative',
284 'blocks' => array(
285 // Email Wrapper
286 array(
287 'type' => 'email-wrapper',
288 'attributes' => array(
289 'backgroundColor' => '#1f1e23',
290 'padding' => '40px 0',
291 ),
292 'children' => array(
293 // Top Bar
294 array(
295 'type' => 'row',
296 'attributes' => array(
297 'backgroundColor' => '#373737',
298 'padding' => '15px 30px',
299 ),
300 'children' => array(
301 array(
302 'type' => 'columns-2',
303 'attributes' => array(),
304 'children' => array(
305 array(
306 'type' => 'text',
307 'attributes' => array(
308 'content' => __( 'Welcome to Company Name', 'double-opt-in' ),
309 'color' => '#ffffff',
310 'fontSize' => '11px',
311 'align' => 'left',
312 '_columnIndex' => 0,
313 ),
314 ),
315 array(
316 'type' => 'text',
317 'attributes' => array(
318 'content' => '<a href="#" style="color:#fff;text-decoration:underline;text-transform:uppercase;font-size:11px;">GO TO WEBSITE</a>',
319 'align' => 'right',
320 '_columnIndex' => 1,
321 ),
322 ),
323 ),
324 ),
325 ),
326 ),
327 // Logo Section
328 array(
329 'type' => 'row',
330 'attributes' => array(
331 'backgroundColor' => '#f6de17',
332 'padding' => '30px',
333 ),
334 'children' => array(
335 array(
336 'type' => 'image',
337 'attributes' => array(
338 'src' => '',
339 'alt' => 'Logo',
340 'width' => '200',
341 'align' => 'left',
342 ),
343 ),
344 ),
345 ),
346 // Main Content
347 array(
348 'type' => 'row',
349 'attributes' => array(
350 'backgroundColor' => '#f6de17',
351 'padding' => '30px',
352 ),
353 'children' => array(
354 array(
355 'type' => 'heading',
356 'attributes' => array(
357 'content' => __( 'Please confirm your Registration', 'double-opt-in' ),
358 'level' => 'h2',
359 'align' => 'center',
360 'color' => '#26252a',
361 ),
362 ),
363 array(
364 'type' => 'spacer',
365 'attributes' => array(
366 'height' => '25',
367 ),
368 ),
369 array(
370 'type' => 'text',
371 'attributes' => array(
372 'content' => __( 'Dear Mr./Mrs.,<br><br>This email address was just used ([doubleoptin_form_date], [doubleoptin_form_time]) to request our newsletter on [doubleoptin_form_url]. If you did not submit this request, please ignore this email and we apologize for disturbing you.<br><br>If you would like to receive our newsletter by email, please confirm your request by clicking on the link below. We will then add you to our newsletter mailing list. You can unsubscribe at any time in the future from our newsletter.<br><br>By clicking on this link, you confirm your registration for our newsletter.', 'double-opt-in' ),
373 'align' => 'center',
374 'color' => '#26252a',
375 ),
376 ),
377 array(
378 'type' => 'spacer',
379 'attributes' => array(
380 'height' => '22',
381 ),
382 ),
383 array(
384 'type' => 'button',
385 'attributes' => array(
386 'text' => __( 'CONFIRM', 'double-opt-in' ),
387 'url' => '[doubleoptinlink]',
388 'backgroundColor' => '#2e2d33',
389 'textColor' => '#f6de17',
390 'align' => 'center',
391 'borderRadius' => '0',
392 'padding' => '12px 24px',
393 ),
394 ),
395 array(
396 'type' => 'spacer',
397 'attributes' => array(
398 'height' => '20',
399 ),
400 ),
401 array(
402 'type' => 'text',
403 'attributes' => array(
404 'content' => __( 'If you have trouble clicking on the button above please copy the following link into your internet browser:<br>[doubleoptinlink]', 'double-opt-in' ),
405 'align' => 'center',
406 'color' => '#26252a',
407 'fontSize' => '14px',
408 ),
409 ),
410 ),
411 ),
412 // Spacer
413 array(
414 'type' => 'spacer',
415 'attributes' => array(
416 'height' => '22',
417 'backgroundColor' => '#f6de17',
418 ),
419 ),
420 // Footer Logo
421 array(
422 'type' => 'row',
423 'attributes' => array(
424 'backgroundColor' => '#373737',
425 'padding' => '40px 30px',
426 ),
427 'children' => array(
428 array(
429 'type' => 'image',
430 'attributes' => array(
431 'src' => '',
432 'alt' => 'Logo',
433 'width' => '150',
434 'align' => 'center',
435 ),
436 ),
437 ),
438 ),
439 // Footer Text
440 array(
441 'type' => 'footer',
442 'attributes' => array(
443 'content' => __( 'Copyright &copy; 2024 Company Name', 'double-opt-in' ),
444 'backgroundColor' => '#373737',
445 'textColor' => '#ffffff',
446 'padding' => '15px 30px 40px',
447 'align' => 'center',
448 ),
449 ),
450 ),
451 ),
452 ),
453 'globalStyles' => array(
454 'fontFamily' => 'Arial, Helvetica, sans-serif',
455 'fontSize' => '14px',
456 'lineHeight' => '1.75',
457 'backgroundColor' => '#1f1e23',
458 'contentWidth' => '650',
459 'primaryColor' => '#f6de17',
460 'textColor' => '#26252a',
461 'linkColor' => '#ffffff',
462 ),
463 );
464 }
465
466 /**
467 * Minimal/Clean theme preset (based on newsletter_en_3.html).
468 *
469 * @return array
470 */
471 private static function getMinimalPreset(): array {
472 return array(
473 'id' => 'minimal-clean',
474 'name' => __( 'Minimal Clean', 'double-opt-in' ),
475 'description' => __( 'A clean, minimal design with a blue accent - perfect for professional communications.', 'double-opt-in' ),
476 'thumbnail' => 'minimal-clean',
477 'category' => 'minimal',
478 'blocks' => array(
479 // Email Wrapper
480 array(
481 'type' => 'email-wrapper',
482 'attributes' => array(
483 'backgroundColor' => '#f6f6f6',
484 'padding' => '10px',
485 ),
486 'children' => array(
487 // Main Content Box
488 array(
489 'type' => 'row',
490 'attributes' => array(
491 'backgroundColor' => '#ffffff',
492 'padding' => '20px',
493 'borderRadius' => '3',
494 ),
495 'children' => array(
496 // Text Content
497 array(
498 'type' => 'text',
499 'attributes' => array(
500 'content' => __( 'Dear Mr./Mrs.,<br><br>This email address was just used ([doubleoptin_form_date], [doubleoptin_form_time]) to request our newsletter on [doubleoptin_form_url]. If you did not submit this request, please ignore this email and we apologize for disturbing you.<br><br>If you would like to receive our newsletter by email, please confirm your request by clicking on the link below. We will then add you to our newsletter mailing list. You can unsubscribe at any time in the future from our newsletter.<br><br>By clicking on this link, you confirm your registration for our newsletter.', 'double-opt-in' ),
501 'align' => 'left',
502 'color' => '#333333',
503 ),
504 ),
505 // Spacer
506 array(
507 'type' => 'spacer',
508 'attributes' => array(
509 'height' => '15',
510 ),
511 ),
512 // Confirm Button
513 array(
514 'type' => 'button',
515 'attributes' => array(
516 'text' => __( 'CONFIRM', 'double-opt-in' ),
517 'url' => '[doubleoptinlink]',
518 'backgroundColor' => '#3498db',
519 'textColor' => '#ffffff',
520 'align' => 'left',
521 'borderRadius' => '5',
522 'padding' => '12px 25px',
523 ),
524 ),
525 // Spacer
526 array(
527 'type' => 'spacer',
528 'attributes' => array(
529 'height' => '15',
530 ),
531 ),
532 // Alternative Link
533 array(
534 'type' => 'text',
535 'attributes' => array(
536 'content' => __( 'If you have trouble clicking on the button above please copy the following link into your internet browser:<br>[doubleoptinlink]', 'double-opt-in' ),
537 'align' => 'left',
538 'color' => '#333333',
539 'fontSize' => '14px',
540 ),
541 ),
542 // Spacer
543 array(
544 'type' => 'spacer',
545 'attributes' => array(
546 'height' => '15',
547 ),
548 ),
549 // Closing
550 array(
551 'type' => 'text',
552 'attributes' => array(
553 'content' => __( 'Thank you for registering.<br>Kind regards,<br>Your Newsletter Team.', 'double-opt-in' ),
554 'align' => 'left',
555 'color' => '#333333',
556 ),
557 ),
558 ),
559 ),
560 // Spacer before footer
561 array(
562 'type' => 'spacer',
563 'attributes' => array(
564 'height' => '10',
565 ),
566 ),
567 // Footer
568 array(
569 'type' => 'footer',
570 'attributes' => array(
571 'content' => __( 'Maxmuster Company, Musterstreet 123, Mustercity 71337', 'double-opt-in' ),
572 'backgroundColor' => 'transparent',
573 'textColor' => '#999999',
574 'padding' => '10px',
575 'align' => 'center',
576 'fontSize' => '12px',
577 ),
578 ),
579 ),
580 ),
581 ),
582 'globalStyles' => array(
583 'fontFamily' => 'Arial, Helvetica, sans-serif',
584 'fontSize' => '14px',
585 'lineHeight' => '1.5',
586 'backgroundColor' => '#f6f6f6',
587 'contentWidth' => '580',
588 'primaryColor' => '#3498db',
589 'textColor' => '#333333',
590 'linkColor' => '#3498db',
591 ),
592 );
593 }
594
595 /**
596 * Opt-Out confirmation email preset.
597 *
598 * @return array
599 */
600 private static function getOptOutPreset(): array {
601 return array(
602 'id' => 'opt-out-confirmation',
603 'name' => __( 'Opt-Out Confirmation', 'double-opt-in' ),
604 'description' => __( 'A clean template for opt-out confirmation emails with a link to the opt-out settings page.', 'double-opt-in' ),
605 'thumbnail' => 'minimal-clean',
606 'category' => 'opt-out',
607 'blocks' => array(
608 // Email Wrapper
609 array(
610 'type' => 'email-wrapper',
611 'attributes' => array(
612 'backgroundColor' => '#f6f6f6',
613 'padding' => '10px',
614 ),
615 'children' => array(
616 // Main Content Box
617 array(
618 'type' => 'row',
619 'attributes' => array(
620 'backgroundColor' => '#ffffff',
621 'padding' => '20px',
622 'borderRadius' => '3',
623 ),
624 'children' => array(
625 // Text Content
626 array(
627 'type' => 'text',
628 'attributes' => array(
629 'content' => __( 'Dear Mr./Mrs.,<br><br>This email address was just used to request access to the opt-out page on <a href="[doubleoptin_optout_url]">[doubleoptin_optout_url]</a>. If you did not submit this request, please ignore this email and we apologize for disturbing you.', 'double-opt-in' ),
630 'align' => 'left',
631 'color' => '#333333',
632 ),
633 ),
634 // Spacer
635 array(
636 'type' => 'spacer',
637 'attributes' => array(
638 'height' => '15',
639 ),
640 ),
641 // Opt-Out Button
642 array(
643 'type' => 'button',
644 'attributes' => array(
645 'text' => __( 'OPT-OUT SETTINGS', 'double-opt-in' ),
646 'url' => '[doubleoptin_optout_url]',
647 'backgroundColor' => '#3498db',
648 'textColor' => '#ffffff',
649 'align' => 'left',
650 'borderRadius' => '5',
651 'padding' => '12px 25px',
652 ),
653 ),
654 // Spacer
655 array(
656 'type' => 'spacer',
657 'attributes' => array(
658 'height' => '15',
659 ),
660 ),
661 // Alternative Link
662 array(
663 'type' => 'text',
664 'attributes' => array(
665 'content' => __( 'If you have trouble clicking on the button above please copy the following link into your internet browser:<br><a href="[doubleoptin_optout_url]">[doubleoptin_optout_url]</a>', 'double-opt-in' ),
666 'align' => 'left',
667 'color' => '#333333',
668 'fontSize' => '14px',
669 ),
670 ),
671 // Spacer
672 array(
673 'type' => 'spacer',
674 'attributes' => array(
675 'height' => '15',
676 ),
677 ),
678 // Closing
679 array(
680 'type' => 'text',
681 'attributes' => array(
682 'content' => __( 'Thank you.<br>Kind regards,<br>Your Newsletter Team.', 'double-opt-in' ),
683 'align' => 'left',
684 'color' => '#333333',
685 ),
686 ),
687 ),
688 ),
689 // Spacer before footer
690 array(
691 'type' => 'spacer',
692 'attributes' => array(
693 'height' => '10',
694 ),
695 ),
696 // Footer
697 array(
698 'type' => 'footer',
699 'attributes' => array(
700 'content' => __( 'Maxmuster Company, Musterstreet 123, Mustercity 71337', 'double-opt-in' ),
701 'backgroundColor' => 'transparent',
702 'textColor' => '#999999',
703 'padding' => '10px',
704 'align' => 'center',
705 'fontSize' => '12px',
706 ),
707 ),
708 ),
709 ),
710 ),
711 'globalStyles' => array(
712 'fontFamily' => 'Arial, Helvetica, sans-serif',
713 'fontSize' => '14px',
714 'lineHeight' => '1.5',
715 'backgroundColor' => '#f6f6f6',
716 'contentWidth' => '580',
717 'primaryColor' => '#3498db',
718 'textColor' => '#333333',
719 'linkColor' => '#3498db',
720 ),
721 );
722 }
723 }
724