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