This commit is contained in:
emmymayo
2025-02-05 23:15:46 +01:00
commit 7269c99357
16995 changed files with 3389680 additions and 0 deletions
@@ -0,0 +1,74 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
class ApiDataSanitizer {
/** @var FormHtmlSanitizer */
private $htmlSanitizer;
/**
* List of blocks and their parameters that will be sanitized
* @var string[][]
*/
private $htmlSanitizeConfig = [
'paragraph' => [
'content',
],
'heading' => [
'content',
],
'image' => [
'caption',
],
'checkbox' => [
'values',
],
];
public function __construct(
FormHtmlSanitizer $htmlSanitizer
) {
$this->htmlSanitizer = $htmlSanitizer;
}
public function sanitizeBody(array $body): array {
foreach ($body as $key => $block) {
$sanitizedBlock = $this->sanitizeBlock($block);
if (isset($sanitizedBlock['body']) && is_array($sanitizedBlock['body']) && !empty($sanitizedBlock['body'])) {
$sanitizedBlock['body'] = $this->sanitizeBody($sanitizedBlock['body']);
}
$body[$key] = $sanitizedBlock;
}
return $body;
}
public function sanitizeBlock(array $block): array {
if (!isset($this->htmlSanitizeConfig[$block['type']])) {
return $block;
}
$params = $block['params'] ?? [];
foreach ($this->htmlSanitizeConfig[$block['type']] as $parameter) {
if (!isset($params[$parameter])) continue;
if ($parameter === 'values' && is_array($params[$parameter])) {
$params[$parameter] = $this->sanitizeValues($params[$parameter]);
} else {
$params[$parameter] = $this->htmlSanitizer->sanitize($params[$parameter]);
}
}
$block['params'] = $params;
return $block;
}
private function sanitizeValues(array $values) {
foreach ($values as $key => $value) {
if (!isset($value['value'])) continue;
$values[$key]['value'] = $this->htmlSanitizer->sanitize($value['value']);
}
return $values;
}
}
@@ -0,0 +1,122 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Captcha\CaptchaConstants;
use MailPoet\Config\Env;
use MailPoet\Config\Renderer as BasicRenderer;
use MailPoet\Settings\SettingsController;
use MailPoet\WP\Functions as WPFunctions;
class AssetsController {
/** @var WPFunctions */
private $wp;
/** @var BasicRenderer */
private $renderer;
/** @var SettingsController */
private $settings;
const RECAPTCHA_API_URL = 'https://www.google.com/recaptcha/api.js?render=explicit';
public function __construct(
WPFunctions $wp,
BasicRenderer $renderer,
SettingsController $settings
) {
$this->wp = $wp;
$this->renderer = $renderer;
$this->settings = $settings;
}
/**
* Returns assets scripts tags as string
* @return string
*/
public function printScripts() {
ob_start();
$captcha = $this->settings->get('captcha');
if (!empty($captcha['type']) && CaptchaConstants::isReCaptcha($captcha['type'])) {
echo '<script src="' . esc_attr(self::RECAPTCHA_API_URL) . '" async defer></script>';
}
$this->wp->wpPrintScripts('jquery');
$this->wp->wpPrintScripts('mailpoet_vendor');
$this->wp->wpPrintScripts('mailpoet_public');
$scripts = ob_get_contents();
ob_end_clean();
if ($scripts === false) {
return '';
}
return $scripts;
}
public function setupFormPreviewDependencies() {
$this->setupFrontEndDependencies();
$this->wp->wpEnqueueScript(
'mailpoet_form_preview',
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('form_preview.js'),
['jquery'],
Env::$version,
true
);
}
public function setupFrontEndDependencies() {
$captcha = $this->settings->get('captcha');
if (!empty($captcha['type']) && CaptchaConstants::isRecaptcha($captcha['type'])) {
$this->wp->wpEnqueueScript(
'mailpoet_recaptcha',
self::RECAPTCHA_API_URL
);
}
$this->wp->wpEnqueueStyle(
'mailpoet_public',
Env::$assetsUrl . '/dist/css/' . $this->renderer->getCssAsset('mailpoet-public.css')
);
$enqueuePlacementParams = [
'in_footer' => true,
'strategy' => 'defer',
];
$this->wp->wpEnqueueScript(
'mailpoet_public',
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('public.js'),
['jquery'],
Env::$version,
$enqueuePlacementParams
);
$ajaxFailedErrorMessage = __('An error has happened while performing a request, please try again later.', 'mailpoet');
$this->wp->wpLocalizeScript('mailpoet_public', 'MailPoetForm', [
'ajax_url' => $this->wp->adminUrl('admin-ajax.php'),
'is_rtl' => (function_exists('is_rtl') ? (bool)is_rtl() : false),
'ajax_common_error_message' => esc_js($ajaxFailedErrorMessage),
]);
}
public function setupAdminWidgetPageDependencies() {
$this->wp->wpEnqueueScript(
'mailpoet_vendor',
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('vendor.js'),
[],
Env::$version,
true
);
$this->wp->wpEnqueueScript(
'mailpoet_admin',
Env::$assetsUrl . '/dist/js/' . $this->renderer->getJsAsset('mailpoet.js'),
[],
Env::$version,
true
);
}
}
@@ -0,0 +1,307 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Services\Validator;
use MailPoet\WP\Functions as WPFunctions;
/**
* This class still covers several responsibilities and could be further refactored
* @package MailPoet\Form\Block
*/
class BlockRendererHelper {
/** @var FieldNameObfuscator */
private $fieldNameObfuscator;
/** @var WPFunctions */
protected $wp;
public function __construct(
FieldNameObfuscator $fieldNameObfuscator,
WPFunctions $wp
) {
$this->fieldNameObfuscator = $fieldNameObfuscator;
$this->wp = $wp;
}
public function getInputValidation(array $block, array $extraRules = [], ?int $formId = null): string {
$rules = [
'errors-container' => '.' . $this->getErrorsContainerClass($block, $formId),
];
$blockId = $this->wp->escAttr($block['id']);
if ($blockId === 'email') {
$rules['required'] = true;
$rules['minlength'] = Validator::EMAIL_MIN_LENGTH;
$rules['maxlength'] = Validator::EMAIL_MAX_LENGTH;
$rules['type-message'] = __('This value should be a valid email.', 'mailpoet');
}
if (($blockId === 'first_name') || ($blockId === 'last_name')) {
$errorMessages = [
__('Please specify a valid name.', 'mailpoet'),
__('Addresses in names are not permitted, please add your name instead.', 'mailpoet'),
];
$rules['names'] = '[' . implode(',', array_map(function (string $errorMessage): string {
return $this->wp->escAttr('"' . $errorMessage . '"');
}, $errorMessages)) . ']';
}
// Segments should be required only when form ID is not empty. That allows save form on subscription management site when any segment is not checked.
if ($blockId === 'segments' && $formId) {
$rules['required'] = true;
$rules['mincheck'] = 1;
$rules['group'] = $blockId;
$rules['required-message'] = __('Please select a list.', 'mailpoet');
}
if (static::getFieldIsRequired($block)) {
$rules['required'] = true;
$rules['required-message'] = __('This field is required.', 'mailpoet');
}
if (!empty($block['params']['validate'])) {
if ($block['params']['validate'] === 'phone') {
$rules['pattern'] = "^[\d\+\-\.\(\)\/\s]*$";
$rules['error-message'] = __('Please specify a valid phone number.', 'mailpoet');
} else {
$rules['type'] = $this->wp->escAttr($block['params']['validate']);
$rules['error-message'] = $this->translateValidationErrorMessage($block['params']['validate']);
}
}
if (in_array($block['type'], ['radio', 'checkbox', 'date'])) {
$rules['group'] = 'custom_field_' . $blockId;
}
$rules = array_merge($rules, $extraRules);
if (empty($rules)) {
return '';
}
$validation = [];
$rules = array_unique($rules);
foreach ($rules as $rule => $value) {
if (is_bool($value)) {
$value = ($value) ? 'true' : 'false';
}
// We need to use single quotes because we need to pass array of strings as a parameter for custom validation
if ($rule === 'names') {
$validation[] = 'data-parsley-' . $rule . '=\'' . $this->wp->wpKsesPost($value) . '\''; // The value has been escaped above.
} else {
$validation[] = 'data-parsley-' . $this->wp->escAttr($rule) . '="' . $this->wp->escAttr($this->wp->wpKsesPost($value)) . '"';
if ($rule === 'required') {
$validation[] = 'required aria-required="true"';
}
}
}
return join(' ', $validation);
}
public function renderLabel(array $block, array $formSettings): string {
$html = '';
$forId = '';
if (
isset($block['params']['hide_label'])
&& $block['params']['hide_label']
) {
return $html;
}
// If the label is displayed within the field,
// we'll use aria-label instead of a label element
if (
isset($block['params']['label_within'])
&& $block['params']['label_within']
) {
return $html;
}
$automationId = null;
if (in_array($block['id'], ['email', 'last_name', 'first_name'], true)) {
$automationId = 'data-automation-id="form_' . $block['id'] . '_label" ';
}
if (isset($formSettings['id'])) {
$forId = 'for="form_' . $block['id'] . '_' . $formSettings['id'] . '" ';
}
if (
isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0
) {
$labelClass = 'class="mailpoet_' . $block['type'] . '_label" ';
$html .= '<label '
. $forId
. $labelClass
. $this->renderFontStyle($formSettings, $block['styles'] ?? [])
. ($automationId ? " $automationId" : '')
. '>';
$html .= static::getFieldLabel($block);
if (static::getFieldIsRequired($block)) {
$html .= ' <span class="mailpoet_required" aria-hidden="true">*</span>';
}
$html .= '</label>';
}
return $html;
}
public function renderLegend(array $block, array $formSettings): string {
$html = '';
if (
isset($block['params']['hide_label'])
&& $block['params']['hide_label']
) {
return $html;
}
if (
isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0
) {
// Use _label suffix for backward compatibility
$labelClass = 'class="mailpoet_' . $block['type'] . '_label" ';
$html .= '<legend '
. $labelClass
. $this->renderFontStyle($formSettings, $block['styles'] ?? [])
. '>';
$html .= static::getFieldLabel($block);
if (static::getFieldIsRequired($block)) {
$html .= ' <span class="mailpoet_required" aria-hidden="true">*</span>';
}
$html .= '</legend>';
}
return $html;
}
public function renderFontStyle(array $formSettings, array $styles = []) {
$rules = [];
if (isset($formSettings['fontSize'])) {
$rules[] = 'font-size: ' . $formSettings['fontSize'] . (is_numeric($formSettings['fontSize']) ? "px;" : ";");
$rules[] = 'line-height: 1.2;';
}
if (isset($styles['bold']) && $styles['bold']) {
$rules[] = 'font-weight: bold;';
}
return $rules ? 'style="' . $this->wp->escAttr(implode("", $rules)) . '"' : '';
}
public function renderInputPlaceholder(array $block): string {
$html = '';
// if the label is displayed as a placeholder,
if (
isset($block['params']['label_within'])
&& $block['params']['label_within']
) {
$label = $this->wp->escAttr(static::getFieldLabel($block));
if (static::getFieldIsRequired($block)) {
$label .= ' *';
}
// Some screen readers don't read placeholders, so we need to add aria-label
// but to prevent reading it twice, they need to be the same (including *)
$html .= ' placeholder="' . $label . '"';
$html .= ' aria-label="' . $label . '" ';
}
return $html;
}
// return field name depending on block data
public function getFieldName(array $block = []): string {
$blockId = $this->wp->escAttr($block['id']);
if ((int)$blockId > 0) {
return 'cf_' . $blockId;
} elseif (isset($block['params']['obfuscate']) && !$block['params']['obfuscate']) {
return $blockId;
} else {
return $this->fieldNameObfuscator->obfuscate($block['id']);//obfuscate field name for spambots
}
}
public function getFieldLabel(array $block = []): string {
return (isset($block['params']['label'])
&& strlen(trim($block['params']['label'])) > 0)
? $this->wp->escHtml(trim($block['params']['label'])) : '';
}
public function getFieldValue($block = []) {
return (isset($block['params']['value'])
&& strlen(trim($block['params']['value'])) > 0)
? $this->wp->escAttr(trim($block['params']['value'])) : '';
}
public function getFieldIsRequired($block = []): bool {
return (isset($block['params']['required'])
&& strlen(trim($block['params']['required'])) > 0)
? !empty($block['params']['required']) : false;
}
public function getInputModifiers(array $block = []): string {
$modifiers = [];
if (isset($block['params']['readonly']) && $block['params']['readonly']) {
$modifiers[] = 'readonly';
}
if (isset($block['params']['disabled']) && $block['params']['disabled']) {
$modifiers[] = 'disabled';
}
return join(' ', $modifiers);
}
public function escapeShortCodes(?string $value): ?string {
if ($value === null) {
return null;
}
return preg_replace_callback('/' . $this->wp->getShortcodeRegex() . '/s', function ($matches) {
return str_replace(['[', ']'], ['&#91;', '&#93;'], $matches[0]);
}, $value);
}
public function renderErrorsContainer(array $block = [], ?int $formId = null): string {
$errorContainerClass = $this->getErrorsContainerClass($block, $formId);
return '<span class="' . $errorContainerClass . '"></span>';
}
private function getErrorsContainerClass(array $block = [], ?int $formId = null): string {
$validationId = $block['validation_id'] ?? null;
if (!$validationId) {
$validationId = $this->wp->escAttr($block['id']);
if ($formId) {
$validationId .= '_' . $formId;
}
}
return 'mailpoet_error_' . $validationId;
}
private function translateValidationErrorMessage(string $validate): string {
switch ($validate) {
case 'email':
return __('This value should be a valid email.', 'mailpoet');
case 'url':
return __('This value should be a valid url.', 'mailpoet');
case 'number':
return __('This value should be a valid number.', 'mailpoet');
case 'integer':
return __('This value should be a valid integer.', 'mailpoet');
case 'digits':
return __('This value should be digits.', 'mailpoet');
case 'alphanum':
return __('This value should be alphanumeric.', 'mailpoet');
default:
return __('This value seems to be invalid.', 'mailpoet');
}
}
}
@@ -0,0 +1,84 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\Form\FormHtmlSanitizer;
use MailPoet\WP\Functions as WPFunctions;
class Checkbox {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var WPFunctions */
private $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockWrapperRenderer $wrapper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->wp = $wp;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
$fieldValidation = $this->rendererHelper->getInputValidation($block, [], $formId);
$html .= '<fieldset>';
$html .= $this->rendererHelper->renderLegend($block, $formSettings);
$options = (!empty($block['params']['values'])
? $block['params']['values']
: []
);
$selectedValue = $this->rendererHelper->getFieldValue($block);
$isFieldRequired = $this->rendererHelper->getFieldIsRequired($block);
foreach ($options as $option) {
$hiddenValue = $isFieldRequired ? '1' : '0'; // Mandatory Fields can not be Empty
$html .= '<input type="hidden" value="' . $hiddenValue . '" name="' . $fieldName . '" />';
$id = $this->wp->wpUniqueId('mailpoet_checkbox_');
$html .= '<label class="mailpoet_checkbox_label" for="' . $id . '" '
. $this->rendererHelper->renderFontStyle($formSettings) . '>';
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
$html .= 'id="' . $id . '" ';
$html .= 'name="' . $fieldName . '" ';
$html .= 'value="1" ';
$html .= (
(
$selectedValue === ''
&& isset($option['is_checked'])
&& $option['is_checked']
) || ($selectedValue)
) ? 'checked="checked"' : '';
$html .= $fieldValidation;
$html .= ' /> ' . $this->wp->wpKses($option['value'], FormHtmlSanitizer::ALLOWED_HTML);
$html .= '</label>';
}
$html .= '</fieldset>';
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1,66 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Column {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function render(array $block, string $content): string {
return "<div {$this->getClass($block['params'])}{$this->getStyles($block['params'])}>$content</div>";
}
private function getStyles(array $params): string {
$styles = [];
if (
!empty($params['width']) &&
(strlen($params['width']) > 0 && ctype_digit(substr($params['width'], 0, 1)))
) {
$widthValue = $params['width'] . (is_numeric($params['width']) ? '%' : '');
$styles[] = "flex-basis:{$widthValue}";
}
if (!empty($params['padding']) && is_array($params['padding'])) {
$top = $params['padding']['top'] ?? 0;
$right = $params['padding']['right'] ?? 0;
$bottom = $params['padding']['bottom'] ?? 0;
$left = $params['padding']['left'] ?? 0;
$styles[] = "padding:{$top} {$right} {$bottom} {$left};";
}
if (!empty($params['text_color'])) {
$styles[] = "color:{$params['text_color']};";
}
if (!empty($params['background_color'])) {
$styles[] = "background-color:{$params['background_color']};";
}
if (!empty($params['gradient'])) {
$styles[] = "background:{$params['gradient']};";
}
if (!count($styles)) {
return '';
}
return ' style="' . $this->wp->escAttr(implode(';', $styles)) . ';"';
}
private function getClass(array $params): string {
$classes = ['mailpoet_form_column'];
if (!empty($params['vertical_alignment'])) {
$classes[] = "mailpoet_vertically_align_{$params['vertical_alignment']}";
}
if (!empty($params['class_name'])) {
$classes[] = $params['class_name'];
}
$classes = implode(' ', $classes);
return "class=\"{$this->wp->escAttr($classes)}\"";
}
}
@@ -0,0 +1,69 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Columns {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function render(array $block, string $content): string {
return "<div class='mailpoet_form_columns_container'><div {$this->getClass($block['params'] ?? [])}{$this->getStyles($block['params'] ?? [])}>$content</div></div>";
}
private function getStyles(array $params): string {
$styles = [];
if (!empty($params['text_color'])) {
$styles[] = "color:{$params['text_color']};";
}
if (!empty($params['background_color'])) {
$styles[] = "background-color:{$params['background_color']};";
}
if (!empty($params['gradient'])) {
$styles[] = "background:{$params['gradient']};";
}
if (!empty($params['padding']) && is_array($params['padding'])) {
$top = $params['padding']['top'] ?? 0;
$right = $params['padding']['right'] ?? 0;
$bottom = $params['padding']['bottom'] ?? 0;
$left = $params['padding']['left'] ?? 0;
$styles[] = "padding:{$top} {$right} {$bottom} {$left};";
}
if (count($styles)) {
return ' style="' . $this->wp->escAttr(implode('', $styles)) . '"';
}
return '';
}
private function getClass(array $params): string {
$classes = ['mailpoet_form_columns mailpoet_paragraph'];
if (!empty($params['vertical_alignment'])) {
$classes[] = "mailpoet_vertically_align_{$params['vertical_alignment']}";
}
if (!empty($params['background_color']) || !empty($params['gradient'])) {
$classes[] = "mailpoet_column_with_background";
}
if (!empty($params['text_color'])) {
$classes[] = "has-{$params['text_color']}-color";
}
// BC !isset for older forms that were saved without the flag
if (!isset($params['is_stacked_on_mobile']) || $params['is_stacked_on_mobile'] === '1') {
$classes[] = "mailpoet_stack_on_mobile";
}
if (!empty($params['class_name'])) {
$classes[] = $params['class_name'];
}
$classes = implode(' ', $classes);
return "class=\"{$this->wp->escAttr($classes)}\"";
}
}
@@ -0,0 +1,226 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
use MailPoetVendor\Carbon\CarbonImmutable;
class Date {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var BlockStylesRenderer */
private $blockStylesRenderer;
/** @var WPFunctions */
private $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockStylesRenderer $blockStylesRenderer,
BlockWrapperRenderer $wrapper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->blockStylesRenderer = $blockStylesRenderer;
$this->wp = $wp;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$html .= $this->renderDateSelect($formId, $block, $formSettings);
return $this->wrapper->render($block, $html);
}
private function renderDateSelect(?int $formId, array $block = [], $formSettings = []): string {
$html = '';
$fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
$dateFormats = $this->getDateFormats();
// automatically select first date format
$dateFormat = $dateFormats[$block['params']['date_type']][0];
// set date format if specified
if (
isset($block['params']['date_format'])
&& strlen(trim($block['params']['date_format'])) > 0
) {
$dateFormat = $block['params']['date_format'];
}
// generate an array of selectors based on date format
$dateSelectors = explode('/', $dateFormat);
foreach ($dateSelectors as $dateSelector) {
if ($dateSelector === 'DD') {
$html .= '<select class="mailpoet_date_day" ';
$html .= ' style="' . $this->wp->escAttr($this->blockStylesRenderer->renderForSelect([], $formSettings)) . '"';
$html .= $this->rendererHelper->getInputValidation($block, [
'required-message' => $this->wp->escAttr(__('Please select a day', 'mailpoet')),
], $formId);
$html .= 'name="' . $fieldName . '[day]" placeholder="' . $this->wp->escAttr(__('Day', 'mailpoet')) . '">';
$html .= $this->getDays($block);
$html .= '</select>';
} else if ($dateSelector === 'MM') {
$html .= '<select class="mailpoet_select mailpoet_date_month" data-automation-id="form_date_month" ';
$html .= ' style="' . $this->wp->escAttr($this->blockStylesRenderer->renderForSelect([], $formSettings)) . '"';
$html .= $this->rendererHelper->getInputValidation($block, [
'required-message' => $this->wp->escAttr(__('Please select a month', 'mailpoet')),
], $formId);
$html .= 'name="' . $fieldName . '[month]" placeholder="' . $this->wp->escAttr(__('Month', 'mailpoet')) . '">';
$html .= $this->getMonths($block);
$html .= '</select>';
} else if ($dateSelector === 'YYYY') {
$html .= '<select class="mailpoet_date_year" data-automation-id="form_date_year" ';
$html .= ' style="' . $this->wp->escAttr($this->blockStylesRenderer->renderForSelect([], $formSettings)) . '"';
$html .= $this->rendererHelper->getInputValidation($block, [
'required-message' => $this->wp->escAttr(__('Please select a year', 'mailpoet')),
], $formId);
$html .= 'name="' . $fieldName . '[year]" placeholder="' . $this->wp->escAttr(__('Year', 'mailpoet')) . '">';
$html .= $this->getYears($block);
$html .= '</select>';
}
}
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $html;
}
public function getDateTypes(): array {
return [
'year_month_day' => $this->wp->escHtml(__('Year, month, day', 'mailpoet')),
'year_month' => $this->wp->escHtml(__('Year, month', 'mailpoet')),
'month' => $this->wp->escHtml(__('Month (January, February,...)', 'mailpoet')),
'year' => $this->wp->escHtml(__('Year', 'mailpoet')),
];
}
public function getDateFormats(): array {
return [
'year_month_day' => ['MM/DD/YYYY', 'DD/MM/YYYY', 'YYYY/MM/DD'],
'year_month' => ['MM/YYYY', 'YYYY/MM'],
'year' => ['YYYY'],
'month' => ['MM'],
];
}
public function getMonthNames(): array {
return [__('January', 'mailpoet'), __('February', 'mailpoet'), __('March', 'mailpoet'), __('April', 'mailpoet'),
__('May', 'mailpoet'), __('June', 'mailpoet'), __('July', 'mailpoet'), __('August', 'mailpoet'), __('September', 'mailpoet'),
__('October', 'mailpoet'), __('November', 'mailpoet'), __('December', 'mailpoet'),
];
}
private function getMonths(array $block = []): string {
$defaults = [
'selected' => null,
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('m', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('m');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$monthNames = $this->getMonthNames();
$html = '';
// empty value label
$html .= '<option value="">' . $this->wp->escHtml(__('Month', 'mailpoet')) . '</option>';
for ($i = 1; $i < 13; $i++) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="' . $i . '" ' . $isSelected . '>';
$html .= $this->wp->escHtml($monthNames[$i - 1]);
$html .= '</option>';
}
return $html;
}
private function getYears(array $block = []): string {
$defaults = [
'selected' => null,
'from' => (int)date('Y') - 100,
'to' => (int)date('Y'),
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('Y', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('Y');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$html = '';
// empty value label
$html .= '<option value="">' . $this->wp->escHtml(__('Year', 'mailpoet')) . '</option>';
// return years as an array
for ($i = (int)$block['to']; $i > (int)($block['from'] - 1); $i--) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="' . $i . '" ' . $isSelected . '>' . $i . '</option>';
}
return $html;
}
private function getDays(array $block = []): string {
$defaults = [
'selected' => null,
];
if (!empty($block['params']['value'])) {
$date = CarbonImmutable::createFromFormat('Y-m-d H:i:s', $block['params']['value']);
if ($date instanceof CarbonImmutable) {
$defaults['selected'] = (int)date('d', $date->getTimestamp());
}
} elseif (!empty($block['params']['is_default_today'])) {
// is default today
$defaults['selected'] = (int)date('d');
}
// merge block with defaults
$block = array_merge($defaults, $block);
$html = '';
// empty value label
$html .= '<option value="">' . $this->wp->escHtml(__('Day', 'mailpoet')) . '</option>';
// return days as an array
for ($i = 1; $i < 32; $i++) {
$isSelected = ($i === $block['selected']) ? 'selected="selected"' : '';
$html .= '<option value="' . $i . '" ' . $isSelected . '>' . $i . '</option>';
}
return $html;
}
}
@@ -0,0 +1,63 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Divider {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
const DEFAULT_ATTRIBUTES = [
'height' => 1,
'type' => 'divider',
'style' => 'solid',
'dividerHeight' => 1,
'dividerWidth' => 100,
'color' => 'black',
];
public function render($block): string {
$classes = ['mailpoet_spacer'];
if (isset($block['params']['type']) && $block['params']['type'] === 'divider') {
$classes[] = 'mailpoet_has_divider';
}
if (!empty($block['params']['class_name'])) {
$classes[] = $block['params']['class_name'];
}
$classAttr = $this->wp->escAttr(join(' ', $classes));
$height = $this->wp->escAttr($block['params']['height'] ?? self::DEFAULT_ATTRIBUTES['height']);
return "<div class='{$classAttr}' style='height: {$height}px;'>"
. $this->renderDivider($block)
. '</div>';
}
private function renderDivider(array $block): string {
if (isset($block['params']['type']) && $block['params']['type'] === 'spacer') {
return '';
}
$width = $block['params']['divider_width'] ?? self::DEFAULT_ATTRIBUTES['dividerWidth'];
$style = $block['params']['style'] ?? self::DEFAULT_ATTRIBUTES['style'];
$dividerHeight = $block['params']['divider_height'] ?? self::DEFAULT_ATTRIBUTES['dividerHeight'];
$color = $block['params']['color'] ?? self::DEFAULT_ATTRIBUTES['color'];
$dividerStyles = [
"border-top-style: $style",
"border-top-width: {$dividerHeight}px",
"border-top-color: $color",
"height: {$dividerHeight}px",
"width: $width%",
];
$style = $this->wp->escAttr(implode(";", $dividerStyles));
return "<div class='mailpoet_divider' data-automation-id='form_divider' style='$style'></div>";
}
}
@@ -0,0 +1,121 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Heading {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function render(array $block): string {
$content = ($block['params']['content'] ?? '');
return $this->wrapContent($content, $block);
}
private function wrapContent(string $content, array $block): string {
$tag = $this->renderTag($block);
$attributes = $this->renderAttributes($block);
$openTag = $this->getOpenTag($tag, $attributes);
return $openTag
. $content
. "</$tag>";
}
private function renderTag(array $block): string {
$level = isset($block['params']['level']) ? (int)$block['params']['level'] : 2;
return ($level < 1 || $level > 6) ? 'h2' : 'h' . $level;
}
private function renderAttributes(array $block): array {
$result = [];
$classes = $this->renderClass($block);
if ($classes) {
$result[] = $classes;
}
if (!empty($block['params']['anchor'])) {
$result[] = $this->renderAnchor($block);
}
$styles = $this->renderStyle($block);
if ($styles) {
$result[] = $styles;
}
return $result;
}
private function getOpenTag(string $tag, array $attributes): string {
if (empty($attributes)) {
return "<$tag>";
}
return "<$tag " . join(' ', $attributes) . ">";
}
private function renderClass(array $block): string {
$classes = ['mailpoet-heading'];
if (isset($block['params']['class_name'])) {
$classes[] = $block['params']['class_name'];
}
if (!empty($block['params']['background_color']) || !empty($block['params']['gradient'])) {
$classes[] = 'mailpoet-has-background-color';
}
if (!empty($block['params']['font_size'])) {
$classes[] = 'mailpoet-has-font-size';
}
return 'class="'
. $this->wp->escAttr(join(' ', $classes))
. '"';
}
private function renderAnchor(array $block): string {
return 'id="'
. $this->wp->escAttr($block['params']['anchor'])
. '"';
}
private function renderStyle(array $block): string {
$styles = [];
if (!empty($block['params']['align'])) {
$styles[] = 'text-align: ' . $block['params']['align'];
}
if (!empty($block['params']['text_color'])) {
$styles[] = 'color: ' . $block['params']['text_color'];
}
if (!empty($block['params']['font_size'])) {
$styles[] = 'font-size: ' . $block['params']['font_size'] . (is_numeric($block['params']['font_size']) ? 'px' : '');
}
if (!empty($block['params']['line_height'])) {
$styles[] = 'line-height: ' . $block['params']['line_height'];
}
if (!empty($block['params']['background_color'])) {
$styles[] = 'background-color: ' . $block['params']['background_color'];
}
if (!empty($block['params']['gradient'])) {
$styles[] = "background: {$block['params']['gradient']};";
}
if (!empty($block['params']['padding']) && is_array($block['params']['padding'])) {
$top = $block['params']['padding']['top'] ?? 0;
$right = $block['params']['padding']['right'] ?? 0;
$bottom = $block['params']['padding']['bottom'] ?? 0;
$left = $block['params']['padding']['left'] ?? 0;
$styles[] = "padding:{$top} {$right} {$bottom} {$left};";
}
if (empty($styles)) {
return '';
}
return 'style="'
. $this->wp->escAttr(join('; ', $styles))
. '"';
}
}
@@ -0,0 +1,43 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Html {
/** @var BlockRendererHelper */
private $rendererHelper;
private WPFunctions $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wp = $wp;
}
public function render(array $block, array $formSettings): string {
$html = '';
$text = '';
if (isset($block['params']['text']) && $block['params']['text']) {
$text = html_entity_decode($block['params']['text'], ENT_QUOTES);
}
if (isset($block['params']['nl2br']) && $block['params']['nl2br']) {
$text = nl2br($text);
}
$classes = isset($block['params']['class_name']) ? " " . $block['params']['class_name'] : '';
$html .= '<div class="mailpoet_paragraph' . $this->wp->escAttr($classes) . '" ' . $this->rendererHelper->renderFontStyle($formSettings) . '>';
$html .= $this->wp->wpKsesPost($text);
$html .= '</div>';
return $html;
}
}
@@ -0,0 +1,92 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\FormHtmlSanitizer;
use MailPoet\WP\Functions as WPFunctions;
class Image {
/** @var WPFunctions */
private $wp;
/** @var FormHtmlSanitizer */
private $htmlSanitizer;
public function __construct(
WPFunctions $wp,
FormHtmlSanitizer $htmlSanitizer
) {
$this->wp = $wp;
$this->htmlSanitizer = $htmlSanitizer;
}
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 = isset($params['caption']) && $params['caption'] ? "<figcaption>{$this->htmlSanitizer->sanitize($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>';
}
}
@@ -0,0 +1,106 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class Paragraph {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function render(array $block): string {
$content = ($block['params']['content'] ?? '');
return $this->wrapContent($content, $block);
}
private function wrapContent(string $content, array $block): string {
$attributes = $this->renderAttributes($block);
$openTag = $this->getOpenTag($attributes);
return $openTag
. $content
. "</p>";
}
private function getOpenTag(array $attributes): string {
if (empty($attributes)) {
return "<p>";
}
return "<p " . join(' ', $attributes) . ">";
}
private function renderAttributes(array $block): array {
$result = [];
$result[] = $this->renderClass($block);
$result[] = $this->renderStyle($block);
$result = array_filter($result, function ($attribute) {
return $attribute !== null;
});
return $result;
}
private function renderClass(array $block) {
$classes = ['mailpoet_form_paragraph'];
if (isset($block['params']['class_name'])) {
$classes[] = $block['params']['class_name'];
}
if (isset($block['params']['drop_cap']) && $block['params']['drop_cap'] === '1') {
$classes[] = 'has-drop-cap';
}
if (!empty($block['params']['background_color']) || !empty($block['params']['gradient'])) {
$classes[] = 'mailpoet-has-background-color';
}
if (!empty($block['params']['font_size'])) {
$classes[] = 'mailpoet-has-font-size';
}
if (empty($classes)) {
return null;
}
return 'class="'
. $this->wp->escAttr(join(' ', $classes))
. '"';
}
private function renderStyle(array $block) {
$styles = [];
if (!empty($block['params']['background_color'])) {
$styles[] = 'background-color: ' . $block['params']['background_color'];
}
if (!empty($block['params']['gradient'])) {
$styles[] = "background: {$block['params']['gradient']};";
}
if (!empty($block['params']['align'])) {
$styles[] = 'text-align: ' . $block['params']['align'];
}
if (!empty($block['params']['text_color'])) {
$styles[] = 'color: ' . $block['params']['text_color'];
}
if (!empty($block['params']['font_size'])) {
$styles[] = 'font-size: ' . $block['params']['font_size'] . (is_numeric($block['params']['font_size']) ? 'px' : '');
}
if (!empty($block['params']['line_height'])) {
$styles[] = 'line-height: ' . $block['params']['line_height'];
}
if (!empty($block['params']['padding']) && is_array($block['params']['padding'])) {
$top = $block['params']['padding']['top'] ?? 0;
$right = $block['params']['padding']['right'] ?? 0;
$bottom = $block['params']['padding']['bottom'] ?? 0;
$left = $block['params']['padding']['left'] ?? 0;
$styles[] = "padding:{$top} {$right} {$bottom} {$left};";
}
if (empty($styles)) {
return null;
}
return 'style="'
. $this->wp->escAttr(join('; ', $styles))
. '"';
}
}
@@ -0,0 +1,87 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
class Radio {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var WPFunctions */
private $wp;
/** @var BlockWrapperRenderer */
private $wrapper;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockWrapperRenderer $wrapper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->wp = $wp;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
$fieldValidation = $this->rendererHelper->getInputValidation($block, [], $formId);
$html .= '<fieldset>';
$html .= $this->rendererHelper->renderLegend($block, $formSettings);
$options = (!empty($block['params']['values'])
? $block['params']['values']
: []
);
$selectedValue = $this->rendererHelper->getFieldValue($block);
foreach ($options as $option) {
$id = $this->wp->wpUniqueId('mailpoet_radio_');
$html .= '<label class="mailpoet_radio_label" for="' . $id . '" '
. $this->rendererHelper->renderFontStyle($formSettings)
. '>';
$html .= '<input type="radio" class="mailpoet_radio" ';
$html .= 'id="' . $id . '" ';
$html .= 'name="' . $fieldName . '" ';
if (is_array($option['value'])) {
$value = key($option['value']);
$label = reset($option['value']);
} else {
$value = $option['value'];
$label = $option['value'];
}
$html .= 'value="' . $this->wp->escAttr($value) . '" ';
$html .= (
(
$selectedValue === ''
&& isset($option['is_checked'])
&& $option['is_checked']
) || ($selectedValue === $value)
) ? 'checked="checked"' : '';
$html .= $fieldValidation;
$html .= ' /> ' . $this->wp->escAttr($label);
$html .= '</label>';
}
$html .= '</fieldset>';
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1,94 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\Segments\SegmentsRepository;
use MailPoet\WP\Functions as WPFunctions;
class Segment {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var WPFunctions */
private $wp;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var SegmentsRepository */
private $segmentsRepository;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockWrapperRenderer $wrapper,
WPFunctions $wp,
SegmentsRepository $segmentsRepository
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->wp = $wp;
$this->segmentsRepository = $segmentsRepository;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
$fieldValidation = $this->rendererHelper->getInputValidation($block, [], $formId);
// Add fieldset around the checkboxes
$html .= '<fieldset>';
$html .= $this->rendererHelper->renderLegend($block, $formSettings);
$options = (!empty($block['params']['values'])
? $block['params']['values']
: []
);
$options = array_map(function ($option) {
$option['id'] = intval($option['id']);
return $option;
}, $options);
$segmentsNamesMap = $this->getSegmentsNames($options);
foreach ($options as $option) {
if (!isset($option['id']) || !isset($segmentsNamesMap[$option['id']])) continue;
$id = $this->wp->wpUniqueId('mailpoet_segment_');
$isChecked = (isset($option['is_checked']) && $option['is_checked']) ? 'checked="checked"' : '';
$html .= '<label class="mailpoet_checkbox_label" for="' . $id . '" '
. $this->rendererHelper->renderFontStyle($formSettings)
. '>';
$html .= '<input type="checkbox" class="mailpoet_checkbox" ';
$html .= 'id="' . $id . '" ';
$html .= 'name="' . $fieldName . '[]" ';
$html .= 'value="' . $option['id'] . '" ' . $isChecked . ' ';
$html .= $fieldValidation;
$html .= ' /> ' . $this->wp->escAttr($segmentsNamesMap[$option['id']]);
$html .= '</label>';
}
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
// End fieldset around checkboxes
$html .= '</fieldset>';
return $this->wrapper->render($block, $html);
}
private function getSegmentsNames($values): array {
$ids = array_column($values, 'id');
$segments = $this->segmentsRepository->findBy(['id' => $ids]);
$namesMap = [];
foreach ($segments as $segment) {
$namesMap[$segment->getId()] = $segment->getName();
}
return $namesMap;
}
}
@@ -0,0 +1,104 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
class Select {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var WPFunctions */
private $wp;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var BlockStylesRenderer */
private $blockStylesRenderer;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockWrapperRenderer $wrapper,
BlockStylesRenderer $blockStylesRenderer,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->wp = $wp;
$this->blockStylesRenderer = $blockStylesRenderer;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$fieldName = 'data[' . $this->rendererHelper->getFieldName($block) . ']';
$automationId = ($block['id'] == 'status') ? 'data-automation-id="form_status"' : '';
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$html .= '<select
class="mailpoet_select"
name="' . $fieldName . '" '
. $automationId
. 'style="' . $this->wp->escAttr($this->blockStylesRenderer->renderForSelect([], $formSettings)) . '"'
. '>';
if (isset($block['params']['label_within']) && $block['params']['label_within']) {
$label = $this->rendererHelper->getFieldLabel($block);
if (!empty($block['params']['required'])) {
$label .= ' *';
}
$html .= '<option value="" disabled selected hidden>' . $this->wp->escHtml($label) . '</option>';
} else {
if (empty($block['params']['required'])) {
$html .= '<option value="">-</option>';
}
}
$options = (!empty($block['params']['values'])
? $block['params']['values']
: []
);
foreach ($options as $option) {
if (!empty($option['is_hidden'])) {
continue;
}
$isSelected = '';
if ($this->rendererHelper->getFieldValue($block) === $option['value']) {
// use selected value if it exist
$isSelected = ' selected="selected"';
} elseif ((isset($option['is_checked']) && $option['is_checked']) && !($this->rendererHelper->getFieldValue($block))) {
// use default value otherwise
$isSelected = ' selected="selected"';
}
$isDisabled = (!empty($option['is_disabled'])) ? ' disabled="disabled"' : '';
if (is_array($option['value'])) {
$value = key($option['value']);
$label = reset($option['value']);
} else {
$value = $option['value'];
$label = $option['value'];
}
$html .= '<option value="' . $this->wp->escAttr($value) . '"' . $isSelected . $isDisabled . '>';
$html .= $this->wp->escAttr($label);
$html .= '</option>';
}
$html .= '</select>';
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1,63 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
class Submit {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var BlockStylesRenderer */
private $stylesRenderer;
/** @var WPFunctions */
private $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockWrapperRenderer $wrapper,
BlockStylesRenderer $stylesRenderer,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->wrapper = $wrapper;
$this->stylesRenderer = $stylesRenderer;
$this->wp = $wp;
}
public function render(array $block, array $formSettings): string {
$html = '';
$html .= '<input type="submit" class="mailpoet_submit" ';
$html .= 'value="' . $this->wp->escAttr($this->rendererHelper->getFieldLabel($block)) . '" ';
$html .= 'data-automation-id="subscribe-submit-button" ';
if (isset($block['styles']['font_family'])) {
$html .= "data-font-family='{$this->wp->escAttr($block['styles']['font_family'])}' " ;
}
$styles = $this->stylesRenderer->renderForButton($block['styles'] ?? [], $formSettings);
if ($styles) {
$html .= 'style="' . $this->wp->escAttr($styles) . '" ';
}
$html .= '/>';
$html .= '<span class="mailpoet_form_loading"><span class="mailpoet_bounce1"></span><span class="mailpoet_bounce2"></span><span class="mailpoet_bounce3"></span></span>';
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1,96 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
class Text {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var BlockStylesRenderer */
private $inputStylesRenderer;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var WPFunctions */
private $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockStylesRenderer $inputStylesRenderer,
BlockWrapperRenderer $wrapper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->inputStylesRenderer = $inputStylesRenderer;
$this->wrapper = $wrapper;
$this->wp = $wp;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$type = 'text';
$automationId = ' ';
$id = '';
if ($block['id'] === 'email') {
$type = 'email';
$autocomplete = 'email';
} else if ($block['id'] === 'first_name') {
$autocomplete = 'given-name';
} else if ($block['id'] === 'last_name') {
$autocomplete = 'family-name';
} else {
$autocomplete = 'on';
}
if (in_array($block['id'], ['email', 'last_name', 'first_name'], true)) {
$automationId = 'data-automation-id="form_' . $this->wp->escAttr($block['id']) . '" ';
}
if (isset($formSettings['id'])) {
$id = 'id="form_' . $this->wp->escAttr($block['id']) . '_' . $this->wp->escAttr($formSettings['id']) . '" ';
}
$styles = $this->inputStylesRenderer->renderForTextInput($block['styles'] ?? [], $formSettings);
$name = $this->rendererHelper->getFieldName($block);
$html = $this->inputStylesRenderer->renderPlaceholderStyles($block, 'input[name="data[' . $name . ']"]');
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$html .= '<input type="' . $type . '" autocomplete="' . $autocomplete . '" class="mailpoet_text" ';
$html .= $id;
$html .= 'name="data[' . $name . ']" ';
$html .= 'title="' . $this->wp->escAttr($this->rendererHelper->getFieldLabel($block)) . '" ';
$html .= 'value="' . $this->rendererHelper->getFieldValue($block) . '" ';
if ($styles) {
$html .= 'style="' . $this->wp->escAttr($styles) . '" ';
}
$html .= $automationId;
$html .= $this->rendererHelper->renderInputPlaceholder($block);
$html .= $this->rendererHelper->getInputValidation($block);
$html .= $this->rendererHelper->getInputModifiers($block);
$html .= '/>';
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1,67 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Block;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\BlockStylesRenderer;
use MailPoet\Form\BlockWrapperRenderer;
use MailPoet\WP\Functions as WPFunctions;
class Textarea {
/** @var BlockRendererHelper */
private $rendererHelper;
/** @var BlockStylesRenderer */
private $inputStylesRenderer;
/** @var BlockWrapperRenderer */
private $wrapper;
/** @var WPFunctions */
private $wp;
public function __construct(
BlockRendererHelper $rendererHelper,
BlockStylesRenderer $inputStylesRenderer,
BlockWrapperRenderer $wrapper,
WPFunctions $wp
) {
$this->rendererHelper = $rendererHelper;
$this->inputStylesRenderer = $inputStylesRenderer;
$this->wrapper = $wrapper;
$this->wp = $wp;
}
public function render(array $block, array $formSettings, ?int $formId = null): string {
$html = '';
$name = $this->rendererHelper->getFieldName($block);
$styles = $this->inputStylesRenderer->renderForTextInput($block['styles'] ?? [], $formSettings);
$html .= $this->rendererHelper->renderLabel($block, $formSettings);
$lines = (isset($block['params']['lines']) ? (int)$block['params']['lines'] : 1);
$html .= $this->inputStylesRenderer->renderPlaceholderStyles($block, 'textarea[name="data[' . $name . ']"]');
$html .= '<textarea class="mailpoet_textarea" data-automation-id="form_custom_text_area" rows="' . $lines . '" ';
$html .= 'name="data[' . $name . ']"';
$html .= $this->rendererHelper->renderInputPlaceholder($block);
$html .= $this->rendererHelper->getInputValidation($block);
$html .= $this->rendererHelper->getInputModifiers($block);
if ($styles) {
$html .= 'style="' . $this->wp->escAttr($styles) . '" ';
}
$html .= '>' . $this->rendererHelper->escapeShortCodes($this->rendererHelper->getFieldValue($block)) . '</textarea>';
$html .= $this->rendererHelper->renderErrorsContainer($block, $formId);
return $this->wrapper->render($block, $html);
}
}
@@ -0,0 +1 @@
<?php
@@ -0,0 +1,120 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class BlockStylesRenderer {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function renderForTextInput(array $styles, array $formSettings = []): string {
$rules = [];
if (isset($styles['full_width']) && intval($styles['full_width'])) {
$rules[] = 'width:100%;';
$rules[] = 'box-sizing:border-box;'; // to avoid a larger width increased by padding
}
if (isset($styles['background_color']) && empty($styles['gradient'])) {
$rules[] = "background-color:{$styles['background_color']};";
}
if (isset($styles['border_size']) || isset($styles['border_radius']) || isset($styles['border_color'])) {
$rules[] = "border-style:solid;";
}
if (isset($styles['border_radius'])) {
$rules[] = "border-radius:" . intval($styles['border_radius']) . "px !important;";
}
if (isset($styles['border_size'])) {
$rules[] = "border-width:" . intval($styles['border_size']) . "px;";
}
if (isset($styles['border_color'])) {
$rules[] = "border-color:{$styles['border_color']};";
}
if (isset($styles['padding'])) {
$rules[] = "padding:{$styles['padding']}px;";
} elseif (isset($formSettings['input_padding'])) {
$rules[] = "padding:{$formSettings['input_padding']}px;";
}
if (isset($formSettings['alignment'])) {
$rules[] = $this->convertAlignmentToMargin($formSettings['alignment']);
}
if (isset($styles['font_family'])) {
$rules[] = "font-family:'{$styles['font_family']}';" ;
} elseif (isset($formSettings['font_family'])) {
$rules[] = "font-family:'{$formSettings['font_family']}';" ;
}
if (isset($styles['font_size'])) {
$rules[] = "font-size:" . $styles['font_size'] . (is_numeric($styles['font_size']) ? "px;" : ";");
}
if (isset($formSettings['fontSize']) && !isset($styles['font_size'])) {
$rules[] = "font-size:" . $formSettings['fontSize'] . (is_numeric($formSettings['fontSize']) ? "px;" : ";");
}
if (isset($formSettings['fontSize']) || isset($styles['font_size'])) {
$rules[] = "line-height:1.5;";
$rules[] = "height:auto;";
}
if (isset($styles['font_color'])) {
$rules[] = "color:{$styles['font_color']};";
}
return implode('', $rules);
}
public function renderForButton(array $styles, array $formSettings = []): string {
$rules = [];
if (!isset($styles['border_color'])) {
$rules[] = "border-color:transparent;";
}
if (!empty($styles['gradient'])) {
$rules[] = "background: {$styles['gradient']};";
}
if (isset($styles['bold']) && $styles['bold'] === '1') {
$rules[] = "font-weight:bold;";
}
return $this->renderForTextInput($styles, $formSettings) . implode('', $rules);
}
public function renderForSelect(array $styles, array $formSettings = []): string {
$rules = [];
if (isset($formSettings['input_padding'])) {
$rules[] = "padding:{$formSettings['input_padding']}px;";
}
if (isset($formSettings['alignment'])) {
$rules[] = $this->convertAlignmentToMargin($formSettings['alignment']);
}
return implode('', $rules);
}
private function convertAlignmentToMargin(string $alignment): string {
if ($alignment === 'right') {
return 'margin: 0 0 0 auto;';
}
if ($alignment === 'center') {
return 'margin: 0 auto;';
}
return 'margin: 0 auto 0 0;';
}
public function renderPlaceholderStyles(array $block, string $selector): string {
if (
isset($block['params']['label_within'])
&& $block['params']['label_within']
&& isset($block['styles']['font_color'])
) {
return '<style>'
. $selector . '::placeholder{'
. 'color:' . $this->wp->escAttr($block['styles']['font_color']) . ';'
. 'opacity: 1;'
. '}'
. '</style>';
}
return '';
}
}
@@ -0,0 +1,24 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class BlockWrapperRenderer {
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function render(array $block, string $blockContent): string {
$classes = isset($block['params']['class_name']) ? " " . $block['params']['class_name'] : '';
return '<div class="mailpoet_paragraph' . $this->wp->escAttr($classes) . '">' . $blockContent . '</div>';
}
}
@@ -0,0 +1,183 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoet\Form\Block\Checkbox;
use MailPoet\Form\Block\Column;
use MailPoet\Form\Block\Columns;
use MailPoet\Form\Block\Date;
use MailPoet\Form\Block\Divider;
use MailPoet\Form\Block\Heading;
use MailPoet\Form\Block\Html;
use MailPoet\Form\Block\Image;
use MailPoet\Form\Block\Paragraph;
use MailPoet\Form\Block\Radio;
use MailPoet\Form\Block\Segment;
use MailPoet\Form\Block\Select;
use MailPoet\Form\Block\Submit;
use MailPoet\Form\Block\Text;
use MailPoet\Form\Block\Textarea;
use MailPoet\Util\Security;
class BlocksRenderer {
/** @var Checkbox */
private $checkbox;
/** @var Date */
private $date;
/** @var Divider */
private $divider;
/** @var Html */
private $html;
/** @var Image */
private $image;
/** @var Radio */
private $radio;
/** @var Segment */
private $segment;
/** @var Select */
private $select;
/** @var Submit */
private $submit;
/** @var Text */
private $text;
/** @var Textarea */
private $textarea;
/** @var Column */
private $column;
/** @var Columns */
private $columns;
/** @var Heading */
private $heading;
/** @var Paragraph */
private $paragraph;
public function __construct(
Checkbox $checkbox,
Column $column,
Columns $columns,
Date $date,
Divider $divider,
Html $html,
Image $image,
Heading $heading,
Paragraph $paragraph,
Radio $radio,
Segment $segment,
Select $select,
Submit $submit,
Text $text,
Textarea $textarea
) {
$this->checkbox = $checkbox;
$this->column = $column;
$this->columns = $columns;
$this->date = $date;
$this->divider = $divider;
$this->html = $html;
$this->image = $image;
$this->radio = $radio;
$this->segment = $segment;
$this->select = $select;
$this->submit = $submit;
$this->text = $text;
$this->textarea = $textarea;
$this->heading = $heading;
$this->paragraph = $paragraph;
}
public function renderBlock(array $block, array $formSettings, ?int $formId): string {
$html = '';
if ($formId) {
$formSettings['id'] = $formId;
}
// This is used to properly show validation message when
// the same form is rendered on a page multiple times
$block['validation_id'] = Security::generateRandomString();
switch ($block['type']) {
case FormEntity::HTML_BLOCK_TYPE:
$html .= $this->html->render($block, $formSettings);
break;
case FormEntity::HEADING_BLOCK_TYPE:
$html .= $this->heading->render($block);
break;
case FormEntity::IMAGE_BLOCK_TYPE:
$html .= $this->image->render($block);
break;
case FormEntity::PARAGRAPH_BLOCK_TYPE:
$html .= $this->paragraph->render($block);
break;
case FormEntity::DIVIDER_BLOCK_TYPE:
$html .= $this->divider->render($block);
break;
case FormEntity::CHECKBOX_BLOCK_TYPE:
$html .= $this->checkbox->render($block, $formSettings, $formId);
break;
case FormEntity::RADIO_BLOCK_TYPE:
$html .= $this->radio->render($block, $formSettings, $formId);
break;
case FormEntity::SEGMENT_SELECTION_BLOCK_TYPE:
$html .= $this->segment->render($block, $formSettings, $formId);
break;
case FormEntity::DATE_BLOCK_TYPE:
$html .= $this->date->render($block, $formSettings, $formId);
break;
case FormEntity::SELECT_BLOCK_TYPE:
$html .= $this->select->render($block, $formSettings, $formId);
break;
case FormEntity::TEXT_BLOCK_TYPE:
$html .= $this->text->render($block, $formSettings, $formId);
break;
case FormEntity::TEXTAREA_BLOCK_TYPE:
$html .= $this->textarea->render($block, $formSettings, $formId);
break;
case FormEntity::SUBMIT_BLOCK_TYPE:
$html .= $this->submit->render($block, $formSettings);
break;
}
return $html;
}
public function renderContainerBlock(array $block, string $content) {
$html = '';
switch ($block['type']) {
case FormEntity::COLUMNS_BLOCK_TYPE:
$html .= $this->columns->render($block, $content);
break;
case FormEntity::COLUMN_BLOCK_TYPE:
$html .= $this->column->render($block, $content);
break;
}
return $html;
}
}
@@ -0,0 +1,423 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\API\JSON\API;
use MailPoet\Config\Renderer as TemplateRenderer;
use MailPoet\Entities\FormEntity;
use MailPoet\Subscribers\SubscribersRepository;
use MailPoet\Subscribers\SubscriberSubscribeController;
use MailPoet\WooCommerce\Helper as WCHelper;
use MailPoet\WP\Functions as WPFunctions;
class DisplayFormInWPContent {
const NO_FORM_TRANSIENT_KEY = 'no_forms_displayed_bellow_content';
const TYPES = [
FormEntity::DISPLAY_TYPE_BELOW_POST,
FormEntity::DISPLAY_TYPE_POPUP,
FormEntity::DISPLAY_TYPE_FIXED_BAR,
FormEntity::DISPLAY_TYPE_SLIDE_IN,
];
const WITH_COOKIE_TYPES = [
FormEntity::DISPLAY_TYPE_POPUP,
FormEntity::DISPLAY_TYPE_FIXED_BAR,
FormEntity::DISPLAY_TYPE_SLIDE_IN,
];
const SUPPORTED_POST_TYPES = [
'post',
'product',
'job_listing',
];
/** @var WPFunctions */
private $wp;
/** @var FormsRepository */
private $formsRepository;
/** @var Renderer */
private $formRenderer;
/** @var AssetsController */
private $assetsController;
/** @var TemplateRenderer */
private $templateRenderer;
/** @var SubscribersRepository */
private $subscribersRepository;
/** @var SubscriberSubscribeController */
private $subscriberSubscribeController;
/** @var WCHelper */
private $woocommerceHelper;
private $wooShopPageId = null;
private $inWooProductLoop = false;
private $renderedDisplayTypes = [];
public function __construct(
WPFunctions $wp,
FormsRepository $formsRepository,
Renderer $formRenderer,
AssetsController $assetsController,
TemplateRenderer $templateRenderer,
SubscriberSubscribeController $subscriberSubscribeController,
SubscribersRepository $subscribersRepository,
WCHelper $woocommerceHelper
) {
$this->wp = $wp;
$this->formsRepository = $formsRepository;
$this->formRenderer = $formRenderer;
$this->assetsController = $assetsController;
$this->templateRenderer = $templateRenderer;
$this->subscriberSubscribeController = $subscriberSubscribeController;
$this->subscribersRepository = $subscribersRepository;
$this->woocommerceHelper = $woocommerceHelper;
}
private function getFormMarkup(): string {
$formMarkup = '';
$forms = $this->getForms();
if (count($forms) === 0) {
return $formMarkup;
}
foreach ($forms as $displayType => $form) {
$formMarkup .= $this->getContentBellow($form, $displayType);
}
return $formMarkup;
}
/**
* Hooked to the_content filter
*/
public function contentDisplay($content = null) {
$this->inWooProductLoop = false;
return $this->getContentWithFormMarkup($content);
}
/**
* Hooked to woocommerce_product_loop_end filter
*/
public function wooProductListDisplay($content = null) {
$this->inWooProductLoop = true;
return $this->getContentWithFormMarkup($content);
}
private function getContentWithFormMarkup($content = null) {
if (!is_string($content) || !$this->shouldDisplay()) {
return $content;
}
$formsMarkup = $this->getFormMarkup();
if ($formsMarkup === '') {
return $content;
}
$this->assetsController->setupFrontEndDependencies();
return $content . $formsMarkup;
}
/**
* Hooked to wp_footer action.
*
* @return void
*/
public function maybeRenderFormsInFooter(): void {
if ($this->wp->isArchive() || $this->wp->isFrontPage() || $this->wp->isHome() || $this->isWooProductPageWithoutContent()) {
$formMarkup = $this->getFormMarkup();
if (!empty($formMarkup)) {
$this->assetsController->setupFrontEndDependencies();
// We are in control of the template and the data can be considered safe at this point
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $formMarkup;
}
}
}
/**
* @return bool
*/
public function isWooProductPageWithoutContent(): bool {
if (
!$this->wp->isSingular('product')
|| !$this->wp->didAction('wp_footer')
) {
return false;
}
return $this->wp->getTheContent() === '';
}
private function shouldDisplay(): bool {
$result = true;
// This is a fix Yoast plugin and Shapely theme compatibility
// This is to make sure we only display once for each page
// Yoast plugin calls `get_the_excerpt` which also triggers hook `the_content` we don't want to include our form in that
// Shapely calls the hook `the_content` multiple times on the page as well and we would display popup multiple times - not ideal
if (!$this->wp->inTheLoop() || !$this->wp->isMainQuery()) {
$result = $this->wp->applyFilters('mailpoet_display_form_is_main_loop', false);
}
// this code ensures that we display the form only on a page which is related to single post
if (!$this->wp->isSingle() && !$this->wp->isPage()) $result = $this->wp->applyFilters('mailpoet_display_form_is_single', false);
// Ensure form does not show up multiple times when called from the woocommerce_product_loop_end filter
if ($this->inWooProductLoop) $result = $this->displayFormInProductListPage();
$noFormsCache = $this->wp->getTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY);
if ($noFormsCache === '1') $result = false;
return $result;
}
private function displayFormInProductListPage(): bool {
$displayCheck = $this->wp->applyFilters('mailpoet_display_form_in_product_listing', true);
$shopPageId = $this->woocommerceHelper->wcGetPageId('shop');
$this->wooShopPageId = $shopPageId && $shopPageId > 0 ? $shopPageId : null;
if ($displayCheck && !is_null($this->wooShopPageId) && $this->wp->isPage($this->wooShopPageId)) {
return true;
}
return $displayCheck && $this->wp->isArchive() && $this->wp->isPostTypeArchive('product');
}
private function saveNoForms() {
$this->wp->setTransient(DisplayFormInWPContent::NO_FORM_TRANSIENT_KEY, '1');
}
/**
* @return array<string, FormEntity>
*/
private function getForms(): array {
$forms = $this->formsRepository->findBy([
'deletedAt' => null,
'status' => FormEntity::STATUS_ENABLED,
], ['updatedAt' => 'ASC']);
if (count($forms) === 0) {
$this->saveNoForms();
}
$forms = $this->filterOneFormInEachDisplayType($forms);
return $forms;
}
/**
* @param FormEntity[] $forms
* @return array<string, FormEntity>
*/
private function filterOneFormInEachDisplayType($forms): array {
$formsFiltered = [];
foreach ($forms as $form) {
foreach (self::TYPES as $displayType) {
if ($this->shouldDisplayFormType($form, $displayType)) {
$formsFiltered[$displayType] = $form;
}
}
}
return $formsFiltered;
}
private function getContentBellow(FormEntity $form, string $displayType): string {
if (!$this->shouldDisplayFormType($form, $displayType)) return '';
$formSettings = $form->getSettings();
if (!is_array($formSettings)) return '';
$htmlId = 'mp_form_' . $displayType . $form->getId();
$templateData = [
'form_html_id' => $htmlId,
'form_id' => $form->getId(),
'form_success_message' => $formSettings['success_message'] ?? null,
'form_type' => $displayType,
'styles' => $this->formRenderer->renderStyles($form, '#' . $htmlId, $displayType),
'html' => $this->formRenderer->renderHTML($form),
'close_button_icon' => $formSettings['close_button'] ?? 'round_white',
];
// (POST) non ajax success/error variables
$templateData['success'] = (
(isset($_GET['mailpoet_success']))
&&
((int)$_GET['mailpoet_success'] === $form->getId())
);
$templateData['error'] = (
(isset($_GET['mailpoet_error']))
&&
((int)$_GET['mailpoet_error'] === $form->getId())
);
$templateData['delay'] = $formSettings['form_placement'][$displayType]['delay'] ?? 0;
$templateData['position'] = $formSettings['form_placement'][$displayType]['position'] ?? '';
$templateData['animation'] = $formSettings['form_placement'][$displayType]['animation'] ?? '';
$templateData['fontFamily'] = $formSettings['font_family'] ?? '';
$templateData['enableExitIntent'] = false;
// Set default value for cookie expiration for backward compatibility with forms without this value
$templateData['cookieFormExpirationTime'] = $formSettings['form_placement'][$displayType]['cookieExpiration'] ?? 7;
if (
isset($formSettings['form_placement'][$displayType]['exit_intent_enabled'])
&& ($formSettings['form_placement'][$displayType]['exit_intent_enabled'] === '1')
) {
$templateData['enableExitIntent'] = true;
}
// generate security token
$templateData['token'] = $this->wp->wpCreateNonce('mailpoet_token');
// add API version
$templateData['api_version'] = API::CURRENT_VERSION;
$this->renderedDisplayTypes[] = $displayType;
return $this->templateRenderer->render('form/front_end_form.html', $templateData);
}
/**
* Checks if the form should be displayed for current WordPress user
*
* @param FormEntity $form The form to check
* @param string $formType Display type of the current form, from self::TYPES
* @return bool False if form can be dismissed and user is subscribed to any of the form's lists
*/
private function shouldDisplayFormForWPUser(FormEntity $form, string $formType): bool {
if (!in_array($formType, self::WITH_COOKIE_TYPES, true)) return true;
$subscriber = $this->subscribersRepository->getCurrentWPUser();
if (!$subscriber) return true;
if ($this->subscriberSubscribeController->isSubscribedToAnyFormSegments($form, $subscriber)) {
return false;
}
return true;
}
private function shouldDisplayFormType(FormEntity $form, string $formType): bool {
if ($this->wasDisplayTypeAlreadyRendered($formType)) {
return false;
}
$settings = $form->getSettings();
// check the structure just to be sure
if (
!is_array($settings)
|| !isset($settings['form_placement'][$formType])
|| !is_array($settings['form_placement'][$formType])
) return false;
$setup = $settings['form_placement'][$formType];
if ($setup['enabled'] !== '1') {
return false;
}
if (!$this->shouldDisplayFormForWPUser($form, $formType)) return false;
if ($this->wp->isFrontPage() && $this->shouldDisplayFormOnFrontPage($setup)) {
return true;
}
/**
* This is a special case when a site is configured with a specific "Posts page" in the Settings > Reading
* WordPress settings. In that case, the only conditional function that returns true is is_home.
*/
if ((!$this->wp->isFrontPage() && $this->wp->isHome()) && $this->shouldDisplayFormOnHome($setup)) {
return true;
}
if ($this->wp->isSingular($this->wp->applyFilters('mailpoet_display_form_supported_post_types', self::SUPPORTED_POST_TYPES))) {
if ($this->shouldDisplayFormOnPost($setup, 'posts')) return true;
if ($this->shouldDisplayFormOnCategory($setup)) return true;
if ($this->shouldDisplayFormOnTag($setup)) return true;
return false;
}
if ($this->wp->isPage() && $this->shouldDisplayFormOnPost($setup, 'pages')) {
return true;
}
if ($this->wp->isTag() || $this->wp->isTax('product_tag')) {
if ($this->shouldDisplayFormOnTagArchive($setup)) return true;
}
if ($this->wp->isCategory() || $this->wp->isTax('product_cat')) {
if ($this->shouldDisplayFormOnCategoryArchive($setup)) return true;
}
if ($this->displayFormInProductListPage()) {
// Allow form display on Woo Shop listing page
if (is_null($this->wooShopPageId)) return false;
if ($this->shouldDisplayFormOnPost($setup, 'pages', $this->wooShopPageId)) return true;
}
return false;
}
private function shouldDisplayFormOnPost(array $setup, string $postsKey, $postId = null): bool {
if (!isset($setup[$postsKey])) {
return false;
}
if (isset($setup[$postsKey]['all']) && $setup[$postsKey]['all'] === '1') {
return true;
}
$post = $this->wp->getPost($postId, ARRAY_A);
if (isset($setup[$postsKey]['selected']) && in_array($post['ID'], $setup[$postsKey]['selected'])) {
return true;
}
return false;
}
private function shouldDisplayFormOnCategory(array $setup): bool {
if (!isset($setup['categories'])) return false;
if ($this->wp->hasCategory($setup['categories'])) return true;
if ($this->wp->hasTerm($setup['categories'], 'product_cat')) return true;
return false;
}
private function shouldDisplayFormOnTag(array $setup): bool {
if (!isset($setup['tags'])) return false;
if ($this->wp->hasTag($setup['tags'])) return true;
if ($this->wp->hasTerm($setup['tags'], 'product_tag')) return true;
return false;
}
private function shouldDisplayFormOnFrontPage(array $setup): bool {
if (($setup['homepage'] ?? false) === '1') {
return true;
}
return false;
}
private function shouldDisplayFormOnHome($setup) {
if (($setup['pages']['all'] ?? false) === '1') {
return true;
}
$selectedPages = $setup['pages']['selected'] ?? [];
if (in_array((string)$this->wp->getQueriedObjectId(), $selectedPages)) {
return true;
}
return false;
}
private function shouldDisplayFormOnCategoryArchive($setup): bool {
if (!isset($setup['categoryArchives'])) return false;
if (($setup['categoryArchives']['all'] ?? false) === '1') return true;
$selectedCategories = $setup['categoryArchives']['selected'] ?? [];
if ($selectedCategories === []) return false;
return $this->wp->hasCategory($selectedCategories) || $this->wp->hasTerm($selectedCategories, 'product_cat');
}
private function shouldDisplayFormOnTagArchive($setup): bool {
if (!isset($setup['tagArchives'])) return false;
if (($setup['tagArchives']['all'] ?? false) === '1') return true;
$selectedTags = $setup['tagArchives']['selected'] ?? [];
if ($selectedTags === []) return false;
return $this->wp->hasTag($selectedTags) || $this->wp->hasTerm($selectedTags, 'product_tag');
}
private function wasDisplayTypeAlreadyRendered(string $displayType): bool {
return in_array($displayType, $this->renderedDisplayTypes);
}
}
@@ -0,0 +1,64 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class FormHtmlSanitizer {
/**
* @var array
* Configuration of allowed tags for form blocks that may contain some html.
* Covers all tags available in the form editor's Rich Text component and which we allow in checkbox label.
* This doesn't cover CustomHTML block.
*/
const ALLOWED_HTML = [
'a' => [
'class' => true,
'href' => true,
'title' => true,
'data-id' => true,
'data-type' => true,
'target' => true,
'rel' => true,
],
'br' => [],
'code' => [],
'em' => [],
'img' => [
'class' => true,
'style' => true,
'src' => true,
'alt' => true,
],
'kbd' => [],
'span' => [
'style' => true,
'data-font' => true,
'class' => true,
],
'mark' => [
'style' => true,
'class' => true,
],
'strong' => [],
'sub' => [],
'sup' => [],
's' => [],
];
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function sanitize(string $html): string {
return $this->wp->wpKses($html, self::ALLOWED_HTML);
}
}
@@ -0,0 +1,51 @@
<?php declare(strict_types = 1);
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoet\Settings\SettingsController;
class FormMessageController {
/** @var FormsRepository */
private $formsRepository;
/** @var SettingsController */
private $settings;
public function __construct(
FormsRepository $formsRepository,
SettingsController $settingsController
) {
$this->formsRepository = $formsRepository;
$this->settings = $settingsController;
}
public function updateSuccessMessages(): void {
$rightMessage = $this->getDefaultSuccessMessage();
$wrongMessage = (
$rightMessage === __('Check your inbox or spam folder to confirm your subscription.', 'mailpoet')
? __('Youve been successfully subscribed to our newsletter!', 'mailpoet')
: __('Check your inbox or spam folder to confirm your subscription.', 'mailpoet')
);
/** @var FormEntity[] $forms */
$forms = $this->formsRepository->findAll();
foreach ($forms as $form) {
$settings = $form->getSettings();
if (isset($settings['success_message']) && $settings['success_message'] === $wrongMessage) {
$settings['success_message'] = $rightMessage;
$form->setSettings($settings);
$this->formsRepository->flush();
}
}
}
public function getDefaultSuccessMessage(): string {
if ($this->settings->get('signup_confirmation.enabled')) {
return __('Check your inbox or spam folder to confirm your subscription.', 'mailpoet');
}
return __('Youve been successfully subscribed to our newsletter!', 'mailpoet');
}
}
@@ -0,0 +1,38 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoetVendor\Carbon\Carbon;
use MailPoetVendor\Doctrine\ORM\EntityManager;
class FormSaveController {
/** @var EntityManager */
private $entityManager;
public function __construct(
EntityManager $entityManager
) {
$this->entityManager = $entityManager;
}
public function duplicate(FormEntity $formEntity): FormEntity {
$duplicate = clone $formEntity;
// translators: %s is name of the form which has been duplicated.
$duplicate->setName(sprintf(__('Copy of %s', 'mailpoet'), $formEntity->getName()));
// reset timestamps
$now = Carbon::now()->millisecond(0);
$duplicate->setCreatedAt($now);
$duplicate->setUpdatedAt($now);
$duplicate->setDeletedAt(null);
$this->entityManager->persist($duplicate);
$this->entityManager->flush();
return $duplicate;
}
}
@@ -0,0 +1,129 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Doctrine\Repository;
use MailPoet\Entities\FormEntity;
/**
* @extends Repository<FormEntity>
*/
class FormsRepository extends Repository {
protected function getEntityClassName() {
return FormEntity::class;
}
/**
* @return FormEntity[]
*/
public function findAllNotDeleted(): array {
return $this->entityManager
->createQueryBuilder()
->select('f')
->from(FormEntity::class, 'f')
->where('f.deletedAt IS NULL')
->orderBy('f.updatedAt', 'desc')
->getQuery()
->getResult();
}
public function getNamesOfFormsForSegments(): array {
$allNonDeletedForms = $this->findAllNotDeleted();
$nameMap = [];
foreach ($allNonDeletedForms as $form) {
$blockSegmentsIds = $form->getSettingsSegmentIds();
foreach ($blockSegmentsIds as $blockSegmentId) {
$nameMap[$blockSegmentId][] = $form->getName();
}
}
return $nameMap;
}
public function count(): int {
return (int)$this->doctrineRepository
->createQueryBuilder('f')
->select('count(f.id)')
->getQuery()
->getSingleScalarResult();
}
public function delete(FormEntity $form) {
$this->entityManager->remove($form);
$this->flush();
}
public function trash(FormEntity $form) {
$this->bulkTrash([$form->getId()]);
$this->entityManager->refresh($form);
}
public function restore(FormEntity $form) {
$this->bulkRestore([$form->getId()]);
$this->entityManager->refresh($form);
}
public function bulkTrash(array $ids): int {
if (empty($ids)) {
return 0;
}
$result = $this->entityManager->createQueryBuilder()
->update(FormEntity::class, 'f')
->set('f.deletedAt', 'CURRENT_TIMESTAMP()')
->where('f.id IN (:ids)')
->setParameter('ids', $ids)
->getQuery()->execute();
// update was done via DQL, make sure the entities are also refreshed in the entity manager
$this->refreshAll(function (FormEntity $entity) use ($ids) {
return in_array($entity->getId(), $ids, true);
});
return $result;
}
public function bulkRestore(array $ids): int {
if (empty($ids)) {
return 0;
}
$result = $this->entityManager->createQueryBuilder()
->update(FormEntity::class, 'f')
->set('f.deletedAt', ':deletedAt')
->where('f.id IN (:ids)')
->setParameter('deletedAt', null)
->setParameter('ids', $ids)
->getQuery()->execute();
// update was done via DQL, make sure the entities are also refreshed in the entity manager
$this->refreshAll(function (FormEntity $entity) use ($ids) {
return in_array($entity->getId(), $ids, true);
});
return $result;
}
public function bulkDelete(array $ids): int {
if (empty($ids)) {
return 0;
}
$result = $this->entityManager->createQueryBuilder()
->delete(FormEntity::class, 'f')
->where('f.id IN (:ids)')
->setParameter('ids', $ids)
->getQuery()->execute();
// delete was done via DQL, make sure the entities are also detached from the entity manager
$this->detachAll(function (FormEntity $entity) use ($ids) {
return in_array($entity->getId(), $ids, true);
});
return $result;
}
}
@@ -0,0 +1,77 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Listing;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoet\Listing\ListingDefinition;
use MailPoet\Listing\ListingRepository;
use MailPoetVendor\Doctrine\ORM\QueryBuilder;
class FormListingRepository extends ListingRepository {
public function getGroups(ListingDefinition $definition): array {
$queryBuilder = clone $this->queryBuilder;
$this->applyFromClause($queryBuilder);
$this->applyParameters($queryBuilder, $definition->getParameters());
// total count
$countQueryBuilder = clone $queryBuilder;
$countQueryBuilder->select('COUNT(f) AS formCount');
$countQueryBuilder->andWhere('f.deletedAt IS NULL');
$totalCount = (int)$countQueryBuilder->getQuery()->getSingleScalarResult();
// trashed count
$trashedCountQueryBuilder = clone $queryBuilder;
$trashedCountQueryBuilder->select('COUNT(f) AS formCount');
$trashedCountQueryBuilder->andWhere('f.deletedAt IS NOT NULL');
$trashedCount = (int)$trashedCountQueryBuilder->getQuery()->getSingleScalarResult();
return [
[
'name' => 'all',
'label' => __('All', 'mailpoet'),
'count' => $totalCount,
],
[
'name' => 'trash',
'label' => __('Trash', 'mailpoet'),
'count' => $trashedCount,
],
];
}
protected function applySelectClause(QueryBuilder $queryBuilder) {
$queryBuilder->select("PARTIAL f.{id,name,status,settings,createdAt,updatedAt,deletedAt}");
}
protected function applyFromClause(QueryBuilder $queryBuilder) {
$queryBuilder->from(FormEntity::class, 'f');
}
protected function applyGroup(QueryBuilder $queryBuilder, string $group) {
// include/exclude deleted
if ($group === 'trash') {
$queryBuilder->andWhere('f.deletedAt IS NOT NULL');
} else {
$queryBuilder->andWhere('f.deletedAt IS NULL');
}
}
protected function applySorting(QueryBuilder $queryBuilder, string $sortBy, string $sortOrder) {
$queryBuilder->addOrderBy("f.$sortBy", $sortOrder);
}
protected function applySearch(QueryBuilder $queryBuilder, string $search, array $parameters = []) {
// the parent class requires this method, but forms listing doesn't currently support this feature.
}
protected function applyFilters(QueryBuilder $queryBuilder, array $filters) {
// the parent class requires this method, but forms listing doesn't currently support this feature.
}
protected function applyParameters(QueryBuilder $queryBuilder, array $parameters) {
// the parent class requires this method, but forms listing doesn't currently support this feature.
}
}
@@ -0,0 +1 @@
<?php
@@ -0,0 +1,126 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Config\Renderer as TemplateRenderer;
use MailPoet\Entities\FormEntity;
use MailPoet\WP\Functions as WPFunctions;
class PreviewPage {
const PREVIEW_DATA_TRANSIENT_PREFIX = 'mailpoet_form_preview_';
const PREVIEW_DATA_EXPIRATION = 84600; // 1 DAY
/** @var WPFunctions */
private $wp;
/** @var Renderer */
private $formRenderer;
/** @var TemplateRenderer */
private $templateRenderer;
/** @var FormsRepository */
private $formRepository;
/** @var AssetsController */
private $assetsController;
public function __construct(
WPFunctions $wp,
Renderer $formRenderer,
TemplateRenderer $templateRenderer,
FormsRepository $formRepository,
AssetsController $assetsController
) {
$this->wp = $wp;
$this->formRenderer = $formRenderer;
$this->templateRenderer = $templateRenderer;
$this->formRepository = $formRepository;
$this->assetsController = $assetsController;
}
public function renderPage(int $formId, string $formType, string $editorUrl): string {
$this->assetsController->setupFormPreviewDependencies();
$formData = $this->fetchFormData($formId);
if (!$formData instanceof FormEntity) {
return '';
}
return $this->templateRenderer->render(
'form/form_preview.html',
[
'post' => $this->getPostContent(),
'form' => $this->getFormContent($formData, $formId, $formType, $editorUrl),
'formType' => $formType,
]
);
}
public function renderTitle($title = null, $id = null) {
if ($id !== $this->wp->getTheId()) {
return $title;
}
return __('Sample page to preview your form', 'mailpoet');
}
private function fetchFormData(int $id): ?FormEntity {
$formData = $this->wp->getTransient(self::PREVIEW_DATA_TRANSIENT_PREFIX . $id);
if (is_array($formData)) {
$form = new FormEntity($formData['name']);
$form->setId($formData['id'] ?? 0);
$form->setBody($formData['body']);
$form->setSettings($formData['settings']);
$form->setStyles($formData['styles']);
$form->setStatus($formData['status']);
return $form;
}
return $this->formRepository->findOneById($id);
}
private function getFormContent(FormEntity $form, int $formId, string $formDisplayType, string $editorUrl): string {
$settings = $form->getSettings();
$htmlId = 'mailpoet_form_preview_' . $formId;
$templateData = [
'is_preview' => true,
'editor_url' => $editorUrl,
'form_html_id' => $htmlId,
'form_id' => $formId,
'form_success_message' => $settings['success_message'] ?? null,
'form_type' => $formDisplayType,
'close_button_icon' => $settings['close_button'] ?? 'classic',
'styles' => $this->formRenderer->renderStyles($form, '#' . $htmlId, $formDisplayType),
'html' => $this->formRenderer->renderHTML($form),
'success' => false,
'error' => false,
'delay' => 1,
'position' => $settings['form_placement'][$formDisplayType]['position'] ?? '',
'animation' => $settings['form_placement'][$formDisplayType]['animation'] ?? '',
'fontFamily' => $settings['font_family'] ?? '',
];
$formPosition = $settings['form_placement'][$formDisplayType]['position'] ?? '';
if (!$formPosition && $formDisplayType === FormEntity::DISPLAY_TYPE_FIXED_BAR) {
$formPosition = 'top';
}
if (!$formPosition && $formDisplayType === FormEntity::DISPLAY_TYPE_SLIDE_IN) {
$formPosition = 'right';
}
$templateData['position'] = $formPosition;
return $this->templateRenderer->render('form/front_end_form.html', $templateData);
}
private function getPostContent(): string {
$posts = $this->wp->getPosts([
'numberposts' => 1,
'orderby' => 'date',
'order' => 'DESC',
'post_status' => 'publish',
'post_type' => 'post',
]);
if (!isset($posts[0])) {
return '';
}
return $posts[0]->post_content;
}
}
@@ -0,0 +1,32 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
class PreviewWidget extends \WP_Widget {
/** @var string */
private $formHtml;
public function __construct(
$formHtml
) {
$this->formHtml = $formHtml;
parent::__construct(
'mailpoet_form_preview',
'Dummy form form preview',
[]
);
}
/**
* Output the widget itself.
*/
public function widget($args, $instance = null) {
// We control the html
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo $this->formHtml;
}
}
@@ -0,0 +1,126 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form;
if (!defined('ABSPATH')) exit;
use MailPoet\Captcha\CaptchaConstants;
use MailPoet\Entities\FormEntity;
use MailPoet\Form\Templates\FormTemplate;
use MailPoet\Form\Util\CustomFonts;
use MailPoet\Form\Util\Styles;
use MailPoet\Settings\SettingsController;
class Renderer {
/** @var Styles */
private $styleUtils;
/** @var SettingsController */
private $settings;
/** @var BlocksRenderer */
private $blocksRenderer;
/** @var CustomFonts */
private $customFonts;
public function __construct(
Styles $styleUtils,
SettingsController $settings,
CustomFonts $customFonts,
BlocksRenderer $blocksRenderer
) {
$this->styleUtils = $styleUtils;
$this->settings = $settings;
$this->blocksRenderer = $blocksRenderer;
$this->customFonts = $customFonts;
}
public function renderStyles(FormEntity $form, string $prefix, string $displayType): string {
$this->customFonts->enqueueStyle();
$html = $this->styleUtils->prefixStyles($this->getCustomStyles($form), $prefix);
$html .= strip_tags($this->styleUtils->renderFormSettingsStyles($form, $prefix, $displayType));
return $html;
}
public function renderHTML(FormEntity $form = null): string {
if (($form instanceof FormEntity) && !empty($form->getBody()) && is_array($form->getSettings())) {
return $this->renderBlocks($form->getBody(), $form->getSettings() ?? [], $form->getId());
}
return '';
}
public function getCustomStyles(FormEntity $form = null): string {
if (($form instanceof FormEntity) && (strlen(trim($form->getStyles() ?? '')) > 0)) {
return strip_tags($form->getStyles() ?? '');
} else {
return FormTemplate::DEFAULT_STYLES;
}
}
public function renderBlocks(
array $blocks = [],
array $formSettings = [],
?int $formId = null,
bool $honeypotEnabled = true,
bool $captchaEnabled = true
): string {
// add honeypot for spambots
$html = ($honeypotEnabled) ? $this->renderHoneypot() : '';
foreach ($blocks as $key => $block) {
if (
$captchaEnabled
&& $block['type'] === FormEntity::SUBMIT_BLOCK_TYPE
&& CaptchaConstants::isRecaptcha($this->settings->get('captcha.type'))
) {
$html .= $this->renderReCaptcha();
}
if (in_array($block['type'], [FormEntity::COLUMN_BLOCK_TYPE, FormEntity::COLUMNS_BLOCK_TYPE])) {
$blocks = $block['body'] ?? [];
$html .= $this->blocksRenderer->renderContainerBlock($block, $this->renderBlocks($blocks, $formSettings, $formId, false)) . PHP_EOL;
} else {
$html .= $this->blocksRenderer->renderBlock($block, $formSettings, $formId) . PHP_EOL;
}
}
return $html;
}
private function renderHoneypot(): string {
return '<label class="mailpoet_hp_email_label" style="display: none !important;">' . __('Please leave this field empty', 'mailpoet') . '<input type="email" name="data[email]"/></label>';
}
private function renderReCaptcha(): string {
if ($this->settings->get('captcha.type') === CaptchaConstants::TYPE_RECAPTCHA) {
$siteKey = $this->settings->get('captcha.recaptcha_site_token');
$size = '';
} else {
$siteKey = $this->settings->get('captcha.recaptcha_invisible_site_token');
$size = 'invisible';
}
$html = '<div class="mailpoet_recaptcha" data-sitekey="' . $siteKey . '" ' . ($size === 'invisible' ? 'data-size="invisible"' : '') . '>
<div class="mailpoet_recaptcha_container"></div>
<noscript>
<div>
<div class="mailpoet_recaptcha_noscript_container">
<div>
<iframe src="https://www.google.com/recaptcha/api/fallback?k=' . $siteKey . '" frameborder="0" scrolling="no">
</iframe>
</div>
</div>
<div class="mailpoet_recaptcha_noscript_input">
<textarea id="g-recaptcha-response" name="data[recaptcha]" class="g-recaptcha-response">
</textarea>
</div>
</div>
</noscript>
<input class="mailpoet_recaptcha_field" type="hidden" name="recaptchaWidgetId">
</div>';
if ($size !== 'invisible') {
$html .= '<div class="parsley-errors-list parsley-required mailpoet_error_recaptcha">' . __('This field is required.', 'mailpoet') . '</div>';
}
return $html;
}
}
@@ -0,0 +1,168 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Entities\FormEntity;
use MailPoet\Settings\SettingsController;
use MailPoet\Util\CdnAssetUrl;
use MailPoet\Util\Helpers;
use MailPoet\WP\Functions as WPFunctions;
abstract class FormTemplate {
const DEFAULT_STYLES = <<<EOL
/* form */
.mailpoet_form {
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
/** @var CdnAssetUrl */
protected $cdnAssetUrl;
/** @var WPFunctions */
protected $wp;
/** @var string */
protected $assetsDirectory = '';
/** @var SettingsController */
private $settings;
public function __construct(
CdnAssetUrl $cdnAssetUrl,
SettingsController $settings,
WPFunctions $wp
) {
$this->cdnAssetUrl = $cdnAssetUrl;
$this->wp = $wp;
$this->settings = $settings;
}
abstract public function getName(): string;
abstract public function getBody(): array;
abstract public function getThumbnailUrl(): string;
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => null,
'segments_selected_by' => 'admin',
];
}
public function getStyles(): string {
return self::DEFAULT_STYLES;
}
public function toFormEntity(): FormEntity {
$formEntity = new FormEntity($this->getName());
$formEntity->setBody($this->getBody());
$formEntity->setSettings($this->getSettings());
$formEntity->setStyles($this->getStyles());
$settings = $formEntity->getSettings();
if (!isset($settings['success_message']) || !($settings['success_message'])) {
$settings['success_message'] = $this->getDefaultSuccessMessage();
$formEntity->setSettings($settings);
}
return $formEntity;
}
private function getDefaultSuccessMessage() {
if ($this->settings->get('signup_confirmation.enabled')) {
return __('Check your inbox or spam folder to confirm your subscription.', 'mailpoet');
}
return __('Youve been successfully subscribed to our newsletter!', 'mailpoet');
}
protected function getAssetUrl(string $filename): string {
return $this->cdnAssetUrl->generateCdnUrl("form-templates/{$this->assetsDirectory}/$filename");
}
protected function replaceLinkTags($source, $link, $attributes = []): string {
return Helpers::replaceLinkTags($source, $link, $attributes);
}
protected function replacePrivacyLinkTags($source, $link = '#'): string {
$privacyPolicyUrl = $this->wp->getPrivacyPolicyUrl();
$attributes = [];
if (!empty($privacyPolicyUrl)) {
$link = $this->wp->escUrl($privacyPolicyUrl);
$attributes = ['target' => '_blank'];
}
return $this->replaceLinkTags($source, $link, $attributes);
}
}
@@ -0,0 +1,182 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\Templates\InitialForm;
use MailPoet\Form\Templates\Templates\Template10BelowPages;
use MailPoet\Form\Templates\Templates\Template10FixedBar;
use MailPoet\Form\Templates\Templates\Template10Popup;
use MailPoet\Form\Templates\Templates\Template10SlideIn;
use MailPoet\Form\Templates\Templates\Template10Widget;
use MailPoet\Form\Templates\Templates\Template11BelowPages;
use MailPoet\Form\Templates\Templates\Template11FixedBar;
use MailPoet\Form\Templates\Templates\Template11Popup;
use MailPoet\Form\Templates\Templates\Template11SlideIn;
use MailPoet\Form\Templates\Templates\Template11Widget;
use MailPoet\Form\Templates\Templates\Template12BelowPages;
use MailPoet\Form\Templates\Templates\Template12FixedBar;
use MailPoet\Form\Templates\Templates\Template12Popup;
use MailPoet\Form\Templates\Templates\Template12SlideIn;
use MailPoet\Form\Templates\Templates\Template12Widget;
use MailPoet\Form\Templates\Templates\Template13BelowPages;
use MailPoet\Form\Templates\Templates\Template13FixedBar;
use MailPoet\Form\Templates\Templates\Template13Popup;
use MailPoet\Form\Templates\Templates\Template13SlideIn;
use MailPoet\Form\Templates\Templates\Template13Widget;
use MailPoet\Form\Templates\Templates\Template14BelowPages;
use MailPoet\Form\Templates\Templates\Template14FixedBar;
use MailPoet\Form\Templates\Templates\Template14Popup;
use MailPoet\Form\Templates\Templates\Template14SlideIn;
use MailPoet\Form\Templates\Templates\Template14Widget;
use MailPoet\Form\Templates\Templates\Template17BelowPages;
use MailPoet\Form\Templates\Templates\Template17FixedBar;
use MailPoet\Form\Templates\Templates\Template17Popup;
use MailPoet\Form\Templates\Templates\Template17SlideIn;
use MailPoet\Form\Templates\Templates\Template17Widget;
use MailPoet\Form\Templates\Templates\Template18BelowPages;
use MailPoet\Form\Templates\Templates\Template18FixedBar;
use MailPoet\Form\Templates\Templates\Template18Popup;
use MailPoet\Form\Templates\Templates\Template18SlideIn;
use MailPoet\Form\Templates\Templates\Template18Widget;
use MailPoet\Form\Templates\Templates\Template1BelowPages;
use MailPoet\Form\Templates\Templates\Template1FixedBar;
use MailPoet\Form\Templates\Templates\Template1Popup;
use MailPoet\Form\Templates\Templates\Template1SlideIn;
use MailPoet\Form\Templates\Templates\Template1Widget;
use MailPoet\Form\Templates\Templates\Template3BelowPages;
use MailPoet\Form\Templates\Templates\Template3FixedBar;
use MailPoet\Form\Templates\Templates\Template3Popup;
use MailPoet\Form\Templates\Templates\Template3SlideIn;
use MailPoet\Form\Templates\Templates\Template3Widget;
use MailPoet\Form\Templates\Templates\Template4BelowPages;
use MailPoet\Form\Templates\Templates\Template4FixedBar;
use MailPoet\Form\Templates\Templates\Template4Popup;
use MailPoet\Form\Templates\Templates\Template4SlideIn;
use MailPoet\Form\Templates\Templates\Template4Widget;
use MailPoet\Form\Templates\Templates\Template6BelowPages;
use MailPoet\Form\Templates\Templates\Template6FixedBar;
use MailPoet\Form\Templates\Templates\Template6Popup;
use MailPoet\Form\Templates\Templates\Template6SlideIn;
use MailPoet\Form\Templates\Templates\Template6Widget;
use MailPoet\Form\Templates\Templates\Template7BelowPages;
use MailPoet\Form\Templates\Templates\Template7FixedBar;
use MailPoet\Form\Templates\Templates\Template7Popup;
use MailPoet\Form\Templates\Templates\Template7SlideIn;
use MailPoet\Form\Templates\Templates\Template7Widget;
use MailPoet\Settings\SettingsController;
use MailPoet\UnexpectedValueException;
use MailPoet\Util\CdnAssetUrl;
use MailPoet\WP\Functions as WPFunctions;
class TemplateRepository {
const INITIAL_FORM_TEMPLATE = InitialForm::ID;
/** @var CdnAssetUrl */
private $cdnAssetUrl;
/** @var WPFunctions */
private $wp;
/** @var SettingsController */
private $settings;
private $templates = [
InitialForm::ID => InitialForm::class,
Template1BelowPages::ID => Template1BelowPages::class,
Template1FixedBar::ID => Template1FixedBar::class,
Template1Popup::ID => Template1Popup::class,
Template1SlideIn::ID => Template1SlideIn::class,
Template1Widget::ID => Template1Widget::class,
Template3BelowPages::ID => Template3BelowPages::class,
Template3FixedBar::ID => Template3FixedBar::class,
Template3Popup::ID => Template3Popup::class,
Template3SlideIn::ID => Template3SlideIn::class,
Template3Widget::ID => Template3Widget::class,
Template4BelowPages::ID => Template4BelowPages::class,
Template4FixedBar::ID => Template4FixedBar::class,
Template4Popup::ID => Template4Popup::class,
Template4SlideIn::ID => Template4SlideIn::class,
Template4Widget::ID => Template4Widget::class,
Template6BelowPages::ID => Template6BelowPages::class,
Template6FixedBar::ID => Template6FixedBar::class,
Template6Popup::ID => Template6Popup::class,
Template6SlideIn::ID => Template6SlideIn::class,
Template6Widget::ID => Template6Widget::class,
Template7BelowPages::ID => Template7BelowPages::class,
Template7FixedBar::ID => Template7FixedBar::class,
Template7Popup::ID => Template7Popup::class,
Template7SlideIn::ID => Template7SlideIn::class,
Template7Widget::ID => Template7Widget::class,
Template10BelowPages::ID => Template10BelowPages::class,
Template10FixedBar::ID => Template10FixedBar::class,
Template10Popup::ID => Template10Popup::class,
Template10SlideIn::ID => Template10SlideIn::class,
Template10Widget::ID => Template10Widget::class,
Template11BelowPages::ID => Template11BelowPages::class,
Template11FixedBar::ID => Template11FixedBar::class,
Template11Popup::ID => Template11Popup::class,
Template11SlideIn::ID => Template11SlideIn::class,
Template11Widget::ID => Template11Widget::class,
Template12BelowPages::ID => Template12BelowPages::class,
Template12FixedBar::ID => Template12FixedBar::class,
Template12Popup::ID => Template12Popup::class,
Template12SlideIn::ID => Template12SlideIn::class,
Template12Widget::ID => Template12Widget::class,
Template13BelowPages::ID => Template13BelowPages::class,
Template13FixedBar::ID => Template13FixedBar::class,
Template13Popup::ID => Template13Popup::class,
Template13SlideIn::ID => Template13SlideIn::class,
Template13Widget::ID => Template13Widget::class,
Template14BelowPages::ID => Template14BelowPages::class,
Template14FixedBar::ID => Template14FixedBar::class,
Template14Popup::ID => Template14Popup::class,
Template14SlideIn::ID => Template14SlideIn::class,
Template14Widget::ID => Template14Widget::class,
Template17BelowPages::ID => Template17BelowPages::class,
Template17FixedBar::ID => Template17FixedBar::class,
Template17Popup::ID => Template17Popup::class,
Template17SlideIn::ID => Template17SlideIn::class,
Template17Widget::ID => Template17Widget::class,
Template18BelowPages::ID => Template18BelowPages::class,
Template18FixedBar::ID => Template18FixedBar::class,
Template18Popup::ID => Template18Popup::class,
Template18SlideIn::ID => Template18SlideIn::class,
Template18Widget::ID => Template18Widget::class,
];
public function __construct(
CdnAssetUrl $cdnAssetUrl,
SettingsController $settings,
WPFunctions $wp
) {
$this->cdnAssetUrl = $cdnAssetUrl;
$this->wp = $wp;
$this->settings = $settings;
}
public function getFormTemplate(string $templateId): FormTemplate {
if (!isset($this->templates[$templateId])) {
throw UnexpectedValueException::create()
->withErrors(["Template with id $templateId doesn't exist."]);
}
/** @var FormTemplate $template */
$template = new $this->templates[$templateId]($this->cdnAssetUrl, $this->settings, $this->wp);
return $template;
}
/**
* @param string[] $templateIds
* @return FormTemplate[] associative array with template ids as keys
*/
public function getFormTemplates(array $templateIds): array {
$result = [];
foreach ($templateIds as $templateId) {
$result[$templateId] = $this->getFormTemplate($templateId);
}
return $result;
}
}
@@ -0,0 +1,49 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class InitialForm extends FormTemplate {
const ID = 'initial_form';
public function getName(): string {
return '';
}
public function getThumbnailUrl(): string {
return '';
}
public function getBody(): array {
return [
[
'id' => 'email',
'name' => __('Email', 'mailpoet'),
'type' => 'text',
'params' => [
'label' => __('Email Address', 'mailpoet'),
'required' => true,
'label_within' => true,
],
'styles' => [
'full_width' => true,
],
],
[
'id' => 'submit',
'name' => __('Submit', 'mailpoet'),
'type' => 'submit',
'params' => [
'label' => __('Subscribe!', 'mailpoet'),
],
'styles' => [
'full_width' => true,
],
],
];
}
}
@@ -0,0 +1,303 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template10BelowPages extends FormTemplate {
const ID = 'template_10_below_pages';
/** @var string */
protected $assetsDirectory = 'template-10';
public function getName(): string {
return _x('Keep in Touch', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('LETS KEEP IN TOUCH!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '48',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('Wed love to keep you updated with our latest news and offers', 'Text in a web form.', 'mailpoet') . '</span> ' . $this->wp->wpStaticizeEmoji('😎'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'line_height' => '1',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Whats your name?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('And your surname?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'last_name',
'name' => 'Last name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Keep me posted!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ff6900',
'font_size' => '20',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '12',
'font_family' => 'Ubuntu',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.2',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'below_post_styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '4',
'border_size' => '0',
'form_padding' => '40',
'input_padding' => '12',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'classic_white',
'segments_selected_by' => 'admin',
'fontColor' => '#ffffff',
'gradient' => 'linear-gradient(180deg,rgb(70,219,232) 0%,rgb(197,222,213) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'font_family' => 'Ubuntu',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,341 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template10FixedBar extends FormTemplate {
const ID = 'template_10_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-10';
public function getName(): string {
return _x('Keep in Touch', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('LETS KEEP IN TOUCH!', 'Text in a web form.', 'mailpoet') . '</span></strong> ' . $this->wp->wpStaticizeEmoji('😎'),
'level' => '2',
'align' => 'left',
'font_size' => '40',
'text_color' => '#ffffff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Wed love to keep you updated with our latest news! We promise well never spam. Take a look at our [link]Privacy Policy[/link] for more details.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '20',
'line_height' => '1.2',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Whats your name?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('And your surname?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'last_name',
'name' => 'Last name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('Keep me posted!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ff6900',
'font_size' => '21',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '12',
'font_family' => 'Ubuntu',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'position' => 'bottom',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '40',
'input_padding' => '12',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'classic_white',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(70,219,232) 0%,rgb(197,222,213) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'font_family' => 'Ubuntu',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,273 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template10Popup extends FormTemplate {
const ID = 'template_10_popup';
/** @var string */
protected $assetsDirectory = 'template-10';
public function getName(): string {
return _x('Keep in Touch', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('LETS KEEP IN TOUCH!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '50',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('Wed love to keep you updated with our latest news and offers', 'Text in a web form.', 'mailpoet') . '</span> ' . $this->wp->wpStaticizeEmoji('😎'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'line_height' => '1',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Whats your name?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('And your surname?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'last_name',
'name' => 'Last name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Keep me posted!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ff6900',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'padding' => '12',
'font_family' => 'Ubuntu',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.2',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '440',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '40',
'input_padding' => '12',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'classic_white',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(70,219,232) 0%,rgb(197,222,213) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'font_family' => 'Ubuntu',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,272 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template10SlideIn extends FormTemplate {
const ID = 'template_10_slide_in';
/** @var string */
protected $assetsDirectory = 'template-10';
public function getName(): string {
return _x('Keep in Touch', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('LETS KEEP IN TOUCH!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '50',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('Wed love to keep you updated with our latest news and offers', 'Text in a web form.', 'mailpoet') . '</span> ' . $this->wp->wpStaticizeEmoji('😎'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'line_height' => '1',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Whats your name?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('And your surname?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'last_name',
'name' => 'Last name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Keep me posted!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ff6900',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'padding' => '12',
'font_family' => 'Ubuntu',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.2',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'form_position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '420',
],
],
],
'others' => [],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '40',
'input_padding' => '12',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'classic_white',
'segments_selected_by' => 'admin',
'fontColor' => '#ffffff',
'gradient' => 'linear-gradient(180deg,rgb(70,219,232) 0%,rgb(197,222,213) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'font_family' => 'Ubuntu',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,273 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template10Widget extends FormTemplate {
const ID = 'template_10_widget';
/** @var string */
protected $assetsDirectory = 'template-10';
public function getName(): string {
return _x('Keep in Touch', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('LETS KEEP IN TOUCH!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '25',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . _x('Wed love to keep you updated with our latest news and offers', 'Text in a web form.', 'mailpoet') . '</span> ' . $this->wp->wpStaticizeEmoji('😎'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '18',
'line_height' => '1',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Whats your name?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('And your surname?', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'last_name',
'name' => 'Last name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#5b8ba7',
'border_size' => '0',
'border_radius' => '4',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Keep me posted!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ff6900',
'font_size' => '20',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'padding' => '12',
'font_family' => 'Ubuntu',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.2',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '15',
'input_padding' => '12',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'classic_white',
'segments_selected_by' => 'admin',
'fontColor' => '#ffffff',
'gradient' => 'linear-gradient(180deg,rgb(70,219,232) 0%,rgb(197,222,213) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'font_family' => 'Ubuntu',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,376 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template11BelowPages extends FormTemplate {
const ID = 'template_11_below_pages';
/** @var string */
protected $assetsDirectory = 'template-11';
public function getName(): string {
return _x('Priority List', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '30',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'left',
'url' => $this->getAssetUrl('soundicon.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '68',
'height' => '69',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '70',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('DONT MISS A BEAT', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'left',
'font_size' => '25',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . _x('Be the first to know when our album is released on <strong>iTunes</strong> and <strong><span style="color:#01d386" class="has-inline-color">Spotify</span></strong>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => 'center',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#4c537e',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#4c537e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Guitarist-787x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#27282e',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'value' => '100',
'unit' => 'percent',
],
],
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '3',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '15',
'font_family' => 'Fira Sans',
'close_button' => 'classic_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:first-child,
.mailpoet_form_column:first-child {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 15px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,326 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template11FixedBar extends FormTemplate {
const ID = 'template_11_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-11';
public function getName(): string {
return _x('Priority List', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'top',
'width' => '7',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('soundicon.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '68',
'height' => '69',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '31',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('DONT MISS A BEAT', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'left',
'font_size' => '25',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . _x('Be the first to know when our album is released on <strong>iTunes</strong> and <strong><span style="color:#01d386" class="has-inline-color">Spotify</span></strong>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '31',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#4c537e',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '31',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#4c537e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#27282e',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'top',
'animation' => 'slideup',
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'below_posts' => ['enabled' => ''],
'slide_in' => ['enabled' => '',],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '10',
'input_padding' => '10',
'font_family' => 'Fira Sans',
'close_button' => 'classic_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h2.mailpoet-heading {
margin-bottom: 6px;
margin-top: -3px;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 10px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,347 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template11Popup extends FormTemplate {
const ID = 'template_11_popup';
/** @var string */
protected $assetsDirectory = 'template-11';
public function getName(): string {
return _x('Priority List', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('soundicon.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '68',
'height' => '69',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('DONT MISS A BEAT', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '22',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . _x('Be the first to know when our album is released on <strong>iTunes</strong> and <strong><span style="color:#01d386" class="has-inline-color">Spotify</span></strong>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#4c537e',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#4c537e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Guitarist-787x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#27282e',
'form_placement' => [
'popup' => [
'enabled' => '1',
'exit_intent_enabled' => '',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '600',
],
],
'animation' => 'slideup',
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => '',],
'slide_in' => ['enabled' => '',],
'others' => [],
],
'border_radius' => '3',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Fira Sans',
'close_button' => 'classic_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:first-child,
.mailpoet_form_column:first-child {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 12px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,346 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template11SlideIn extends FormTemplate {
const ID = 'template_11_slide_in';
/** @var string */
protected $assetsDirectory = 'template-11';
public function getName(): string {
return _x('Priority List', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('soundicon.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '68',
'height' => '69',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('DONT MISS A BEAT', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '22',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . _x('Be the first to know when our album is released on <strong>iTunes</strong> and <strong><span style="color:#01d386" class="has-inline-color">Spotify</span></strong>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#4c537e',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#4c537e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Guitarist-787x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#27282e',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '600',
],
],
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'others' => [],
],
'border_radius' => '3',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Fira Sans',
'close_button' => 'classic_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:first-child,
.mailpoet_form_column:first-child {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 12px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,278 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template11Widget extends FormTemplate {
const ID = 'template_11_widget';
/** @var string */
protected $assetsDirectory = 'template-11';
public function getName(): string {
return _x('Priority List', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('soundicon.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '68',
'height' => '69',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('DONT MISS A BEAT', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . _x('Be the first to know when our album is released on <strong>iTunes</strong> and <strong><span style="color:#01d386" class="has-inline-color">Spotify</span></strong>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#4c537e',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#4c537e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#27282e',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => '',],
'slide_in' => ['enabled' => '',],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '3',
'border_size' => '0',
'form_padding' => '15',
'input_padding' => '10',
'font_family' => 'Fira Sans',
'close_button' => 'classic_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
h2.mailpoet-heading {
margin: 0 0 12px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,318 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template12BelowPages extends FormTemplate {
const ID = 'template_12_below_pages';
/** @var string */
protected $assetsDirectory = 'template-12';
public function getName(): string {
return _x('Limited Time Offer', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '33',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Fashion-Image-1.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '67',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('DEAL<span style="color:#e04f8e" class="has-inline-color">WEEK</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'left',
'font_size' => '45',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('<strong>SUBSCRIBE</strong> AND <strong><span style="color:#e04f8e" class="has-inline-color">GET 20% OFF</span></strong> YOUR NEXT ORDER! <strong>OFFER ENDS SOON</strong> - DONT MISS OUT!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '20',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Full Name', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET 20% OFF', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#e04f8e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#ffffff',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Cairo',
'close_button' => 'square_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'border_color' => '#000000',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
::placeholder {
color: black;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 25px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,359 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template12FixedBar extends FormTemplate {
const ID = 'template_12_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-12';
public function getName(): string {
return _x('Limited Time Offer', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('DEAL<span style="color:#e04f8e" class="has-inline-color">WEEK</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'left',
'font_size' => '36',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Full Name', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('GET 20% OFF', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#e04f8e',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Cairo',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '65',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('<strong>SUBSCRIBE</strong> AND <strong><span style="color:#e04f8e" class="has-inline-color">GET 20% OFF</span></strong> YOUR NEXT ORDER! <strong>OFFER ENDS SOON</strong> - DONT MISS OUT!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '17',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '35',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'right',
'font_size' => '15',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'top',
'animation' => 'slideup',
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'below_posts' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Cairo',
'close_button' => 'square_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'gradient' => 'linear-gradient(230deg,rgba(255,159,218,0.7) 0%,rgb(255,255,255) 41%)',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
::placeholder {
color: black;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 5px;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,334 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template12Popup extends FormTemplate {
const ID = 'template_12_popup';
/** @var string */
protected $assetsDirectory = 'template-12';
public function getName(): string {
return _x('Limited Time Offer', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Fashion-Image-1.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('DEAL<span style="color:#e04f8e" class="has-inline-color">WEEK</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'left',
'font_size' => '35',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('<strong>SUBSCRIBE</strong> AND <strong><span style="color:#e04f8e" class="has-inline-color">GET 20% OFF</span></strong> YOUR NEXT ORDER! <strong>OFFER ENDS SOON</strong> - DONT MISS OUT!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '17',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Full Name', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET 20% OFF', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#e04f8e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '1',
'exit_intent_enabled' => '',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '580',
],
],
'animation' => 'slideup',
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Cairo',
'close_button' => 'square_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'gradient' => 'linear-gradient(230deg,rgba(255,159,218,0.7) 0%,rgb(255,255,255) 32%)',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
::placeholder {
color: black;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,334 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template12SlideIn extends FormTemplate {
const ID = 'template_12_slide_in';
/** @var string */
protected $assetsDirectory = 'template-12';
public function getName(): string {
return _x('Limited Time Offer', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('Fashion-Image-1.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('DEAL<span style="color:#e04f8e" class="has-inline-color">WEEK</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'left',
'font_size' => '35',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('<strong>SUBSCRIBE</strong> AND <strong><span style="color:#e04f8e" class="has-inline-color">GET 20% OFF</span></strong> YOUR NEXT ORDER! <strong>OFFER ENDS SOON</strong> - DONT MISS OUT!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '17',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Full Name', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET 20% OFF', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#e04f8e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '580',
],
],
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Cairo',
'close_button' => 'square_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'gradient' => 'linear-gradient(230deg,rgba(255,159,218,0.7) 0%,rgb(255,255,255) 30%)',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
::placeholder {
color: black;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,256 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template12Widget extends FormTemplate {
const ID = 'template_12_widget';
/** @var string */
protected $assetsDirectory = 'template-12';
public function getName(): string {
return _x('Limited Time Offer', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('DEAL<span style="color:#e04f8e" class="has-inline-color">WEEK</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'left',
'font_size' => '35',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('<strong>SUBSCRIBE</strong> AND <strong><span style="color:#e04f8e" class="has-inline-color">GET 20% OFF</span></strong> YOUR NEXT ORDER! <strong>OFFER ENDS SOON</strong> - DONT MISS OUT!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '17',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Full Name', 'Form label', 'mailpoet'),
'class_name' => '',
'label_within' => '1',
],
'id' => 'first_name',
'name' => 'First name',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#000000',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET 20% OFF', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#e04f8e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
'padding' => '10',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '15',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'backgroundColor' => '#ffffff',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Cairo',
'close_button' => 'square_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
::placeholder {
color: black;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,321 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template13BelowPages extends FormTemplate {
const ID = 'template_13_below_pages';
/** @var string */
protected $assetsDirectory = 'template-13';
public function getName(): string {
return _x('Restaurant Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('pic-684x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '75',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '5',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '4',
'divider_width' => '20',
'color' => '#dcb64b',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('10% OFF YOUR BILL', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . _x('SUBSCRIBE TO OUR NEWSLETTER AND SAVE 10% NEXT TIME YOU DINE IN', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '16',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#eeeeee',
'font_color' => '#707070',
'border_size' => '0',
'border_radius' => '0',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#dcb64b',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '0',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Titillium Web',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,334 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template13FixedBar extends FormTemplate {
const ID = 'template_13_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-13';
public function getName(): string {
return _x('Restaurant Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('pic-684x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '5',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '4',
'divider_width' => '20',
'color' => '#dcb64b',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('10% OFF YOUR BILL', 'Text in a web form', 'mailpoet') . '</strong></span>', // @todo Add translations, links and emoji processing.,
'level' => '2',
'align' => 'center',
'font_size' => '24',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . _x('SUBSCRIBE TO OUR NEWSLETTER AND SAVE 10% NEXT TIME YOU DINE IN', 'Text in a web form', 'mailpoet') . '</span><br>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '30',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#eeeeee',
'font_color' => '#707070',
'border_size' => '0',
'border_radius' => '0',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#dcb64b',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '0',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'top',
'animation' => 'slideup',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Titillium Web',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,322 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template13Popup extends FormTemplate {
const ID = 'template-13-popup';
/** @var string */
protected $assetsDirectory = 'template-13';
public function getName(): string {
return _x('Restaurant Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('pic-684x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '5',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '4',
'divider_width' => '20',
'color' => '#dcb64b',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('10% OFF YOUR BILL', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . _x('SUBSCRIBE TO OUR NEWSLETTER AND SAVE 10% NEXT TIME YOU DINE IN', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '16',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#eeeeee',
'font_color' => '#707070',
'border_size' => '0',
'border_radius' => '0',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#dcb64b',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '0',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '600',
],
],
'animation' => 'slideup',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Titillium Web',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,323 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template13SlideIn extends FormTemplate {
const ID = 'template_13_slide_in';
/** @var string */
protected $assetsDirectory = 'template-13';
public function getName(): string {
return _x('Restaurant Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => '',
'url' => $this->getAssetUrl('pic-684x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '5',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '4',
'divider_width' => '20',
'color' => '#dcb64b',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('10% OFF YOUR BILL', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . _x('SUBSCRIBE TO OUR NEWSLETTER AND SAVE 10% NEXT TIME YOU DINE IN', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '16',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#eeeeee',
'font_color' => '#707070',
'border_size' => '0',
'border_radius' => '0',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#dcb64b',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '0',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '600',
],
],
],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Titillium Web',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,307 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template13Widget extends FormTemplate {
const ID = 'template_13_widget';
/** @var string */
protected $assetsDirectory = 'template-13';
public function getName(): string {
return _x('Restaurant Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '5',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '4',
'divider_width' => '20',
'color' => '#dcb64b',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font"><strong>' . _x('10% OFF YOUR BILL', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '#ffffff',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . _x('SUBSCRIBE TO OUR NEWSLETTER AND SAVE 10% NEXT TIME YOU DINE IN', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'text_color' => '',
'background_color' => '#ffffff',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#eeeeee',
'font_color' => '#707070',
'border_size' => '0',
'border_radius' => '0',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE LIST', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#dcb64b',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '0',
'padding' => '10',
'font_family' => 'Fira Sans',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#000000',
'background_color' => '#ffffff',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [
'styles' => [
'width' => [
'value' => '100',
'unit' => 'percent',
],
],
],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Titillium Web',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
'background_image_url' => $this->getAssetUrl('pic-684x1024.jpg'),
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,306 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template14BelowPages extends FormTemplate {
const ID = 'template_14_below_pages';
/** @var string */
protected $assetsDirectory = 'template-14';
public function getName(): string {
return _x('Lifestyle Blog', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '25',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('pic-1-682x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '75',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Nothing You Could Do" data-font="Nothing You Could Do" class="mailpoet-has-font"><strong>' . _x('WANT MORE?', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . _x('SIGN UP TO RECEIVE THE LATEST LIFESTYLE TIPS & TRICKS, PLUS SOME EXCLUSIVE GOODIES!', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '16',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#faf6f1',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('LETS DO THIS!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#edd4b5',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'padding' => '10',
'font_family' => 'Karla',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '4',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Karla',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,319 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template14FixedBar extends FormTemplate {
const ID = 'template_14_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-14';
public function getName(): string {
return _x('Lifestyle Blog', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('pic-1-682x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Nothing You Could Do" data-font="Nothing You Could Do" class="mailpoet-has-font"><strong>' . _x('WANT MORE?', 'Text in a web form', 'mailpoet') . '</strong></span>', // @todo Add translations, links and emoji processing.,
'level' => '2',
'align' => 'center',
'font_size' => '24',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . _x('SIGN UP TO RECEIVE THE LATEST LIFESTYLE TIPS & TRICKS, PLUS SOME EXCLUSIVE GOODIES!', 'Text in a web form', 'mailpoet') . '</span><br><span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '30',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#faf6f1',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('LETS DO THIS!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#edd4b5',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'padding' => '10',
'font_family' => 'Karla',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'top',
'animation' => 'slideup',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '4',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Karla',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,307 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template14Popup extends FormTemplate {
const ID = 'template_14_popup';
/** @var string */
protected $assetsDirectory = 'template-14';
public function getName(): string {
return _x('Lifestyle Blog', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('pic-1-682x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Nothing You Could Do" data-font="Nothing You Could Do" class="mailpoet-has-font"><strong>' . _x('WANT MORE?', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . _x('SIGN UP TO RECEIVE THE LATEST LIFESTYLE TIPS & TRICKS, PLUS SOME EXCLUSIVE GOODIES!', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#faf6f1',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('LETS DO THIS!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#edd4b5',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'padding' => '10',
'font_family' => 'Karla',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '550',
],
],
'animation' => 'slideup',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'border_radius' => '4',
'border_size' => '0',
'form_padding' => '10',
'input_padding' => '10',
'font_family' => 'Karla',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,308 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template14SlideIn extends FormTemplate {
const ID = 'template_14_slide_in';
/** @var string */
protected $assetsDirectory = 'template-14';
public function getName(): string {
return _x('Lifestyle Blog', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('pic-1-682x1024.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Nothing You Could Do" data-font="Nothing You Could Do" class="mailpoet-has-font"><strong>' . _x('WANT MORE?', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '30',
'text_color' => '',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . _x('SIGN UP TO RECEIVE THE LATEST LIFESTYLE TIPS & TRICKS, PLUS SOME EXCLUSIVE GOODIES!', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#faf6f1',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('LETS DO THIS!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#edd4b5',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'padding' => '10',
'font_family' => 'Karla',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '550',
],
],
],
'others' => [],
],
'border_radius' => '4',
'border_size' => '0',
'form_padding' => '10',
'input_padding' => '10',
'font_family' => 'Karla',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,292 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template14Widget extends FormTemplate {
const ID = 'template_14_widget';
/** @var string */
protected $assetsDirectory = 'template-14';
public function getName(): string {
return _x('Lifestyle Blog', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Nothing You Could Do" data-font="Nothing You Could Do" class="mailpoet-has-font"><strong>' . _x('WANT MORE?', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '#ffffff',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . _x('SIGN UP TO RECEIVE THE LATEST LIFESTYLE TIPS & TRICKS, PLUS SOME EXCLUSIVE GOODIES!', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'text_color' => '',
'background_color' => '#ffffff',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#faf6f1',
'border_size' => '0',
'border_radius' => '5',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('LETS DO THIS!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '5',
'padding' => '10',
'font_family' => 'Karla',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '#1e1e1e',
'background_color' => '#ffffff',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'font_family' => 'Karla',
'close_button' => 'classic',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'fontSize' => '15',
'fontColor' => '#1e1e1e',
'backgroundColor' => '#ffffff',
'background_image_url' => $this->getAssetUrl('pic-1-682x1024.jpg'),
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 0px;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 0;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,312 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template17BelowPages extends FormTemplate {
const ID = 'template_17_below_pages';
/** @var string */
protected $assetsDirectory = 'template-17';
public function getName(): string {
return _x('Halloween', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '20',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '60',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Sue Ellen Francisco" data-font="Sue Ellen Francisco" class="mailpoet-has-font"><strong>' . _x('BOO! DONT BE SCARED!', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'center',
'font_size' => '35',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font"><strong>' . _x('There arent any tricks here, only treats!', 'Text in a web form.', 'mailpoet') . '</strong></span><br><strong>' . _x('Subscribe to claim your exclusive Halloween offer from us.', 'Text in a web form.', 'mailpoet') . '</strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#595656',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('DARE TO SUBSCRIBE?!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '10',
'font_family' => 'Sue Ellen Francisco',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font"><strong>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</strong></span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '20',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '8',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#ffffff',
'close_button' => 'square_black',
'font_family' => 'Oxygen',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'value' => '100',
'unit' => 'percent',
],
],
'posts' => [
'all' => '',
],
'pages' => [
'all' => '',
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'backgroundColor' => '#1a1a1a',
'background_image_url' => $this->getAssetUrl('2714165.jpg'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,294 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template17FixedBar extends FormTemplate {
const ID = 'template_17_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-17';
public function getName(): string {
return _x('Halloween', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '33.3',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#595656',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('DARE TO SUBSCRIBE?!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '10',
'font_family' => 'Sue Ellen Francisco',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '66.6',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Sue Ellen Francisco" data-font="Sue Ellen Francisco" class="mailpoet-has-font"><strong>' . _x('BOO! DONT BE SCARED!', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'left',
'font_size' => '35',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font"><strong>' . _x('There arent any tricks here, only treats!', 'Text in a web form.', 'mailpoet') . ' ' . _x('Subscribe to claim your exclusive Halloween offer from us.', 'Text in a web form.', 'mailpoet') . '</strong><br><strong>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</strong></span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '16',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#ffffff',
'close_button' => 'square_black',
'font_family' => 'Oxygen',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'top',
'animation' => 'slidedown',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'backgroundColor' => '#1a1a1a',
'background_image_url' => $this->getAssetUrl('2714165.jpg'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,335 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template17Popup extends FormTemplate {
const ID = 'template_17_popup';
/** @var string */
protected $assetsDirectory = 'template-17';
public function getName(): string {
return _x('Halloween', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('2714165.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Sue Ellen Francisco" data-font="Sue Ellen Francisco" class="mailpoet-has-font"><strong>' . _x('BOO! DONT BE SCARED!', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'center',
'font_size' => '35',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . _x('There arent any tricks here, only treats!', 'Text in a web form.', 'mailpoet') . '<br>' . _x('Subscribe to claim your <strong><span style="color:#ce4e09" class="has-inline-color">exclusive Halloween</span></strong> offer from us.</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#595656',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('DARE TO SUBSCRIBE?!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ce4e09',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '10',
'font_family' => 'Sue Ellen Francisco',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '8',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'square_black',
'font_family' => 'Oxygen',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '420',
],
],
'animation' => 'slideup',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'backgroundColor' => '#1a1a1a',
'background_image_url' => '',
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,336 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template17SlideIn extends FormTemplate {
const ID = 'template_17_slide_in';
/** @var string */
protected $assetsDirectory = 'template-17';
public function getName(): string {
return _x('Halloween', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('2714165.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Sue Ellen Francisco" data-font="Sue Ellen Francisco" class="mailpoet-has-font"><strong>' . _x('BOO! DONT BE SCARED!', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'center',
'font_size' => '35',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . _x('There arent any tricks here, only treats!', 'Text in a web form.', 'mailpoet') . '<br>' . _x('Subscribe to claim your <strong><span style="color:#ce4e09" class="has-inline-color">exclusive Halloween</span></strong> offer from us.</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#595656',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('DARE TO SUBSCRIBE?!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ce4e09',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '10',
'font_family' => 'Sue Ellen Francisco',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '20',
'border_size' => '0',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'square_black',
'font_family' => 'Oxygen',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '420',
],
],
],
'others' => [],
],
'backgroundColor' => '#1a1a1a',
'background_image_url' => '',
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,283 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template17Widget extends FormTemplate {
const ID = 'template_17_widget';
/** @var string */
protected $assetsDirectory = 'template-17';
public function getName(): string {
return _x('Halloween', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => 'is-style-default',
'align' => '',
'url' => $this->getAssetUrl('2714165.jpg'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Sue Ellen Francisco" data-font="Sue Ellen Francisco" class="mailpoet-has-font"><strong>' . _x('BOO! DONT BE SCARED!', 'Text in a web form', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'center',
'font_size' => '28',
'text_color' => '#ffffff',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . _x('There arent any tricks here, only treats!', 'Text in a web form.', 'mailpoet') . '<br>' . _x('Subscribe to claim your <strong><span style="color:#ce4e09" class="has-inline-color">exclusive Halloween</span></strong> offer from us.</span>', 'Text in a web form. Keep HTML tags!', 'mailpoet'),
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#595656',
'border_size' => '0',
'border_radius' => '4',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('DARE TO SUBSCRIBE?!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ce4e09',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '4',
'padding' => '10',
'font_family' => 'Sue Ellen Francisco',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '10',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'square_black',
'font_family' => 'Oxygen',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'backgroundColor' => '#1a1a1a',
'background_image_url' => '',
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,398 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template18BelowPages extends FormTemplate {
const ID = 'template_18_below_pages';
/** @var string */
protected $assetsDirectory = 'template-18';
public function getName(): string {
return _x('Black Friday', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . _x('ITS HERE! DONT MISS OUT!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font"><strong>' . _x('B L A C K', 'Text in a web form (Black Friday).', 'mailpoet') . '</strong></span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '32',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font">' . _x('F R I D A Y', 'Text in a web form (Black Friday).', 'mailpoet') . '</span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '32',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font"><strong>' . _x('ENJOY 50% OFF ON ALL PRODUCTS', 'Text in a web form', 'mailpoet') . '<br></strong>' . _x('PLUS FREE SHIPPING = ORDERS OVER $100', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '50',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#5b5e60',
'border_size' => '0',
'border_radius' => '2',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET YOUR COUPON', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#cf2e2e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'padding' => '10',
'font_family' => 'Heebo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '40',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic_white',
'font_family' => 'Heebo',
'fontSize' => '15',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'backgroundColor' => '#000000',
'background_image_url' => $this->getAssetUrl('blackfriday-5.png'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
'border_color' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,414 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template18FixedBar extends FormTemplate {
const ID = 'template_18_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-18';
public function getName(): string {
return _x('Black Friday', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . _x('ITS HERE! DONT MISS OUT!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font"><strong>' . _x('B L A C K', 'Text in a web form (Black Friday).', 'mailpoet') . '</strong></span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '38',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font">' . _x('F R I D A Y', 'Text in a web form (Black Friday).', 'mailpoet') . '</span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '38',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font"><strong>' . _x('ENJOY 50% OFF ON ALL PRODUCTS', 'Text in a web form', 'mailpoet') . '<br></strong>' . _x('PLUS FREE SHIPPING = ORDERS OVER $100', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '50',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#5b5e60',
'border_size' => '0',
'border_radius' => '2',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET YOUR COUPON', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#cf2e2e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'padding' => '10',
'font_family' => 'Heebo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '0',
'border_size' => '5',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic_white',
'font_family' => 'Heebo',
'fontSize' => '15',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
'position' => 'bottom',
'animation' => 'slideup',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'backgroundColor' => '#000000',
'background_image_url' => $this->getAssetUrl('blackfriday-5.png'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
'border_color' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
.wp-block-column:not(:first-child),
.mailpoet_form_column:not(:first-child) {
padding: 0 20px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,354 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template18Popup extends FormTemplate {
const ID = 'template_18_popup';
/** @var string */
protected $assetsDirectory = 'template-18';
public function getName(): string {
return _x('Black Friday', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . _x('ITS HERE! DONT MISS OUT!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font">' . _x('B L A C K', 'Text in a web form (Black Friday).', 'mailpoet') . '<br>' . _x('F R I D A Y', 'Text in a web form (Black Friday).', 'mailpoet') . '</span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '68',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '10',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font"><strong>' . _x('ENJOY 50% OFF ON ALL PRODUCTS', 'Text in a web form', 'mailpoet') . '<br></strong>' . _x('PLUS FREE SHIPPING = ORDERS OVER $100', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#5b5e60',
'border_size' => '0',
'border_radius' => '2',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET YOUR COUPON', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#cf2e2e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'padding' => '10',
'font_family' => 'Heebo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '4',
'border_size' => '5',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic_white',
'font_family' => 'Heebo',
'fontSize' => '15',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '430',
],
],
'animation' => 'slideup',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [],
],
'backgroundColor' => '#000000',
'background_image_url' => $this->getAssetUrl('blackfriday-5.png'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
'border_color' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,363 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template18SlideIn extends FormTemplate {
const ID = 'tempalete_18_slide_in';
/** @var string */
protected $assetsDirectory = 'template-18';
public function getName(): string {
return _x('Black Friday', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '80',
],
'body' => [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '20',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . _x('ITS HERE! DONT MISS OUT!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '7',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '7',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font">' . _x('B L A C K', 'Text in a web form (Black Friday).', 'mailpoet') . ' ' . _x('F R I D A Y', 'Text in a web form (Black Friday).', 'mailpoet') . '</span></strong>',
'level' => '1',
'align' => 'center',
'font_size' => '37',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '7',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '7',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font"><strong>' . _x('ENJOY 50% OFF ON ALL PRODUCTS', 'Text in a web form', 'mailpoet') . '<br></strong>' . _x('PLUS FREE SHIPPING = ORDERS OVER $100', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#5b5e60',
'border_size' => '0',
'border_radius' => '2',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET YOUR COUPON', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#cf2e2e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'padding' => '10',
'font_family' => 'Heebo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#185f70',
],
'id' => 'divider',
'name' => 'Divider',
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '25',
'border_size' => '5',
'form_padding' => '0',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic_white',
'font_family' => 'Heebo',
'fontSize' => '15',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'animation' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '430',
],
],
],
'others' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'backgroundColor' => '#000000',
'background_image_url' => $this->getAssetUrl('blackfriday-5.png'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
'border_color' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,325 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template18Widget extends FormTemplate {
const ID = 'template_18_widget';
/** @var string */
protected $assetsDirectory = 'template-18';
public function getName(): string {
return _x('Black Friday', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '12.5',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '75',
],
'body' => [
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . _x('ITS HERE! DONT MISS OUT!', 'Text in a web form', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '16',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '7',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '7',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Fjalla One" data-font="Fjalla One" class="mailpoet-has-font">' . _x('B L A C K', 'Text in a web form (Black Friday).', 'mailpoet') . '<br>' . _x('F R I D A Y', 'Text in a web form (Black Friday).', 'mailpoet') . '</span></strong>', // @todo Add translations, links and emoji processing.,
'level' => '1',
'align' => 'center',
'font_size' => '38',
'text_color' => '#ffffff',
'background_color' => '',
'anchor' => 'block-heading_0.8430326562811867-1602517711078',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '7',
'type' => 'divider',
'style' => 'solid',
'divider_height' => '7',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font"><strong>' . _x('ENJOY 50% OFF ON ALL PRODUCTS', 'Text in a web form', 'mailpoet') . '<br></strong>' . _x('PLUS FREE SHIPPING = ORDERS OVER $100', 'Text in a web form', 'mailpoet') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#ffffff',
'font_color' => '#5b5e60',
'border_size' => '0',
'border_radius' => '2',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('GET YOUR COUPON', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#cf2e2e',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'padding' => '10',
'font_family' => 'Heebo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '12.5',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '10',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic_white',
'font_family' => 'Heebo',
'fontSize' => '15',
'form_placement' => [
'popup' => [
'enabled' => '',
],
'fixed_bar' => [
'enabled' => '',
],
'below_posts' => [
'enabled' => '',
],
'slide_in' => [
'enabled' => '',
],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'backgroundColor' => '#000000',
'background_image_url' => $this->getAssetUrl('blackfriday-5.png'),
'background_image_display' => 'scale',
'fontColor' => '#ffffff',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,269 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template1BelowPages extends FormTemplate {
const ID = 'template_1_below_pages';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return _x('Join the Club', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🤞') . ' <span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">' . _x('Dont miss these tips!', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '20',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read more in our [link]privacy policy[/link]', 'Text in a web form.', 'mailpoet'), "#") . '</span></em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '15',
'border_size' => '10',
'form_padding' => '10',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'classic',
'border_color' => '#f7f7f7',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
form.mailpoet_form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,302 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template1FixedBar extends FormTemplate {
const ID = 'template_1_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return _x('Join the Club', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🤞') . ' <span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">' . _x('Dont miss these tips!', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '1',
'align' => 'left',
'font_size' => '28',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), "#") . '</span></em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '12',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '20',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '10',
'form_padding' => '0',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '16',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
'border_color' => '#f7f7f7',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,245 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template1Popup extends FormTemplate {
const ID = 'template_1_popup';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return _x('Join the Club', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">' . _x('Dont miss these tips!', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '24',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), "#") . '</span></em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '360',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '16',
'border_size' => '0',
'form_padding' => '16',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,246 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template1SlideIn extends FormTemplate {
const ID = 'template_1_slide_in';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return _x('Join the Club', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">' . _x('Dont miss these tips!', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '24',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), "#") . '</span></em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'form_position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '360',
],
],
],
'others' => [],
],
'border_radius' => '16',
'border_size' => '0',
'form_padding' => '20',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '20',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'round_black',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,244 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template1Widget extends FormTemplate {
const ID = 'template_1_widget';
/** @var string */
protected $assetsDirectory = 'template-1';
public function getName(): string {
return _x('Join the Club', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('Oval@3x-2-1024x570.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '',
'height' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: BioRhyme" data-font="BioRhyme" class="mailpoet-has-font">' . _x('Dont miss these tips!', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '1',
'align' => 'center',
'font_size' => '25',
'text_color' => '#313131',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#eeeeee',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '8',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('JOIN THE CLUB', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '15',
'font_color' => '#ffd456',
'border_size' => '0',
'border_radius' => '8',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), "#") . '</span></em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontColor' => '#313131',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '20',
'border_size' => '10',
'form_padding' => '10',
'input_padding' => '16',
'background_image_display' => 'scale',
'fontSize' => '15',
'font_family' => 'Montserrat',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'backgroundColor' => '#ffffff',
'background_image_url' => '',
'close_button' => 'classic',
'border_color' => '#f7f7f7',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
h1.mailpoet-heading {
margin: 0 0 20px;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,277 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template3BelowPages extends FormTemplate {
const ID = 'template_3_below_pages';
/** @var string */
protected $assetsDirectory = 'template-3';
public function getName(): string {
return _x('Welcome Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '100',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('10% off, <br>especially for you', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong></span>' . ' ' . $this->wp->wpStaticizeEmoji('🎁'),
'level' => '1',
'align' => 'center',
'font_size' => '40',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Sign up to receive your exclusive discount, and keep up to date on our latest products & offers!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '20',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('Save 10%', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '20',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => '1', 'styles' => ['width' => ['unit' => 'percent', 'value' => '100']]],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '2',
'border_size' => '1',
'form_padding' => '25',
'input_padding' => '16',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'round_white',
'border_color' => '#000000',
'fontSize' => '16',
'font_family' => 'Montserrat',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,262 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template3FixedBar extends FormTemplate {
const ID = 'template_3_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-3';
public function getName(): string {
return _x('Welcome Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '67.5',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('10% off, <br>especially for you', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong></span>' . ' ' . $this->wp->wpStaticizeEmoji('🎁'),
'level' => '1',
'align' => 'left',
'font_size' => '30',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => 'block-heading_0.27494222669689683-1595510796066',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Sign up to receive your exclusive discount,<br>and keep up to date on our latest products & offers!', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'left',
'font_size' => '16',
'text_color' => '#000000',
'line_height' => '1.7',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '32.5',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Save 10%', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '12',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '2',
'border_size' => '0',
'form_padding' => '16',
'input_padding' => '12',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic',
'fontSize' => '16',
'font_family' => 'Montserrat',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,256 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template3Popup extends FormTemplate {
const ID = 'template_3_popup';
/** @var string */
protected $assetsDirectory = 'template-3';
public function getName(): string {
return _x('Welcome Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">10</span>%</strong>',
'level' => '1',
'align' => 'center',
'font_size' => '80',
'text_color' => '#000000',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('off, especially for you', 'Text in a web form. Second line of "10% off, especially..."', 'mailpoet') . '</strong></span> ' . $this->wp->wpStaticizeEmoji('🎁'),
'level' => '2',
'align' => 'center',
'font_size' => '25',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => 'mailpoet-heading',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Sign up to receive your exclusive discount, and keep up to date on our latest products & offers!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Save 10%', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '380',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '2',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '15',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic',
'font_family' => 'Montserrat',
'fontSize' => '16',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
.mailpoet_form_paragraph last {
margin-bottom: 0px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,251 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template3SlideIn extends FormTemplate {
const ID = 'template_3_slide_in';
/** @var string */
protected $assetsDirectory = 'template-3';
public function getName(): string {
return _x('Welcome Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">10</span>%</strong>',
'level' => '1',
'align' => 'center',
'font_size' => '80',
'text_color' => '#000000',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('off, especially for you', 'Text in a web form. Second line of "10% off, especially..."', 'mailpoet') . '</strong></span> ' . $this->wp->wpStaticizeEmoji('🎁'),
'level' => '2',
'align' => 'center',
'font_size' => '25',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => 'mailpoet-heading',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Sign up to receive your exclusive discount, and keep up to date on our latest products & offers!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '15',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Save 10%', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '380',
],
],
],
'others' => ['enabled' => ''],
],
'border_radius' => '15',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '15',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'classic',
'font_family' => 'Montserrat',
'fontSize' => '16',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,251 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template3Widget extends FormTemplate {
const ID = 'template_3_widget';
/** @var string */
protected $assetsDirectory = 'template-3';
public function getName(): string {
return _x('Welcome Discount', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('10% off,', 'Text in a web form. First line of "10% off, especially for you."', 'mailpoet') . '</strong></span>',
'level' => '1',
'align' => 'center',
'font_size' => '30',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('especially for you', 'Text in a web form. Second line of "10% off, especially..."', 'mailpoet') . '</strong></span> ' . $this->wp->wpStaticizeEmoji('🎁'),
'level' => '2',
'align' => 'center',
'font_size' => '18',
'text_color' => '#000000',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => 'mailpoet-heading',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Sign up to receive your exclusive discount, and keep up to date on our latest products & offers!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '0',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Save 10%', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#000000',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '2',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '2',
'border_size' => '1',
'form_padding' => '16',
'input_padding' => '15',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
'close_button' => 'round_white',
'border_color' => '#000000',
'fontSize' => '16',
'font_family' => 'Montserrat',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,261 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template4BelowPages extends FormTemplate {
const ID = 'template_4_below_pages';
/** @var string */
protected $assetsDirectory = 'template-4';
public function getName(): string {
return _x('Newsletter Signup', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('Oh hi there 👋 Its nice to meet you.', 'Text in a web form.', 'mailpoet') . '</strong>',
'level' => '3',
'align' => 'left',
'font_size' => '25',
'text_color' => '#0081ff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => 'block-heading_0.05691231782049089-1595515365731',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong>' . _x('Sign up to receive awesome content in your inbox, every month.', 'Text in a web form.', 'mailpoet') . '</strong>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '18',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f1f1f1',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Lets keep in touch', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#0081ff',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => 'center',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '25',
'input_padding' => '15',
'font_family' => 'Montserrat',
'close_button' => 'round_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,269 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template4FixedBar extends FormTemplate {
const ID = 'templates_4_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-4';
public function getName(): string {
return _x('Newsletter Signup', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '67.5',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Oh hi there 👋 Its nice to meet you.', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'left',
'font_size' => '30',
'text_color' => '#0081ff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong>' . _x('Sign up to receive awesome content in your inbox, every month.', 'Text in a web form.', 'mailpoet') . '</strong>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '16',
'line_height' => '1.7',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'bottom',
'width' => '32.5',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f1f1f1',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Lets keep in touch', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#0081ff',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'position' => 'top',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '16',
'input_padding' => '15',
'font_family' => 'Montserrat',
'close_button' => 'round_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,287 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template4Popup extends FormTemplate {
const ID = 'template_4_popup';
/** @var string */
protected $assetsDirectory = 'template-4';
public function getName(): string {
return _x('Newsletter Signup', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('mailbox@3x.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '95',
'height' => '90',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('Oh hi there 👋<br>Its nice to meet you.', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#0081ff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('Sign up to receive awesome content in your inbox, every month.', 'Text in a web form.', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'center',
'font_size' => '18',
'text_color' => '',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f1f1f1',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Lets keep in touch', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#0081ff',
'font_size' => '20',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'center',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '380',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '25',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '15',
'font_family' => 'Montserrat',
'close_button' => 'round_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,288 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template4SlideIn extends FormTemplate {
const ID = 'template_4_slide_in';
/** @var string */
protected $assetsDirectory = 'template-4';
public function getName(): string {
return _x('Newsletter Signup', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'image',
'id' => 'image',
'params' => [
'class_name' => '',
'align' => 'center',
'url' => $this->getAssetUrl('mailbox@3x.png'),
'alt' => '',
'title' => '',
'caption' => '',
'link_destination' => 'none',
'link' => '',
'href' => '',
'link_class' => '',
'rel' => '',
'link_target' => '',
'id' => '',
'size_slug' => 'large',
'width' => '95',
'height' => '90',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('Oh hi there 👋<br>Its nice to meet you.', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#0081ff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<strong>' . _x('Sign up to receive awesome content in your inbox, every month.', 'Text in a web form.', 'mailpoet') . '</strong>',
'level' => '2',
'align' => 'center',
'font_size' => '18',
'text_color' => '',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f1f1f1',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Lets keep in touch', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#0081ff',
'font_size' => '20',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'center',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '380',
],
],
],
'others' => [],
],
'border_radius' => '25',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '15',
'font_family' => 'Montserrat',
'close_button' => 'round_black',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin: 0 0 20px 0;
}
h1.mailpoet-heading {
margin: 0 0 10px;
}
EOL;
}
}
@@ -0,0 +1,242 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template4Widget extends FormTemplate {
const ID = 'template_4_widget';
/** @var string */
protected $assetsDirectory = 'template-4';
public function getName(): string {
return _x('Newsletter Signup', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Oh hi there 👋<br>Its nice to meet you.', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#0081ff',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . _x('Sign up to receive awesome content in your inbox, every month.', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#000000',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f1f1f1',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Lets keep in touch', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'background_color' => '#0081ff',
'font_size' => '15',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '40',
'border_color' => '#313131',
'padding' => '15',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<em>' . $this->replacePrivacyLinkTags(_x('We dont spam! Read our [link]privacy policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</em>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'on_success' => 'message',
'success_message' => '',
'segments' => [],
'segments_selected_by' => 'admin',
'alignment' => 'left',
'fontSize' => '15',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'value' => '100',
'unit' => 'percent',
],
],
],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '10',
'input_padding' => '15',
'font_family' => 'Montserrat',
'close_button' => 'round_white',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph {
margin-bottom: 10px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,285 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template6BelowPages extends FormTemplate {
const ID = 'template_6_below_pages';
/** @var string */
protected $assetsDirectory = 'template-6';
public function getName(): string {
return _x('Fitness Tips', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Dive in!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '44',
'text_color' => '#38527a',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Join [mailpoet_subscribers_count] others, and start your fitness journey with us today.', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#38527a',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f8fbff',
'font_color' => '#38527a',
'border_size' => '0',
'border_radius' => '10',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('Get Started!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(0deg,rgb(56,82,122) 0%,rgb(81,128,199) 100%)',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '10',
'padding' => '12',
'font_family' => 'Montserrat',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We promise well never spam! Take a look at our [link]Privacy Policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#38527a',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'below_post_styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '10',
'border_size' => '0',
'form_padding' => '35',
'input_padding' => '12',
'font_family' => 'Montserrat',
'background_image_url' => $this->getAssetUrl('form-bg.jpg'),
'background_image_display' => 'scale',
'close_button' => 'classic',
'segments_selected_by' => 'admin',
'fontColor' => '#ffffff',
'backgroundColor' => '#ffffff',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
h2.mailpoet-heading {
margin-bottom: 20px;
margin-top: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,252 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template6FixedBar extends FormTemplate {
const ID = 'template_6_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-6';
public function getName(): string {
return _x('Fitness Tips', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '70',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . _x('<strong>Dive in!</strong> Start your journey today.', 'Text in a web form. Keep HTML tags!', 'mailpoet') . '</span>',
'level' => '2',
'align' => 'left',
'font_size' => '30',
'text_color' => '#38527a',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Sign up to start your fitness program. We promise well never spam! Take a look at our [link]Privacy Policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span></strong>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#38527a',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '30',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f8fbff',
'font_color' => '#38527a',
'border_size' => '0',
'border_radius' => '10',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get Started!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(0deg,rgb(56,82,122) 0%,rgb(81,128,199) 100%)',
'font_size' => '19',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '10',
'padding' => '10',
'font_family' => 'Montserrat',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'position' => 'top',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '20',
'input_padding' => '12',
'font_family' => 'Montserrat',
'background_image_url' => $this->getAssetUrl('form-bg.jpg'),
'background_image_display' => 'scale',
'close_button' => 'classic',
'segments_selected_by' => 'admin',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
h2.mailpoet-heading {
margin-bottom: 20px;
margin-top: 0;
}
EOL;
}
}
@@ -0,0 +1,236 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template6Popup extends FormTemplate {
const ID = 'template_6__popup';
/** @var string */
protected $assetsDirectory = 'template-6';
public function getName(): string {
return _x('Fitness Tips', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Dive in!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '72',
'text_color' => '#38527a',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Join [mailpoet_subscribers_count] others, and start your fitness journey with us today.', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#38527a',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f8fbff',
'font_color' => '#38527a',
'border_size' => '0',
'border_radius' => '10',
'border_color' => '#38527a',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get Started!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(0deg,rgb(56,82,122) 0%,rgb(81,128,199) 100%)',
'font_size' => '19',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '10',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We promise well never spam! Take a look at our [link]Privacy Policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#38527a',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '440',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '10',
'border_size' => '0',
'form_padding' => '35',
'input_padding' => '16',
'font_family' => 'Montserrat',
'background_image_url' => $this->getAssetUrl('form-bg.jpg'),
'background_image_display' => 'scale',
'close_button' => 'classic',
'segments_selected_by' => 'admin',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
h2.mailpoet-heading {
margin-bottom: 20px;
margin-top: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,236 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template6SlideIn extends FormTemplate {
const ID = 'template_6_slide_in';
/** @var string */
protected $assetsDirectory = 'template-6';
public function getName(): string {
return _x('Fitness Tips', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Dive in!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '72',
'text_color' => '#38527a',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Join [mailpoet_subscribers_count] others, and start your fitness journey with us today.', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#38527a',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f8fbff',
'font_color' => '#38527a',
'border_size' => '0',
'border_radius' => '10',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get Started!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(0deg,rgb(56,82,122) 0%,rgb(81,128,199) 100%)',
'font_size' => '19',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '10',
'padding' => '16',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We promise well never spam! Take a look at our [link]Privacy Policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '14',
'line_height' => '1.5',
'text_color' => '#38527a',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '16',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'form_position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '400',
],
],
],
'others' => [],
],
'border_radius' => '10',
'border_size' => '0',
'form_padding' => '35',
'input_padding' => '16',
'font_family' => 'Montserrat',
'background_image_url' => $this->getAssetUrl('form-bg.jpg'),
'background_image_display' => 'scale',
'close_button' => 'classic',
'segments_selected_by' => 'admin',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
h2.mailpoet-heading {
margin-bottom: 20px;
margin-top: 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,229 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template6Widget extends FormTemplate {
const ID = 'template_6_widget';
/** @var string */
protected $assetsDirectory = 'template-6';
public function getName(): string {
return _x('Fitness Tips', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Dive in!', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '32',
'text_color' => '#38527a',
'line_height' => '1',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font"><strong>' . _x('Join [mailpoet_subscribers_count] others, and start your fitness journey with us today.', 'Text in a web form.', 'mailpoet') . '</strong></span>',
'level' => '2',
'align' => 'center',
'font_size' => '16',
'text_color' => '#38527a',
'line_height' => '1.5',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#f8fbff',
'font_color' => '#38527a',
'border_size' => '0',
'border_radius' => '10',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get Started!', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(0deg,rgb(56,82,122) 0%,rgb(81,128,199) 100%)',
'font_size' => '19',
'font_color' => '#ffffff',
'border_size' => '0',
'border_radius' => '10',
'padding' => '12',
'font_family' => 'Montserrat',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('We promise well never spam! Take a look at our [link]Privacy Policy[/link] for more info.', 'Text in a web form.', 'mailpoet'), '#') . '</span></strong>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#38527a',
'background_color' => '',
'class_name' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '19',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '10',
'border_size' => '0',
'form_padding' => '15',
'input_padding' => '12',
'font_family' => 'Montserrat',
'background_image_url' => $this->getAssetUrl('form-bg.jpg'),
'background_image_display' => 'scale',
'close_button' => 'classic',
'segments_selected_by' => 'admin',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 5px;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,327 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template7BelowPages extends FormTemplate {
const ID = 'template_7_below_pages';
/** @var string */
protected $assetsDirectory = 'template-7';
public function getName(): string {
return _x('Latest Deals', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('belowpage.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🕶️') . ' <strong><span style="font-family: Abril FatFace" data-font="Abril FatFace" class="mailpoet-has-font">' . _x('Relax!', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '72',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('Put your feet up and let us do the hard work for you. Sign up to receive our latest deals directly in your inbox.', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '2',
'align' => 'center',
'font_size' => '20',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '6',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '40',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('Get the latest deals', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(180deg,rgb(0,159,251) 0%,rgb(29,123,164) 100%)',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '6',
'padding' => '12',
'font_family' => 'Cairo',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '10',
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Well never send you spam or share your email address.<br>Find out more in our [link]Privacy Policy[/link].', 'Text in a web form. Keep HTML tags!', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'slide_in_form_delay' => '15',
'slide_in_form_position' => 'right',
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '30',
'input_padding' => '15',
'font_family' => 'Cairo',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'round_white',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(255,233,112) 0%,rgb(230,174,70) 51%,rgb(228,37,111) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,284 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template7FixedBar extends FormTemplate {
const ID = 'template_7_fixed_bar';
/** @var string */
protected $assetsDirectory = 'template-7';
public function getName(): string {
return _x('Latest Deals', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('fixedbar.png');
}
public function getBody(): array {
return [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🕶️') . ' <strong><span style="font-family: Abril FatFace" data-font="Abril FatFace" class="mailpoet-has-font">' . _x('Relax!', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'left',
'font_size' => '44',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Let us do the hard work for you. Sign up to receive our latest deals directly in your inbox. Well never send you spam - promise. Find out more in our [link]Privacy Policy[/link].', 'Text in a web form. Keep HTML tags!', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'left',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => 'center',
'width' => '50',
],
'body' => [
[
'type' => 'columns',
'body' => [
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '6',
],
],
],
],
[
'type' => 'column',
'params' => [
'class_name' => '',
'vertical_alignment' => '',
'width' => '50',
],
'body' => [
[
'type' => 'submit',
'params' => [
'label' => _x('Get the latest deals', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(180deg,rgb(0,159,251) 0%,rgb(29,123,164) 100%)',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '6',
'padding' => '12',
'font_family' => 'Cairo',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
],
],
],
'params' => [
'vertical_alignment' => '',
'class_name' => '',
'text_color' => '',
'background_color' => '',
'gradient' => '',
],
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '1100',
],
],
],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '0',
'border_size' => '0',
'form_padding' => '20',
'input_padding' => '15',
'font_family' => 'Cairo',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'round_black',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(255,233,112) 0%,rgb(230,174,70) 51%,rgb(228,37,111) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 15px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,277 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template7Popup extends FormTemplate {
const ID = 'template_7';
/** @var string */
protected $assetsDirectory = 'template-7';
public function getName(): string {
return _x('Latest Deals', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('popup.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🕶️') . ' <strong><span style="font-family: Abril FatFace" data-font="Abril FatFace" class="mailpoet-has-font">' . _x('Relax!', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '88',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('Put your feet up and let us do the hard work for you. Sign up to receive our latest deals directly in your inbox.', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '2',
'align' => 'center',
'font_size' => '24',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '6',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get the latest deals', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(180deg,rgb(0,159,251) 0%,rgb(29,123,164) 100%)',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '6',
'padding' => '12',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Well never send you spam or share your email address.<br>Find out more in our [link]Privacy Policy[/link].', 'Text in a web form. Keep HTML tags!', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => [
'enabled' => '1',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '430',
],
],
],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '25',
'input_padding' => '15',
'font_family' => 'Cairo',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'round_black',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(255,233,112) 0%,rgb(230,174,70) 50%,rgb(228,37,111) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,278 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template7SlideIn extends FormTemplate {
const ID = 'template_7_slide_in';
/** @var string */
protected $assetsDirectory = 'template-7';
public function getName(): string {
return _x('Latest Deals', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('slidein.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🕶️') . ' <strong><span style="font-family: Abril FatFace" data-font="Abril FatFace" class="mailpoet-has-font">' . _x('Relax!', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '80',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('Put your feet up and let us do the hard work for you. Sign up to receive our latest deals directly in your inbox.', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '2',
'align' => 'center',
'font_size' => '24',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '1',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => '#ffffff',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '6',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get the latest deals', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(180deg,rgb(0,159,251) 2%,rgb(29,123,164) 100%)',
'font_size' => '24',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '6',
'padding' => '12',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Well never send you spam or share your email address.<br>Find out more in our [link]Privacy Policy[/link].', 'Text in a web form. Keep HTML tags!', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '20',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => [
'enabled' => '1',
'form_position' => 'right',
'styles' => [
'width' => [
'unit' => 'pixel',
'value' => '400',
],
],
],
'others' => [],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '25',
'input_padding' => '16',
'font_family' => 'Cairo',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'round_black',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(255,233,112) 0%,rgb(230,174,70) 49%,rgb(228,37,111) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1,262 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Templates\Templates;
if (!defined('ABSPATH')) exit;
use MailPoet\Form\Templates\FormTemplate;
class Template7Widget extends FormTemplate {
const ID = 'template-7-widget';
/** @var string */
protected $assetsDirectory = 'template-7';
public function getName(): string {
return _x('Latest Deals', 'Form template name', 'mailpoet');
}
public function getThumbnailUrl(): string {
return $this->getAssetUrl('widget.png');
}
public function getBody(): array {
return [
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => $this->wp->wpStaticizeEmoji('🕶️') . ' <strong><span style="font-family: Abril FatFace" data-font="Abril FatFace" class="mailpoet-has-font">' . _x('Relax!', 'Text in a web form.', 'mailpoet') . '</span></strong>',
'level' => '2',
'align' => 'center',
'font_size' => '40',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'heading',
'id' => 'heading',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . _x('Put your feet up and let us do the hard work for you. Sign up to receive our latest deals directly in your inbox.', 'Text in a web form.', 'mailpoet') . '</span>',
'level' => '2',
'align' => 'center',
'font_size' => '16',
'text_color' => '#ffffff',
'line_height' => '1.2',
'background_color' => '',
'anchor' => '',
'class_name' => '',
],
],
[
'type' => 'text',
'params' => [
'label' => _x('Email Address', 'Form label', 'mailpoet'),
'class_name' => '',
'required' => '1',
'label_within' => '1',
],
'id' => 'email',
'name' => 'Email',
'styles' => [
'full_width' => '1',
'bold' => '0',
'background_color' => '#ffffff',
'font_color' => '#abb8c3',
'border_size' => '0',
'border_radius' => '6',
],
],
[
'type' => 'submit',
'params' => [
'label' => _x('Get the latest deals', 'Form label', 'mailpoet'),
'class_name' => '',
],
'id' => 'submit',
'name' => 'Submit',
'styles' => [
'full_width' => '1',
'bold' => '1',
'gradient' => 'linear-gradient(180deg,rgb(0,159,251) 0%,rgb(29,123,164) 100%)',
'font_size' => '16',
'font_color' => '#ffffff',
'border_size' => '1',
'border_radius' => '6',
'padding' => '11',
'font_family' => 'Cairo',
],
],
[
'type' => 'paragraph',
'id' => 'paragraph',
'params' => [
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replacePrivacyLinkTags(_x('Well never send you spam or share your email address.<br>Find out more in our [link]Privacy Policy[/link].', 'Text in a web form. Keep HTML tags!', 'mailpoet'), '#') . '</span>',
'drop_cap' => '0',
'align' => 'center',
'font_size' => '13',
'line_height' => '1.5',
'text_color' => '#ffffff',
'background_color' => '',
'class_name' => '',
],
],
[
'type' => 'divider',
'params' => [
'class_name' => '',
'height' => '10',
'type' => 'spacer',
'style' => 'solid',
'divider_height' => '1',
'divider_width' => '100',
'color' => 'black',
],
'id' => 'divider',
'name' => 'Divider',
],
];
}
public function getSettings(): array {
return [
'success_message' => '',
'segments' => [],
'alignment' => 'left',
'fontSize' => '14',
'form_placement' => [
'popup' => ['enabled' => ''],
'below_posts' => ['enabled' => ''],
'fixed_bar' => ['enabled' => ''],
'slide_in' => ['enabled' => ''],
'others' => [
'styles' => [
'width' => [
'unit' => 'percent',
'value' => '100',
],
],
],
],
'border_radius' => '24',
'border_size' => '0',
'form_padding' => '20',
'input_padding' => '12',
'font_family' => 'Cairo',
'background_image_url' => '',
'background_image_display' => 'scale',
'close_button' => 'round_white',
'segments_selected_by' => 'admin',
'gradient' => 'linear-gradient(180deg,rgb(255,233,112) 0%,rgb(230,174,70) 49%,rgb(228,37,111) 100%)',
'success_validation_color' => '#00d084',
'error_validation_color' => '#cf2e2e',
];
}
public function getStyles(): string {
return <<<EOL
/* form */
.mailpoet_form {
}
form {
margin-bottom: 0;
}
p.mailpoet_form_paragraph.last {
margin-bottom: 0px;
}
h2.mailpoet-heading {
margin: -10px 0 10px 0;
}
/* columns */
.mailpoet_column_with_background {
padding: 10px;
}
/* space between columns */
.mailpoet_form_column:not(:first-child) {
margin-left: 20px;
}
/* input wrapper (label + input) */
.mailpoet_paragraph {
line-height:20px;
margin-bottom: 20px;
}
/* labels */
.mailpoet_segment_label,
.mailpoet_text_label,
.mailpoet_textarea_label,
.mailpoet_select_label,
.mailpoet_radio_label,
.mailpoet_checkbox_label,
.mailpoet_list_label,
.mailpoet_date_label {
display:block;
font-weight: normal;
}
/* inputs */
.mailpoet_text,
.mailpoet_textarea,
.mailpoet_select,
.mailpoet_date_month,
.mailpoet_date_day,
.mailpoet_date_year,
.mailpoet_date {
display:block;
}
.mailpoet_text,
.mailpoet_textarea {
width: 200px;
}
.mailpoet_checkbox {
}
.mailpoet_submit {
}
.mailpoet_divider {
}
.mailpoet_message {
}
.mailpoet_form_loading {
width: 30px;
text-align: center;
line-height: normal;
}
.mailpoet_form_loading > span {
width: 5px;
height: 5px;
background-color: #5b5b5b;
}
EOL;
}
}
@@ -0,0 +1 @@
<?php
@@ -0,0 +1 @@
<?php
@@ -0,0 +1,129 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Util;
if (!defined('ABSPATH')) exit;
use MailPoet\Settings\SettingsController;
use MailPoet\WP\Functions;
class CustomFonts {
const FONT_CHUNK_SIZE = 25;
const FONTS = [
'Abril FatFace',
'Alegreya',
'Alegreya Sans',
'Amatic SC',
'Anonymous Pro',
'Architects Daughter',
'Archivo',
'Archivo Narrow',
'Asap',
'Barlow',
'BioRhyme',
'Bonbon',
'Cabin',
'Cairo',
'Cardo',
'Chivo',
'Concert One',
'Cormorant',
'Crimson Text',
'Eczar',
'Exo 2',
'Fira Sans',
'Fjalla One',
'Frank Ruhl Libre',
'Great Vibes',
'Heebo',
'IBM Plex',
'Inconsolata',
'Indie Flower',
'Inknut Antiqua',
'Inter',
'Karla',
'Libre Baskerville',
'Libre Franklin',
'Montserrat',
'Neuton',
'Notable',
'Nothing You Could Do',
'Noto Sans',
'Nunito',
'Old Standard TT',
'Oxygen',
'Pacifico',
'Poppins',
'Proza Libre',
'PT Sans',
'PT Serif',
'Rakkas',
'Reenie Beanie',
'Roboto Slab',
'Ropa Sans',
'Rubik',
'Shadows Into Light',
'Space Mono',
'Spectral',
'Sue Ellen Francisco',
'Titillium Web',
'Ubuntu',
'Varela',
'Vollkorn',
'Work Sans',
'Yatra One',
];
/** @var Functions */
private $wp;
/** @var SettingsController */
private $settings;
public function __construct(
Functions $wp,
SettingsController $settings
) {
$this->wp = $wp;
$this->settings = $settings;
}
public function displayCustomFonts(): bool {
$display = $this->wp->applyFilters('mailpoet_display_custom_fonts', $this->settings->get('3rd_party_libs.enabled') === '1');
return (bool)$display;
}
public function enqueueStyle() {
if (!$this->displayCustomFonts()) {
return;
}
// Due to a conflict with the WooCommerce Payments plugin, we need to load custom fonts in more requests.
// When we load all custom fonts in one request, a form from WC Payments isn't displayed correctly.
// It looks that the larger file size overloads the Stripe SDK.
foreach (array_chunk(self::FONTS, self::FONT_CHUNK_SIZE) as $key => $fonts) {
$this->wp->wpEnqueueStyle('mailpoet_custom_fonts_' . $key, $this->generateLink($fonts));
}
}
public function generateHtmlCustomFontLink(): string {
if (!$this->displayCustomFonts()) {
return '';
}
$output = '';
foreach (array_chunk(self::FONTS, self::FONT_CHUNK_SIZE) as $key => $fonts) {
$output .= sprintf('<link href="%s" rel="stylesheet">', $this->generateLink($fonts));
}
return $output;
}
private function generateLink(array $fonts): string {
$fonts = array_map(function ($fontName) {
return urlencode($fontName) . ':400,400i,700,700i';
}, $fonts);
$fonts = implode('|', $fonts);
return 'https://fonts.googleapis.com/css?family=' . $fonts;
}
}
@@ -0,0 +1,109 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Util;
if (!defined('ABSPATH')) exit;
use MailPoet\Config\Env;
use MailPoet\Form\Widget;
use MailPoet\WP\Functions as WPFunctions;
class Export {
public static function getAll() {
return [
'html' => static::get('html'),
'php' => static::get('php'),
'iframe' => static::get('iframe'),
'shortcode' => static::get('shortcode'),
];
}
public static function get($type = 'html') {
switch ($type) {
case 'iframe':
// generate url to load iframe's content
$iframeUrl = WPFunctions::get()->addQueryArg([
'mailpoet_form_iframe' => ':form_id:',
], WPFunctions::get()->trailingslashit(WPFunctions::get()->siteUrl()));
$onload = "var _this = this; window.addEventListener('message', function(e) {if(e.data.MailPoetIframeHeight){_this.style.height = e.data.MailPoetIframeHeight;}})";
// generate iframe
return join(' ', [
'<iframe',
'width="100%"',
'height="100%"',
'scrolling="no"',
'frameborder="0"',
'src="' . WPFunctions::get()->escUrl($iframeUrl) . '"',
'class="mailpoet_form_iframe"',
'id="mailpoet_form_iframe"',
'vspace="0"',
'tabindex="0"',
sprintf('onload="%s"', $onload),
'marginwidth="0"',
'marginheight="0"',
'hspace="0"',
'allowtransparency="true"></iframe>',
]);
case 'php':
$output = [
'$form_widget = new \MailPoet\Form\Widget();',
'echo $form_widget->widget(array(\'form\' => ' .
':form_id:' .
', \'form_type\' => \'php\'));',
];
return join("\n", $output);
case 'html':
$output = [];
$output[] = '<!-- ' .
__(
'BEGIN Scripts: you should place them in the header of your theme',
'mailpoet'
) .
' -->';
// CSS
$output[] = '<link rel="stylesheet" type="text/css" href="' .
Env::$assetsUrl . '/dist/css/mailpoet-public.css?mp_ver=' . MAILPOET_VERSION .
'" />';
// jQuery
$output[] = '<script type="text/javascript" src="' .
WPFunctions::get()->includesUrl() . 'js/jquery/jquery.js?mp_ver' . MAILPOET_VERSION .
'"></script>';
// JS
$output[] = '<script type="text/javascript" src="' .
Env::$assetsUrl . '/dist/js/vendor.js?mp_ver=' . MAILPOET_VERSION .
'"></script>';
$output[] = '<script type="text/javascript" src="' .
Env::$assetsUrl . '/dist/js/public.js?mp_ver=' . MAILPOET_VERSION .
'"></script>';
// (JS) variables...
$output[] = '<script type="text/javascript">';
$output[] = ' var MailPoetForm = MailPoetForm || {';
$output[] = ' is_rtl: ' . ((int)is_rtl()) . ",";
$output[] = ' ajax_url: "' . admin_url('admin-ajax.php') . '"';
$output[] = ' };';
$output[] = '</script>';
$output[] = '<!-- ' .
__('END Scripts', 'mailpoet') .
'-->';
$formWidget = new Widget();
$output[] = $formWidget->widget([
'form' => ':form_id:',
'form_type' => 'php',
]);
return join("\n", $output);
case 'shortcode':
return '[mailpoet_form id=":form_id:"]';
}
}
}
@@ -0,0 +1,54 @@
<?php // phpcs:ignore SlevomatCodingStandard.TypeHints.DeclareStrictTypes.DeclareStrictTypesMissing
namespace MailPoet\Form\Util;
if (!defined('ABSPATH')) exit;
use MailPoet\WP\Functions as WPFunctions;
class FieldNameObfuscator {
const OBFUSCATED_FIELD_PREFIX = 'form_field_';
const HASH_LENGTH = 12;
/** @var WPFunctions */
private $wp;
public function __construct(
WPFunctions $wp
) {
$this->wp = $wp;
}
public function obfuscate($name) {
$authKey = defined('AUTH_KEY') ? AUTH_KEY : '';
$hash = substr(md5($authKey . $this->wp->homeUrl() . $name), 0, self::HASH_LENGTH);
return self::OBFUSCATED_FIELD_PREFIX . base64_encode($hash . '_' . $name);
}
public function deobfuscate($name) {
$decoded = base64_decode(substr($name, strlen(self::OBFUSCATED_FIELD_PREFIX)));
return substr($decoded, self::HASH_LENGTH + 1);
}
public function deobfuscateFormPayload($data) {
$result = [];
foreach ($data as $key => $value) {
$result[$this->deobfuscateField($key)] = $value;
}
return $result;
}
private function deobfuscateField($name) {
if ($this->wasFieldObfuscated($name)) {
return $this->deobfuscate($name);
} else {
return $name;
}
}
private function wasFieldObfuscated($name) {
return strpos($name, FieldNameObfuscator::OBFUSCATED_FIELD_PREFIX) === 0;
}
}

Some files were not shown because too many files have changed in this diff Show More