init
This commit is contained in:
+64
@@ -0,0 +1,64 @@
|
||||
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
|
||||
|
||||
namespace MailPoet\WooCommerce\TransactionalEmails;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
|
||||
use MailPoet\Newsletter\Editor\LayoutHelper;
|
||||
use MailPoet\WooCommerce\TransactionalEmails;
|
||||
|
||||
class ContentPreprocessor {
|
||||
public const WC_HEADING_PLACEHOLDER = '[mailpoet_woocommerce_heading_placeholder]';
|
||||
public const WC_CONTENT_PLACEHOLDER = '[mailpoet_woocommerce_content_placeholder]';
|
||||
|
||||
public const WC_HEADING_BEFORE = '
|
||||
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
|
||||
<tr>
|
||||
<td class="mailpoet_text" valign="top" style="padding-top:20px;padding-bottom:20px;word-break:break-word;word-wrap:break-word;">';
|
||||
public const WC_HEADING_AFTER = '
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
/** @var TransactionalEmails */
|
||||
private $transactionalEmails;
|
||||
|
||||
public function __construct(
|
||||
TransactionalEmails $transactionalEmails
|
||||
) {
|
||||
$this->transactionalEmails = $transactionalEmails;
|
||||
}
|
||||
|
||||
public function preprocessContent() {
|
||||
return $this->renderPlaceholderBlock(self::WC_CONTENT_PLACEHOLDER);
|
||||
}
|
||||
|
||||
public function preprocessHeader() {
|
||||
$wcEmailSettings = $this->transactionalEmails->getWCEmailSettings();
|
||||
$content = self::WC_HEADING_BEFORE . '<h1 id="mailpoet-woo-email-header" style="color:' . $wcEmailSettings['base_text_color'] . ';">' . self::WC_HEADING_PLACEHOLDER . '</h1>' . self::WC_HEADING_AFTER;
|
||||
return $this->renderTextBlock($content, ['backgroundColor' => $wcEmailSettings['base_color']]);
|
||||
}
|
||||
|
||||
private function renderTextBlock(string $text, array $styles = []): array {
|
||||
return [
|
||||
LayoutHelper::row([
|
||||
LayoutHelper::col([[
|
||||
'type' => 'text',
|
||||
'text' => $text,
|
||||
]]),
|
||||
], $styles),
|
||||
];
|
||||
}
|
||||
|
||||
private function renderPlaceholderBlock(string $placeholder): array {
|
||||
return [
|
||||
LayoutHelper::row([
|
||||
LayoutHelper::col([[
|
||||
'type' => 'placeholder',
|
||||
'placeholder' => $placeholder,
|
||||
]]),
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
|
||||
|
||||
namespace MailPoet\WooCommerce\TransactionalEmails;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
|
||||
use MailPoet\Entities\NewsletterEntity;
|
||||
use MailPoet\Newsletter\Renderer\Renderer as NewsletterRenderer;
|
||||
use MailPoet\Newsletter\Shortcodes\Shortcodes;
|
||||
use MailPoetVendor\csstidy;
|
||||
use MailPoetVendor\csstidy_print;
|
||||
|
||||
class Renderer {
|
||||
const CONTENT_CONTAINER_ID = 'mailpoet_woocommerce_container';
|
||||
|
||||
/** @var csstidy */
|
||||
private $cssParser;
|
||||
|
||||
/** @var NewsletterRenderer */
|
||||
private $renderer;
|
||||
|
||||
/** @var string */
|
||||
private $htmlBeforeContent;
|
||||
|
||||
/** @var string */
|
||||
private $htmlAfterContent;
|
||||
|
||||
/** @var Shortcodes */
|
||||
private $shortcodes;
|
||||
|
||||
public function __construct(
|
||||
csstidy $cssParser,
|
||||
NewsletterRenderer $renderer,
|
||||
Shortcodes $shortcodes
|
||||
) {
|
||||
$this->cssParser = $cssParser;
|
||||
$this->htmlBeforeContent = '';
|
||||
$this->htmlAfterContent = '';
|
||||
$this->renderer = $renderer;
|
||||
$this->shortcodes = $shortcodes;
|
||||
}
|
||||
|
||||
public function render(NewsletterEntity $newsletter, ?string $subject = null) {
|
||||
$preparedNewsletter = $this->prepareNewsletterForRendering($newsletter);
|
||||
$renderedNewsletter = $this->renderer->renderAsPreview($preparedNewsletter, 'html', $subject);
|
||||
$headingText = $subject ?? '';
|
||||
|
||||
$renderedHtml = $this->processShortcodes($preparedNewsletter, $renderedNewsletter);
|
||||
|
||||
$renderedHtml = str_replace(ContentPreprocessor::WC_HEADING_PLACEHOLDER, $headingText, $renderedHtml);
|
||||
$html = explode(ContentPreprocessor::WC_CONTENT_PLACEHOLDER, $renderedHtml);
|
||||
$this->htmlBeforeContent = $html[0];
|
||||
$this->htmlAfterContent = $html[1];
|
||||
}
|
||||
|
||||
public function getHTMLBeforeContent() {
|
||||
if (empty($this->htmlBeforeContent)) {
|
||||
throw new \Exception("You should call 'render' before 'getHTMLBeforeContent'");
|
||||
}
|
||||
return $this->htmlBeforeContent . '<!--WooContent--><div id="' . self::CONTENT_CONTAINER_ID . '"><div id="body_content"><div id="body_content_inner"><table style="width: 100%"><tr><td style="padding: 10px 20px;">';
|
||||
}
|
||||
|
||||
public function getHTMLAfterContent() {
|
||||
if (empty($this->htmlAfterContent)) {
|
||||
throw new \Exception("You should call 'render' before 'getHTMLAfterContent'");
|
||||
}
|
||||
return '<!--WooContent--></td></tr></table></div></div></div>' . $this->htmlAfterContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* In this method we alter the rendered content that is output when processing the WooCommerce email template.
|
||||
* - We update inlined font-family rules in the content block generated by Woo
|
||||
*/
|
||||
public function updateRenderedContent(NewsletterEntity $newsletter, string $content): string {
|
||||
$isSavedWithStyledWooBlock = $newsletter->getGlobalStyle('woocommerce', 'isSavedWithUpdatedStyles');
|
||||
// For Backward compatibility do not apply styles for content unless the template was edited with the editor
|
||||
// and user visually checked and is aware of updated styles feature.
|
||||
if (!$isSavedWithStyledWooBlock) {
|
||||
return $content;
|
||||
}
|
||||
$contentParts = explode('<!--WooContent-->', $content);
|
||||
if (count($contentParts) !== 3) {
|
||||
return $content;
|
||||
}
|
||||
[$beforeWooContent, $wooContent, $afterWooContent] = $contentParts;
|
||||
$fontFamily = $newsletter->getGlobalStyle('text', 'fontFamily');
|
||||
$replaceFontFamilyCallback = function ($matches) use ($fontFamily) {
|
||||
$pattern = '/font-family\s*:\s*[^;]+;/i';
|
||||
$style = $matches[1];
|
||||
$style = preg_replace($pattern, "font-family:$fontFamily;", $style);
|
||||
return 'style="' . esc_attr($style) . '"';
|
||||
};
|
||||
$stylePattern = '/style="(.*?)"/i';
|
||||
$wooContent = (string)preg_replace_callback($stylePattern, $replaceFontFamilyCallback, $wooContent);
|
||||
return implode('', [$beforeWooContent, $wooContent, $afterWooContent]);
|
||||
}
|
||||
|
||||
/**
|
||||
* In this method we alter CSS that is later inlined into the WooCommerce email template. WooCommerce use Emogrifier to inline CSS.
|
||||
* The inlining is called after the rendering and after the modifications we apply to the rendered content in self::updateRenderedContent
|
||||
* - We prefix the original selectors to avoid inlining those rules into content added int the MailPoet's editor.
|
||||
* - We update the font-family in the original CSS if it's set in the editor.
|
||||
* - We update the font-size for the inner content if it's set in the editor.
|
||||
*/
|
||||
public function enhanceCss(string $css, NewsletterEntity $newsletter): string {
|
||||
$this->cssParser->settings['compress_colors'] = false;
|
||||
$this->cssParser->parse($css);
|
||||
foreach ($this->cssParser->css as $index => $rules) {
|
||||
$this->cssParser->css[$index] = [];
|
||||
foreach ($rules as $selectors => $properties) {
|
||||
$properties = $this->updateStyleDefinition($selectors, $newsletter, $properties);
|
||||
$selectors = explode(',', $selectors);
|
||||
$selectors = array_map(function($selector) {
|
||||
return '#' . self::CONTENT_CONTAINER_ID . ' ' . $selector;
|
||||
}, $selectors);
|
||||
$selectors = implode(',', $selectors);
|
||||
|
||||
$this->cssParser->css[$index][$selectors] = $properties;
|
||||
}
|
||||
}
|
||||
|
||||
/** @var csstidy_print */
|
||||
$print = $this->cssParser->print;
|
||||
$css = $print->plain();
|
||||
|
||||
// Enforce the special heading color for the WooCommerce email header
|
||||
$wooHeadingColor = $newsletter->getGlobalStyle('woocommerce', 'headingFontColor');
|
||||
if ($wooHeadingColor) {
|
||||
$css .= "#mailpoet-woo-email-header { color: $wooHeadingColor !important; }";
|
||||
}
|
||||
return $css;
|
||||
}
|
||||
|
||||
private function processShortcodes(NewsletterEntity $newsletter, $content) {
|
||||
$this->shortcodes->setQueue(null);
|
||||
$this->shortcodes->setSubscriber(null);
|
||||
$this->shortcodes->setNewsletter($newsletter);
|
||||
return $this->shortcodes->replace($content);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method prepares the newsletter for rendering
|
||||
* - We ensure that the font-family and branding color are used as default for all headings
|
||||
*/
|
||||
private function prepareNewsletterForRendering(NewsletterEntity $newsletter): NewsletterEntity {
|
||||
$newsletterClone = clone($newsletter);
|
||||
$headingFontFamily = $newsletter->getGlobalStyle('woocommerce', 'headingFontFamily');
|
||||
if ($headingFontFamily) {
|
||||
$newsletterClone->setGlobalStyle('h1', 'fontFamily', $headingFontFamily);
|
||||
$newsletterClone->setGlobalStyle('h2', 'fontFamily', $headingFontFamily);
|
||||
$newsletterClone->setGlobalStyle('h3', 'fontFamily', $headingFontFamily);
|
||||
}
|
||||
$brandingColor = $newsletter->getGlobalStyle('woocommerce', 'brandingColor');
|
||||
$contentHeadingColor = $newsletter->getGlobalStyle('woocommerce', 'contentHeadingFontColor') ?? $brandingColor;
|
||||
if ($contentHeadingColor) {
|
||||
$newsletterClone->setGlobalStyle('h1', 'color', $contentHeadingColor);
|
||||
$newsletterClone->setGlobalStyle('h2', 'color', $contentHeadingColor);
|
||||
$newsletterClone->setGlobalStyle('h3', 'color', $contentHeadingColor);
|
||||
}
|
||||
return $newsletterClone;
|
||||
}
|
||||
|
||||
private function updateStyleDefinition(string $selectors, NewsletterEntity $newsletter, $properties) {
|
||||
// For Backward compatibility do not apply styles for content unless the template was edited with the editor
|
||||
// and user visually checked and is aware of updated styles feature.
|
||||
$isSavedWithStyledWooBlock = $newsletter->getGlobalStyle('woocommerce', 'isSavedWithUpdatedStyles');
|
||||
if (!$isSavedWithStyledWooBlock) {
|
||||
return $properties;
|
||||
}
|
||||
|
||||
if (!is_array($properties)) {
|
||||
$properties = [];
|
||||
}
|
||||
$fontFamily = $newsletter->getGlobalStyle('text', 'fontFamily');
|
||||
$headingFontFamily = $newsletter->getGlobalStyle('woocommerce', 'headingFontFamily');
|
||||
$fontSize = $newsletter->getGlobalStyle('text', 'fontSize');
|
||||
$brandingColor = $newsletter->getGlobalStyle('woocommerce', 'brandingColor');
|
||||
$contentHeadingColor = $newsletter->getGlobalStyle('woocommerce', 'contentHeadingFontColor') ?? $brandingColor;
|
||||
|
||||
// Update font family if it's set in the editor
|
||||
if ($fontFamily && !empty($properties['font-family'])) {
|
||||
$properties['font-family'] = $fontFamily;
|
||||
}
|
||||
// Update font size for inner content
|
||||
if ($fontSize && ($selectors === '#body_content_inner')) {
|
||||
$properties['font-size'] = $fontSize;
|
||||
}
|
||||
|
||||
// Update heading font sizes and font family
|
||||
$supportedHeadings = ['h1', 'h2', 'h3'];
|
||||
foreach ($supportedHeadings as $heading) {
|
||||
$headingFontSize = $newsletter->getGlobalStyle($heading, 'fontSize');
|
||||
if ($headingFontSize && ($selectors === $heading)) {
|
||||
$properties['font-size'] = $headingFontSize;
|
||||
}
|
||||
if ($headingFontFamily && ($selectors === $heading)) {
|
||||
$properties['font-family'] = $headingFontFamily;
|
||||
}
|
||||
if ($contentHeadingColor && ($selectors === $heading)) {
|
||||
$properties['color'] = $contentHeadingColor;
|
||||
}
|
||||
}
|
||||
return $properties;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,724 @@
|
||||
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
|
||||
|
||||
namespace MailPoet\WooCommerce\TransactionalEmails;
|
||||
|
||||
if (!defined('ABSPATH')) exit;
|
||||
|
||||
|
||||
use MailPoet\Config\Env;
|
||||
|
||||
class Template {
|
||||
public function create($wcEmailSettings) {
|
||||
$socialIconUrl = Env::$assetsUrl . '/img/newsletter_editor/social-icons';
|
||||
return [
|
||||
'content' =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'vertical',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'horizontal',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'vertical',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'spacer',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
],
|
||||
1 =>
|
||||
[
|
||||
'type' => 'image',
|
||||
'link' => '',
|
||||
'src' => $wcEmailSettings['header_image'],
|
||||
'alt' => '',
|
||||
'fullWidth' => false,
|
||||
'width' => '180px',
|
||||
'height' => '362px',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
2 =>
|
||||
[
|
||||
'type' => 'spacer',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
1 =>
|
||||
[
|
||||
'type' => 'woocommerceHeading',
|
||||
],
|
||||
2 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'horizontal',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'vertical',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'spacer',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
3 =>
|
||||
[
|
||||
'type' => 'woocommerceContent',
|
||||
],
|
||||
4 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'horizontal',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'vertical',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'spacer',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
5 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'horizontal',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'container',
|
||||
'columnLayout' => false,
|
||||
'orientation' => 'vertical',
|
||||
'image' =>
|
||||
[
|
||||
'src' => null,
|
||||
'display' => 'scale',
|
||||
],
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
],
|
||||
'blocks' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'spacer',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
],
|
||||
1 =>
|
||||
[
|
||||
'type' => 'text',
|
||||
'text' => '<p style="text-align: center;">' . $wcEmailSettings['footer_text'] . '</p>',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'globalStyles' =>
|
||||
[
|
||||
'text' =>
|
||||
[
|
||||
'fontColor' => $wcEmailSettings['text_color'],
|
||||
'fontFamily' => 'Arial',
|
||||
'fontSize' => '14px',
|
||||
'lineHeight' => '1.6',
|
||||
],
|
||||
'h1' =>
|
||||
[
|
||||
'fontColor' => $wcEmailSettings['base_color'],
|
||||
'fontFamily' => 'Source Sans Pro',
|
||||
'fontSize' => '36px',
|
||||
'lineHeight' => '1.6',
|
||||
],
|
||||
'h2' =>
|
||||
[
|
||||
'fontColor' => $wcEmailSettings['base_color'],
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '24px',
|
||||
'lineHeight' => '1.6',
|
||||
],
|
||||
'h3' =>
|
||||
[
|
||||
'fontColor' => $wcEmailSettings['base_color'],
|
||||
'fontFamily' => 'Trebuchet MS',
|
||||
'fontSize' => '22px',
|
||||
'lineHeight' => '1.6',
|
||||
],
|
||||
'link' =>
|
||||
[
|
||||
'fontColor' => $wcEmailSettings['link_color'],
|
||||
'textDecoration' => 'underline',
|
||||
],
|
||||
'wrapper' =>
|
||||
[
|
||||
'backgroundColor' => $wcEmailSettings['body_background_color'],
|
||||
],
|
||||
'body' =>
|
||||
[
|
||||
'backgroundColor' => $wcEmailSettings['background_color'],
|
||||
],
|
||||
'woocommerce' =>
|
||||
[
|
||||
'brandingColor' => $wcEmailSettings['base_color'],
|
||||
'headingFontColor' => $wcEmailSettings['base_text_color'],
|
||||
'headingFontFamily' => 'Arial',
|
||||
],
|
||||
],
|
||||
'blockDefaults' =>
|
||||
[
|
||||
'automatedLatestContent' =>
|
||||
[
|
||||
'amount' => '5',
|
||||
'withLayout' => false,
|
||||
'contentType' => 'post',
|
||||
'inclusionType' => 'include',
|
||||
'displayType' => 'excerpt',
|
||||
'titleFormat' => 'h1',
|
||||
'titleAlignment' => 'left',
|
||||
'titleIsLink' => false,
|
||||
'imageFullWidth' => false,
|
||||
'featuredImagePosition' => 'belowTitle',
|
||||
'showAuthor' => 'no',
|
||||
'authorPrecededBy' => 'Author:',
|
||||
'showCategories' => 'no',
|
||||
'categoriesPrecededBy' => 'Categories:',
|
||||
'readMoreType' => 'button',
|
||||
'readMoreText' => 'Read more',
|
||||
'readMoreButton' =>
|
||||
[
|
||||
'text' => 'Read more',
|
||||
'url' => '[postLink]',
|
||||
'context' => 'automatedLatestContent.readMoreButton',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => '#2ea1cd',
|
||||
'borderColor' => '#0074a2',
|
||||
'borderWidth' => '1px',
|
||||
'borderRadius' => '5px',
|
||||
'borderStyle' => 'solid',
|
||||
'width' => '180px',
|
||||
'lineHeight' => '40px',
|
||||
'fontColor' => '#ffffff',
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '18px',
|
||||
'fontWeight' => 'normal',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
'sortBy' => 'newest',
|
||||
'showDivider' => true,
|
||||
'divider' =>
|
||||
[
|
||||
'context' => 'automatedLatestContent.divider',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'padding' => '13px',
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => '3px',
|
||||
'borderColor' => '#aaaaaa',
|
||||
],
|
||||
],
|
||||
],
|
||||
'backgroundColor' => '#ffffff',
|
||||
'backgroundColorAlternate' => '#eeeeee',
|
||||
],
|
||||
'automatedLatestContentLayout' =>
|
||||
[
|
||||
'amount' => '5',
|
||||
'withLayout' => true,
|
||||
'contentType' => 'post',
|
||||
'inclusionType' => 'include',
|
||||
'displayType' => 'excerpt',
|
||||
'titleFormat' => 'h1',
|
||||
'titleAlignment' => 'left',
|
||||
'titleIsLink' => false,
|
||||
'imageFullWidth' => false,
|
||||
'featuredImagePosition' => 'alternate',
|
||||
'showAuthor' => 'no',
|
||||
'authorPrecededBy' => 'Author:',
|
||||
'showCategories' => 'no',
|
||||
'categoriesPrecededBy' => 'Categories:',
|
||||
'readMoreType' => 'button',
|
||||
'readMoreText' => 'Read more',
|
||||
'readMoreButton' =>
|
||||
[
|
||||
'text' => 'Read more',
|
||||
'url' => '[postLink]',
|
||||
'context' => 'automatedLatestContentLayout.readMoreButton',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => '#2ea1cd',
|
||||
'borderColor' => '#0074a2',
|
||||
'borderWidth' => '1px',
|
||||
'borderRadius' => '5px',
|
||||
'borderStyle' => 'solid',
|
||||
'width' => '180px',
|
||||
'lineHeight' => '40px',
|
||||
'fontColor' => '#ffffff',
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '18px',
|
||||
'fontWeight' => 'normal',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
'sortBy' => 'newest',
|
||||
'showDivider' => true,
|
||||
'divider' =>
|
||||
[
|
||||
'context' => 'automatedLatestContentLayout.divider',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'padding' => '13px',
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => '3px',
|
||||
'borderColor' => '#aaaaaa',
|
||||
],
|
||||
],
|
||||
],
|
||||
'backgroundColor' => '#ffffff',
|
||||
'backgroundColorAlternate' => '#eeeeee',
|
||||
],
|
||||
'button' =>
|
||||
[
|
||||
'text' => 'Button',
|
||||
'url' => '',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => '#2ea1cd',
|
||||
'borderColor' => '#0074a2',
|
||||
'borderWidth' => '1px',
|
||||
'borderRadius' => '5px',
|
||||
'borderStyle' => 'solid',
|
||||
'width' => '180px',
|
||||
'lineHeight' => '40px',
|
||||
'fontColor' => '#ffffff',
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '18px',
|
||||
'fontWeight' => 'normal',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
'divider' =>
|
||||
[
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'padding' => '13px',
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => '3px',
|
||||
'borderColor' => '#aaaaaa',
|
||||
],
|
||||
],
|
||||
],
|
||||
'footer' =>
|
||||
[
|
||||
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Add your postal address here!</p>',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
'text' =>
|
||||
[
|
||||
'fontColor' => '#222222',
|
||||
'fontFamily' => 'Arial',
|
||||
'fontSize' => '12px',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
'link' =>
|
||||
[
|
||||
'fontColor' => '#6cb7d4',
|
||||
'textDecoration' => 'none',
|
||||
],
|
||||
],
|
||||
],
|
||||
'posts' =>
|
||||
[
|
||||
'amount' => '10',
|
||||
'withLayout' => true,
|
||||
'contentType' => 'post',
|
||||
'postStatus' => 'publish',
|
||||
'inclusionType' => 'include',
|
||||
'displayType' => 'excerpt',
|
||||
'titleFormat' => 'h1',
|
||||
'titleAlignment' => 'left',
|
||||
'titleIsLink' => false,
|
||||
'imageFullWidth' => false,
|
||||
'featuredImagePosition' => 'alternate',
|
||||
'showAuthor' => 'no',
|
||||
'authorPrecededBy' => 'Author:',
|
||||
'showCategories' => 'no',
|
||||
'categoriesPrecededBy' => 'Categories:',
|
||||
'readMoreType' => 'link',
|
||||
'readMoreText' => 'Read more',
|
||||
'readMoreButton' =>
|
||||
[
|
||||
'text' => 'Read more',
|
||||
'url' => '[postLink]',
|
||||
'context' => 'posts.readMoreButton',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => '#2ea1cd',
|
||||
'borderColor' => '#0074a2',
|
||||
'borderWidth' => '1px',
|
||||
'borderRadius' => '5px',
|
||||
'borderStyle' => 'solid',
|
||||
'width' => '180px',
|
||||
'lineHeight' => '40px',
|
||||
'fontColor' => '#ffffff',
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '18px',
|
||||
'fontWeight' => 'normal',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
'sortBy' => 'newest',
|
||||
'showDivider' => true,
|
||||
'divider' =>
|
||||
[
|
||||
'context' => 'posts.divider',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'padding' => '13px',
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => '3px',
|
||||
'borderColor' => '#aaaaaa',
|
||||
],
|
||||
],
|
||||
],
|
||||
'backgroundColor' => '#ffffff',
|
||||
'backgroundColorAlternate' => '#eeeeee',
|
||||
],
|
||||
'products' =>
|
||||
[
|
||||
'amount' => '10',
|
||||
'withLayout' => true,
|
||||
'contentType' => 'product',
|
||||
'postStatus' => 'publish',
|
||||
'inclusionType' => 'include',
|
||||
'displayType' => 'excerpt',
|
||||
'titleFormat' => 'h1',
|
||||
'titleAlignment' => 'left',
|
||||
'titleIsLink' => false,
|
||||
'imageFullWidth' => false,
|
||||
'featuredImagePosition' => 'alternate',
|
||||
'pricePosition' => 'below',
|
||||
'readMoreType' => 'link',
|
||||
'readMoreText' => 'Buy now',
|
||||
'readMoreButton' =>
|
||||
[
|
||||
'text' => 'Buy now',
|
||||
'url' => '[postLink]',
|
||||
'context' => 'posts.readMoreButton',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => '#2ea1cd',
|
||||
'borderColor' => '#0074a2',
|
||||
'borderWidth' => '1px',
|
||||
'borderRadius' => '5px',
|
||||
'borderStyle' => 'solid',
|
||||
'width' => '180px',
|
||||
'lineHeight' => '40px',
|
||||
'fontColor' => '#ffffff',
|
||||
'fontFamily' => 'Verdana',
|
||||
'fontSize' => '18px',
|
||||
'fontWeight' => 'normal',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
],
|
||||
'sortBy' => 'newest',
|
||||
'showDivider' => true,
|
||||
'divider' =>
|
||||
[
|
||||
'context' => 'posts.divider',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'padding' => '13px',
|
||||
'borderStyle' => 'solid',
|
||||
'borderWidth' => '3px',
|
||||
'borderColor' => '#aaaaaa',
|
||||
],
|
||||
],
|
||||
],
|
||||
'backgroundColor' => '#ffffff',
|
||||
'backgroundColorAlternate' => '#eeeeee',
|
||||
],
|
||||
'social' =>
|
||||
[
|
||||
'iconSet' => 'default',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
],
|
||||
'icons' =>
|
||||
[
|
||||
0 =>
|
||||
[
|
||||
'type' => 'socialIcon',
|
||||
'iconType' => 'facebook',
|
||||
'link' => 'http://www.facebook.com',
|
||||
'image' => $socialIconUrl . '/01-social/Facebook.png',
|
||||
'height' => '32px',
|
||||
'width' => '32px',
|
||||
'text' => 'Facebook',
|
||||
],
|
||||
1 =>
|
||||
[
|
||||
'type' => 'socialIcon',
|
||||
'iconType' => 'twitter',
|
||||
'link' => 'http://www.twitter.com',
|
||||
'image' => $socialIconUrl . '/01-social/Twitter.png',
|
||||
'height' => '32px',
|
||||
'width' => '32px',
|
||||
'text' => 'Twitter',
|
||||
],
|
||||
],
|
||||
],
|
||||
'spacer' =>
|
||||
[
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
'height' => '20px',
|
||||
],
|
||||
],
|
||||
'type' => 'spacer',
|
||||
],
|
||||
'header' =>
|
||||
[
|
||||
'text' => 'Display problems? <a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser.</a>',
|
||||
'styles' =>
|
||||
[
|
||||
'block' =>
|
||||
[
|
||||
'backgroundColor' => 'transparent',
|
||||
],
|
||||
'text' =>
|
||||
[
|
||||
'fontColor' => '#222222',
|
||||
'fontFamily' => 'Arial',
|
||||
'fontSize' => '12px',
|
||||
'textAlign' => 'center',
|
||||
],
|
||||
'link' =>
|
||||
[
|
||||
'fontColor' => '#6cb7d4',
|
||||
'textDecoration' => 'underline',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<?php
|
||||
Reference in New Issue
Block a user