Newsletter.php
90 lines
| 1 | <?php declare(strict_types = 1); |
| 2 | |
| 3 | namespace MailPoet\EmailEditor\Integrations\MailPoet\Templates\Library; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\WP\Functions as WPFunctions; |
| 9 | |
| 10 | class Newsletter { |
| 11 | private WPFunctions $wp; |
| 12 | |
| 13 | public function __construct( |
| 14 | WPFunctions $wp |
| 15 | ) { |
| 16 | $this->wp = $wp; |
| 17 | } |
| 18 | |
| 19 | public function getSlug(): string { |
| 20 | return 'newsletter'; |
| 21 | } |
| 22 | |
| 23 | public function getTitle(): string { |
| 24 | return __('Newsletter', 'mailpoet'); |
| 25 | } |
| 26 | |
| 27 | public function getDescription(): string { |
| 28 | return __('Newsletter', 'mailpoet'); |
| 29 | } |
| 30 | |
| 31 | public function getContent(): string { |
| 32 | // translators: This is a text used in a footer on an email <!--[mailpoet/site-title]--> will be replaced with the site title. |
| 33 | $footerText = __('You received this email because you are subscribed to the <!--[mailpoet/site-title]-->', 'mailpoet'); |
| 34 | $siteIdentityBlock = $this->getSiteIdentityBlock(); |
| 35 | return '<!-- wp:group {"backgroundColor":"white","layout":{"type":"constrained"},"lock":{"move":false,"remove":true}} --> |
| 36 | <div class="wp-block-group has-white-background-color has-background"> |
| 37 | <!-- wp:group {"style":{"spacing":{"padding":{"top":"var:preset|spacing|30","bottom":"var:preset|spacing|10","left":"var:preset|spacing|40","right":"var:preset|spacing|20"}}}} --> |
| 38 | <div |
| 39 | class="wp-block-group" |
| 40 | style=" |
| 41 | padding-top: var(--wp--preset--spacing--30); |
| 42 | padding-right: var(--wp--preset--spacing--20); |
| 43 | padding-bottom: var(--wp--preset--spacing--10); |
| 44 | padding-left: var(--wp--preset--spacing--40); |
| 45 | " |
| 46 | > |
| 47 | ' . $siteIdentityBlock . ' |
| 48 | </div> |
| 49 | <!-- /wp:group --> |
| 50 | <!-- wp:post-content {"lock":{"move":false,"remove":true},"layout":{"type":"default"}} /--> |
| 51 | <!-- wp:group {"style":{"spacing":{"padding":{"right":"var:preset|spacing|40","left":"var:preset|spacing|40","top":"var:preset|spacing|10","bottom":"var:preset|spacing|10"}}}} --> |
| 52 | <div |
| 53 | class="wp-block-group" |
| 54 | style=" |
| 55 | padding-top: var(--wp--preset--spacing--10); |
| 56 | padding-right: var(--wp--preset--spacing--40); |
| 57 | padding-bottom: var(--wp--preset--spacing--10); |
| 58 | padding-left: var(--wp--preset--spacing--40); |
| 59 | " |
| 60 | > |
| 61 | <!-- wp:paragraph {"align":"center","fontSize":"small","style":{"border":{"top":{"color":"var:preset|color|cyan-bluish-gray","width":"1px","style":"solid"},"right":{},"bottom":{},"left":{}},"spacing":{"padding":{"top":"var:preset|spacing|20","bottom":"var:preset|spacing|20"}},"color":{"text":"#787c82"},"elements":{"link":{"color":{"text":"#787c82"}}}}} --> |
| 62 | <p |
| 63 | class="has-text-align-center has-text-color has-link-color has-small-font-size" |
| 64 | style=" |
| 65 | border-top-color: var(--wp--preset--color--cyan-bluish-gray); |
| 66 | border-top-style: solid; |
| 67 | border-top-width: 1px; |
| 68 | color: #787c82; |
| 69 | padding-top: var(--wp--preset--spacing--20); |
| 70 | padding-bottom: var(--wp--preset--spacing--20); |
| 71 | " |
| 72 | >' . $footerText . '<br /><a data-link-href="[mailpoet/subscription-unsubscribe-url]" contenteditable="false" style="text-decoration: underline;" class="mailpoet-email-editor__personalization-tags-link">' . __('Unsubscribe', 'mailpoet') . '</a> | <a data-link-href="[mailpoet/subscription-manage-url]" contenteditable="false" style="text-decoration: underline;" class="mailpoet-email-editor__personalization-tags-link">' . __('Manage subscription', 'mailpoet') . '</a> |
| 73 | </p> |
| 74 | <!-- /wp:paragraph --> |
| 75 | </div> |
| 76 | <!-- /wp:group --> |
| 77 | <!-- wp:mailpoet/powered-by-mailpoet {"lock":{"move":true,"remove":true}} /--> |
| 78 | </div> |
| 79 | <!-- /wp:group -->'; |
| 80 | } |
| 81 | |
| 82 | private function getSiteIdentityBlock(): string { |
| 83 | if ($this->wp->hasCustomLogo()) { |
| 84 | return '<!-- wp:site-logo {"width":130,"isLink":false,"align":"center"} /-->'; |
| 85 | } |
| 86 | |
| 87 | return '<!-- wp:site-title {"level":2,"textAlign":"center","style":{"spacing":{"padding":{"top":"var:preset|spacing|10","bottom":"var:preset|spacing|10"}}}} /-->'; |
| 88 | } |
| 89 | } |
| 90 |