REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 4.26 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Newsletter/Renderer/Blocks/Renderer.php
Text
Base64
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Newsletter\Renderer\Blocks; if (!defined('ABSPATH')) exit; use MailPoet\Entities\NewsletterEntity; use MailPoet\Newsletter\Renderer\Columns\ColumnsHelper; use MailPoet\Newsletter\Renderer\StylesHelper; class Renderer { /** @var AutomatedLatestContentBlock */ private $ALC; /** @var Button */ private $button; /** @var Divider */ private $divider; /** @var Footer */ private $footer; /** @var Header */ private $header; /** @var Image */ private $image; /** @var Social */ private $social; /** @var Spacer */ private $spacer; /** @var Text */ private $text; /** @var Placeholder */ private $placeholder; /** @var Coupon */ private $coupon; public function __construct( AutomatedLatestContentBlock $ALC, Button $button, Divider $divider, Footer $footer, Header $header, Image $image, Social $social, Spacer $spacer, Text $text, Placeholder $placeholder, Coupon $coupon ) { $this->ALC = $ALC; $this->button = $button; $this->divider = $divider; $this->footer = $footer; $this->header = $header; $this->image = $image; $this->social = $social; $this->spacer = $spacer; $this->text = $text; $this->placeholder = $placeholder; $this->coupon = $coupon; } public function render(NewsletterEntity $newsletter, $data) { if (is_null($data['blocks']) && isset($data['type'])) { return null; } $columnCount = count($data['blocks']); $columnsLayout = isset($data['columnLayout']) ? $data['columnLayout'] : null; $columnWidths = ColumnsHelper::columnWidth($columnCount, $columnsLayout); $columnContent = []; foreach ($data['blocks'] as $index => $columnBlocks) { $renderedBlockElement = $this->renderBlocksInColumn($newsletter, $columnBlocks, $columnWidths[$index]); $columnContent[] = $renderedBlockElement; } return $columnContent; } private function renderBlocksInColumn(NewsletterEntity $newsletter, $block, $columnBaseWidth) { $blockContent = ''; $_this = $this; array_map(function($block) use (&$blockContent, $columnBaseWidth, $newsletter, $_this) { $renderedBlockElement = $_this->createElementFromBlockType($newsletter, $block, $columnBaseWidth); if (isset($block['blocks'])) { $renderedBlockElement = $_this->renderBlocksInColumn($newsletter, $block, $columnBaseWidth); // nested vertical column container is rendered as an array if (is_array($renderedBlockElement)) { $renderedBlockElement = implode('', $renderedBlockElement); } } $blockContent .= $renderedBlockElement; }, $block['blocks']); return $blockContent; } public function createElementFromBlockType(NewsletterEntity $newsletter, $block, $columnBaseWidth) { if ($block['type'] === 'automatedLatestContent') { return $this->processAutomatedLatestContent($newsletter, $block, $columnBaseWidth); } $block = StylesHelper::applyTextAlignment($block); switch ($block['type']) { case 'button': return $this->button->render($block, $columnBaseWidth); case 'divider': return $this->divider->render($block); case 'footer': return $this->footer->render($block); case 'header': return $this->header->render($block); case 'image': return $this->image->render($block, $columnBaseWidth); case 'social': return $this->social->render($block); case 'spacer': return $this->spacer->render($block); case 'text': return $this->text->render($block); case 'placeholder': return $this->placeholder->render($block); case Coupon::TYPE: return $this->coupon->render($block, $columnBaseWidth); } return "<!-- Skipped unsupported block type: {$block['type']} -->"; } public function processAutomatedLatestContent(NewsletterEntity $newsletter, $args, $columnBaseWidth) { $transformedPosts = [ 'blocks' => $this->ALC->render($newsletter, $args), ]; $transformedPosts = StylesHelper::applyTextAlignment($transformedPosts); return $this->renderBlocksInColumn($newsletter, $transformedPosts, $columnBaseWidth); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 14
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AbandonedCartContent.php
2.34 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AutomatedLatestContentBlock.php
2.39 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Button.php
3.40 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Coupon.php
4.13 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Divider.php
1.69 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Footer.php
1.92 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Header.php
1.92 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Image.php
3.01 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
index.php
0 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Placeholder.php
676 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Renderer.php
4.26 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Social.php
1.46 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Spacer.php
701 B
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Text.php
6.83 KB
lrw-r--r--
2023-04-04 05:35:40
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).