[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.118.12.124: ~ $
<?php

namespace MailPoet\Form\Block;

if (!defined('ABSPATH')) exit;


use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;

class Select {

  /** @var BlockRendererHelper */
  private $rendererHelper;

  /** @var WPFunctions */
  private $wp;

  /** @var BlockWrapperRenderer */
  private $wrapper;

  /** @var BlockStylesRenderer */
  private $blockStylesRenderer;

  public function __construct(
    BlockRendererHelper $rendererHelper,
    BlockWrapperRenderer $wrapper,
    BlockStylesRenderer $blockStylesRenderer,
    WPFunctions $wp
  ) {
    $this->rendererHelper = $rendererHelper;
    $this->wrapper = $wrapper;
    $this->wp = $wp;
    $this->blockStylesRenderer = $blockStylesRenderer;
  }

  public function render(array $block, array $formSettings): string {
    $html = '';

    $fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
    $automationId = ($block['id'] == 'status') ? 'data-automation-id="form_status"' : '';

    $html .= $this->rendererHelper->renderLabel($block, $formSettings);
    $html .= '<select
      class="mailpoet_select"
      name="' . $fieldName . '" '
      . $automationId
      . 'style="' . $this->wp->escAttr($this->blockStylesRenderer->renderForSelect([], $formSettings)) . '"'
      . '>';

    if (isset($block['params']['label_within']) && $block['params']['label_within']) {
      $label = $this->rendererHelper->getFieldLabel($block);
      if (!empty($block['params']['required'])) {
        $label .= ' *';
      }
      $html .= '<option value="" disabled selected hidden>' . $label . '</option>';
    } else {
      if (empty($block['params']['required'])) {
        $html .= '<option value="">-</option>';
      }
    }

    $options = (!empty($block['params']['values'])
      ? $block['params']['values']
      : []
    );

    foreach ($options as $option) {
      if (!empty($option['is_hidden'])) {
        continue;
      }

      $isSelected = (
        (isset($option['is_checked']) && $option['is_checked'])
        ||
        ($this->rendererHelper->getFieldValue($block) === $option['value'])
      ) ? ' selected="selected"' : '';

      $isDisabled = (!empty($option['is_disabled'])) ? ' disabled="disabled"' : '';

      if (is_array($option['value'])) {
        $value = key($option['value']);
        $label = reset($option['value']);
      } else {
        $value = $option['value'];
        $label = $option['value'];
      }

      $html .= '<option value="' . $value . '"' . $isSelected . $isDisabled . '>';
      $html .= $this->wp->escAttr($label);
      $html .= '</option>';
    }
    $html .= '</select>';

    return $this->wrapper->render($block, $html);
  }
}

Filemanager

Name Type Size Permission Actions
BlockRendererHelper.php File 6.65 KB 0644
Checkbox.php File 1.79 KB 0644
Column.php File 1.85 KB 0644
Columns.php File 1.81 KB 0644
Date.php File 7.46 KB 0644
Divider.php File 1.88 KB 0644
Heading.php File 2.85 KB 0644
Html.php File 928 B 0644
Image.php File 2.88 KB 0644
Paragraph.php File 2.54 KB 0644
Radio.php File 2.02 KB 0644
Segment.php File 2.45 KB 0644
Select.php File 2.67 KB 0644
Submit.php File 1.59 KB 0644
Text.php File 2.26 KB 0644
Textarea.php File 1.84 KB 0644
index.php File 0 B 0644