BlockRendererHelper.php
3 weeks ago
Checkbox.php
1 year ago
Close.php
2 weeks ago
Column.php
2 months ago
Columns.php
2 months ago
Date.php
1 year ago
Divider.php
3 years ago
Heading.php
2 months ago
Html.php
1 year ago
Image.php
10 months ago
Paragraph.php
3 weeks ago
Radio.php
1 year ago
Segment.php
2 months ago
Select.php
2 months ago
Submit.php
1 year ago
Text.php
1 year ago
Textarea.php
1 year ago
index.php
3 years ago
Html.php
44 lines
| 1 | <?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing |
| 2 | |
| 3 | namespace MailPoet\Form\Block; |
| 4 | |
| 5 | if (!defined('ABSPATH')) exit; |
| 6 | |
| 7 | |
| 8 | use MailPoet\WP\Functions as WPFunctions; |
| 9 | |
| 10 | class Html { |
| 11 | /** @var BlockRendererHelper */ |
| 12 | private $rendererHelper; |
| 13 | |
| 14 | private WPFunctions $wp; |
| 15 | |
| 16 | public function __construct( |
| 17 | BlockRendererHelper $rendererHelper, |
| 18 | WPFunctions $wp |
| 19 | ) { |
| 20 | $this->rendererHelper = $rendererHelper; |
| 21 | $this->wp = $wp; |
| 22 | } |
| 23 | |
| 24 | public function render(array $block, array $formSettings): string { |
| 25 | $html = ''; |
| 26 | $text = ''; |
| 27 | |
| 28 | if (isset($block['params']['text']) && $block['params']['text']) { |
| 29 | $text = html_entity_decode($block['params']['text'], ENT_QUOTES); |
| 30 | } |
| 31 | |
| 32 | if (isset($block['params']['nl2br']) && $block['params']['nl2br']) { |
| 33 | $text = nl2br($text); |
| 34 | } |
| 35 | |
| 36 | $classes = isset($block['params']['class_name']) ? " " . $block['params']['class_name'] : ''; |
| 37 | $html .= '<div class="mailpoet_paragraph' . $this->wp->escAttr($classes) . '" ' . $this->rendererHelper->renderFontStyle($formSettings) . '>'; |
| 38 | $html .= $this->wp->wpKsesPost($text); |
| 39 | $html .= '</div>'; |
| 40 | |
| 41 | return $html; |
| 42 | } |
| 43 | } |
| 44 |