<?php namespace MailPoet\Newsletter\Renderer\Blocks; if (!defined('ABSPATH')) exit; use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper; use MailPoet\Newsletter\Renderer\StylesHelper; use MailPoet\Util\pQuery\pQuery; use MailPoetVendor\CSS; class Footer { public function render($element) { $element['text'] = preg_replace('/\n/', '<br />', $element['text']); $element['text'] = preg_replace('/(<\/?p.*?>)/i', '', $element['text']); $lineHeight = sprintf( '%spx', StylesHelper::$defaultLineHeight * (int)$element['styles']['text']['fontSize'] ); if (!is_string($element['text'])) { throw new \RuntimeException('$element[\'text\'] should be a string.'); } $dOMParser = new pQuery(); $DOM = $dOMParser->parseStr($element['text']); if (isset($element['styles']['link'])) { $links = $DOM->query('a'); if ($links->count()) { $css = new CSS(); foreach ($links as $link) { $elementLinkStyles = StylesHelper::getStyles($element['styles'], 'link'); $link->style = $css->mergeInlineStyles($elementLinkStyles, $link->style); } } } $backgroundColor = $element['styles']['block']['backgroundColor']; $backgroundColor = ($backgroundColor !== 'transparent') ? 'bgcolor="' . $backgroundColor . '"' : false; if (!$backgroundColor) unset($element['styles']['block']['backgroundColor']); $style = 'line-height: ' . $lineHeight . ';' . StylesHelper::getBlockStyles($element) . StylesHelper::getStyles($element['styles'], 'text'); $style = EHelper::escapeHtmlStyleAttr($style); $template = ' <tr> <td class="mailpoet_header_footer_padded mailpoet_footer" ' . $backgroundColor . ' style="' . $style . '"> ' . str_replace('&', '&', $DOM->html()) . ' </td> </tr>'; return $template; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
AbandonedCartContent.php | File | 2.25 KB | 0644 |
|
AutomatedLatestContentBlock.php | File | 2.12 KB | 0644 |
|
Button.php | File | 3.3 KB | 0644 |
|
Divider.php | File | 1.59 KB | 0644 |
|
Footer.php | File | 1.83 KB | 0644 |
|
Header.php | File | 1.83 KB | 0644 |
|
Image.php | File | 2.91 KB | 0644 |
|
Placeholder.php | File | 676 B | 0644 |
|
Renderer.php | File | 4 KB | 0644 |
|
Social.php | File | 1.37 KB | 0644 |
|
Spacer.php | File | 607 B | 0644 |
|
Text.php | File | 6.7 KB | 0644 |
|
index.php | File | 0 B | 0644 |
|