[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.191.233.198: ~ $
<?php

namespace MailPoet\Form\Block;

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


use MailPoet\WP\Functions as WPFunctions;

class Image {
  /** @var WPFunctions */
  private $wp;

  public function __construct(
    WPFunctions $wp
  ) {
    $this->wp = $wp;
  }

  public function render(array $block): string {
    if (empty($block['params']['url'])) {
      return '';
    }
    return $this->wrapImage($block['params'], $this->renderImage($block['params']));
  }

  private function renderImage(array $params): string {
    $attributes = [];
    $styles = [];
    $attributes[] = 'src="' . $this->wp->escAttr($params['url']) . '"';
    $attributes[] = $params['alt'] ? 'alt="' . $this->wp->escAttr($params['alt']) . '"' : 'alt';
    if ($params['title']) {
      $attributes[] = 'title="' . $this->wp->escAttr($params['title']) . '"';
    }
    if ($params['id']) {
      $attributes[] = 'class="wp-image-' . $this->wp->escAttr($params['id']) . '"';
      $attributes[] = 'srcset="' . $this->wp->wpGetAttachmentImageSrcset(intval($params['id']), $params['size_slug']) . '"';
    }
    if ($params['width']) {
      $attributes[] = 'width=' . intval($params['width']);
      $styles[] = 'width: ' . intval($params['width']) . 'px';
    }
    if ($params['height']) {
      $attributes[] = 'height=' . intval($params['height']);
      $styles[] = 'height: ' . intval($params['height']) . 'px';
    }
    if ($styles) {
      $attributes[] = 'style="' . $this->wp->escAttr(implode(';', $styles)) . '"';
    }
    return '<img ' . implode(' ', $attributes) . '>';
  }

  private function wrapImage(array $params, string $img): string {
    // Figure
    $figureClasses = ['size-' . $params['size_slug']];
    if ($params['align']) {
      $figureClasses[] = 'align' . $params['align'];
    }
    // Link
    if ($params['href']) {
      $img = $this->wrapToLink($params, $img);
    }
    $caption = $params['caption'] ? "<figcaption>{$this->wp->escHtml($params['caption'])}</figcaption>" : '';
    $figure = '<figure class="' . $this->wp->escAttr(implode(' ', $figureClasses)) . '">' . $img . $caption . '</figure>';
    // Main wrapper
    $divClasses = ['mailpoet_form_image'];
    if (trim($params['class_name'])) {
      $divClasses[] = trim($params['class_name']);
    }
    return '<div class="' . $this->wp->escAttr(implode(' ', $divClasses)) . '">' . $figure . '</div>';
  }

  private function wrapToLink(array $params, string $img): string {
    $attributes = ['href="' . $this->wp->escAttr($params['href']) . '"'];
    if ($params['link_class']) {
      $attributes[] = 'class="' . $this->wp->escAttr($params['link_class']) . '"';
    }
    if ($params['link_target']) {
      $attributes[] = 'target="' . $this->wp->escAttr($params['link_target']) . '"';
    }
    if ($params['rel']) {
      $attributes[] = 'rel="' . $this->wp->escAttr($params['rel']) . '"';
    }
    return '<a ' . implode(' ', $attributes) . ' >' . $img . '</a>';
  }
}

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