Compare commits

..

1 Commits
4.0.1 ... 4.0.0

Author SHA1 Message Date
f0b779d724 Release 4.0.0 2022-11-15 15:06:53 +01:00
93 changed files with 270 additions and 491 deletions

View File

@ -179,7 +179,7 @@ jobs:
- run:
name: Download additional WP Plugins for tests
command: |
./do download:woo-commerce-zip 7.1.0
./do download:woo-commerce-zip 7.0.1
./do download:woo-commerce-subscriptions-zip 4.6.0
./do download:woo-commerce-memberships-zip 1.23.1
./do download:woo-commerce-blocks-zip 8.8.2
@ -311,7 +311,7 @@ jobs:
parallelism: 20
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: ubuntu-2204:2022.10.2
image: ubuntu-2204:2022.07.1
parameters:
multisite:
type: integer
@ -476,7 +476,7 @@ jobs:
integration_tests:
working_directory: /home/circleci/mailpoet/mailpoet
machine:
image: ubuntu-2204:2022.10.2
image: ubuntu-2204:2022.07.1
environment:
CODECEPTION_IMAGE_VERSION: << parameters.codeception_image_version >>
parameters:
@ -501,6 +501,9 @@ jobs:
multisite:
type: integer
default: 0
woo_core_version:
type: string
default: ''
steps:
- attach_workspace:
at: /home/circleci
@ -508,6 +511,14 @@ jobs:
name: 'Pull test docker images'
# Pull docker images with 3 retries
command: i='0';while ! docker-compose -f tests/docker/docker-compose.yml pull && ((i < 3)); do sleep 3 && i=$[$i+1]; done
- when:
condition: << parameters.woo_core_version >>
steps:
- run:
name: Download WooCommerce Core
command: |
cd tests/docker
docker-compose run --rm -w /project --entrypoint "./do download:woo-commerce-zip << parameters.woo_core_version >>" --no-deps codeception_integration
- run:
name: 'PHP Integration tests'
command: |
@ -630,6 +641,7 @@ workflows:
group: woo
enable_cot: 1
enable_cot_sync: 1
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
requires:
- unit_tests
- static_analysis_php8
@ -641,6 +653,7 @@ workflows:
group: woo
enable_cot: 1
enable_cot_sync: 0
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
requires:
- unit_tests
- static_analysis_php8
@ -650,6 +663,7 @@ workflows:
<<: *slack-fail-post-step
name: acceptance_tests_woo_cot_off
group: woo
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
requires:
- unit_tests
- static_analysis_php8
@ -673,6 +687,7 @@ workflows:
group: woo
enable_cot: 1
enable_cot_sync: 1
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
name: integration_test_woo_cot_sync
requires:
- unit_tests
@ -684,6 +699,7 @@ workflows:
group: woo
enable_cot: 1
enable_cot_sync: 0
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
name: integration_test_woo_cot_no_sync
requires:
- unit_tests
@ -693,6 +709,7 @@ workflows:
- integration_tests:
<<: *slack-fail-post-step
group: woo
woo_core_version: 7.1.0-rc.2 # Temporarily force COT beta version
name: integration_test_woo_cot_off
requires:
- unit_tests

View File

@ -799,9 +799,6 @@ class RoboFile extends \Robo\Tasks {
->addCode(function () use ($version) {
$this->releaseCreatePullRequest($version);
})
->addCode(function () use ($version) {
$this->releaseRerunCircleWorkflow(\MailPoetTasks\Release\CircleCiController::PROJECT_PREMIUM);
})
->addCode(function () use ($version) {
$this->translationsPrepareLanguagePacks($version);
})
@ -1119,18 +1116,6 @@ class RoboFile extends \Robo\Tasks {
$this->say("Release '$version[name]' info was published on Slack.");
}
public function releaseRerunCircleWorkflow(string $project = null) {
$circleciController = $this->createCircleCiController();
$result = $circleciController->rerunLatestWorkflow($project);
// Sometimes can be useful to know which Circle project workflow was restarted
$project = $project ? " for the project '{$project}'" : '';
if (!$result) {
$this->yell("Circle Workflow{$project} was not restarted", 40, 'red');
} else {
$this->say("Circle Workflow{$project} was started from the beginning");
}
}
public function downloadWooCommerceBlocksZip($tag = null) {
$this->createWpOrgDownloader('woo-gutenberg-products-block')
->downloadPluginZip('woo-gutenberg-products-block.zip', __DIR__ . '/tests/plugins/', $tag);

View File

@ -15,7 +15,7 @@ export function DeactivateImmediatelyModal({
return (
<Modal
className="mailpoet-automatoin-deactivate-modal"
title={__('Stop automation for all subscribers?', 'mailpoet')}
title={__('Stop automatoin for all subscribers?', 'mailpoet')}
onRequestClose={onClose}
>
<p>

View File

@ -24,19 +24,8 @@ class FormComponent extends Component {
this.loadItem(this.props.params.id);
} else {
setImmediate(() => {
const defaultValues =
jQuery('.mailpoet_form').mailpoetSerializeObject();
const checkboxField =
Array.isArray(this.props.fields) &&
this.props.fields.length > 0 &&
this.props.fields.find(
(field) => field?.type === 'checkbox' && field?.isChecked,
);
if (checkboxField && checkboxField.name) {
defaultValues[checkboxField.name] = '1';
}
this.setState({
item: defaultValues,
item: jQuery('.mailpoet_form').mailpoetSerializeObject(),
});
});
}

View File

@ -19,17 +19,6 @@ const fields = [
type: 'textarea',
tip: MailPoet.I18n.t('segmentDescriptionTip'),
},
{
name: 'showInManageSubscriptionPage',
label: MailPoet.I18n.t('showInManageSubscriptionPage'),
type: 'checkbox',
values: {
showInManageSubscriptionPage: MailPoet.I18n.t(
'showInManageSubscriptionPageTip',
),
},
isChecked: true, // default checked state
},
];
const messages = {

View File

@ -1,10 +1,11 @@
import ReactStringReplace from 'react-string-replace';
import { t } from 'common/functions';
import { useSetting } from 'settings/store/hooks';
import { Inputs, Label, PageSelect } from 'settings/components';
import { Inputs, Label, PageSelect, SegmentsSelect } from 'settings/components';
export function ManageSubscription() {
const [page, setPage] = useSetting('subscription', 'pages', 'manage');
const [segments, setSegments] = useSetting('subscription', 'segments');
return (
<>
<Label
@ -41,24 +42,18 @@ export function ManageSubscription() {
automationId="subscription-manage-page-selection"
linkAutomationId="preview_manage_subscription_page_link"
/>
<p>
{ReactStringReplace(
t('hideListFromManageSubPage'),
/\[link\](.*?)\[\/link\]/,
(text) => (
<a
className="mailpoet-link"
key={text}
href="/wp-admin/admin.php?page=mailpoet-segments#/lists"
rel="noopener noreferrer"
target="_blank"
>
{text}
</a>
),
)}
</p>
<label
className="mailpoet-settings-inputs-row"
htmlFor="subscription-segments"
>
{t('subscribersCanChooseFrom')}
</label>
<SegmentsSelect
id="subscription-segments"
value={segments}
setValue={setSegments}
placeholder={t('leaveEmptyToDisplayAll')}
/>
</Inputs>
</>
);

View File

@ -34,7 +34,6 @@ class SegmentsResponseBuilder {
'deleted_at' => ($deletedAt = $segment->getDeletedAt()) ? $deletedAt->format(self::DATE_FORMAT) : null,
'average_engagement_score' => $segment->getAverageEngagementScore(),
'filters_connect' => $segment->getFiltersConnectOperator(),
'showInManageSubscriptionPage' => (int)$segment->getDisplayInManageSubscriptionPage(),
];
}

View File

@ -89,12 +89,16 @@ class Menu {
// @ToDo Remove Beta once Automation is no longer beta.
$this->wp->addAction('admin_head', function () {
echo '<style>
#adminmenu .toplevel_page_mailpoet-newsletters a[href="admin.php?page=mailpoet-automation"] {
display: flex;
gap: 8px;
}
.mailpoet-beta-badge {
text-transform: uppercase;
font-size: 10px;
position: relative;
top: -5px;
color: #ffab66;
background: #F0F0F1;
border-radius: 50px;
padding: 0 12px;
color: #1D2327;
font-weight: normal;
}
</style>';
});

View File

@ -67,12 +67,6 @@ class SegmentEntity {
*/
private $averageEngagementScoreUpdatedAt;
/**
* @ORM\Column(type="boolean")
* @var bool
*/
private $displayInManageSubscriptionPage = false;
public function __construct(
string $name,
string $type,
@ -162,14 +156,6 @@ class SegmentEntity {
$this->averageEngagementScoreUpdatedAt = $averageEngagementScoreUpdatedAt;
}
public function getDisplayInManageSubscriptionPage(): bool {
return $this->displayInManageSubscriptionPage;
}
public function setDisplayInManageSubscriptionPage(bool $state): void {
$this->displayInManageSubscriptionPage = $state;
}
/**
* Returns connect operand from the first filter, when doesn't exist, then returns a default value.
* @return string

View File

@ -151,17 +151,4 @@ EOL;
protected function replaceLinkTags($source, $link, $attributes = [], $linkTag = false): string {
return Helpers::replaceLinkTags($source, $link, $attributes, $linkTag);
}
protected function replacePrivacyLinkTags($source, $link = '#'): string {
$privacyPolicyUrl = $this->wp->getPrivacyPolicyUrl();
$attributes = [];
$linkTag = false;
if (!empty($privacyPolicyUrl)) {
$link = $this->wp->escUrl($privacyPolicyUrl);
$attributes = ['target' => '_blank'];
$linkTag = 'link';
}
return $this->replaceLinkTags($source, $link, $attributes, $linkTag);
}
}

View File

@ -160,7 +160,7 @@ class Template10BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -60,7 +60,7 @@ class Template10FixedBar extends FormTemplate {
'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>',
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -131,7 +131,7 @@ class Template10Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -128,7 +128,7 @@ class Template10SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -131,7 +131,7 @@ class Template10Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Concert One" data-font="Concert One" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -185,7 +185,7 @@ class Template11BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -138,7 +138,7 @@ class Template11FixedBar extends FormTemplate {
'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>',
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -153,7 +153,7 @@ class Template11Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -153,7 +153,7 @@ class Template11SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -142,7 +142,7 @@ class Template11Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Fira Sans" data-font="Fira Sans" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -154,7 +154,7 @@ class Template12BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -198,7 +198,7 @@ class Template12FixedBar extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -168,7 +168,7 @@ class Template12Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -168,7 +168,7 @@ class Template12SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -111,7 +111,7 @@ class Template12Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -161,7 +161,7 @@ class Template13BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -109,7 +109,7 @@ class Template13FixedBar extends FormTemplate {
'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'), '#'),
'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->replaceLinkTags(_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',

View File

@ -161,7 +161,7 @@ class Template13Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -161,7 +161,7 @@ class Template13SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -156,7 +156,7 @@ class Template13Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Titillium Web" data-font="Titillium Web" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template14BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -95,7 +95,7 @@ class Template14FixedBar extends FormTemplate {
'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>',
'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->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template14Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template14SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -142,7 +142,7 @@ class Template14Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Karla" data-font="Karla" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -125,7 +125,7 @@ class Template17BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font"><strong>' . $this->replaceLinkTags(_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',

View File

@ -113,7 +113,7 @@ class Template17FixedBar extends FormTemplate {
'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>',
'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->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template17Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template17SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -128,7 +128,7 @@ class Template17Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Oxygen" data-font="Oxygen" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -227,7 +227,7 @@ class Template18BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -241,7 +241,7 @@ class Template18FixedBar extends FormTemplate {
'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>',
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -165,7 +165,7 @@ class Template18Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -165,7 +165,7 @@ class Template18SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -151,7 +151,7 @@ class Template18Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Heebo" data-font="Heebo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -127,7 +127,7 @@ class Template1BelowPages extends FormTemplate {
'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>',
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -64,7 +64,7 @@ class Template1FixedBar extends FormTemplate {
'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>',
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -101,7 +101,7 @@ class Template1Popup extends FormTemplate {
'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>',
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -101,7 +101,7 @@ class Template1SlideIn extends FormTemplate {
'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>',
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -101,7 +101,7 @@ class Template1Widget extends FormTemplate {
'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>',
'content' => '<em><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -147,7 +147,7 @@ class Template3BelowPages extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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' => '',

View File

@ -65,7 +65,7 @@ class Template3FixedBar extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -108,7 +108,7 @@ class Template3Popup extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -108,7 +108,7 @@ class Template3SlideIn extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -108,7 +108,7 @@ class Template3Widget extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -64,7 +64,7 @@ class Template4BelowPages extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -64,7 +64,7 @@ class Template4FixedBar extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -144,7 +144,7 @@ class Template4Popup extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -144,7 +144,7 @@ class Template4SlideIn extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -107,7 +107,7 @@ class Template4Widget extends FormTemplate {
'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>',
'content' => '<em>' . $this->replaceLinkTags(_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',

View File

@ -141,7 +141,7 @@ class Template6BelowPages extends FormTemplate {
'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>',
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -50,7 +50,7 @@ class Template6FixedBar extends FormTemplate {
'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>',
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -94,7 +94,7 @@ class Template6Popup extends FormTemplate {
'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>',
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -93,7 +93,7 @@ class Template6SlideIn extends FormTemplate {
'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>',
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -93,7 +93,7 @@ class Template6Widget extends FormTemplate {
'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>',
'content' => '<strong><span style="font-family: Montserrat" data-font="Montserrat" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -169,7 +169,7 @@ class Template7BelowPages extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -50,7 +50,7 @@ class Template7FixedBar extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -153,7 +153,7 @@ class Template7Popup extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -153,7 +153,7 @@ class Template7SlideIn extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -107,7 +107,7 @@ class Template7Widget extends FormTemplate {
'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>',
'content' => '<span style="font-family: Cairo" data-font="Cairo" class="mailpoet-has-font">' . $this->replaceLinkTags(_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',

View File

@ -1,62 +0,0 @@
<?php declare(strict_types = 1);
namespace MailPoet\Migrations;
use MailPoet\Config\Env;
use MailPoet\Entities\SegmentEntity;
use MailPoet\Migrator\Migration;
use MailPoet\Settings\SettingsController;
class Migration_20221108_140545 extends Migration {
/** @var string */
private $prefix;
/** @var SettingsController */
private $settings;
public function run(): void {
$this->prefix = Env::$dbPrefix;
$this->settings = $this->container->get(SettingsController::class);
$this->migrateSegmentDisplaySettingsOnManageSubscriptionPage();
}
private function migrateSegmentDisplaySettingsOnManageSubscriptionPage(): bool {
global $wpdb;
$segmentsTable = esc_sql("{$this->prefix}segments");
// Add display_in_manage_subscription_page column in case it doesn't exist
$displayInManageSubscriptionPageColumnExists = $wpdb->get_results($wpdb->prepare("
SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_name = %s AND column_name = 'display_in_manage_subscription_page';
", $segmentsTable));
if (empty($displayInManageSubscriptionPageColumnExists)) {
$addNewColumnQuery = "
ALTER TABLE `$segmentsTable`
ADD `display_in_manage_subscription_page` tinyint(1) NOT NULL DEFAULT 0;
";
$wpdb->query($addNewColumnQuery);
}
$segmentIds = $this->settings->get('subscription.segments', []);
if (!empty($segmentIds)) {
// when a segment exist in the list (subscription.segments), show only that segment, do not display the other segments
foreach ($segmentIds as $segmentId) {
$wpdb->update($segmentsTable, [
'display_in_manage_subscription_page' => 1,
], ['id' => $segmentId]);
}
$this->settings->set('subscription.segments', []);
} else {
$wpdb->update($segmentsTable, [
'display_in_manage_subscription_page' => 1,
], ['type' => SegmentEntity::TYPE_DEFAULT]);
}
return true;
}
}

View File

@ -2,72 +2,77 @@
namespace MailPoet\Migrations;
use MailPoet\Config\Env;
use MailPoet\Migrator\Migration;
/**
* The "created_at" column must be NULL in some tables to avoid "there can be only one
* TIMESTAMP column with CURRENT_TIMESTAMP" error on MySQL version < 5.6.5 that occurs
* even when other timestamp is simply "NOT NULL".
*
* Additionally, having multiple timestamp columns with "NOT NULL" seems to produce the
* following error in some SQL modes:
* SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'updated_at'"
*/
class Migration_20221110_151621 extends Migration {
public function run(): void {
$this->createTable('automations', [
'id int(11) unsigned NOT NULL AUTO_INCREMENT',
'name varchar(191) NOT NULL',
'author bigint NOT NULL',
'status varchar(191) NOT NULL',
'created_at timestamp NULL', // must be NULL, see comment at the top
'updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'activated_at timestamp NULL',
'deleted_at timestamp NULL',
'PRIMARY KEY (id)',
]);
$prefix = Env::$dbPrefix;
$charsetCollate = Env::$dbCharsetCollate;
$this->createTable('automation_versions', [
'id int(11) unsigned NOT NULL AUTO_INCREMENT',
'automation_id int(11) unsigned NOT NULL',
'steps longtext',
'created_at timestamp NULL', // must be NULL, see comment at the top
'updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'PRIMARY KEY (id)',
'INDEX (automation_id)',
]);
$this->connection->executeStatement("
CREATE TABLE {$prefix}automations (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
name varchar(191) NOT NULL,
author bigint NOT NULL,
status varchar(191) NOT NULL,
created_at timestamp NULL, -- must be NULL, see comment at the top
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
activated_at timestamp NULL,
deleted_at timestamp NULL,
PRIMARY KEY (id)
) {$charsetCollate};
");
$this->createTable('automation_triggers', [
'automation_id int(11) unsigned NOT NULL',
'trigger_key varchar(191)',
'PRIMARY KEY (automation_id, trigger_key)',
]);
$this->connection->executeStatement("
CREATE TABLE {$prefix}automation_versions (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
automation_id int(11) unsigned NOT NULL,
steps longtext,
created_at timestamp NULL, -- must be NULL, see comment at the top
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
INDEX (automation_id)
) {$charsetCollate};
");
$this->createTable('automation_runs', [
'id int(11) unsigned NOT NULL AUTO_INCREMENT',
'automation_id int(11) unsigned NOT NULL',
'version_id int(11) unsigned NOT NULL',
'trigger_key varchar(191) NOT NULL',
'status varchar(191) NOT NULL',
'created_at timestamp NULL', // must be NULL, see comment at the top
'updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
'subjects longtext',
'next_step_id varchar(191)',
'PRIMARY KEY (id)',
'INDEX (automation_id, status)',
]);
$this->connection->executeStatement("
CREATE TABLE {$prefix}automation_triggers (
automation_id int(11) unsigned NOT NULL,
trigger_key varchar(191),
PRIMARY KEY (automation_id, trigger_key)
);
");
$this->createTable('automation_run_logs', [
'id int(11) unsigned NOT NULL AUTO_INCREMENT',
'automation_run_id int(11) unsigned NOT NULL',
'step_id varchar(191) NOT NULL',
'status varchar(191) NOT NULL',
'started_at timestamp NOT NULL',
'completed_at timestamp NULL DEFAULT NULL',
'error longtext',
'data longtext',
'PRIMARY KEY (id)',
'INDEX (automation_run_id)',
]);
$this->connection->executeStatement("
CREATE TABLE {$prefix}automation_runs (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
automation_id int(11) unsigned NOT NULL,
version_id int(11) unsigned NOT NULL,
trigger_key varchar(191) NOT NULL,
status varchar(191) NOT NULL,
created_at timestamp NULL, -- must be NULL, see comment at the top
updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
subjects longtext,
next_step_id varchar(191),
PRIMARY KEY (id),
INDEX (automation_id, status)
) {$charsetCollate};
");
$this->connection->executeStatement("
CREATE TABLE {$prefix}automation_run_logs (
id int(11) unsigned NOT NULL AUTO_INCREMENT,
automation_run_id int(11) unsigned NOT NULL,
step_id varchar(191) NOT NULL,
status varchar(191) NOT NULL,
started_at timestamp NOT NULL,
completed_at timestamp NULL DEFAULT NULL,
error longtext,
data longtext,
PRIMARY KEY (id),
INDEX (automation_run_id)
) {$charsetCollate};
");
}
}

View File

@ -2,7 +2,6 @@
namespace MailPoet\Migrator;
use MailPoet\Config\Env;
use MailPoet\DI\ContainerWrapper;
use MailPoetVendor\Doctrine\DBAL\Connection;
use MailPoetVendor\Doctrine\ORM\EntityManager;
@ -26,15 +25,4 @@ abstract class Migration {
}
abstract public function run(): void;
protected function createTable(string $tableName, array $attributes): void {
$prefix = Env::$dbPrefix;
$charsetCollate = Env::$dbCharsetCollate;
$sql = implode(",\n", $attributes);
$this->connection->executeStatement("
CREATE TABLE IF NOT EXISTS {$prefix}{$tableName} (
$sql
) {$charsetCollate};
");
}
}

View File

@ -218,32 +218,26 @@ class ScheduledTasksRepository extends Repository {
],
$limit = Scheduler::TASK_BATCH_SIZE
) {
$result = [];
foreach ($statuses as $status) {
$tasksQuery = $this->doctrineRepository->createQueryBuilder('st')
->select('st')
->where('st.deletedAt IS NULL')
->where('st.status = :status');
if ($status === ScheduledTaskEntity::VIRTUAL_STATUS_RUNNING) {
$tasksQuery = $tasksQuery->orWhere('st.status IS NULL');
}
$tasksQuery = $this->doctrineRepository->createQueryBuilder('st')
->select('st')
->where('st.deletedAt IS NULL')
->where('st.status IN (:statuses)');
if ($type) {
$tasksQuery = $tasksQuery->andWhere('st.type = :type')
->setParameter('type', $type);
}
$tasks = $tasksQuery
->setParameter('status', $status)
->setMaxResults($limit)
->orderBy('st.id', 'desc')
->getQuery()
->getResult();
$result = array_merge($result, $tasks);
if (in_array(ScheduledTaskEntity::VIRTUAL_STATUS_RUNNING, $statuses)) {
$tasksQuery = $tasksQuery->orWhere('st.status IS NULL');
}
return $result;
if ($type) {
$tasksQuery = $tasksQuery->andWhere('st.type = :type')
->setParameter('type', $type);
}
return $tasksQuery
->setParameter('statuses', $statuses)
->setMaxResults($limit)
->getQuery()
->getResult();
}
/**

View File

@ -54,7 +54,7 @@ class Subscriber implements CategoryInterface {
}
return $defaultValue;
case 'count':
return (string)$this->getSubscribersCountWithSubscribedStatus();
return (string)$this->subscribersRepository->getTotalSubscribers();
default:
if (
preg_match('/cf_(\d+)/', $shortcodeDetails['action'], $customField) &&
@ -69,8 +69,4 @@ class Subscriber implements CategoryInterface {
return null;
}
}
private function getSubscribersCountWithSubscribedStatus(): int {
return $this->subscribersRepository->countBy(['status' => SubscriberEntity::STATUS_SUBSCRIBED, 'deletedAt' => null]);
}
}

View File

@ -33,9 +33,8 @@ class SegmentSaveController {
$id = isset($data['id']) ? (int)$data['id'] : null;
$name = $data['name'] ?? '';
$description = $data['description'] ?? '';
$displayInManageSubPage = isset($data['showInManageSubscriptionPage']) ? (int)$data['showInManageSubscriptionPage'] : false;
return $this->segmentsRepository->createOrUpdate($name, $description, SegmentEntity::TYPE_DEFAULT, [], $id, (bool)$displayInManageSubPage);
return $this->segmentsRepository->createOrUpdate($name, $description, SegmentEntity::TYPE_DEFAULT, [], $id);
}
/**

View File

@ -133,10 +133,8 @@ class SegmentsRepository extends Repository {
string $description = '',
string $type = SegmentEntity::TYPE_DEFAULT,
array $filtersData = [],
?int $id = null,
bool $displayInManageSubscriptionPage = true
?int $id = null
): SegmentEntity {
$displayInManageSubPage = $type === SegmentEntity::TYPE_DEFAULT ? $displayInManageSubscriptionPage : false;
if ($id) {
$segment = $this->findOneById($id);
if (!$segment instanceof SegmentEntity) {
@ -147,11 +145,9 @@ class SegmentsRepository extends Repository {
$segment->setName($name);
}
$segment->setDescription($description);
$segment->setDisplayInManageSubscriptionPage($displayInManageSubPage);
} else {
$this->verifyNameIsUnique($name, $id);
$segment = new SegmentEntity($name, $type, $description);
$segment->setDisplayInManageSubscriptionPage($displayInManageSubPage);
$this->persist($segment);
}

View File

@ -9,6 +9,7 @@ use MailPoet\Entities\SubscriberSegmentEntity;
use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Newsletter\Scheduler\WelcomeScheduler;
use MailPoet\Segments\SegmentsRepository;
use MailPoet\Settings\SettingsController;
use MailPoet\Statistics\Track\Unsubscribes;
use MailPoet\Subscribers\LinkTokens;
use MailPoet\Subscribers\NewSubscriberNotificationMailer;
@ -28,6 +29,9 @@ class Manage {
/** @var LinkTokens */
private $linkTokens;
/** @var SettingsController */
private $settings;
/** @var Unsubscribes */
private $unsubscribesTracker;
@ -57,6 +61,7 @@ class Manage {
FieldNameObfuscator $fieldNameObfuscator,
LinkTokens $linkTokens,
Unsubscribes $unsubscribesTracker,
SettingsController $settings,
NewSubscriberNotificationMailer $newSubscriberNotificationMailer,
WelcomeScheduler $welcomeScheduler,
CustomFieldsRepository $customFieldsRepository,
@ -69,6 +74,7 @@ class Manage {
$this->fieldNameObfuscator = $fieldNameObfuscator;
$this->unsubscribesTracker = $unsubscribesTracker;
$this->linkTokens = $linkTokens;
$this->settings = $settings;
$this->newSubscriberNotificationMailer = $newSubscriberNotificationMailer;
$this->welcomeScheduler = $welcomeScheduler;
$this->segmentsRepository = $segmentsRepository;
@ -134,6 +140,7 @@ class Manage {
if (isset($subscriberData['segments']) && is_array($subscriberData['segments'])) {
$segmentsIds = $subscriberData['segments'];
}
$allowedSegments = $this->settings->get('subscription.segments', false);
// Unsubscribe from all other segments already subscribed to
// but don't change disallowed segments
@ -143,7 +150,7 @@ class Manage {
continue;
}
if (empty($segment->getDisplayInManageSubscriptionPage())) {
if ($allowedSegments && !in_array($segment->getId(), $allowedSegments)) {
continue;
}
if (!in_array($segment->getId(), $segmentsIds)) {
@ -166,15 +173,15 @@ class Manage {
}, $subscriberSegments));
$newSegmentIds = array_diff($segmentsIds, $currentSegmentIds);
// Allow subscribing only to allowed segments
if ($allowedSegments) {
$segmentsIds = array_intersect($segmentsIds, $allowedSegments);
}
foreach ($segmentsIds as $segmentId) {
$segment = $this->segmentsRepository->findOneById($segmentId);
if (!$segment) {
continue;
}
// Allow subscribing only to allowed segments
if (empty($segment->getDisplayInManageSubscriptionPage())) {
continue;
}
$this->subscriberSegmentRepository->createOrUpdate(
$subscriber,
$segment,

View File

@ -10,6 +10,7 @@ use MailPoet\Entities\SubscriberEntity;
use MailPoet\Form\Block\Date as FormBlockDate;
use MailPoet\Form\Renderer as FormRenderer;
use MailPoet\Segments\SegmentsRepository;
use MailPoet\Settings\SettingsController;
use MailPoet\Subscribers\LinkTokens;
use MailPoet\Util\Helpers;
use MailPoet\Util\Url as UrlHelper;
@ -20,6 +21,9 @@ class ManageSubscriptionFormRenderer {
const FORM_STATE_SUCCESS = 'success';
const FORM_STATE_NOT_SUBMITTED = 'not_submitted';
/** @var SettingsController */
private $settings;
/** @var UrlHelper */
private $urlHelper;
@ -46,6 +50,7 @@ class ManageSubscriptionFormRenderer {
public function __construct(
WPFunctions $wp,
SettingsController $settings,
UrlHelper $urlHelper,
LinkTokens $linkTokens,
FormRenderer $formRenderer,
@ -55,6 +60,7 @@ class ManageSubscriptionFormRenderer {
SegmentsRepository $segmentsRepository
) {
$this->wp = $wp;
$this->settings = $settings;
$this->urlHelper = $urlHelper;
$this->linkTokens = $linkTokens;
$this->formRenderer = $formRenderer;
@ -221,12 +227,13 @@ class ManageSubscriptionFormRenderer {
}
private function getSegmentField(SubscriberEntity $subscriber): array {
$segmentIds = $this->settings->get('subscription.segments', []);
// Get default segments
$criteria = [
'type' => SegmentEntity::TYPE_DEFAULT,
'deletedAt' => null,
'displayInManageSubscriptionPage' => true,
];
$criteria = ['type' => SegmentEntity::TYPE_DEFAULT, 'deletedAt' => null];
if (!empty($segmentIds)) {
$criteria['id'] = $segmentIds;
}
$segments = $this->segmentsRepository->findBy($criteria, ['name' => Criteria::ASC]);
$subscribedSegmentIds = [];

View File

@ -140,10 +140,6 @@ class Functions {
return esc_sql($sql);
}
public function escUrl($url): string {
return esc_url($url);
}
public function getBloginfo($show = '', $filter = 'raw') {
return get_bloginfo($show, $filter);
}
@ -627,10 +623,6 @@ class Functions {
return is_main_query();
}
public function getPrivacyPolicyUrl(): string {
return get_privacy_policy_url();
}
/**
* @param string $action
* @param array|object $args

View File

@ -2,7 +2,7 @@
/*
* Plugin Name: MailPoet
* Version: 4.0.1
* Version: 4.0.0
* Plugin URI: https://www.mailpoet.com
* Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
* Author: MailPoet
@ -20,7 +20,7 @@
*/
$mailpoetPlugin = [
'version' => '4.0.1',
'version' => '4.0.0',
'filename' => __FILE__,
'path' => dirname(__FILE__),
'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',

View File

@ -300,15 +300,6 @@ $replacements = [
'\'\\\\MailPoetVendor\\\\twig_call_macro(',
],
],
[
'file' => '../vendor-prefixed/twig/twig/src/Node/CheckSecurityCallNode.php',
'find' => [
'\'\\\\Twig\\\\Extension\\\\SandboxExtension',
],
'replace' => [
'\'\\\\MailPoetVendor\\\\Twig\\\\Extension\\\\SandboxExtension',
],
],
];
foreach ($replacements as $singleFile) {

View File

@ -3,7 +3,7 @@ Contributors: mailpoet
Tags: email, email marketing, post notification, woocommerce emails, email automation, newsletter, newsletter builder, newsletter subscribers
Requires at least: 5.8
Tested up to: 6.0
Stable tag: 4.0.1
Stable tag: 4.0.0
Requires PHP: 7.2
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
@ -219,14 +219,6 @@ Check our [Knowledge Base](https://kb.mailpoet.com) or contact us through our [s
== Changelog ==
= 4.0.1 - 2022-11-22 =
* Improved: when editing a list, you can choose if it should be shown on the Manage Subscription page (on by default);
* Improved: form templates now link to existing Privacy Page;
* Changed: [subscriber:count] shortcode now counts only subscribed subscribers (and not unconfirmed or inactive);
* Fixed: automations beta badge overflows menu in some languages;
* Fixed: failing to create automation tables with "Base table or view already exists" in rare cases;
* Fixed: displaying wrong tasks in System Status.
= 4.0.0 - 2022-11-15 =
* Added: new Automations page (beta version, please share your feedback directly from the plugin);
* Added: optional support for POST unsubscribe when sending with MailPoet Sending Service, which enables 1-click unsubscribe button in more email clients;

View File

@ -18,9 +18,6 @@ class CircleCiController {
/** @var string */
private $token;
/** @var string */
private $username;
/** @var string */
private $zipFilename;
@ -36,9 +33,8 @@ class CircleCiController {
$project,
GitHubController $githubController
) {
$this->username = $username;
$this->token = $token;
$circleCiProject = $this->getCircleCiProject($project);
$circleCiProject = $project === self::PROJECT_MAILPOET ? 'mailpoet' : 'mailpoet-premium';
$this->zipFilename = $project === self::PROJECT_MAILPOET ? self::FREE_ZIP_FILENAME : self::PREMIUM_ZIP_FILENAME;
$this->httpClient = new Client([
'auth' => [$token, null],
@ -65,48 +61,15 @@ class CircleCiController {
return $targetPath;
}
/**
* Returns true when the Circle workflow was started from the beginning
* and false when the last workflow was successful.
*/
public function rerunLatestWorkflow(?string $project = null): bool {
$circleCiProject = null;
// We use the current project if the project parameter is null
if ($project) {
$project = strtoupper($project);
$supportedProjects = [
\MailPoetTasks\Release\CircleCiController::PROJECT_PREMIUM,
\MailPoetTasks\Release\CircleCiController::PROJECT_MAILPOET,
];
if (!in_array($project, $supportedProjects, true)) {
throw new \Exception('Unsupported project');
}
$circleCiProject = $this->getCircleCiProject($project);
}
$pipeline = $this->getLatestPipeline($circleCiProject);
if (!$pipeline) {
throw new \Exception('No pipeline found');
}
$workflow = $this->getWorkflowByPipelineId($pipeline['id']);
if (!$workflow) {
throw new \Exception('No workflow found');
}
$workflowStatus = $workflow['status'] ?? null;
if (in_array($workflowStatus, ['running', 'failed', 'failing', 'canceled'], true)) {
if ($workflowStatus === 'running') {
$this->cancelWorkflow($workflow['id']);
}
$this->rerunWorkflow($workflow['id']);
return true;
}
return false;
}
private function getLatestZipBuildJob(): array {
$latestPipeline = $this->getLatestPipeline();
$latestPipelineId = $latestPipeline['id'] ?? null;
$latestPipelineRevision = $latestPipeline['vcs']['revision'] ?? null;
// Latest Pipeline for release branch
$params = [
'query' => ['branch' => urlencode(self::RELEASE_BRANCH)],
];
$response = $this->httpClient->get('pipeline', $params);
$pipelines = json_decode($response->getBody()->getContents(), true);
$latestPipelineId = $pipelines['items'][0]['id'] ?? null;
$latestPipelineRevision = $pipelines['items'][0]['vcs']['revision'] ?? null;
if ($latestPipelineId === null) {
throw new \Exception('No release ZIP build found');
@ -123,8 +86,9 @@ class CircleCiController {
);
}
$latestWorkflow = $this->getWorkflowByPipelineId($latestPipelineId);
$latestWorkFlowId = $latestWorkflow['id'] ?? null;
$responseWorkflows = $this->httpClient->get('https://circleci.com/api/v2/pipeline/' . urlencode($latestPipelineId) . '/workflow');
$workflows = json_decode($responseWorkflows->getBody()->getContents(), true);
$latestWorkFlowId = $workflows['items'][0]['id'] ?? null;
if ($latestWorkFlowId === null) {
throw new \Exception('No release ZIP build found');
}
@ -159,53 +123,4 @@ class CircleCiController {
}
throw new \Exception('No ZIP file found in build artifacts');
}
/**
* Returns the latest pipeline for the current project or the for the specific when is set in the project argument
* @param string|null $project
* @return array|null
*/
private function getLatestPipeline(?string $project = null): ?array {
// Latest Pipeline for release branch
$params = [
'query' => ['branch' => urlencode(self::RELEASE_BRANCH)],
];
if ($project) {
$username = urlencode($this->username);
$circleCiProject = urlencode($project);
$response = $this->httpClient->get("https://circleci.com/api/v2/project/gh/{$username}/{$circleCiProject}/pipeline", $params);
} else {
$response = $this->httpClient->get('pipeline', $params);
}
$pipelines = json_decode($response->getBody()->getContents(), true);
return reset($pipelines['items']) ?: null;
}
private function getWorkflowByPipelineId(string $pipelineId): ?array {
$responseWorkflows = $this->httpClient->get('https://circleci.com/api/v2/pipeline/' . urlencode($pipelineId) . '/workflow');
$workflows = json_decode($responseWorkflows->getBody()->getContents(), true);
$workflows = $workflows['items'] ?? [];
return reset($workflows) ?: null;
}
private function rerunWorkflow(string $workflowId, bool $fromFailed = false): void {
$this->httpClient->post(
'https://circleci.com/api/v2/workflow/' . urlencode($workflowId) . '/rerun',
[
'json' => [
'from_failed' => $fromFailed,
],
]
);
}
private function cancelWorkflow(string $workflowId): void {
$this->httpClient->post('https://circleci.com/api/v2/workflow/' . urlencode($workflowId) . '/cancel');
}
private function getCircleCiProject(string $project): string {
return $project === self::PROJECT_MAILPOET ? 'mailpoet' : 'mailpoet-premium';
}
}

View File

@ -26,7 +26,6 @@ class Segment {
'type' => SegmentEntity::TYPE_DEFAULT,
'name' => 'List ' . bin2hex(random_bytes(7)), // phpcs:ignore
'description' => '',
'display_in_manage_subscription_page' => true,
];
}
@ -58,21 +57,11 @@ class Segment {
return $this->update('type', $type);
}
/**
* @return $this
*/
public function withDisplayInManageSubscriptionPage(bool $state) {
return $this->update('display_in_manage_subscription_page', $state);
}
public function create(): SegmentEntity {
$segment = $this->segmentsRepository->createOrUpdate(
$this->data['name'],
$this->data['description'],
$this->data['type'],
[],
null,
$this->data['display_in_manage_subscription_page']
$this->data['type']
);
if (($this->data['deleted_at'] ?? null) instanceof \DateTimeInterface) {
$segment->setDeletedAt($this->data['deleted_at']);

View File

@ -90,7 +90,7 @@ class WooCommerceDynamicSegmentsCest {
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->wantTo('Check subscriber is in category segment');
$i->amOnMailpoetPage('Lists');
@ -122,10 +122,9 @@ class WooCommerceDynamicSegmentsCest {
$i->login();
// Run action scheduler wc-admin hooks to sync customer and order data to lookup tables
// See https://github.com/woocommerce/woocommerce/blob/ba91c94ca9b1c4903964de70c8658cc7bff67d3f/plugins/woocommerce/src/Internal/Admin/Schedulers/ImportScheduler.php#L90
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->wantTo('Check subscriber is in category segment');
$i->amOnMailpoetPage('Lists');
@ -148,45 +147,51 @@ class WooCommerceDynamicSegmentsCest {
public function checkThatCustomersAreAddedToNumberOfOrdersSegment(\AcceptanceTester $i) {
$i->wantTo('Check that customers are added to the number of orders segment when the number of orders they placed matches what is expected');
$customer1Email = 'customer_2@example.com';
$anyProduct = $this->productInCategory;
$i->orderProduct($anyProduct, $customer1Email);
$product1 = $this->productFactory->create();
$i->orderProduct($product1, $customer1Email);
$guestEmail = 'guest_3@example.com';
$i->orderProduct($product1, $guestEmail);
$i->login();
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->wantTo('Check there is one subscriber in the number of orders segments (the segment was configured to match customers that placed one order in the last day)');
$i->amOnMailpoetPage('Lists');
$i->click('[data-automation-id="dynamic-segments-tab"]');
$i->waitForText(self::NUMBER_OF_ORDERS_SEGMENT);
$numberOfOrdersSegmentRow = "[data-automation-id='listing_item_{$this->numberOfOrdersSegment->getId()}']";
$i->see('1', $numberOfOrdersSegmentRow . " [data-colname='Number of subscribers']");
$i->see('2', $numberOfOrdersSegmentRow . " [data-colname='Number of subscribers']");
$i->clickItemRowActionByItemName(self::NUMBER_OF_ORDERS_SEGMENT, 'View Subscribers');
$i->waitForText($customer1Email);
$i->waitForText($guestEmail);
}
public function checkThatCustomersAreAddedToTotalSpentSegment(\AcceptanceTester $i) {
$i->wantTo('Check that customers are added to the total spent segment when the value of orders they placed matches what is expected');
$customerEmail = 'customer_2@example.com';
$anyProduct = $this->productInCategory;
$i->orderProduct($anyProduct, $customerEmail);
$product = $this->productFactory->create();
$i->orderProduct($product, $customerEmail);
$guestEmail = 'guest_2@example.com';
$i->orderProduct($product, $guestEmail);
$i->login();
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->wantTo('Check that there is one subscriber in the total spent segment');
$i->amOnMailpoetPage('Lists');
$i->click('[data-automation-id="dynamic-segments-tab"]');
$i->waitForText(self::TOTAL_SPENT_SEGMENT);
$totalSpentSegmentRow = "[data-automation-id='listing_item_{$this->totalSpentSegment->getId()}']";
$i->see('1', $totalSpentSegmentRow . " [data-colname='Number of subscribers']");
$i->see('2', $totalSpentSegmentRow . " [data-colname='Number of subscribers']");
$i->clickItemRowActionByItemName(self::TOTAL_SPENT_SEGMENT, 'View Subscribers');
$i->waitForText($customerEmail);
$i->waitForText($guestEmail);
}
public function checkThatCustomersAreAddedToCustomerInCountrySegment(\AcceptanceTester $i) {
@ -201,7 +206,7 @@ class WooCommerceDynamicSegmentsCest {
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->wantTo('Check that there is one subscriber in customer country segment');
$i->amOnMailpoetPage('Lists');

View File

@ -37,7 +37,7 @@ class WooCommerceSetupPageCest {
$registeredCustomer = $this->customerFactory->withEmail('customer1@email.com')->create();
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->login();
$i->amOnPage('wp-admin/admin.php?page=mailpoet-woocommerce-setup');
@ -99,7 +99,7 @@ class WooCommerceSetupPageCest {
$i->login();
// run action scheduler to sync customer and order data to lookup tables
$i->wait(2);
$i->cli(['action-scheduler', 'run', '--hooks=wc-admin_import_orders,wc-admin_import_customers --force']);
$i->cli(['action-scheduler', 'run', '--force']);
$i->amOnPage('wp-admin/admin.php?page=mailpoet-woocommerce-setup');
$i->see('Get ready to use MailPoet for WooCommerce');

View File

@ -16,6 +16,15 @@ use MailPoet\Settings\SettingsRepository;
use MailPoet\Subscription\Captcha;
use MailPoet\WP\Functions as WPFunctions;
/**
* The "created_at" column must be NULL in some tables to avoid "there can be only one
* TIMESTAMP column with CURRENT_TIMESTAMP" error on MySQL version < 5.6.5 that occurs
* even when other timestamp is simply "NOT NULL".
*
* Additionally, having multiple timestamp columns with "NOT NULL" seems to produce the
* following error in some SQL modes:
* SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'updated_at'"
*/
class SetupTest extends \MailPoetTest {
public function _before() {
parent::_before();

View File

@ -236,7 +236,9 @@ class ShortcodesTest extends \MailPoetTest {
$subscriberCount = $subscribersRepository->countBy(
[
'status' =>[
SubscriberEntity::STATUS_SUBSCRIBED
SubscriberEntity::STATUS_SUBSCRIBED,
SubscriberEntity::STATUS_UNCONFIRMED,
SubscriberEntity::STATUS_INACTIVE
]
]
);

View File

@ -54,7 +54,6 @@ class ManageSubscriptionFormRendererTest extends \MailPoetTest {
private function getSegment(): SegmentEntity {
$segment = new SegmentEntity('Test segment', SegmentEntity::TYPE_DEFAULT, 'Description');
$segment->setDisplayInManageSubscriptionPage(true);
$this->entityManager->persist($segment);
$this->entityManager->flush();
return $segment;

View File

@ -7,6 +7,7 @@ use MailPoet\Entities\SegmentEntity;
use MailPoet\Entities\SubscriberEntity;
use MailPoet\Entities\SubscriberSegmentEntity;
use MailPoet\Form\Util\FieldNameObfuscator;
use MailPoet\Settings\SettingsController;
use MailPoet\Subscribers\LinkTokens;
use MailPoet\Subscribers\SubscribersRepository;
use MailPoet\Subscription\Manage;
@ -15,6 +16,9 @@ use MailPoet\Test\DataFactories\Subscriber as SubscriberFactory;
use MailPoet\Util\Url as UrlHelper;
class ManageTest extends \MailPoetTest {
/** @var SettingsController */
private $settings;
/** @var SegmentEntity */
private $segmentB;
@ -34,10 +38,12 @@ class ManageTest extends \MailPoetTest {
parent::_before();
$this->_after();
$segmentFactory = new SegmentFactory();
$this->settings = $this->diContainer->get(SettingsController::class);
$this->subscribersRepository = $this->diContainer->get(SubscribersRepository::class);
$this->segmentA = $segmentFactory->withName('List A')->create();
$this->segmentB = $segmentFactory->withName('List B')->create();
$this->hiddenSegment = $segmentFactory->withName('Hidden List')->withDisplayInManageSubscriptionPage(false)->create();
$this->hiddenSegment = $segmentFactory->withName('Hidden List')->create();
$this->settings->set('subscription.segments', [$this->segmentA->getId(), $this->segmentB->getId()]);
$this->subscriber = (new SubscriberFactory())
->withFirstName('John')
->withLastName('John')
@ -60,7 +66,8 @@ class ManageTest extends \MailPoetTest {
'verifyToken' => function($token) {
return true;
},
])
]),
'settings' => $this->settings,
]);
$_POST['action'] = 'mailpoet_subscription_update';
$_POST['token'] = 'token';

View File

@ -96,9 +96,6 @@
'segmentDescriptionTip': __('This text box is for your own use and is never shown to your subscribers.'),
'backToList': __('Back'),
'showInManageSubscriptionPage': __('Show this list on the “Manage Subscription” page'),
'showInManageSubscriptionPageTip': __('Uncheck to hide this list from the Manage Subscription page.'),
'subscribersInPlanCount': _x('%1$d / %2$d', 'count / total subscribers'),
'subscribersInPlan': _x('%s subscribers in your plan', 'number of subscribers in a sending plan'),
'subscribersInPlanTooltip': __('This is the total of subscribed, unconfirmed and inactive subscribers we count when you are sending with MailPoet Sending Service. The count excludes unsubscribed and bounced (invalid) email addresses.'),

View File

@ -61,8 +61,8 @@
'manageSubDescription2': __('Want to use a custom Subscription page? Check out our [link]Knowledge Base[/link] for instructions.'),
'previewPage': __('Preview page'),
'preview': __('Preview'),
'subscribersCanChooseFrom': __('Subscribers can choose from these lists:'),
'leaveEmptyToDisplayAll': __('Leave this field empty to display all lists'),
'hideListFromManageSubPage': __('To hide a list from the Manage Subscription page, go to [link]Lists[/link] and edit the one you want to hide.'),
'reEngagementTitle': __('Re-engagement page'),
'reEngagementDescription': __('Thank your subscribers reactivated by the Re-engagement email for their continued interest in your emails.'),