AbandonedCartContent.php
1 year ago
AutomatedLatestContentBlock.php
3 years ago
Button.php
1 year ago
Coupon.php
3 years ago
Divider.php
2 years ago
DynamicProductsBlock.php
11 months ago
Footer.php
2 months ago
Header.php
2 months ago
Image.php
3 years ago
Placeholder.php
4 years ago
Renderer.php
2 months ago
Social.php
2 months ago
Spacer.php
3 years ago
Text.php
2 months ago
index.php
3 years ago
Divider.php
43 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Newsletter\Renderer\Blocks; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper; |
| 9 | use MailPoet\Newsletter\Renderer\StylesHelper; |
| 10 | |
| 11 | class Divider { |
| 12 | public function render($element) { |
| 13 | $backgroundColor = $element['styles']['block']['backgroundColor']; |
| 14 | $dividerCellStyle = "border-top-width: {$element['styles']['block']['borderWidth']};"; |
| 15 | $dividerCellStyle .= "border-top-style: {$element['styles']['block']['borderStyle']};"; |
| 16 | $dividerCellStyle .= "border-top-color: {$element['styles']['block']['borderColor']};"; |
| 17 | $template = ' |
| 18 | <tr> |
| 19 | <td class="mailpoet_divider" valign="top" ' . |
| 20 | (($element['styles']['block']['backgroundColor'] !== 'transparent') ? |
| 21 | 'bgColor="' . EHelper::escapeHtmlAttr($backgroundColor) . '" style="background-color:' . EHelper::escapeHtmlStyleAttr($backgroundColor) . ';' : |
| 22 | 'style="' |
| 23 | ) . |
| 24 | sprintf( |
| 25 | 'padding: %s %spx %s %spx;', |
| 26 | EHelper::escapeHtmlStyleAttr($element['styles']['block']['padding']), |
| 27 | StylesHelper::$paddingWidth, |
| 28 | EHelper::escapeHtmlStyleAttr($element['styles']['block']['padding']), |
| 29 | StylesHelper::$paddingWidth |
| 30 | ) . '"> |
| 31 | <table width="100%" border="0" cellpadding="0" cellspacing="0" |
| 32 | style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0;"> |
| 33 | <tr> |
| 34 | <td class="mailpoet_divider-cell" style="' . EHelper::escapeHtmlStyleAttr($dividerCellStyle) . '"> |
| 35 | </td> |
| 36 | </tr> |
| 37 | </table> |
| 38 | </td> |
| 39 | </tr>'; |
| 40 | return $template; |
| 41 | } |
| 42 | } |
| 43 |