REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.99 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Form/Block/Heading.php
Text
Base64
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Form\Block; if (!defined('ABSPATH')) exit; use MailPoet\WP\Functions as WPFunctions; class Heading { /** @var WPFunctions */ private $wp; public function __construct( WPFunctions $wp ) { $this->wp = $wp; } public function render(array $block): string { $content = ($block['params']['content'] ?? ''); return $this->wrapContent($content, $block); } private function wrapContent(string $content, array $block): string { $tag = $this->renderTag($block); $attributes = $this->renderAttributes($block); $openTag = $this->getOpenTag($tag, $attributes); return $openTag . $content . "</$tag>"; } private function renderTag(array $block): string { $tag = 'h2'; if (isset($block['params']['level'])) { $tag = 'h' . $block['params']['level']; } return $tag; } private function renderAttributes(array $block): array { $result = []; $classes = $this->renderClass($block); if ($classes) { $result[] = $classes; } if (!empty($block['params']['anchor'])) { $result[] = $this->renderAnchor($block); } $styles = $this->renderStyle($block); if ($styles) { $result[] = $styles; } return $result; } private function getOpenTag(string $tag, array $attributes): string { if (empty($attributes)) { return "<$tag>"; } return "<$tag " . join(' ', $attributes) . ">"; } private function renderClass(array $block): string { $classes = ['mailpoet-heading']; if (isset($block['params']['class_name'])) { $classes[] = $block['params']['class_name']; } if (!empty($block['params']['background_color'])) { $classes[] = 'mailpoet-has-background-color'; } if (!empty($block['params']['font_size'])) { $classes[] = 'mailpoet-has-font-size'; } return 'class="' . $this->wp->escAttr(join(' ', $classes)) . '"'; } private function renderAnchor(array $block): string { return 'id="' . $block['params']['anchor'] . '"'; } private function renderStyle(array $block): string { $styles = []; if (!empty($block['params']['align'])) { $styles[] = 'text-align: ' . $block['params']['align']; } if (!empty($block['params']['text_color'])) { $styles[] = 'color: ' . $block['params']['text_color']; } if (!empty($block['params']['font_size'])) { $styles[] = 'font-size: ' . $block['params']['font_size'] . (is_numeric($block['params']['font_size']) ? 'px' : ''); } if (!empty($block['params']['line_height'])) { $styles[] = 'line-height: ' . $block['params']['line_height']; } if (!empty($block['params']['background_color'])) { $styles[] = 'background-color: ' . $block['params']['background_color']; } if (empty($styles)) { return ''; } return 'style="' . $this->wp->escAttr(join('; ', $styles)) . '"'; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 17
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
BlockRendererHelper.php
9.24 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
Checkbox.php
2.25 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
Column.php
1.95 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
Columns.php
2.12 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
Date.php
7.63 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.97 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
Heading.php
2.99 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
Html.php
1022 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
Image.php
3.15 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
Paragraph.php
2.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
Radio.php
2.24 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
Segment.php
2.75 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
Select.php
2.96 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
Submit.php
1.68 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
Text.php
2.64 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
Textarea.php
1.93 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).