Няма описание

Social.php 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace MailPoet\Newsletter\Renderer\Blocks;
  3. if (!defined('ABSPATH')) exit;
  4. use MailPoet\Newsletter\Renderer\EscapeHelper as EHelper;
  5. class Social {
  6. public function render($element) {
  7. $iconsBlock = '';
  8. if (is_array($element['icons'])) {
  9. foreach ($element['icons'] as $index => $icon) {
  10. if (empty($icon['image'])) {
  11. continue;
  12. }
  13. $style = 'width:' . $icon['width'] . ';height:' . $icon['width'] . ';-ms-interpolation-mode:bicubic;border:0;display:inline;outline:none;';
  14. $iconsBlock .= '<a href="' . EHelper::escapeHtmlLinkAttr($icon['link']) . '" style="text-decoration:none!important;"
  15. ><img
  16. src="' . EHelper::escapeHtmlLinkAttr($icon['image']) . '"
  17. width="' . (int)$icon['width'] . '"
  18. height="' . (int)$icon['height'] . '"
  19. style="' . EHelper::escapeHtmlStyleAttr($style) . '"
  20. alt="' . EHelper::escapeHtmlAttr($icon['iconType']) . '"
  21. ></a>&nbsp;';
  22. }
  23. }
  24. $alignment = isset($element['styles']['block']['textAlign']) ? $element['styles']['block']['textAlign'] : 'center';
  25. if (!empty($iconsBlock)) {
  26. $template = '
  27. <tr>
  28. <td class="mailpoet_padded_side mailpoet_padded_vertical" valign="top" align="' . EHelper::escapeHtmlAttr($alignment) . '">
  29. ' . $iconsBlock . '
  30. </td>
  31. </tr>';
  32. return $template;
  33. }
  34. }
  35. }