REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.75 KB
Close
/home/nshryvcy/himaltourism.com/wp-content/plugins/mailpoet/lib/Form/Block/Segment.php
Text
Base64
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing namespace MailPoet\Form\Block; if (!defined('ABSPATH')) exit; use MailPoet\Form\BlockWrapperRenderer; use MailPoet\Segments\SegmentsRepository; use MailPoet\WP\Functions as WPFunctions; class Segment { /** @var BlockRendererHelper */ private $rendererHelper; /** @var WPFunctions */ private $wp; /** @var BlockWrapperRenderer */ private $wrapper; /** @var SegmentsRepository */ private $segmentsRepository; public function __construct( BlockRendererHelper $rendererHelper, BlockWrapperRenderer $wrapper, WPFunctions $wp, SegmentsRepository $segmentsRepository ) { $this->rendererHelper = $rendererHelper; $this->wrapper = $wrapper; $this->wp = $wp; $this->segmentsRepository = $segmentsRepository; } public function render(array $block, array $formSettings, ?int $formId = null): string { $html = ''; $fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']'; $fieldValidation = $this->rendererHelper->getInputValidation($block, [], $formId); // Add fieldset around the checkboxes $html .= '<fieldset>'; $html .= $this->rendererHelper->renderLegend($block, $formSettings); $options = (!empty($block['params']['values']) ? $block['params']['values'] : [] ); $options = array_map(function ($option) { $option['id'] = intval($option['id']); return $option; }, $options); $segmentsNamesMap = $this->getSegmentsNames($options); foreach ($options as $option) { if (!isset($option['id']) || !isset($segmentsNamesMap[$option['id']])) continue; $isChecked = (isset($option['is_checked']) && $option['is_checked']) ? 'checked="checked"' : ''; $html .= '<label class="mailpoet_checkbox_label" ' . $this->rendererHelper->renderFontStyle($formSettings) . '>'; $html .= '<input type="checkbox" class="mailpoet_checkbox" '; $html .= 'name="' . $fieldName . '[]" '; $html .= 'value="' . $option['id'] . '" ' . $isChecked . ' '; $html .= $fieldValidation; $html .= ' /> ' . $this->wp->escAttr($segmentsNamesMap[$option['id']]); $html .= '</label>'; } $html .= '<span class="mailpoet_error_' . $block['id'] . ($formId ? '_' . $formId : '') . '"></span>'; // End fieldset around checkboxes $html .= '</fieldset>'; return $this->wrapper->render($block, $html); } private function getSegmentsNames($values): array { $ids = array_column($values, 'id'); $segments = $this->segmentsRepository->findBy(['id' => $ids]); $namesMap = []; foreach ($segments as $segment) { $namesMap[$segment->getId()] = $segment->getName(); } return $namesMap; } }
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).