Indented HTML code as per Marco's comment
This commit is contained in:
@ -5,35 +5,41 @@ use MailPoet\Newsletter\Blocks\Renderer as BlocksRenderer;
|
||||
class Button {
|
||||
|
||||
static function render($element) {
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_button mailpoet_padded" valign = "top" >
|
||||
<div>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="' . $element['styles']['block']['textAlign'] . '">
|
||||
<!--[if mso]>
|
||||
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
href="' . $element['url'] . '"
|
||||
style="height:' . $element['styles']['block']['lineHeight'] . ';width:' . $element['styles']['block']['width'] . ';v-text-anchor:middle;"
|
||||
arcsize="' . round($element['styles']['block']['borderRadius'] / $element['styles']['block']['lineHeight'] * 100) . '%" strokecolor="' . $element['styles']['block']['borderColor'] . '"
|
||||
fillcolor="' . $element['styles']['block']['backgroundColor'] . '">
|
||||
<w:anchorlock/>
|
||||
<center style="color:' . $element['styles']['block']['fontColor'] . ';font-family:' . $element['styles']['block']['fontFamily'] . ';font-size:' . $element['styles']['block']['fontSize'] . ';font-weight:bold;">
|
||||
' . $element['text'] . '
|
||||
</center>
|
||||
</v:roundrect>
|
||||
<![endif]-->
|
||||
<a class="mailpoet_button" href="' . $element['url'] . '"
|
||||
style="display:inline-block;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;mso-hide:all;' . BlocksRenderer::getBlockStyles($element, array('textAlign')) . '">
|
||||
' . $element['text'] . '
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_button mailpoet_padded" valign = "top" >
|
||||
<div>
|
||||
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
||||
<tr>
|
||||
<td align="' . $element['styles']['block']['textAlign'] . '">
|
||||
<!--[if mso]>
|
||||
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml"
|
||||
xmlns:w="urn:schemas-microsoft-com:office:word"
|
||||
href="' . $element['url'] . '"
|
||||
style="height:' . $element['styles']['block']['lineHeight'] . ';
|
||||
width:' . $element['styles']['block']['width'] . ';
|
||||
v-text-anchor:middle;"
|
||||
arcsize="' . round($element['styles']['block']['borderRadius'] / $element['styles']['block']['lineHeight'] * 100) . '%"
|
||||
strokecolor="' . $element['styles']['block']['borderColor'] . '"
|
||||
fillcolor="' . $element['styles']['block']['backgroundColor'] . '">
|
||||
<w:anchorlock/>
|
||||
<center style="color:' . $element['styles']['block']['fontColor'] . ';
|
||||
font-family:' . $element['styles']['block']['fontFamily'] . ';
|
||||
font-size:' . $element['styles']['block']['fontSize'] . ';
|
||||
font-weight:bold;">' . $element['text'] . '
|
||||
</center>
|
||||
</v:roundrect>
|
||||
<![endif]-->
|
||||
<a class="mailpoet_button"
|
||||
href="' . $element['url'] . '"
|
||||
style="display:inline-block;text-align:center;text-decoration:none;-webkit-text-size-adjust:none;mso-hide:all;' . BlocksRenderer::getBlockStyles($element, array('textAlign')) . '"> ' . $element['text'] . '
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -3,18 +3,19 @@
|
||||
class Divider {
|
||||
|
||||
static function render($element) {
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_divider mailpoet_padded" style="background-color: ' . $element['styles']['block']['backgroundColor'] . '; padding: ' . $element['styles']['block']['padding'] . ' 0;" valign="top">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="border-top-width: ' . $element['styles']['block']['borderWidth'] . ';
|
||||
border-top-style: ' . $element['styles']['block']['borderStyle'] . ';
|
||||
border-top-color: ' . $element['styles']['block']['borderColor'] . ';">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_divider mailpoet_padded" style="background-color: ' . $element['styles']['block']['backgroundColor'] . '; padding: ' . $element['styles']['block']['padding'] . ' 0;" valign="top">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td style="border-top-width: ' . $element['styles']['block']['borderWidth'] . ';
|
||||
border-top-style: ' . $element['styles']['block']['borderStyle'] . ';
|
||||
border-top-color: ' . $element['styles']['block']['borderColor'] . ';">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -15,11 +15,12 @@ class Footer {
|
||||
$element['text'] = str_replace('<p', '<p style="' . BlocksRenderer::getStyles($element['styles'], 'text') . '"', $element['text']);
|
||||
}
|
||||
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_footer" style="' . BlocksRenderer::getStyles($element['styles'], 'block') . '" valign="top">
|
||||
<div>' . $element['text'] . '</div>
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_footer" style="' . BlocksRenderer::getStyles($element['styles'], 'block') . '" valign="top">
|
||||
<div>' . $element['text'] . '</div>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php namespace MailPoet\Newsletter\Blocks;
|
||||
|
||||
use MailPoet\Newsletter\Blocks\Renderer as BlocksRenderer;
|
||||
|
||||
|
||||
class Header {
|
||||
|
||||
static function render($element) {
|
||||
@ -15,11 +15,12 @@ class Header {
|
||||
$element['text'] = str_replace('<p', '<p style="' . BlocksRenderer::getStyles($element['styles'], 'text') . '"', $element['text']);
|
||||
}
|
||||
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_header" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top">
|
||||
<div>' . $element['text'] . '</div>
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_header" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top">
|
||||
<div>' . $element['text'] . '</div>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -7,11 +7,14 @@ class Image {
|
||||
static function render($element) {
|
||||
$element['width'] = (int) $element['width'];
|
||||
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_image ' . (($element['padded'] === true) ? "mailpoet_padded" : "") . '" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top">
|
||||
<img style="top:0; left:0; height: auto; width:100%;" src="' . $element['src'] . '" width="' . (($element['padded'] === true) ? $element['width'] - (20 * 2) : $element['width']) . '">
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_image ' . (($element['padded'] === true) ? "mailpoet_padded" : "") . '" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top">
|
||||
<img style="top:0; left:0; height: auto; width:100%;"
|
||||
src="' . $element['src'] . '"
|
||||
width="' . (($element['padded'] === true) ? $element['width'] - (20 * 2) : $element['width']) . '">
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -9,13 +9,12 @@ class Social {
|
||||
$iconsBlock .= '<a href="' . $icon['link'] . '"><img src="' . $icon['image'] . '" width = "32" height = "32" style="width: 32px; height: 32px;" alt="' . $icon['iconType'] . '"></a><img src="http://mp3.mailpoet.net/spacer.gif" width = "10" height = "1" style=" width: 10px; height: 1px;">';
|
||||
}
|
||||
}
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_social" valign="top">
|
||||
<div class="mailpoet_social-icon mailpoet_padded">
|
||||
' . $iconsBlock . '
|
||||
</div>
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_social" valign="top">
|
||||
<div class="mailpoet_social-icon mailpoet_padded">' . $iconsBlock . ' </div>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ class Spacer {
|
||||
unset($element['styles']['block']['backgroundColor']);
|
||||
}
|
||||
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_spacer" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top">
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_spacer" style="' . BlocksRenderer::getBlockStyles($element) . '" valign="top"> </td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -31,11 +31,10 @@ class Text {
|
||||
// remove the last break line
|
||||
$element['text'] = preg_replace('/<br>([^<br>]*)$/s', '', $element['text']);
|
||||
|
||||
$template = '<tr>
|
||||
<td class="mailpoet_col mailpoet_text mailpoet_padded" valign="top">
|
||||
' . $element['text'] . '
|
||||
</td>
|
||||
</tr>';
|
||||
$template = '
|
||||
<tr>
|
||||
<td class="mailpoet_col mailpoet_text mailpoet_padded" valign="top">' . $element['text'] . ' </td>
|
||||
</tr>';
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
@ -17,24 +17,32 @@ class Renderer {
|
||||
$columnClass = $columnClasses[$columnsCount];
|
||||
|
||||
// open column container
|
||||
$columnContainerTemplate = '<tr>
|
||||
<td class="mailpoet_content" align="left" style="border-collapse: collapse;">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="mailpoet_cols-wrapper" style="border-collapse: collapse; padding-left: 0px; padding-right: 0px;">
|
||||
<!--[if mso]>
|
||||
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="' . $columnWidth . '" style="width: ' . $columnWidth . 'px;" valign="top">
|
||||
<![endif]-->';
|
||||
$columnOpenTemplate = '<table width="' . $columnWidth . '" border="0" cellpadding="0" cellspacing="0" align="left" class="mailpoet_force-row ' . $columnClass . ' mailpoet_col" style="width: ' . $columnWidth . 'px; border-spacing: 0; mso-table-lspace: 0pt; mso-table-rspace: 0pt; table-layout: fixed; margin-left: auto; margin-right: auto;" bgcolor="#999999"><tbody>';
|
||||
$columnCloseTemplate = '</tbody></table>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
<td width="' . $columnWidth . '" style="width: ' . $columnWidth . 'px;" valign="top">
|
||||
<![endif]-->';
|
||||
$columnContainerTemplate = '
|
||||
<tr>
|
||||
<td class="mailpoet_content" align="left" style="border-collapse: collapse;">
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="mailpoet_cols-wrapper" style="border-collapse: collapse; padding-left: 0px; padding-right: 0px;">
|
||||
<!--[if mso]>
|
||||
<table border="0" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td width="' . $columnWidth . '" style="width: ' . $columnWidth . 'px;" valign="top">
|
||||
<![endif]-->';
|
||||
$columnOpenTemplate = '
|
||||
<table width="' . $columnWidth . '"
|
||||
border="0" cellpadding="0" cellspacing="0" align="left" class="mailpoet_force-row ' . $columnClass . ' mailpoet_col"
|
||||
style="width: ' . $columnWidth . 'px; border-spacing: 0; mso-table-lspace: 0pt; mso-table-rspace: 0pt;
|
||||
table-layout: fixed; margin-left: auto; margin-right: auto;" bgcolor="#999999">
|
||||
<tbody>';
|
||||
$columnCloseTemplate = '
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
<td width="' . $columnWidth . '" style="width: ' . $columnWidth . 'px;" valign="top">
|
||||
<![endif]-->';
|
||||
|
||||
foreach ($columnsData as $index => $columnData) {
|
||||
$index++;
|
||||
@ -42,23 +50,23 @@ class Renderer {
|
||||
if($columnsCount > 1 && $index != $columnsCount) {
|
||||
$columnContainerTemplate .= $columnCloseTemplate;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// close column container
|
||||
$columnContainerTemplate .= ' </tbody>
|
||||
</table>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
$columnContainerTemplate .= '
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if mso]>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>';
|
||||
|
||||
return $columnContainerTemplate;
|
||||
}
|
||||
|
Reference in New Issue
Block a user