mailpoet
/
lib
/
EmailEditor
/
Integrations
/
MailPoet
/
Patterns
/
Library
/
BirthdayEmailPattern.php
AbandonedCartPattern.php
4 months ago
AbandonedCartReminderPattern.php
1 month ago
AbandonedCartWithDiscountPattern.php
1 month ago
AbstractAbandonedCartPattern.php
5 months ago
AskForReviewPostPurchasePattern.php
1 month ago
BirthdayEmailPattern.php
1 month ago
BookingAutomationEmailPattern.php
1 month ago
CategoryPurchaseFollowUpPattern.php
1 month ago
EducationalCampaignPattern.php
1 month ago
EventInvitationPattern.php
3 months ago
FirstPurchaseThankYouPattern.php
1 month ago
NewArrivalsAnnouncementPattern.php
3 months ago
NewProductsAnnouncementPattern.php
3 months ago
NewsletterPattern.php
4 months ago
PostPurchaseThankYouPattern.php
1 month ago
ProductPurchaseFollowUpPattern.php
1 month ago
ProductRestockNotificationPattern.php
5 months ago
SaleAnnouncementPattern.php
3 months ago
SubscriptionAutomationEmailPattern.php
1 month ago
TagPurchaseFollowUpPattern.php
1 month ago
WelcomeEmailPattern.php
1 month ago
WelcomeWithDiscountEmailPattern.php
1 month ago
WinBackCustomerPattern.php
1 month ago
index.php
1 year ago
BirthdayEmailPattern.php
110 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\EmailEditor\Integrations\MailPoet\Patterns\Library; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\EmailEditor\Integrations\MailPoet\EmailEditor; |
| 9 | use MailPoet\EmailEditor\Integrations\MailPoet\Patterns\Pattern; |
| 10 | use MailPoet\Util\CdnAssetUrl; |
| 11 | |
| 12 | /** |
| 13 | * Birthday email pattern. |
| 14 | */ |
| 15 | class BirthdayEmailPattern extends Pattern { |
| 16 | protected $name = 'birthday-email-content'; |
| 17 | protected $block_types = ['core/post-content']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 18 | protected $template_types = ['email-template']; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 19 | protected $categories = ['celebrations']; |
| 20 | protected $post_types = [EmailEditor::MAILPOET_EMAIL_POST_TYPE]; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps |
| 21 | |
| 22 | /** @var bool */ |
| 23 | private $withDiscount; |
| 24 | |
| 25 | public function __construct( |
| 26 | CdnAssetUrl $cdnAssetUrl, |
| 27 | bool $withDiscount = false |
| 28 | ) { |
| 29 | parent::__construct($cdnAssetUrl); |
| 30 | $this->withDiscount = $withDiscount; |
| 31 | |
| 32 | if ($withDiscount) { |
| 33 | $this->name = 'birthday-email-with-discount'; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Get pattern content. |
| 39 | * |
| 40 | * @return string Pattern HTML content. |
| 41 | */ |
| 42 | protected function get_content(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 43 | if ($this->withDiscount) { |
| 44 | return $this->getDiscountContent(); |
| 45 | } |
| 46 | |
| 47 | return ' |
| 48 | <!-- wp:group {"style":{"spacing":{"padding":{"right":"var:preset|spacing|40","left":"var:preset|spacing|40"}}},"layout":{"type":"constrained"}} --> |
| 49 | <div class="wp-block-group" style="padding-right:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"> |
| 50 | <!-- wp:heading {"textAlign":"center","level":1} --> |
| 51 | <h1 class="wp-block-heading has-text-align-center">' . __('Happy birthday!', 'mailpoet') . '</h1> |
| 52 | <!-- /wp:heading --> |
| 53 | |
| 54 | <!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"18px"},"spacing":{"padding":{"top":"0","bottom":"var:preset|spacing|30"}}}} --> |
| 55 | <p class="has-text-align-center" style="padding-top:0;padding-bottom:var(--wp--preset--spacing--30);font-size:18px">' . __('Wishing you a day filled with good things.', 'mailpoet') . '</p> |
| 56 | <!-- /wp:paragraph --> |
| 57 | |
| 58 | <!-- wp:paragraph {"style":{"typography":{"fontSize":"16px"},"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|30"}}}} --> |
| 59 | <p style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--30);font-size:16px">' . __('We’re glad you’re part of our community. Here’s to another year of moments worth celebrating.', 'mailpoet') . '</p> |
| 60 | <!-- /wp:paragraph --> |
| 61 | </div> |
| 62 | <!-- /wp:group --> |
| 63 | '; |
| 64 | } |
| 65 | |
| 66 | private function getDiscountContent(): string { |
| 67 | return ' |
| 68 | <!-- wp:group {"style":{"spacing":{"padding":{"right":"var:preset|spacing|40","left":"var:preset|spacing|40"}}},"layout":{"type":"constrained"}} --> |
| 69 | <div class="wp-block-group" style="padding-right:var(--wp--preset--spacing--40);padding-left:var(--wp--preset--spacing--40)"> |
| 70 | <!-- wp:heading {"textAlign":"center","level":1} --> |
| 71 | <h1 class="wp-block-heading has-text-align-center">' . __('Happy birthday - here’s 10% off', 'mailpoet') . '</h1> |
| 72 | <!-- /wp:heading --> |
| 73 | |
| 74 | <!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"18px"},"spacing":{"padding":{"top":"0","bottom":"var:preset|spacing|30"}}}} --> |
| 75 | <p class="has-text-align-center" style="padding-top:0;padding-bottom:var(--wp--preset--spacing--30);font-size:18px">' . __('A little birthday treat for your next order.', 'mailpoet') . '</p> |
| 76 | <!-- /wp:paragraph --> |
| 77 | |
| 78 | <!-- wp:paragraph {"style":{"typography":{"fontSize":"16px"},"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|20"}}}} --> |
| 79 | <p style="padding-top:var(--wp--preset--spacing--30);padding-bottom:var(--wp--preset--spacing--20);font-size:16px">' . __('We’re wishing you a wonderful day. Use this code for 10% off your next order:', 'mailpoet') . '</p> |
| 80 | <!-- /wp:paragraph --> |
| 81 | |
| 82 | ' . $this->getGeneratedCouponBlock('center', 10, 10) . ' |
| 83 | |
| 84 | <!-- wp:paragraph {"align":"center","style":{"typography":{"fontSize":"14px"},"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|30"}}}} --> |
| 85 | <p class="has-text-align-center" style="padding-top:var(--wp--preset--spacing--20);padding-bottom:var(--wp--preset--spacing--30);font-size:14px">' . __('Valid for the next 10 days.', 'mailpoet') . '</p> |
| 86 | <!-- /wp:paragraph --> |
| 87 | |
| 88 | <!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} --> |
| 89 | <div class="wp-block-buttons"> |
| 90 | <!-- wp:button {"style":{"typography":{"fontSize":"16px"},"spacing":{"padding":{"top":"var:preset|spacing|10","bottom":"var:preset|spacing|10","left":"var:preset|spacing|20","right":"var:preset|spacing|20"}}}} --> |
| 91 | <div class="wp-block-button"><a class="wp-block-button__link has-custom-font-size wp-element-button" style="padding-top:var(--wp--preset--spacing--10);padding-bottom:var(--wp--preset--spacing--10);padding-left:var(--wp--preset--spacing--20);padding-right:var(--wp--preset--spacing--20);font-size:16px" href="[mailpoet/site-homepage-url]">' . __('Shop birthday picks', 'mailpoet') . '</a></div> |
| 92 | <!-- /wp:button --> |
| 93 | </div> |
| 94 | <!-- /wp:buttons --> |
| 95 | </div> |
| 96 | <!-- /wp:group --> |
| 97 | '; |
| 98 | } |
| 99 | |
| 100 | protected function get_title(): string { // phpcs:ignore PSR1.Methods.CamelCapsMethodName.NotCamelCaps |
| 101 | if ($this->withDiscount) { |
| 102 | /* translators: Name of a content pattern used as starting content of an email */ |
| 103 | return __('Birthday Email with Discount', 'mailpoet'); |
| 104 | } |
| 105 | |
| 106 | /* translators: Name of a content pattern used as starting content of an email */ |
| 107 | return __('Birthday Email', 'mailpoet'); |
| 108 | } |
| 109 | } |
| 110 |