Compare commits

...

148 Commits

Author SHA1 Message Date
c3a97b7139 Merge pull request #1547 from mailpoet/release-3.11.3
Prepare 3.11.3 release
2018-10-09 18:30:11 +03:00
d59ace50f5 Update stable tag to the latest version 2018-10-09 17:52:55 +03:00
ff6f686333 Prepare 3.11.3 release 2018-10-09 17:51:22 +03:00
2ef8512fa7 Include mailpoet-cron.php in the zip during build 2018-10-09 16:46:34 +02:00
cabea5dadb Merge pull request #1544 from mailpoet/release-3.11.2
Prepare for 3.11.2 release
2018-10-09 14:56:01 +03:00
b80505a17c Update readme.txt with updated changelog 2018-10-09 14:29:40 +03:00
df4d3bacab Restore original version of package-json.lock using Node 9 2018-10-09 11:27:55 +03:00
6dc0acb63a Add release information and update package-lock.json 2018-10-09 11:03:11 +03:00
9ec6f52098 Merge pull request #1526 from mailpoet/linux-cron
Linux cron [MAILPOET-1538]
2018-10-08 06:41:57 -04:00
222d6b4eac Merge pull request #1514 from mailpoet/delete-subscriber-tasks
delete related scheduled_task_subscribers records [MAILPOET-1532]
2018-10-05 13:32:41 -04:00
0683dc9817 Merge pull request #1537 from mailpoet/admin-fatal-error
Fix error at editor page for admin who is not a subscriber [MAILPOET-1556]
2018-10-05 11:59:44 -04:00
45e6ddd9cb Merge pull request #1538 from mailpoet/better-drag-and-drop-modal
Better drag and drop modal title [MAILPOET-1555]
2018-10-05 11:23:41 -04:00
c556ec64fc Merge pull request #1535 from mailpoet/add-missing-translation
Add missing translation [MAILPOET-1554]
2018-10-05 10:24:30 -04:00
5bc9573ac6 Merge pull request #1528 from mailpoet/post-notifications-log
Add post notification logging [MAILPOET-1536]
2018-10-05 10:04:04 -04:00
a3d7afd1ca Merge pull request #1534 from mailpoet/fix-day-picker
Make date picker wider [MAILPOET-1531]
2018-10-05 09:32:56 -04:00
8c44ef561c adding transaction 2018-10-04 14:52:49 +02:00
c51a3f208c delete related scheduled_task_subscribers records 2018-10-04 14:52:49 +02:00
5524805ec3 pulled bad tests 2018-10-04 14:06:06 +02:00
816ec7e1d7 code sniffer fixes for 4 files 2018-10-04 14:06:06 +02:00
d74283ecad better drag and drop modal title 2018-10-04 10:36:19 +02:00
e810840445 Fix error at editor page for admin who is not a subscriber
[MAILPOET-1556]
2018-10-04 09:42:27 +02:00
b2e2087cfc Split cron daemon into 2 classes
[MAILPOET-1538]
2018-10-04 08:27:31 +02:00
69d920376f requested changes [MQ-70][MQ-71][MQ-72][MQ-73][MQ-74][MQ-77] 2018-10-04 08:01:07 +02:00
22efacd2d7 requested changes, added coverage for import/export [MQ-76][MQ-75][MQ-74][MQ-73][MQ-72][MQ-71][MQ-70][MQ-77] 2018-10-04 08:01:07 +02:00
25c72c6ce7 Edit, Add, Delete Subscribers [MQ-71][MQ-72][MQ-73][MQ-74][MQ-77] 2018-10-04 08:01:07 +02:00
e94d85fd47 Edit, Add, Delete Subscribers [MQ-71][MQ-72][MQ-73][MQ-74][MQ-77] 2018-10-04 08:01:07 +02:00
c6b379c840 Edit, Add, Delete Subscribers [MQ-71][MQ-72][MQ-73][MQ-74][MQ-77] 2018-10-04 08:01:07 +02:00
71bf3bbe19 Merge pull request #1531 from mailpoet/data-factory-lists
Data factory lists [MAILPOET-1546]
2018-10-03 15:01:26 -04:00
6e60056061 Merge pull request #1529 from mailpoet/cookies-accptance-tests
Add cookies option [MAILPOET-1547]
2018-10-03 14:59:58 -04:00
96edbc159f Merge pull request #1523 from mailpoet/create-welcome-email
Create Welcome Email [MQ-61]
2018-10-03 13:03:07 -04:00
c3c0765b78 Merge pull request #1524 from mailpoet/edit-delete-duplicate-welcome-email
Manage welcome emails by saving as draft, editing, deleting, duplicat…
2018-10-03 12:52:45 -04:00
b614997150 add missing translation 2018-10-03 16:31:51 +02:00
f81323ad52 Rename Daemon to DaemonHttpRunner
[MAILPOET-1538]
2018-10-03 10:28:26 +02:00
cfc0d79bed requested changes [MQ-61] 2018-10-02 22:33:22 -04:00
c6adfc6a5c requested changes, cleanup [MQ-[MQ-62][MQ-63][MQ-64][MQ-66][MQ-67][MQ-68] 2018-10-02 22:01:12 -04:00
53149c291c Merge pull request #1521 from mailpoet/receive-email-types
Confirm standard newsletter is sent to a subscriber [MQ-60]
2018-10-02 20:11:10 -04:00
e8f0a0067d Exit with error on failure
[MAILPOET-1538]
2018-10-02 14:53:36 +02:00
cc4ff09aea Small acceptance tests improvements 2018-10-02 13:54:06 +02:00
be11558b68 Releasing 3.11.1 2018-10-02 13:21:06 +02:00
77dfd28479 Make date picker wider
[MAILPOET-1531]
2018-10-02 12:10:39 +02:00
088a44a107 Merge pull request #1525 from mailpoet/satis-meter-nps-poll
Satis meter nps poll [MAILPOET-1539]
2018-10-02 06:03:01 -04:00
6b850d9d91 Merge pull request #1532 from mailpoet/fix-vuln-dependency
Fix vulnerable dependency cryptiles [MAILPOET-1534]
2018-10-02 12:53:32 +03:00
b878a73607 Merge pull request #1533 from mailpoet/remove-unused-config
Remove unused API keys [MAILPOET-1544]
2018-10-02 12:51:17 +03:00
9fb5b80f21 Merge pull request #1530 from mailpoet/webpack-named-modules
JS assets caching fix [MAILPOET-1548]
2018-10-02 05:38:31 -04:00
d7b2cfd759 Remove unused API keys
[MAILPOET-1544]
2018-10-02 11:11:56 +02:00
00be4849a5 Fix vulnerable dependency cryptiles
[MAILPOET-1534]
2018-10-02 10:53:04 +02:00
5a13ed746f Use hash of whole build instead of named modules and chunkhash
[MAILPOET-1548]
2018-10-02 09:51:34 +02:00
cd283c11fe Use data factory
[MAILPOET-1546]
2018-10-02 09:33:06 +02:00
57baff7b1d Add segments to form factory
[MAILPOET-1546]
2018-10-02 09:22:31 +02:00
fd72756622 Add Segment data factory
[MAILPOET-1546]
2018-10-02 08:56:43 +02:00
9b3abea2e5 Add more checks to linux cron
[MAILPOET-1538]
2018-10-02 08:25:56 +02:00
19086f8457 Add webpack named modules plugin into build
We need consistent module indexes within our build to be able to use chunkhash for file names
[MAILPOET-1548]
2018-10-01 16:16:15 +02:00
42c557a981 Add cookies option
[MAILPOET-1547]
2018-10-01 15:45:26 +02:00
e4db455a47 Add post notification logging
[MAILPOET-1536]
2018-10-01 15:02:12 +02:00
da059ad4b2 Prefix all global variables
[MAILPOET-1539]
2018-10-01 08:36:47 +02:00
5d1f3153cd Add Linux Cron Script
[MAILPOET-1538]
2018-09-27 16:51:44 +02:00
fcd8509cef Add linux cron option to settings
[MAILPOET-1538]
2018-09-27 15:08:56 +02:00
b0f5b4cfe9 Merge pull request #1522 from mailpoet/subscribe-to-multiple-lists
Confirms user can subscribe to multiple lists [MQ-11]
2018-09-27 08:46:42 -04:00
281e3c7eaa Show the poll on standard listings only
[MAILPOET-1539]
2018-09-27 13:28:30 +02:00
94efc67658 Move tracking code into a sepparate file
[MAILPOET-1539]
2018-09-27 10:43:17 +02:00
fc5bba9f11 Show NPS survey for all users
[MAILPOET-1539]
2018-09-27 08:54:40 +02:00
ad731fc5ed Manage welcome emails by saving as draft, editing, deleting, duplicating, searching, and saving as template [MQ-62][MQ-63][MQ-64][MQ-66][MQ-67][MQ-68] 2018-09-27 01:32:32 -04:00
4257ff6313 Create Welcome Email [MQ-61] 2018-09-26 19:59:25 -04:00
f9a3875de1 Create Welcome Email [MQ-61] 2018-09-26 19:39:54 -04:00
fcca86d607 Confirms user can subscribe to multiple lists [MQ-11] 2018-09-26 17:09:47 -04:00
b17d217669 Confirm standard newsletter is sent to a subscriber [MQ-60] 2018-09-26 14:37:01 -04:00
556e4a0ce0 Confirm standard newsletter is sent to a subscriber [MQ-60] 2018-09-26 13:43:39 -04:00
a72d84b940 Confirm standard newsletter is sent to a subscriber [MQ-60] 2018-09-26 13:21:05 -04:00
049074e793 Confirm standard newsletter is sent to a subscriber [MQ-60] 2018-09-26 13:05:30 -04:00
486c0ce4ee releasing 3.11.0 2018-09-25 14:10:12 +00:00
00d5623d72 Merge pull request #1520 from mailpoet/in-app-background-images
Add announcement for newsletter background image [MAILPOET-1430]
2018-09-24 10:00:06 -04:00
7b6d8afc53 Refactor passing window properties to background image announcement via props
[MAILPOET-1430]
2018-09-24 14:40:23 +02:00
08cd4e09f9 Refactor tutorial and announcement code out of editor initializer
[MAILPOET-1430]
2018-09-24 14:40:23 +02:00
7853271148 Add announcement for newsletter background images
[MAILPOET-1430]
2018-09-24 14:40:17 +02:00
5614a7a4b2 Merge pull request #1505 from mailpoet/sending-erros-levels
Multiple Sending Error Levels [MAILPOET-1154]
2018-09-24 07:09:39 -04:00
acc7100109 Merge pull request #1519 from mailpoet/form-edit
Edit an existing form [MQ-51]
2018-09-24 07:06:36 -04:00
e8c7dc937d Merge pull request #1504 from mailpoet/new-newsletter-templates
New newsletter templates [MAILPOET-1480]
2018-09-24 06:09:39 -04:00
c6273a6c3f Merge pull request #1513 from mailpoet/woo-fix
adding wasScheduledForSubscriber method to Newsletter model [PREMIUM-95]
2018-09-21 09:34:27 -04:00
15b4f7feb1 Merge pull request #1516 from mailpoet/listings-warning
Emails listing JS warning fix [MAILPOET-1537]
2018-09-20 14:54:34 -04:00
02e1f7f6dc Merge pull request #1489 from mailpoet/migration-notice
Migration notice [MAILPOET-1492]
2018-09-20 14:13:17 -04:00
356ca4c9d3 Merge pull request #1509 from mailpoet/free-welcome-premium
Update premium page for welcome emails [MAILPOET-1527]
2018-09-20 13:39:39 -04:00
93f9c65736 Edit an existing form [MQ-51] 2018-09-20 13:06:14 -04:00
5d5f3b8888 Edit an existing form [MQ-51] 2018-09-20 12:51:32 -04:00
85c2d40492 Edit an existing form [MQ-51] 2018-09-20 12:42:08 -04:00
0bb81660a5 Edit an existing form [MQ-51] 2018-09-20 12:11:24 -04:00
07c63bbb89 Merge pull request #1515 from mailpoet/in-app-welcome-emails
In app announcement for free welcome emails [MALPOET-1525]
2018-09-20 11:29:24 -04:00
a0007c048e Merge pull request #1517 from mailpoet/sub-form-test-fix
Fix Subscription Form Test [MQ-59]
2018-09-20 11:24:30 -04:00
b94d014e58 Fix Subscription Form Test [MQ-59] 2018-09-20 11:05:46 -04:00
94f2d3f1df Make a form factory return created form and alway create a form with a list
[MQ-59]
2018-09-20 16:37:40 +02:00
b208dca01d commit so branch can be shared [MQ-59] 2018-09-20 10:08:46 -04:00
3e12ac8928 Use Date object instead of seconds to set valid time of announcement
[MAILPOET-1525]
2018-09-20 15:28:26 +02:00
54e518e664 Don't show error notice for in app announcements
[MAILPOET-1525]
2018-09-20 15:23:09 +02:00
41eeae2d14 Refactor property names in inAppAnnouncements to be easy to understand
[MAILPOET-1525]
2018-09-20 15:21:58 +02:00
fdd1bce566 Add annoucement for free welcome emails
[MAILPOET-1525]
2018-09-20 14:52:25 +02:00
2215ce83b2 Update premium page for welcome emails
[MAILPOET-1527]
2018-09-20 13:26:16 +02:00
101ab67a83 Fix missing assets
[MAILPOET-1480]
2018-09-20 12:57:23 +02:00
deaebae034 Remove header from template
[MAILPOET-1480]
2018-09-20 11:00:04 +02:00
4ae1f4a107 Prevent setting state on unmounted listing component
[MAILPOET-1537]
2018-09-20 10:16:28 +02:00
f5db5c3881 Refactor long if block in getItems in listings
[MAILPOET-1537]
2018-09-20 10:14:12 +02:00
31067364f6 Add spacers to templates
[MAILPOET-1480]
2018-09-20 10:04:08 +02:00
2c89b767a4 adding wasScheduledForSubscriber method to Newsletter model 2018-09-20 09:06:14 +02:00
5b7a5bbf0f Merge pull request #1512 from mailpoet/in-app-announcements
In app announcements component [MAILPOET-1413]
2018-09-19 10:41:30 -04:00
827c0860fc Merge pull request #1511 from mailpoet/ci-speedup
Circle CI workflow enhancements [MAILPOET-1535]
2018-09-19 17:30:31 +03:00
91364b391f Resize thumbnails
[MAILPOET-1480]
2018-09-19 15:57:55 +02:00
57cfdee9ad Fix some template texts
[MAILPOET-1480]
2018-09-19 14:43:31 +02:00
814fceb297 Remove container blockDefaults from templates data
[MAILPOET-1480]
2018-09-19 14:40:21 +02:00
ef17e82685 Fix failing test
[MAILPOET-1480
2018-09-19 14:40:21 +02:00
f6bf32de01 Ensure the right order
[MAILPOET-1480]
2018-09-19 14:40:21 +02:00
41880f72fd Add WooCommerce templates category
[MAILPOET-1480]
2018-09-19 14:40:21 +02:00
7d98de521d Add woocommerce templates
[MAILPOET-1480]
2018-09-19 14:39:01 +02:00
31f0a62a7a Add Notifications templates
[MAILPOET-1480]
2018-09-19 14:39:01 +02:00
44c1d865ba Add Welcome email templates
[MAILPOET-1480]
2018-09-19 14:39:01 +02:00
bcb9f3cc86 Add new Email Templates for Newsletters
[MAILPOET-1480]
2018-09-19 14:39:00 +02:00
4515cb345b Remove old templates
[MAILPOET-1480]
2018-09-19 14:39:00 +02:00
c2bb93f3b7 Ensure notice is not shown on wizard
[MAILPOET-1492]
2018-09-19 14:30:11 +02:00
868930d43a Improve the annoucements component that it could be displayed only once
[MAILPOET-1525]
2018-09-19 13:44:00 +02:00
be17a35faa Add condition for premium user to an in app announcement
[MAILPOET-1525]
2018-09-19 13:40:13 +02:00
d42d48c716 Rename some methods
[MAILPOET-1492]
2018-09-19 10:28:24 +02:00
017918c870 Add after migration notice
[MAILPOET-1492]
2018-09-19 10:27:04 +02:00
de6ba39595 Fix private access error 2018-09-19 10:24:37 +02:00
4a641ba94e Create permanent notices
[MAILPOET-1492]
2018-09-19 10:24:37 +02:00
ed2ebeee52 Refactor in_app_announcement component to class
[MAILPOET-1525]
2018-09-19 08:51:24 +02:00
c17c9d239d Merge pull request #1508 from mailpoet/fix-translations
Fix translations based on FxB's feedback [MAILPOET-1533]
2018-09-18 12:10:45 -04:00
9b50163b10 Add in app announcement component
[MAILPOET-1413]
2018-09-18 17:50:29 +02:00
0bab112f2b Merge pull request #1510 from mailpoet/limit-page-improvements
Limit page improvements [MAILPOET-1526]
2018-09-18 10:54:00 -04:00
e7e091cb36 Make multisite jobs run after the ordinary ones are done
[MAILPOET-1535]
2018-09-18 11:57:44 +02:00
809240abb9 Remove unnecessary steps from codeception Dockerfile
[MAILPOET-1535]
2018-09-18 11:57:36 +02:00
cb8ef72a85 Optimize acceptance tests wait times
[MAILPOET-1535]
2018-09-18 11:54:39 +02:00
079fe6f280 Remove dependencies installation from acceptace tests
[MAILPOET-1535]
2018-09-18 11:45:48 +02:00
78967c8d6a Switch build job on CI to php7 runtime
[MAILPOET-1535]
2018-09-18 11:45:24 +02:00
64f83ef86c Change CI workflow and use shared workspace
This commit extracts dependencies installation and build to extra job which run before other jobs.
The first job contains also linter checks becase these are fast and whole workflow can fail fast and
don't have to consume additional resources.

[MAILPOET-1535]
2018-09-18 11:44:52 +02:00
faed435500 Update limit page
[MAILPOET-1526]
2018-09-17 16:20:14 +02:00
edd447ce82 Add a new function for number formating
[MAILPOET-1526]
2018-09-17 16:19:56 +02:00
bb8a94d580 Fix broken test after translation change 2018-09-17 15:55:33 +03:00
1f116d8cef Fix translations based on FxB's feedback. 2018-09-17 15:45:12 +03:00
f5c9d0f7db Remove unnecessary test_email extra parameter for mailer->send
It was used only to prevent appending unprocessed subscribers into error message.
Since the message is now composed by on demand by MailerError the parameter is not needed any more.

[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
665fce9dbb Temporarily set every sending error to hard
This is temporary solution until we implement follow-up feature https://mailpoet.atlassian.net/browse/MAILPOET-1155

[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
624c6d900e Add processing of soft errors
When processing soft error we only save error to particular subscriber and continue sending.

[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
ea4c5f46fb Refactor sendingQueue to distinguish bulk/individual sending method
[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
3ae8763837 Refactor sending error handling to extra class
The SendigQueue worker is already a very complex class and handles a lot of things.
Since we want to make error handling more sophisticated it is better to move the error handling responsibility
to a new class.

[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
fe69b56692 Add soft level errors distinction for PHPMail method
[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
45433c9deb Add soft level errors distinction for SMTP method
[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
6437f4a1b3 Add soft level errors distinction for SendGrid service
[MAILPOET-1154]
2018-09-13 11:12:38 +02:00
6df1db933e Add soft level errors distinction for Amazon SES service
[MAILPOET-1154]
2018-09-13 11:12:01 +02:00
db3ddd22f1 Add soft level errors distinction for MailPoet service
[MAILPOET-1154]
2018-09-13 09:52:13 +02:00
223c2e1562 Add subscriber errors passing via MailerError object
We want to process errors for individual subscribers.
Subscriber errors were inlined into error message string.
This commit changes this so that we are now able to get
subscriber errors as a data which are easy to process further.

[MAILPOET-1154]
2018-09-13 09:48:54 +02:00
0923c892c1 Refactor sending methods to use error mappers
We want to add some logic to error handling.
This commit extracts error handling code from sending methods classes,
which already do a lot of other stuff, to error mappers which are responsible
for creating proper error object (MailerError). This error object is a replacement
for assoc. array which already had some special keys for certain usecases and
can not be properly type hinted.

[MAILPOET-1154]
2018-09-13 09:33:26 +02:00
8cf5d17cfd Refactor sending task variable name and add typehint
[MAILPOET-1154]
2018-09-13 09:33:26 +02:00
306 changed files with 29329 additions and 6127 deletions

View File

@ -1,24 +1,28 @@
version: 2
jobs:
qa_js_security_php5:
build_and_code_qa:
working_directory: /home/circleci/mailpoet
docker:
- image: mailpoet/wordpress:5.6.30_20180417.1
- image: circleci/mysql:5.7
- image: mailpoet/wordpress:7.1_20180417.1
environment:
TZ: /usr/share/zoneinfo/Etc/UTC
steps:
- checkout
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- restore_cache:
key: npm-{{ checksum "package.json" }}
- run:
name: "Set up test environment"
command: source ./.circleci/setup.bash && setup php5
command: |
# Install NodeJS+NPM
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs build-essential
# install plugin dependencies
curl -sS https://getcomposer.org/installer | php
./composer.phar install
./do install
./do compile:all --env production
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
@ -27,50 +31,67 @@ jobs:
key: npm-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: "QA Scripts"
command: ./do qa
- run:
name: "Preparing test results folder"
command: mkdir test-results
- run:
name: "JS tests"
command: |
mkdir test-results/mocha
./do t:j test-results/mocha/junit.xml
- run:
name: "Composer security check"
command: |
./do s:composer
- run:
name: "PHP Unit tests"
command: |
WP_TEST_PATH="/home/circleci/mailpoet/wordpress" ./do t:u --xml
- store_test_results:
path: test-results/mocha
- store_artifacts:
path: test-results/mocha
destination: mocha
- store_test_results:
path: tests/_output
- store_artifacts:
path: tests/_output
destination: codeception
- store_artifacts:
path: /tmp/fake-mailer/
destination: fake-mailer
name: "QA Scripts"
command: ./do qa
- persist_to_workspace:
root: /home/circleci/mailpoet
paths:
- .
php5_and_js:
working_directory: /home/circleci/mailpoet
docker:
- image: mailpoet/wordpress:5.6.30_20180417.1
- image: circleci/mysql:5.7
environment:
TZ: /usr/share/zoneinfo/Etc/UTC
steps:
- attach_workspace:
at: /home/circleci/mailpoet
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- run:
name: "Set up test environment"
command: source ./.circleci/setup.bash && setup php5
- run:
name: "Preparing test results folder"
command: mkdir test-results
- run:
name: "JS tests"
command: |
mkdir test-results/mocha
./do t:j test-results/mocha/junit.xml
- run:
name: "PHP Unit tests"
command: |
WP_TEST_PATH="/home/circleci/mailpoet/wordpress" ./do t:u --xml
- store_test_results:
path: test-results/mocha
- store_artifacts:
path: test-results/mocha
destination: mocha
- store_test_results:
path: tests/_output
- store_artifacts:
path: tests/_output
destination: codeception
- store_artifacts:
path: /tmp/fake-mailer/
destination: fake-mailer
acceptance_tests:
working_directory: /home/circleci/mailpoet
machine: true
steps:
- checkout
- attach_workspace:
at: /home/circleci/mailpoet
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- restore_cache:
key: npm-{{ checksum "package.json" }}
- run:
name: "Set up test environment"
command: |
@ -78,73 +99,38 @@ jobs:
sudo apt-get install circleci-php-5.6.23
sudo rm /usr/bin/php
sudo ln -s /opt/circleci/php/5.6.23/bin/php /usr/bin/php
# Install NodeJS+NPM
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs build-essential
# install plugin dependencies
curl -sS https://getcomposer.org/installer | php
php composer.phar install
./do install
./do compile:all --env production
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- vendor
- save_cache:
key: npm-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Run acceptance tests
command: |
docker-compose run codeception --steps --debug -vvv --html --xml
docker-compose run -e SKIP_DEPS=1 codeception --steps --debug -vvv --html --xml
- store_artifacts:
path: tests/_output
- store_test_results:
path: tests/_output
acceptance_tests_multisite:
working_directory: /home/circleci/mailpoet
machine: true
steps:
- checkout
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- restore_cache:
key: npm-{{ checksum "package.json" }}
- run:
name: "Set up test environment"
command: |
sudo apt-get update
sudo apt-get install circleci-php-5.6.23
sudo rm /usr/bin/php
sudo ln -s /opt/circleci/php/5.6.23/bin/php /usr/bin/php
# Install NodeJS+NPM
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install nodejs build-essential
# install plugin dependencies
curl -sS https://getcomposer.org/installer | php
php composer.phar install
./do install
./do compile:all --env production
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- vendor
- save_cache:
key: npm-{{ checksum "package.json" }}
paths:
- node_modules
- run:
name: Run acceptance tests
command: |
docker-compose run -e MULTISITE=1 codeception --steps --debug -vvv --html --xml
- store_artifacts:
path: tests/_output
- store_test_results:
path: tests/_output
working_directory: /home/circleci/mailpoet
machine: true
steps:
- attach_workspace:
at: /home/circleci/mailpoet
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- run:
name: "Set up test environment"
command: |
sudo apt-get update
sudo apt-get install circleci-php-5.6.23
sudo rm /usr/bin/php
sudo ln -s /opt/circleci/php/5.6.23/bin/php /usr/bin/php
- run:
name: Run acceptance tests
command: |
docker-compose run -e SKIP_DEPS=1 -e MULTISITE=1 codeception --steps --debug -vvv --html --xml
- store_artifacts:
path: tests/_output
- store_test_results:
path: tests/_output
php7:
working_directory: /home/circleci/mailpoet
docker:
@ -153,17 +139,14 @@ jobs:
environment:
TZ: /usr/share/zoneinfo/Etc/UTC
steps:
- checkout
- attach_workspace:
at: /home/circleci/mailpoet
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- run:
name: "Prepare example.com for testing"
command: echo 127.0.0.1 example.com | sudo tee -a /etc/hosts
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- restore_cache:
key: npm-{{ checksum "package.json" }}
- run:
name: "Set up test environment"
command: source ./.circleci/setup.bash && setup php7
@ -187,17 +170,14 @@ jobs:
environment:
TZ: /usr/share/zoneinfo/Etc/UTC
steps:
- checkout
- attach_workspace:
at: /home/circleci/mailpoet
- run:
name: "Set up virtual host"
command: echo 127.0.0.1 mailpoet.loc | sudo tee -a /etc/hosts
- run:
name: "Prepare example.com for testing"
command: echo 127.0.0.1 example.com | sudo tee -a /etc/hosts
- restore_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
- restore_cache:
key: npm-{{ checksum "package.json" }}
- run:
name: "Set up test environment"
command: source ./.circleci/setup.bash && setup php7_multisite
@ -217,8 +197,21 @@ workflows:
version: 2
build_and_test:
jobs:
- qa_js_security_php5
- php7
- acceptance_tests
- php7_multisite
- acceptance_tests_multisite
- build_and_code_qa
- php7:
requires:
- build_and_code_qa
- php5_and_js:
requires:
- build_and_code_qa
- acceptance_tests:
requires:
- build_and_code_qa
- php7_multisite:
requires:
- build_and_code_qa
- php7
- acceptance_tests_multisite:
requires:
- build_and_code_qa
- acceptance_tests

View File

@ -16,11 +16,6 @@ function setup {
sudo a2enmod rewrite
sudo service apache2 restart
# install plugin dependencies
curl -sS https://getcomposer.org/installer | php
./composer.phar install
./do install
until mysql -h 127.0.0.1 -u root -e "select 1"; do
>&2 echo "Mysql is starting up ... will try again momentarily"
sleep 1

View File

@ -8,9 +8,6 @@ WP_TEST_MAILER_ENABLE_SENDING="true"
WP_TEST_MAILER_AMAZON_ACCESS=""
WP_TEST_MAILER_AMAZON_SECRET=""
WP_TEST_MAILER_AMAZON_REGION=""
WP_TEST_MAILER_ELASTICEMAIL_API=""
WP_TEST_MAILER_MAILGUN_API=""
WP_TEST_MAILER_MAILGUN_DOMAIN=""
WP_TEST_MAILER_MAILPOET_API=""
WP_TEST_MAILER_SENDGRID_API=""
WP_TEST_MAILER_SMTP_HOST=""
@ -19,4 +16,4 @@ WP_TEST_MAILER_SMTP_PASSWORD=""
WP_SVN_USERNAME=""
WP_SVN_PASSWORD=""
WP_TRANSIFEX_API_TOKEN=""
HTTP_HOST="" // URL of your site (used for multisite env and equals to DOMAIN_CURRENT_SITE from wp-config.php)
HTTP_HOST="" // URL of your site (used for multisite env and equals to DOMAIN_CURRENT_SITE from wp-config.php)

View File

@ -4,15 +4,6 @@ ENV COMPOSER_ALLOW_SUPERUSER=1
RUN composer global require --optimize-autoloader "hirak/prestissimo"
# Prepare application
WORKDIR /repo
# Install vendor
COPY ./composer.json /repo/composer.json
# Add source-code
COPY . /repo
WORKDIR /wp-core/wp-content/plugins/mailpoet
ENV WP_TEST_PATH=/wp-core

View File

@ -197,4 +197,9 @@ If youre on a Mac, you can open vnc://localhost:5900 in Safari to watch the t
To run tests:
```sh
$ ./do test:acceptance
```
```
You can skip installation of composer dependencies using --skip-deps parameter.
```sh
$ ./do test:acceptance --skip-deps
```

View File

@ -231,19 +231,19 @@ class RoboFile extends \Robo\Tasks {
return $this->_exec($command);
}
function testAcceptance($opts=['file' => null, 'keep-deps' => false]) {
function testAcceptance($opts=['file' => null, 'skip-deps' => false]) {
return $this->_exec(
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
($opts['keep-deps'] ? '-e KEEP_DEPS=1 ' : '') .
($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
'codeception --steps --debug -vvv ' .
'-f ' . ($opts['file'] ? $opts['file'] : '')
);
}
function testAcceptanceMultisite($opts=['file' => null, 'keep-deps' => false]) {
function testAcceptanceMultisite($opts=['file' => null, 'skip-deps' => false]) {
return $this->_exec(
'COMPOSE_HTTP_TIMEOUT=200 docker-compose run ' .
($opts['keep-deps'] ? '-e KEEP_DEPS=1 ' : '') .
($opts['skip-deps'] ? '-e SKIP_DEPS=1 ' : '') .
'-e MULTISITE=1 ' .
'codeception --steps --debug -vvv' .
'-f ' . ($opts['file'] ? $opts['file'] : '')
@ -299,7 +299,7 @@ class RoboFile extends \Robo\Tasks {
'--standard=./tasks/code_sniffer/MailPoet '.
'--runtime-set testVersion 5.5-7.2 '.
'--ignore=./tests/unit/_bootstrap.php '.
'tests/unit/ '.
'tests/unit/ tests/acceptance tests/DataFactories '.
$severityFlag
)
->run();

View File

@ -35,3 +35,4 @@
@require 'newsletter_templates'
@require 'welcome_wizard'
@require 'intro'
@require 'in_app_announcements'

View File

@ -0,0 +1,48 @@
.mailpoet_in_app_announcement_pulsing_dot
display: inline-block
width: 10px
height: 10px
border-radius: 50%
background: #ff5301
cursor: pointer
box-shadow: 0 0 0 rgba(255, 83, 1, 0.4)
animation: mailpoet_in_app_dot_pulse 2s infinite
@-webkit-keyframes mailpoet_in_app_dot_pulse
0%
-webkit-box-shadow: 0 0 0 0 rgba(255, 83, 1, 0.4)
70%
-webkit-box-shadow: 0 0 0 10px rgba(255, 83, 1, 0)
100%
-webkit-box-shadow: 0 0 0 0 rgba(255, 83, 1, 0)
@keyframes mailpoet_in_app_dot_pulse
0%
-moz-box-shadow: 0 0 0 0 rgba(255, 83, 1, 0.4)
box-shadow: 0 0 0 0 rgba(255, 83, 1, 0.4)
70%
-moz-box-shadow: 0 0 0 10px rgba(255, 83, 1, 0)
box-shadow: 0 0 0 10px rgba(255, 83, 1, 0)
100%
-moz-box-shadow: 0 0 0 0 rgba(255, 83, 1, 0)
box-shadow: 0 0 0 0 rgba(255, 83, 1, 0)
.mailpoet_in_app_announcement_free_welcome_emails
text-align: center
h2
font-size: 28px
img
width: 640px
margin-top: -20px
.mailpoet_in_app_announcement_free_welcome_emails_dot
position: relative
top: -3px
left: 8px
.mailpoet_in_app_announcement_background_videos, .mailpoet_drag_and_drop_tutorial
text-align: center
h2
font-size: 28px
video
margin-top: 20px

View File

@ -20,3 +20,8 @@
p
margin: 0
.mailpoet_editor_announcement
position: absolute
right: 20px
top: 90px

View File

@ -4,6 +4,7 @@ $content-border-color = $structure-border-color
#mailpoet_editor
width: 100%
clear: both
position: relative
#mailpoet_editor_heading
padding-left: 15px

View File

@ -41,3 +41,9 @@ Custom styles for MailPoet pages.
list-style-type: disc
margin-left: 40px
}
.half-width-centered
display block
max-width 50%
margin-left auto
margin-right auto

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

View File

@ -1,8 +1,8 @@
import jQuery from 'jquery';
jQuery(($) => {
$(document).on('click', '.notice-php-warning .notice-dismiss', function xyz() {
const type = $(this).closest('.notice-php-warning').data('notice');
$(document).on('click', '.mailpoet-dismissible-notice .notice-dismiss', function dismiss() {
const type = $(this).closest('.mailpoet-dismissible-notice').data('notice');
$.ajax(window.ajaxurl,
{
type: 'POST',

View File

@ -0,0 +1,121 @@
import React from 'react';
import MailPoet from 'mailpoet';
import InAppAnnouncementDot from './in_app_announcement_dot.jsx';
class InAppAnnouncement extends React.Component {
constructor(props) {
super(props);
this.saveDisplayed = this.saveDisplayed.bind(this);
this.state = {
announcementsSettings: window.mailpoet_in_app_announcements || null,
};
}
saveDisplayed() {
const settings = Object.assign({}, this.state.announcementsSettings);
settings.displayed.push(this.props.showOnlyOnceSlug);
return MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'settings',
action: 'set',
data: { in_app_announcements: settings },
}).always(() => (this.setState({ announcementsSettings: settings })));
}
render() {
if (this.props.showToNewUser !== null &&
window.mailpoet_is_new_user !== this.props.showToNewUser
) {
return null;
}
if (this.props.validUntil !== null
&& this.props.validUntil < new Date()
) {
return null;
}
if (this.props.showToPremiumUser !== null &&
window.mailpoet_premium_active !== this.props.showToPremiumUser
) {
return null;
}
if (this.props.showOnlyOnceSlug &&
this.state.announcementsSettings.displayed.includes(this.props.showOnlyOnceSlug)
) {
return null;
}
return (
<InAppAnnouncementDot
className={this.props.className}
width={this.props.width}
height={this.props.height}
onUserTrigger={() => {
if (!this.props.showOnlyOnceSlug) { return; }
this.saveDisplayed();
}}
>
{this.props.children}
</InAppAnnouncementDot>
);
}
}
const validateBooleanWithWindowDependency = (props, propName, componentName, windowProperty) => {
const propValue = props[propName];
if (propValue !== null && propValue !== true && propValue !== false) {
return new Error(`Invalid property in ${componentName}. newUser must be of type boolean`);
}
if (propValue !== null && typeof window[windowProperty] === 'undefined') {
return new Error(
`Missing data for evaluation of ${componentName} display condition. ${propName} requires window.${windowProperty}`
);
}
return null;
};
InAppAnnouncement.propTypes = {
width: React.PropTypes.string,
height: React.PropTypes.string,
className: React.PropTypes.string,
children: React.PropTypes.element.isRequired,
validUntil: React.PropTypes.instanceOf(Date),
showToNewUser: (props, propName, componentName) => (
validateBooleanWithWindowDependency(props, propName, componentName, 'mailpoet_is_new_user')
),
showToPremiumUser: (props, propName, componentName) => (
validateBooleanWithWindowDependency(props, propName, componentName, 'mailpoet_premium_active')
),
showOnlyOnceSlug: (props, propName, componentName) => {
const propValue = props[propName];
if (propValue !== null && typeof propValue !== 'string') {
return new Error(`Invalid property in ${componentName}. ${propName} must be of type string`);
}
if (propValue === null) {
return null;
}
if (
typeof window.mailpoet_in_app_announcements === 'undefined'
) {
return new Error(
`Missing data for evaluation of ${componentName} display condition. ${propName} requires window.mailpoet_in_app_announcements`
);
}
return null;
},
};
InAppAnnouncement.defaultProps = {
width: '900px',
height: '600px',
className: null,
validUntil: null,
showToNewUser: null,
showToPremiumUser: null,
showOnlyOnceSlug: null,
};
module.exports = InAppAnnouncement;

View File

@ -0,0 +1,37 @@
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import classNames from 'classnames';
import MailPoet from 'mailpoet';
const InAppAnnouncementDot = props => (
<span
role="button"
tabIndex="-1"
className={classNames('mailpoet_in_app_announcement_pulsing_dot', props.className)}
onClick={() => {
MailPoet.Modal.popup({
template: ReactDOMServer.renderToString(props.children),
width: props.width,
height: props.height,
});
if (props.onUserTrigger) props.onUserTrigger();
}}
/>
);
InAppAnnouncementDot.propTypes = {
children: React.PropTypes.element.isRequired,
width: React.PropTypes.string,
height: React.PropTypes.string,
className: React.PropTypes.string,
onUserTrigger: React.PropTypes.func,
};
InAppAnnouncementDot.defaultProps = {
width: 'auto',
height: 'auto',
className: null,
onUserTrigger: null,
};
module.exports = InAppAnnouncementDot;

View File

@ -456,55 +456,56 @@ const Listing = React.createClass({
this.initWithParams(params);
},
getItems: function getItems() {
if (this.isComponentMounted) {
this.setState({ loading: true });
if (!this.isComponentMounted) return;
this.clearSelection();
this.setState({ loading: true });
this.clearSelection();
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: this.props.endpoint,
action: 'listing',
data: {
params: this.getParams(),
offset: (this.state.page - 1) * this.state.limit,
limit: this.state.limit,
group: this.state.group,
filter: this.state.filter,
search: this.state.search,
sort_by: this.state.sort_by,
sort_order: this.state.sort_order,
},
}).always(() => {
this.setState({ loading: false });
}).done((response) => {
this.setState({
items: response.data || [],
filters: response.meta.filters || {},
groups: response.meta.groups || [],
count: response.meta.count || 0,
meta: _.omit(response.meta, ['filters', 'groups', 'count']),
}, () => {
// if viewing an empty trash
if (this.state.group === 'trash' && response.meta.count === 0) {
// redirect to default group
this.handleGroup('all');
}
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: this.props.endpoint,
action: 'listing',
data: {
params: this.getParams(),
offset: (this.state.page - 1) * this.state.limit,
limit: this.state.limit,
group: this.state.group,
filter: this.state.filter,
search: this.state.search,
sort_by: this.state.sort_by,
sort_order: this.state.sort_order,
},
}).always(() => {
if (!this.isComponentMounted) return;
this.setState({ loading: false });
}).done((response) => {
if (!this.isComponentMounted) return;
this.setState({
items: response.data || [],
filters: response.meta.filters || {},
groups: response.meta.groups || [],
count: response.meta.count || 0,
meta: _.omit(response.meta, ['filters', 'groups', 'count']),
}, () => {
// if viewing an empty trash
if (this.state.group === 'trash' && response.meta.count === 0) {
// redirect to default group
this.handleGroup('all');
}
// trigger afterGetItems callback if specified
if (this.props.afterGetItems !== undefined) {
this.props.afterGetItems(this.state);
}
});
}).fail((response) => {
if (response.errors.length > 0) {
MailPoet.Notice.error(
response.errors.map(error => error.message),
{ scroll: true }
);
// trigger afterGetItems callback if specified
if (this.props.afterGetItems !== undefined) {
this.props.afterGetItems(this.state);
}
});
}
}).fail((response) => {
if (response.errors.length > 0) {
MailPoet.Notice.error(
response.errors.map(error => error.message),
{ scroll: true }
);
}
});
},
handleRestoreItem: function handleRestoreItem(id) {
this.setState({

View File

@ -0,0 +1,26 @@
import React from 'react';
import MailPoet from 'mailpoet';
import InAppAnnouncement from 'in_app_announcements/in_app_announcement.jsx';
const BackgroundImageAnnouncement = props => (
<InAppAnnouncement
validUntil={new Date('2018-10-06')}
height="700px"
showOnlyOnceSlug="background_image"
>
<div className="mailpoet_in_app_announcement_background_videos">
<h2>
{MailPoet.I18n.t('announcementBackgroundImagesHeading').replace('%username%', props.username)}
</h2>
<p>{MailPoet.I18n.t('announcementBackgroundImagesMessage')}</p>
<video src={props.videoUrl} controls autoPlay><track kind="captions" /></video>
</div>
</InAppAnnouncement>
);
BackgroundImageAnnouncement.propTypes = {
username: React.PropTypes.string.isRequired,
videoUrl: React.PropTypes.string.isRequired,
};
module.exports = BackgroundImageAnnouncement;

View File

@ -3,7 +3,8 @@ import Breadcrumb from 'newsletters/breadcrumb.jsx';
import MailPoet from 'mailpoet';
import React from 'react';
import ReactDOM from 'react-dom';
import moment from 'moment';
import BackgroundImageAnnouncement from './background_image_announcement.jsx';
import displayTutorial from './tutorial.jsx';
const renderBreadcrumb = (newsletterType) => {
const breadcrumbContainer = document.getElementById('mailpoet_editor_breadcrumb');
@ -17,27 +18,15 @@ const renderBreadcrumb = (newsletterType) => {
ReactDOM.render(breadcrumb, breadcrumbContainer);
};
function displayTutorial() {
const key = `user_seen_editor_tutorial${window.config.currentUserId}`;
if (window.config.dragDemoUrlSettings) {
return;
}
if (moment(window.config.installedAt).isBefore(moment().subtract(7, 'days'))) {
return;
}
MailPoet.Modal.popup({
title: MailPoet.I18n.t('tutorialVideoTitle'),
template: `<video style="height:640px;" src="${window.config.dragDemoUrl}" controls autoplay></video>`,
onCancel: () => {
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'settings',
action: 'set',
data: { [key]: 1 },
});
},
});
}
const renderAnnouncement = () => {
const container = document.getElementById('mailpoet_editor_announcement');
ReactDOM.render(
<BackgroundImageAnnouncement
username={window.config.currentUserFirstName || window.config.currentUserUsername}
videoUrl={window.config.backgroundImageDemoUrl}
/>, container
);
};
const initializeEditor = (config) => {
const editorContainer = document.getElementById('mailpoet_editor');
@ -73,6 +62,7 @@ const initializeEditor = (config) => {
});
renderBreadcrumb(newsletter.type);
renderAnnouncement();
if (newsletter.status === 'sending' && newsletter.queue && newsletter.queue.status === null) {
MailPoet.Ajax.post({

View File

@ -0,0 +1,25 @@
import MailPoet from 'mailpoet';
import moment from 'moment';
const displayTutorial = () => {
const key = `user_seen_editor_tutorial${window.config.currentUserId}`;
if (window.config.dragDemoUrlSettings) {
return;
}
if (moment(window.config.installedAt).isBefore(moment().subtract(7, 'days'))) {
return;
}
MailPoet.Modal.popup({
template: `<div class="mailpoet_drag_and_drop_tutorial"><h2>${MailPoet.I18n.t('tutorialVideoTitle')}</h2><video style="height:640px;" src="${window.config.dragDemoUrl}" controls autoplay></video></div>`,
onCancel: () => {
MailPoet.Ajax.post({
api_version: window.mailpoet_api_version,
endpoint: 'settings',
action: 'set',
data: { [key]: 1 },
});
},
});
};
export default displayTutorial;

View File

@ -1,6 +1,7 @@
import React from 'react';
import { Link } from 'react-router';
import MailPoet from 'mailpoet';
import InAppAnnoucement from 'in_app_announcements/in_app_announcement.jsx';
const ListingHeading = () => (
<h1 className="title">
@ -17,6 +18,23 @@ const ListingHeading = () => (
>
{MailPoet.I18n.t('new')}
</Link>
<InAppAnnoucement
className="mailpoet_in_app_announcement_free_welcome_emails_dot"
showToNewUser={false}
showToPremiumUser={false}
showOnlyOnceSlug="free_welcome_emails"
height="650px"
validUntil={new Date('2018-10-31')}
>
<div className="mailpoet_in_app_announcement_free_welcome_emails">
<h2>{MailPoet.I18n.t('freeWelcomeEmailsHeading')}</h2>
<img
src={window.mailpoet_free_welcome_emails_image}
alt={MailPoet.I18n.t('freeWelcomeEmailsHeading')}
/>
<p>{MailPoet.I18n.t('freeWelcomeEmailsParagraph')}</p>
</div>
</InAppAnnoucement>
</h1>
);

View File

@ -142,7 +142,7 @@ const DateText = React.createClass({
return (
<input
type="text"
size="10"
size="30"
name={this.getFieldName()}
value={this.getDisplayDate(this.props.value)}
readOnly

View File

@ -24,6 +24,10 @@ const templatesCategories = [
name: 'notification',
label: MailPoet.I18n.t('tabNotificationTitle'),
},
{
name: 'woocommerce',
label: MailPoet.I18n.t('tabWoocommerceTitle'),
},
{
name: 'sample',
label: MailPoet.I18n.t('sample'),
@ -70,7 +74,7 @@ class NewsletterTemplates extends React.Component {
{
name:
MailPoet.I18n.t('mailpoetGuideTemplateTitle'),
categories: '["welcome", "notification", "standard"]',
categories: '["welcome", "notification", "standard", "woocommerce"]',
readonly: '1',
},
];

View File

@ -42,7 +42,7 @@ class AutomaticEmailEventsList extends React.Component {
render() {
const heading = MailPoet.I18n.t('selectAutomaticEmailsEventsHeading')
.replace('%1s', this.email.title);
.replace('%$1s', this.email.title);
return (
<div>

View File

@ -0,0 +1,15 @@
function displayPoll() {
if (window.mailpoet_display_nps_poll && window.satismeter) {
window.satismeter({
writeKey: '6L479eVPXk7pBn6S',
userId: window.mailpoet_current_wp_user.ID + window.mailpoet_site_url,
traits: {
name: window.mailpoet_current_wp_user.user_nicename,
email: window.mailpoet_current_wp_user.user_email,
createdAt: window.mailpoet_settings.installed_at,
},
});
}
}
setImmediate(displayPoll);

View File

@ -74,6 +74,7 @@ rm -f $plugin_name/assets/js/lib/tinymce/package.json
echo '[BUILD] Copying release files'
cp license.txt $plugin_name
cp index.php $plugin_name
cp $plugin_name-cron.php $plugin_name
cp $plugin_name.php $plugin_name
cp mailpoet_initializer.php $plugin_name
cp readme.txt $plugin_name

View File

@ -92,16 +92,12 @@ else
fi
sed -i "s/define( *'WP_DEBUG', false *);/define('WP_DEBUG', true);define('WP_DEBUG_DISPLAY', true);define('WP_DEBUG_LOG', true);/" ./wp-config.php
sed -i "s/.*That's all, stop editing! Happy blogging.*/define('COOKIE_DOMAIN', \$_SERVER['HTTP_HOST'] );/" ./wp-config.php
# Load Composer dependencies
# Set KEEP_DEPS environment flag to not redownload them on each run, only for the 1st time, useful for development.
# Example: docker-compose run -e KEEP_DEPS=1 codeception ...
# Don't forget to restore your original /vendor folder from /vendor_backup manually or by running acceptance tests without this flag.
if [[ -z "${KEEP_DEPS}" ]]; then
rm -rf /project/vendor_backup
fi
if [ ! -d "/project/vendor_backup" ]; then
mv /project/vendor /project/vendor_backup
# Set SKIP_DEPS environment flag to not download them. E.g. you have downloaded them yourself
# Example: docker-compose run -e SKIP_DEPS=1 codeception ...
if [[ -z "${SKIP_DEPS}" ]]; then
cd /project
php composer.phar install
fi
@ -111,9 +107,4 @@ cd /wp-core/wp-content/plugins/mailpoet
/project/vendor/bin/codecept run acceptance -c codeception.acceptance.yml $@
exitcode=$?
if [[ -z "${KEEP_DEPS}" ]]; then
rm -rf /project/vendor
mv /project/vendor_backup /project/vendor
fi
exit $exitcode

View File

@ -21,10 +21,7 @@ class Mailer extends APIEndpoint {
(isset($data['sender'])) ? $data['sender'] : false,
(isset($data['reply_to'])) ? $data['reply_to'] : false
);
$extra_params = array(
'test_email' => true
);
$result = $mailer->send($data['newsletter'], $data['subscriber'], $extra_params);
$result = $mailer->send($data['newsletter'], $data['subscriber']);
} catch(\Exception $e) {
return $this->errorResponse(array(
$e->getCode() => $e->getMessage()
@ -34,7 +31,7 @@ class Mailer extends APIEndpoint {
if($result['response'] === false) {
$error = sprintf(
__('The email could not be sent: %s', 'mailpoet'),
$result['error_message']
$result['error']->getMessage()
);
return $this->errorResponse(array(APIError::BAD_REQUEST => $error));
} else {
@ -46,4 +43,4 @@ class Mailer extends APIEndpoint {
MailerLog::resumeSending();
return $this->successResponse(null);
}
}
}

View File

@ -31,8 +31,9 @@ class NewsletterTemplates extends APIEndpoint {
function getAll() {
$collection = NewsletterTemplate
::selectExpr('id, categories, thumbnail, name, description, readonly')
->orderByAsc('readonly')
->orderByDesc('created_at')
->orderByAsc('name')
->orderByDesc('id')
->findMany();
$templates = array_map(function($item) {
return $item->asArray();

View File

@ -8,6 +8,7 @@ use MailPoet\Models\Setting;
use MailPoet\Router;
use MailPoet\Util\ConflictResolver;
use MailPoet\Util\Helpers;
use MailPoet\Util\Notices\PermanentNotices;
use MailPoet\WP\Notice as WPNotice;
if(!defined('ABSPATH')) exit;
@ -144,7 +145,7 @@ class Initializer {
$this->setupPages();
$this->setupPHPVersionWarnings();
$this->setupPermanentNotices();
$this->setupDeactivationSurvey();
do_action('mailpoet_initialized', MAILPOET_VERSION);
@ -289,9 +290,9 @@ class Initializer {
$erasers->init();
}
function setupPHPVersionWarnings() {
$php_version_warnings = new PHPVersionWarnings();
$php_version_warnings->init(phpversion(), Menu::isOnMailPoetAdminPage());
function setupPermanentNotices() {
$notices = new PermanentNotices();
$notices->init();
}
function handleFailedInitialization($exception) {

View File

@ -10,6 +10,7 @@ use MailPoet\Models\Setting;
use MailPoet\Models\Subscriber;
use MailPoet\Models\SubscriberCustomField;
use MailPoet\Models\SubscriberSegment;
use MailPoet\Util\Notices\AfterMigrationNotice;
use MailPoet\Util\ProgressBar;
if(!defined('ABSPATH')) exit;
@ -169,6 +170,8 @@ class MP2Migrator {
if(!$this->importStopped()) {
Setting::setValue('mailpoet_migration_complete', true);
$this->log(mb_strtoupper(__('Import complete', 'mailpoet'), 'UTF-8'));
$after_migration_notice = new AfterMigrationNotice();
$after_migration_notice->enable();
}
$this->log(sprintf('=== ' . mb_strtoupper(__('End import', 'mailpoet'), 'UTF-8') . ' %s ===', $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT)));

View File

@ -419,6 +419,8 @@ class Menu {
'pages' => Pages::getAll(),
'flags' => $flags,
'current_user' => wp_get_current_user(),
'linux_cron_path' => dirname(dirname(__DIR__)),
'ABSPATH' => ABSPATH,
'hosts' => array(
'web' => Hosts::getWebHosts(),
'smtp' => Hosts::getSMTPHosts()
@ -522,8 +524,6 @@ class Menu {
}
function segments() {
if($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
$data = array();
$data['items_per_page'] = $this->getLimitPerPage('segments');
$this->displayPage('segments.html', $data);
@ -560,6 +560,8 @@ class Menu {
});
$data['segments'] = $segments;
$data['settings'] = Setting::getAll();
$data['current_wp_user'] = wp_get_current_user()->to_array();
$data['site_url'] = site_url();
$data['roles'] = $wp_roles->get_names();
$data['roles']['mailpoet_all'] = __('In any WordPress role', 'mailpoet');
@ -636,10 +638,12 @@ class Menu {
}
function newletterEditor() {
$subscriber = Subscriber::getCurrentWPUser();
$subscriber_data = $subscriber ? $subscriber->asArray() : [];
$data = array(
'shortcodes' => ShortcodesHelper::getShortcodes(),
'settings' => Setting::getAll(),
'current_wp_user' => Subscriber::getCurrentWPUser(),
'current_wp_user' => array_merge($subscriber_data, wp_get_current_user()->to_array()),
'sub_menu' => self::MAIN_PAGE_SLUG,
'mss_active' => Bridge::isMPSendingServiceEnabled()
);

View File

@ -131,6 +131,8 @@ class Migrator {
'task_id int(11) unsigned NOT NULL,',
'subscriber_id int(11) unsigned NOT NULL,',
'processed int(1) NOT NULL,',
'failed int(1) NOT NULL,',
'error text NULL,',
'created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,',
'PRIMARY KEY (task_id, subscriber_id),',
'KEY subscriber_id (subscriber_id)'

View File

@ -35,27 +35,46 @@ class Populator {
'NewsletterBlank12Column',
'NewsletterBlank121Column',
'NewsletterBlank13Column',
'PostNotificationsBlank1Column',
'WelcomeBlank1Column',
'WelcomeBlank12Column',
'SimpleText',
'BurgerJoint',
'AppWelcome',
'TakeAHike',
'Faith',
'NewsDay',
'WorldCup',
'FoodBox',
'Discount',
'KickOff',
'TakeAHike',
'FestivalEvent',
'PieceOfCake',
'RetroComputingMagazine',
'Shoes',
'ScienceWeekly',
'ChocolateStore',
'Faith',
'TravelNomads',
'CoffeeShop',
'NewsDay',
'PieceOfCake',
'Coffee',
'Drone',
'Retro',
'Hotels',
'Music',
'YogaStudio',
'Charity',
'FashionStore',
'WelcomeBlank1Column',
'WelcomeBlank12Column',
'GiftWelcome',
'Minimal',
'Phone',
'Sunglasses',
'RealEstate',
'AppWelcome',
'PostNotificationsBlank1Column',
'ModularStyleStories',
'NotSoMedium',
'RssSimpleNews',
'WideStoryLayout',
'ScienceWeekly',
'WineCity',
'DogFood',
'Fitness',
'KidsClothing',
'Avocado',
);
}

View File

@ -8,7 +8,7 @@ class AppWelcome {
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/app_welcome';
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/app_welcome';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}

File diff suppressed because it is too large Load Diff

View File

@ -1,497 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class BurgerJoint {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/burger_joint';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Burger Joint", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/header.jpg',
'alt' => 'Joe\'s Burger Joint',
'fullWidth' => true,
'width' => '660px',
'height' => '100px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/burger-03.jpg',
'alt' => 'burger-03',
'fullWidth' => true,
'width' => '1200px',
'height' => '613px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
array(
'type' => 'button',
'text' => 'Make a reservation',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#d83b3b',
'borderColor' => '#ffffff',
'borderWidth' => '0px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '225px',
'lineHeight' => '50px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><em>Upgrade! Add these sides</em></h1>',
),
array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/fries-01.jpg',
'alt' => 'fries-01',
'fullWidth' => false,
'width' => '1000px',
'height' => '1500px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
array(
'type' => 'text',
'text' => '<blockquote><p>Cras cursus viverra nulla non tempus. Curabitur sed neque vel sapien! - Morbi ullamcorper, Tellus Diam</p></blockquote>',
),
),
),
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/rolls-01.jpg',
'alt' => 'rolls-01',
'fullWidth' => false,
'width' => '1000px',
'height' => '1500px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
array(
'type' => 'text',
'text' => '<blockquote><p>Morbi ex diam, venenatis a efficitur et, iaculis at nibh. - Quis Ullamcorper, Tortor Ligula</p></blockquote>',
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '34px',
'borderStyle' => 'dashed',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#e0e0e0',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
array(
'type' => 'text',
'text' => '<h2 style="text-align: center;">Find us at these locations</h2>',
),
array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#e0e0e0',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'text',
'text' => '<h3><span style="text-decoration: underline;"><em>Denver</em></span></h3><p>1263 Schoville Street</p><p>53355 DENVER</p><p>CO</p>',
),
),
),
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'text',
'text' => '<h3><span style="text-decoration: underline;"><em>Fort Collins</em></span></h3><p><em></em>157 Maine Street</p><p>86432 FORT COLLINS<br />CO</p><p></p>',
),
),
),
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'text',
'text' => '<h3><span style="text-decoration: underline;"><em>Pueblo</em></span></h3><p><em></em>5390 York Avenue</p><p>64297 Pueblo</p><p>CO</p>',
),
),
),
),
),
array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
array(
'type' => 'social',
'iconSet' => 'full-symbol-black',
'icons' => array(
array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://example.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://example.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
array(
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
),
array(
'type' => 'header',
'text' => '<p><a href="[link:newsletter_view_in_browser_url]">View&nbsp;this email in your web browser</a></p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#222222',
'fontFamily' => 'Verdana',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#d83b3b',
'textDecoration' => 'underline',
),
),
),
array(
'type' => 'footer',
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Address: Colorado</p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#222222',
'fontFamily' => 'Verdana',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#d83b3b',
'textDecoration' => 'none',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#434343',
'fontFamily' => 'Tahoma',
'fontSize' => '16px',
),
'h1' => array(
'fontColor' => '#222222',
'fontFamily' => 'Verdana',
'fontSize' => '24px',
),
'h2' => array(
'fontColor' => '#222222',
'fontFamily' => 'Verdana',
'fontSize' => '22px',
),
'h3' => array(
'fontColor' => '#222222',
'fontFamily' => 'Verdana',
'fontSize' => '20px',
),
'link' => array(
'fontColor' => '#21759B',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#f0f0f0',
),
'body' => array(
'backgroundColor' => '#ffffff',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/burger-joint.jpg';
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,846 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class ChocolateStore {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/chocolate_store';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Chocolate Store", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '28px',
),
),
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/cafe-cocoa-logo_small.png',
'alt' => 'cafe-cocoa-logo_small',
'fullWidth' => true,
'width' => '648px',
'height' => '80px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'social',
'iconSet' => 'full-symbol-grey',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 => array(
'type' => 'socialIcon',
'iconType' => 'pinterest',
'link' => 'http://www.pinterest.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Pinterest.png',
'height' => '32px',
'width' => '32px',
'text' => 'Pinterest',
),
3 => array(
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '36px',
),
),
),
),
),
),
),
3 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#5b5b5b',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/cocoa-hero.jpg',
'alt' => 'cocoa-hero',
'fullWidth' => true,
'width' => '1320px',
'height' => '677px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;">SEASONAL SPECIAL: RUM TRUFFLE</h1>
<p style="text-align: left;">Vestibulum eu nulla quis nulla rutrum efficitur ac in orci. Praesent vulputate neque et scelerisque porttitor. Duis mauris ipsum, sagittis nec semper et, dapibus eget nunc. Fusce ornare eros non mauris tempus varius.</p>',
),
3 => array(
'type' => 'button',
'text' => 'Shop Truffles',
'url' => '',
'styles' => array(
'block' => array(
'backgroundColor' => '#a4a4a4',
'borderColor' => '#4e4e4e',
'borderWidth' => '2px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '18px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
),
4 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
4 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/bottom-divider-1.png',
'alt' => 'bottom-divider',
'fullWidth' => true,
'width' => '1320px',
'height' => '102px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '50px',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h2 style="text-align: center;">Store News</h2>',
),
3 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
5 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/cake-shop.png',
'alt' => 'cake-shop',
'fullWidth' => true,
'width' => '300px',
'height' => '300px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/bottom-divider_lightgrey-1.png',
'alt' => 'bottom-divider_lightgrey',
'fullWidth' => true,
'width' => '440px',
'height' => '60px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'header',
'text' => '<p><span style="font-family: \'Open Sans\', Arial, sans-serif;"><span style="font-size: 14px;">Duis pellentesque nibh in lectus blandit.</span></span></p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '14px',
'textAlign' => 'left',
),
'link' => array(
'fontColor' => '#ffffff',
'textDecoration' => 'underline',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/new-desserts.png',
'alt' => 'new-desserts',
'fullWidth' => true,
'width' => '300px',
'height' => '300px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/bottom-divider_lightgrey-1.png',
'alt' => 'bottom-divider_lightgrey',
'fullWidth' => true,
'width' => '440px',
'height' => '60px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'header',
'text' => '<p>Phasellus feugiat laoreet ex ac elementum.</p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '14px',
'textAlign' => 'left',
),
'link' => array(
'fontColor' => '#a4a4a4',
'textDecoration' => 'underline',
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/cupcakes.jpg',
'alt' => 'cupcakes',
'fullWidth' => true,
'width' => '300px',
'height' => '300px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/bottom-divider_lightgrey-1.png',
'alt' => 'bottom-divider_lightgrey',
'fullWidth' => true,
'width' => '440px',
'height' => '60px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'header',
'text' => '<p>Mauris lacinia venenatis luctus.&nbsp;</p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '14px',
'textAlign' => 'left',
),
'link' => array(
'fontColor' => '#ffffff',
'textDecoration' => 'underline',
),
),
),
),
),
),
),
6 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 => array(
'type' => 'button',
'text' => 'Visit Store',
'url' => '',
'styles' => array(
'block' => array(
'backgroundColor' => '#a4a4a4',
'borderColor' => '#4e4e4e',
'borderWidth' => '2px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '20px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'double',
'borderWidth' => '7px',
'borderColor' => '#4e4e4e',
),
),
),
3 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;">Cocoa Blogs...</h1>',
),
4 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '8.5px',
'borderStyle' => 'double',
'borderWidth' => '7px',
'borderColor' => '#4e4e4e',
),
),
),
5 => array(
'type' => 'automatedLatestContent',
'amount' => '1',
'contentType' => 'post',
'terms' => array(),
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'center',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'belowText',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'button',
'readMoreText' => 'Read more',
'readMoreButton' => array(
'type' => 'button',
'text' => 'Read more',
'url' => '[postLink]',
'styles' => array(
'block' => array(
'backgroundColor' => '#a4a4a4',
'borderColor' => '#4e4e4e',
'borderWidth' => '2px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#000001',
'fontFamily' => 'Georgia',
'fontSize' => '20px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => false,
'divider' => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
6 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
7 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '10.5px',
'borderStyle' => 'double',
'borderWidth' => '7px',
'borderColor' => '#4e4e4e',
),
),
),
),
),
),
),
7 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'social',
'iconSet' => 'full-symbol-grey',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p>Add your postal address here!</p>',
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'footer',
'text' => '<p><em>Praesent metus ante, venenatis egestas nisl ac, molestie viverra ante.&nbsp;</em></p>
<p><em>&nbsp;</em></p>
<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe<br /></a><a href="[link:subscription_manage_url]">Manage subscription</a></p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#dadada',
'fontFamily' => 'Arial',
'fontSize' => '14px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#dadada',
'textDecoration' => 'underline',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'text',
'text' => '<p><em>Aliquam feugiat nisl eget eleifend congue.</em></p>',
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/owner-1.jpg',
'alt' => 'owner',
'fullWidth' => false,
'width' => '100px',
'height' => '100px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '16px',
),
'h1' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Georgia',
'fontSize' => '24px',
),
'h2' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Georgia',
'fontSize' => '32px',
),
'h3' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Georgia',
'fontSize' => '24px',
),
'link' => array(
'fontColor' => '#ffffff',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#000000',
),
'body' => array(
'backgroundColor' => '#000000',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/chocolate-store.jpg';
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,425 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class CoffeeShop {
private $social_icon_url;
private $template_image_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/franks-roast-house';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Coffee Shop", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => '#ccc6c6',
'height' => '20px',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
2 => array(
'type' => 'image',
'link' => 'http://www.example.com',
'src' => $this->template_image_url . '/header-v2.jpg',
'alt' => 'Frank\'s Café',
'fullWidth' => true,
'width' => '600px',
'height' => '220px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
3 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
4 => array(
'type' => 'text',
'text' => '<p>Hi there [subscriber:firstname | default:coffee drinker]</p>
<p></p>
<p>Sit back and enjoy your favorite roast as you read this week\'s newsletter. </p>',
),
5 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/coffee-grain.jpg',
'alt' => 'Coffee grain',
'fullWidth' => true,
'width' => '1599px',
'height' => '777px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
6 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;">--- Guest Roaster: <em>Brew Bros. ---</em></h1>
<p><em></em></p>
<p>Visit our Center Avenue store to try the latest guest coffee from Brew Bros, a local coffee roaster. This young duo started only two years ago, but have quickly gained popularity through pop-up shops, local events, and collaborations with food trucks.</p>
<p></p>
<blockquote>
<p><span style="color: #ff6600;"><em><strong>Tasting notes:</strong> A rich, caramel flavor with subtle hints of molasses. The perfect wake-up morning espresso!</em></span></p>
</blockquote>',
),
7 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '22px',
),
),
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#ebebeb',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h2>Sandwich Competition</h2>',
),
2 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/sandwich.jpg',
'alt' => 'Sandwich',
'fullWidth' => false,
'width' => '640px',
'height' => '344px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
3 => array(
'type' => 'text',
'text' => '<p>Have an idea for the Next Great Sandwich? Tell us! We\'re offering free lunch for a month if you can invent an awesome new sandwich for our menu.</p>
<p></p>
<p>Simply tweet your ideas to <a href="http://www.example.com" title="This isn\'t a real twitter account">@franksroasthouse</a> and use #sandwichcomp and we\'ll let you know if you\'re a winner.</p>',
),
4 => array(
'type' => 'button',
'text' => 'Find out more',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#604b4b',
'borderColor' => '#443232',
'borderWidth' => '1px',
'borderRadius' => '3px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '34px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '14px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
5 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
6 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;">Follow Us</h3>',
),
7 => array(
'type' => 'social',
'iconSet' => 'full-symbol-black',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com/mailpoetplugin',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com/mailpoet',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 => array(
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://www.instagram.com/test',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
3 => array(
'type' => 'socialIcon',
'iconType' => 'website',
'link' => 'http://www.mailpoet.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Website.png',
'height' => '32px',
'width' => '32px',
'text' => 'Website',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h2>New Store Opening!</h2>',
),
2 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/map-v2.jpg',
'alt' => 'Map',
'fullWidth' => false,
'width' => '636px',
'height' => '342px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
3 => array(
'type' => 'text',
'text' => '<p>Watch out Broad Street, we\'re coming to you very soon! </p>
<p></p>
<p>Keep an eye on your inbox, as we\'ll have some special offers for our email subscribers plus an exclusive launch party invite!<br /><br /></p>',
),
4 => array(
'type' => 'text',
'text' => '<h2>New and Improved Hours!</h2>
<p></p>
<p>Frank\'s is now open even later, so you can get your caffeine fix all day (and night) long! Here\'s our new opening hours:</p>
<p></p>
<ul>
<li>Monday - Thursday: 6am - 12am</li>
<li>Friday - Saturday: 6am - 1:30am</li>
<li>Sunday: 7:30am - 11pm</li>
</ul>',
),
5 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '33px',
),
),
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'footer',
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />12345 MailPoet Drive, EmailVille, 76543</p>',
'styles' => array(
'block' => array(
'backgroundColor' => '#a9a7a7',
),
'text' => array(
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'right',
),
'link' => array(
'fontColor' => '#000000',
'textDecoration' => 'underline',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '14px',
),
'h1' => array(
'fontColor' => '#604b4b',
'fontFamily' => 'Lucida',
'fontSize' => '30px',
),
'h2' => array(
'fontColor' => '#5c4242',
'fontFamily' => 'Lucida',
'fontSize' => '22px',
),
'h3' => array(
'fontColor' => '#333333',
'fontFamily' => 'Lucida',
'fontSize' => '20px',
),
'link' => array(
'fontColor' => '#047da7',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#ffffff',
),
'body' => array(
'backgroundColor' => '#ccc6c6',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/coffee-shop.jpg';
}
}

View File

@ -1,467 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class Discount {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/discount';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Discount", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/bicycle-header3.png',
'alt' => 'bicycle-header3',
'fullWidth' => false,
'width' => '423px',
'height' => '135px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'text',
'text' => '<p></p>
<p>Hi&nbsp;[subscriber:firstname | default:reader]</p>
<p class=""></p>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec ut venenatis ipsum. Etiam efficitur magna a convallis consectetur.&nbsp;Nunc dapibus cursus mauris vel sollicitudin. Etiam magna libero, posuere ac nulla nec, iaculis pulvinar arcu.</p>',
),
3 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#ebdddd',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '16px',
'borderStyle' => 'dashed',
'borderWidth' => '2px',
'borderColor' => '#9a5fa1',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><em><strong>15% odio felis fringilla eget enim</strong></em></h1>',
),
2 => array(
'type' => 'text',
'text' => '<h2 style="text-align: center;">FUSCE LOBORTIS<strong>: WELOVEMAILPOET</strong></h2>',
),
3 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '16px',
'borderStyle' => 'dashed',
'borderWidth' => '2px',
'borderColor' => '#9a5fa1',
),
),
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'button',
'text' => 'SHOP NOW',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#9a5fa1',
'borderColor' => '#854f8b',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '288px',
'lineHeight' => '50px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><strong><em>Use your discount on these great&nbsp;products...</em></strong></h1>',
),
3 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
3 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/red-icycle-2.jpg',
'alt' => 'red-icycle',
'fullWidth' => false,
'width' => '558px',
'height' => '399px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;">Lovely Red Bicycle</h3>
<p>Quisque nec vulputate velit, non sagittis ex.&nbsp;Suspendisse ligula urna, tempus sed iaculis sit amet, convallis at arcu.</p>
<h3 style="text-align: center;"><strong><span style="color: #488e88;">$289.99</span></strong></h3>',
),
2 => array(
'type' => 'button',
'text' => 'Tempus',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#9a5fa1',
'borderColor' => '#854f8b',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/orange-bicycle.jpg',
'alt' => 'orange-bicycle',
'fullWidth' => false,
'width' => '639px',
'height' => '457px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;">Little Orange Bicycle</h3>
<p>Praesent molestie mollis sapien vel dignissim. Maecenas ultrices, odio eget dapibus iaculis, ligula ex aliquet leo.</p>
<h3 style="line-height: 22.4px; text-align: center;"><span style="color: #488e88;"><strong>$209.99</strong></span></h3>',
),
2 => array(
'type' => 'button',
'text' => 'Tempus',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#9a5fa1',
'borderColor' => '#854f8b',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
),
),
),
),
4 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '22px',
),
),
),
1 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '20px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#9e9e9e',
),
),
),
2 => array(
'type' => 'text',
'text' => '<p><em>Diam et vestibulum facilisis:</em></p>
<ul>
<li>Massa justo tincidunt magna, a volutpat dolor leo vel mi.</li>
<li>Curabitur ornare tellus libero, nec porta dolor elementum et.</li>
<li>Vestibulum sodales congue ex quis euismod.</li>
</ul>',
),
3 => array(
'type' => 'social',
'iconSet' => 'grey',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://example.com',
'image' => $this->social_icon_url . '/02-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://example.com',
'image' => $this->social_icon_url . '/02-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
),
),
4 => array(
'type' => 'footer',
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a></p><p>1 Store Street, Shopville, CA 1345</p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#343434',
'fontFamily' => 'Verdana',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#488e88',
'textDecoration' => 'none',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#343434',
'fontFamily' => 'Verdana',
'fontSize' => '14px',
),
'h1' => array(
'fontColor' => '#488e88',
'fontFamily' => 'Trebuchet MS',
'fontSize' => '22px',
),
'h2' => array(
'fontColor' => '#9a5fa1',
'fontFamily' => 'Verdana',
'fontSize' => '24px',
),
'h3' => array(
'fontColor' => '#9a5fa1',
'fontFamily' => 'Trebuchet MS',
'fontSize' => '18px',
),
'link' => array(
'fontColor' => '#488e88',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#afe3de',
),
'body' => array(
'backgroundColor' => '#afe3de',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/discount.jpg';
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,348 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class GiftWelcome {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/gift';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Gift Welcome", 'mailpoet'),
'categories' => json_encode(array('welcome', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/gift.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Gift-Header-1.jpg',
'alt' => 'Gift-Header-1',
'fullWidth' => true,
'width' => '1280px',
'height' => '920px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#e7e7e7',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h2 style="text-align: center;"><span style="color: #dd2d2d;">We\'re so happy you\'re onboard!</span></h2>
<p style="text-align: center;"><span style="color: #333333;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra. Pellentesque in interdum eros, a venenatis velit. Fusce finibus convallis augue, ut viverra felis placerat in. </span></p>
<p style="text-align: center;"><span style="color: #333333;"></span></p>
<p style="text-align: center;"><span style="color: #333333;">Curabitur et commodo ipsum. Mauris tellus metus, tristique vel sollicitudin ut, malesuada in augue. Aliquam ultricies purus vel commodo vehicula.</span></p>',
),
1 =>
array (
'type' => 'button',
'text' => 'Get Started',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#dd2d2d',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '40px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '50px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '22px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
),
2 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Gift-Footer.jpg',
'alt' => 'Gift-Footer',
'fullWidth' => true,
'width' => '1280px',
'height' => '920px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '23px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<p style="font-size: 11px; text-align: center;"><span style="color: #808080;"><strong>Address Line 1</strong></span></p>
<p style="font-size: 11px; text-align: center;"><span style="color: #808080;"><strong>Address Line 2</strong></span></p>
<p style="font-size: 11px; text-align: center;"><span style="color: #808080;"><strong>City</strong></span></p>
<p style="font-size: 11px; text-align: center;"><span style="color: #808080;"><strong>Country</strong></span></p>',
),
2 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '5.5px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#aaaaaa',
),
),
),
3 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
4 =>
array (
'type' => 'social',
'iconSet' => 'grey',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/02-grey/Facebook.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/02-grey/Twitter.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/02-grey/Instagram.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
),
5 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center; font-size: 11px;"><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a><span>&nbsp;|&nbsp;</span><a href="[link:subscription_manage_url]">Manage your subscription</a></p>',
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '15px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Arial',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Arial',
'fontSize' => '22px',
),
'link' =>
array (
'fontColor' => '#dd2d2d',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#ffffff',
),
),
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,721 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class KickOff {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/kick_off';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Kick-Off", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/football-header.jpg',
'alt' => 'football-header',
'fullWidth' => true,
'width' => '1320px',
'height' => '540px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><strong>ALL THE LATEST MATCH RESULTS &amp; NEWS FROM THE SUNDAYS CLUB</strong></h1>',
),
3 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/football-player-1.jpeg',
'alt' => 'football-player',
'fullWidth' => false,
'width' => '600px',
'height' => '840px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p><em>Nam convallis lorem tellus, eget sodales magna semper quis.</em></p>',
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'text',
'text' => '<h2>North</h2>
<p>Nottington 0-1 East Lettersley</p>
<p>Little Bickburgh 2-1 Rockingham</p>
<p></p>
<h2>South</h2>
<p>Richmond West 1-0 Offington</p>
<p>Shorleton 5-2 Garphingham</p>
<p>Westwood 1-3 Chesham</p>
<p></p>
<h2>West</h2>
<p>Millham 4-2 Dunn Village</p>
<p>Emmington 1-1 Finham</p>
<p>Little Forest 0-2 Winton</p>
<p></p>
<h2>East</h2>
<p>Southfield 2-1 Fincham</p>
<p>High Ridlington 0-1 Benham</p>
<p>Tinton 4-6 Dortington</p>',
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '25px',
'borderStyle' => 'ridge',
'borderWidth' => '5px',
'borderColor' => '#484747',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;">MATCH REPORTS</h1>',
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '21px',
),
),
),
),
),
),
),
3 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'text',
'text' => '<h2>Branham United vs Finkley</h2>
<p>Vestibulum consectetur, quam sed tristique feugiat, elit sapien molestie mi, eu dapibus eros sapien ut risus. Nullam non scelerisque ligula.</p>
<p></p>
<p>Donec vitae nunc tempus, elementum magna et, ultrices velit. Sed eu consequat sapien, at dictum diam. Sed tristique egestas justo sit amet vulputate. Proin rhoncus sem eu odio ultricies ultrices.</p>',
),
1 => array(
'type' => 'button',
'text' => 'READ MORE',
'url' => 'http://www.google.co.uk',
'styles' => array(
'block' => array(
'backgroundColor' => '#61cc5a',
'borderColor' => '#2f6a2c',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#252525',
'fontFamily' => 'Lucida',
'fontSize' => '14px',
'fontWeight' => 'bold',
'textAlign' => 'left',
),
),
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'text',
'text' => '<h2 style="text-align: center;">Champton Albion vs Swanhall</h2>
<p>Aenean a arcu egestas, tincidunt nisi ut, mollis arcu. Sed eget dapibus nisi. Quisque tortor mi, consequat ut erat et, porta imperdiet dui.</p>
<p></p>
<p>Mauris vestibulum tortor ut justo luctus blandit. Vestibulum mollis sollicitudin tempor. Duis gravida, dui quis eleifend scelerisque, libero orci semper metus, sed maximus odio tortor ac sem.</p>',
),
1 => array(
'type' => 'button',
'text' => 'READ MORE',
'url' => 'https://www.google.co.uk',
'styles' => array(
'block' => array(
'backgroundColor' => '#61cc5a',
'borderColor' => '#2f6a2c',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#252525',
'fontFamily' => 'Lucida',
'fontSize' => '14px',
'fontWeight' => 'bold',
'textAlign' => 'left',
),
),
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
4 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#8aeb83',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '28px',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><strong><span style="color: #333333;">FROM OUR ONLINE STORE</span></strong></h1>',
),
),
),
),
),
5 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => '#8aeb83',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/shoes.jpg',
'alt' => 'shoes',
'fullWidth' => false,
'width' => '400px',
'height' => '400px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;"><strong>Team Colours Laces</strong></h3><p style="text-align: center;"><span style="color: #333333;">Donec imperdiet<em><br /></em>Tortor tincidunt, luctus libero vel, dapibus quam</span></p>',
),
3 => array(
'type' => 'button',
'text' => 'SHOP',
'url' => '',
'styles' => array(
'block' => array(
'backgroundColor' => '#61cc5a',
'borderColor' => '#2f6a2c',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#252525',
'fontFamily' => 'Lucida',
'fontSize' => '14px',
'fontWeight' => 'bold',
'textAlign' => 'left',
),
),
),
4 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/football.jpg',
'alt' => 'football',
'fullWidth' => false,
'width' => '400px',
'height' => '400px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;"><strong>Match Quality Balls</strong></h3><p style="text-align: center;"><span style="color: #333333;">Donec vulputate tempor auctor purus sit amet cursus ultricies</span></p>',
),
3 => array(
'type' => 'button',
'text' => 'SHOP',
'url' => '',
'styles' => array(
'block' => array(
'backgroundColor' => '#61cc5a',
'borderColor' => '#2f6a2c',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#252525',
'fontFamily' => 'Lucida',
'fontSize' => '14px',
'fontWeight' => 'bold',
'textAlign' => 'left',
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/plant-pot.jpg',
'alt' => 'plant-pot',
'fullWidth' => false,
'width' => '400px',
'height' => '400px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h3 style="text-align: center;"><strong>Football Plant Pots</strong></h3><p style="text-align: center;"><span style="color: #333333;">Libero tortor aliquet metus eget efficitur est lorem sit amet purus</span></p>',
),
3 => array(
'type' => 'button',
'text' => 'SHOP',
'url' => '',
'styles' => array(
'block' => array(
'backgroundColor' => '#61cc5a',
'borderColor' => '#2f6a2c',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#252525',
'fontFamily' => 'Lucida',
'fontSize' => '14px',
'fontWeight' => 'bold',
'textAlign' => 'left',
),
),
),
),
),
),
),
6 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 => array(
'type' => 'footer',
'text' => '<a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br /><b>Add your postal address here!</b>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Lucida',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#ffffff',
'textDecoration' => 'underline',
),
),
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '23px',
),
),
),
3 => array(
'type' => 'social',
'iconSet' => 'full-symbol-grey',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 => array(
'type' => 'socialIcon',
'iconType' => 'youtube',
'link' => 'http://www.youtube.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Youtube.png',
'height' => '32px',
'width' => '32px',
'text' => 'Youtube',
),
3 => array(
'type' => 'socialIcon',
'iconType' => 'email',
'link' => '',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Email.png',
'height' => '32px',
'width' => '32px',
'text' => 'Email',
),
),
),
4 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Georgia',
'fontSize' => '16px',
),
'h1' => array(
'fontColor' => '#ffffff',
'fontFamily' => 'Lucida',
'fontSize' => '24px',
),
'h2' => array(
'fontColor' => '#61cc5a',
'fontFamily' => 'Lucida',
'fontSize' => '22px',
),
'h3' => array(
'fontColor' => '#333333',
'fontFamily' => 'Lucida',
'fontSize' => '20px',
),
'link' => array(
'fontColor' => '#21759B',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#252525',
),
'body' => array(
'backgroundColor' => '#eaeaea',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/sports.jpg';
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,778 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class Phone {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/phone';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("New Phone Purchase", 'mailpoet'),
'categories' => json_encode(array('welcome', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/phone.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#1b1821',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Phone-Logo.png',
'alt' => 'Phone-Logo',
'fullWidth' => true,
'width' => '122px',
'height' => '23px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#1b1821',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Phone-Title.png',
'alt' => 'Phone-Title',
'fullWidth' => true,
'width' => '1280px',
'height' => '215px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Phone-Header.jpg',
'alt' => 'Phone-Header',
'fullWidth' => true,
'width' => '1280px',
'height' => '920px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
2 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
3 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;"><span style="color: #ffffff;"><strong>Welcome to your brand new Casia 7200.</strong></span></h3>
<p style="text-align: center;"><strong><span style="color: #8748d5;">Let\'s get you all set up.</span></strong></p>
<p style="text-align: center;"><span style="color: #999999;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra. Pellentesque in interdum eros, a venenatis velit. Fusce finibus convallis augue, ut viverra felis placerat in.</span></p>',
),
4 =>
array (
'type' => 'button',
'text' => 'Get Started',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#8748d5',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '40px',
'borderStyle' => 'solid',
'width' => '159px',
'lineHeight' => '45px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '20px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
),
5 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'dashed',
'borderWidth' => '2px',
'borderColor' => '#2c2c2c',
),
),
),
6 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<p style="font-size: 11px; text-align: left;"><span style="color: #999999;">Address Line 1</span></p>
<p style="font-size: 11px; text-align: left;"><span style="color: #999999;">Address Line 2</span></p>
<p style="font-size: 11px; text-align: left;"><span style="color: #999999;">City</span></p>
<p style="font-size: 11px; text-align: left;"><span style="color: #999999;">Country</span></p>',
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Phone-Logo.png',
'alt' => 'Phone-Logo',
'fullWidth' => false,
'width' => '122px',
'height' => '23px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
1 =>
array (
'type' => 'social',
'iconSet' => 'full-symbol-grey',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'pinterest',
'link' => 'http://www.pinterest.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Pinterest.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Pinterest',
),
3 =>
array (
'type' => 'socialIcon',
'iconType' => 'linkedin',
'link' => 'http://www.linkedin.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/LinkedIn.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'LinkedIn',
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<p style="text-align: right; font-size: 11px;"><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a></p>
<p style="text-align: right; font-size: 11px;"><a href="[link:subscription_manage_url]">Manage subscription</a></p>',
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '15px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Arial',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Arial',
'fontSize' => '22px',
),
'link' =>
array (
'fontColor' => '#8748d5',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#1b1821',
),
'body' =>
array (
'backgroundColor' => '#1b1821',
),
),
'blockDefaults' =>
array (
'automatedLatestContent' =>
array (
'amount' => '5',
'withLayout' => false,
'contentType' => 'post',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'button',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'automatedLatestContent.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'automatedLatestContent.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'automatedLatestContentLayout' =>
array (
'amount' => '5',
'withLayout' => true,
'contentType' => 'post',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'alternate',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'button',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'automatedLatestContentLayout.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'automatedLatestContentLayout.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'button' =>
array (
'text' => 'Button',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'divider' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'footer' =>
array (
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Add your postal address here!</p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'none',
),
),
),
'posts' =>
array (
'amount' => '10',
'withLayout' => true,
'contentType' => 'post',
'postStatus' => 'publish',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'alternate',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'link',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'posts.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'posts.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'social' =>
array (
'iconSet' => 'default',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/01-social/Facebook.png?mailpoet_version=3.9.1',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/01-social/Twitter.png?mailpoet_version=3.9.1',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
),
),
'spacer' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
'header' =>
array (
'text' => 'Display problems?&nbsp;<a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser.</a>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'underline',
),
),
),
),
);
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,662 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class RetroComputingMagazine {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/retro_computing_magazine';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Retro Computing Magazine", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/retro_computing_magazine.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#4473a1',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#008282',
'height' => '40px',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8f8f8',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Windows94-Header.png',
'alt' => 'Windows94-Header',
'fullWidth' => true,
'width' => '1280px',
'height' => '740px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'header',
'text' => '<p><span style="color: #ffffff;">Display problems? <a href="[link:newsletter_view_in_browser_url]" style="color: #ffffff;">Open this email in your web browser.</a></span></p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#008282',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Courier New',
'fontSize' => '12px',
'textAlign' => 'left',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'underline',
),
),
),
1 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
2 =>
array (
'type' => 'text',
'text' => '<h1 style="text-align: left;"><strong>We\'re upgrading!</strong></h1>
<p><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In elementum nunc vel est congue, a venenatis nunc aliquet. Curabitur luctus, nulla et dignissim elementum, ipsum eros fermentum nulla, non cursus eros mi eu velit. Nunc ex nibh, porta vulputate pharetra ac, placerat sed orci. Etiam enim enim, aliquet nec ligula in, ultrices iaculis dolor. Suspendisse potenti. Praesent fringilla augue ut lorem mattis, vitae fringilla nunc faucibus. </span></p>
<p><span></span></p>
<p><span>Quisque in leo felis. Etiam at libero et enim tincidunt scelerisque. Ut felis lectus, imperdiet quis justo quis, elementum sagittis tellus. Sed elementum, lacus at iaculis vestibulum, nunc leo gravida nisi, sed dapibus nisi odio ac ex. Aliquam id arcu dictum, cursus quam id, eleifend libero.</span></p>',
),
3 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'ridge',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
4 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
5 =>
array (
'type' => 'text',
'text' => '<h1><strong>Latest News</strong></h1>',
),
),
),
),
),
3 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: left;" data-post-id="1987"><strong>What is it like to use a Windows 98 PC in 2017?</strong></h3>',
),
1 =>
array (
'type' => 'text',
'text' => '<p class="mailpoet_wp_post"><span>Computers are much more advanced than they were even a few years ago, but of course we all like to complain about the dumb things they sometimes do. It&rsquo;s easy to forget how clunky things used to be, though...</span></p>
<p><a href="http://mailpoet.info/odds-on-10-science-breakthroughs-you-can-bet-on/">Read more</a></p>',
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: left;" data-post-id="1938"><strong>Windows 95 still finds life online</strong></h3>',
),
1 =>
array (
'type' => 'text',
'text' => '<p class="mailpoet_wp_post">Microsoft&rsquo;s Windows 95 has reached the ripe old age of 22 this year and to commemorate this milestone, TheNextWeb goes into some details about the operating system that users may have missed over the years...</p>
<p><a href="http://mailpoet.info/brazils-history-making-hurricane/">Read more</a></p>',
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: left;" data-post-id="1997"><strong>New Sinclair ZX Spectrum Fully Funded</strong></h3>',
),
1 =>
array (
'type' => 'text',
'text' => '<p class="mailpoet_wp_post">The new Sinclair ZX Spectrum Next home computer which was launched on Kickstarter to mark the 35th birthday of the original Spectrum produced by Sinclair Research has been fully funded in less than 48 hours...</p>
<p><a href="http://mailpoet.info/cutting-through-the-smog-what-to-do-to-fight-air-pollution/">Read more</a></p>',
),
),
),
),
),
4 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '35px',
),
),
),
1 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#008282',
'height' => '50px',
),
),
),
),
),
),
),
5 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#008282',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h2><strong><span style="color: #ffffff;">Did you know?</span></strong></h2>
<p><span style="color: #ffffff;">At the time of creation and development, the microcomputers in Japan were not powerful enough to handle the complex tasks related to the design and programming of Space Invaders. Nishikado then designed his own hardware and developmental tools to make the game a reality.</span></p>
<p><strong><span style="color: #ffffff;"></span></strong></p>',
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Windows94-Today.png',
'alt' => 'Windows94-Today',
'fullWidth' => false,
'width' => '364px',
'height' => '291px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
6 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#008282',
'height' => '20px',
),
),
),
),
),
),
),
7 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8f8f8',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center;"><strong>Let\'s get social!</strong></p>',
),
2 =>
array (
'type' => 'social',
'iconSet' => 'grey',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/02-grey/Facebook.png?mailpoet_version=3.0.0-rc.1.0.4',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/02-grey/Twitter.png?mailpoet_version=3.0.0-rc.1.0.4',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'youtube',
'link' => 'http://www.youtube.com',
'image' => $this->social_icon_url . '/02-grey/Youtube.png?mailpoet_version=3.0.0-rc.1.0.4',
'height' => '32px',
'width' => '32px',
'text' => 'Youtube',
),
3 =>
array (
'type' => 'socialIcon',
'iconType' => 'email',
'link' => '',
'image' => $this->social_icon_url . '/02-grey/Email.png?mailpoet_version=3.0.0-rc.1.0.4',
'height' => '32px',
'width' => '32px',
'text' => 'Email',
),
),
),
3 =>
array (
'type' => 'footer',
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage your subscription</a><br />Add your postal address here!</p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Courier New',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#008282',
'textDecoration' => 'none',
),
),
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Courier New',
'fontSize' => '14px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Courier New',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Courier New',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Courier New',
'fontSize' => '18px',
),
'link' =>
array (
'fontColor' => '#008282',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#008282',
),
),
);
}
}

View File

@ -0,0 +1,700 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class RssSimpleNews {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/rss-simple-news';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Stripped RSS Style Layout", 'mailpoet'),
'categories' => json_encode(array('notification', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/rss-simple-news.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f4f4f4',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '25px',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/RSS-Logo-2.png',
'alt' => 'RSS-Logo-2',
'fullWidth' => true,
'width' => '210px',
'height' => '90px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '24px',
),
),
),
1 =>
array (
'type' => 'social',
'iconSet' => 'full-symbol-color',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/06-full-symbol-color/Facebook.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/06-full-symbol-color/Twitter.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'website',
'link' => '',
'image' => $this->social_icon_url . '/06-full-symbol-color/Website.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Website',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: left;"><strong><span style="color: #333333;">Latest RSS Simple&nbsp;Posts</span></strong></h3>
<p><span style="color: #999999;">Week 23: 23/19/19</span></p>',
),
1 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
2 =>
array (
'type' => 'automatedLatestContent',
'amount' => '3',
'contentType' => 'post',
'terms' =>
array (
),
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h3',
'titleAlignment' => 'left',
'titleIsLink' => true,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'link',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'type' => 'button',
'text' => 'Read more',
'url' => '[postLink]',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
'context' => 'automatedLatestContent.readMoreButton',
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#efe7f0',
),
),
'context' => 'automatedLatestContent.divider',
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
3 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
3 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f4f4f4',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<p><span style="color: #808080;"><strong>RSS Simple</strong></span></p>
<p><span style="color: #808080; font-size: 11px;"><strong><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a><span>&nbsp;|&nbsp;</span><a href="[link:subscription_manage_url]">Manage subscription</a></strong></span></p>
<p><span style="color: #808080; font-size: 11px;"><strong><span>Add your postal address here!</span></strong></span></p>',
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '15px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Arial',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#3478f5',
'fontFamily' => 'Arial',
'fontSize' => '20px',
),
'link' =>
array (
'fontColor' => '#3478f5',
'textDecoration' => 'none',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#f4f4f4',
),
),
'blockDefaults' =>
array (
'automatedLatestContent' =>
array (
'amount' => '3',
'contentType' => 'post',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h3',
'titleAlignment' => 'left',
'titleIsLink' => true,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'link',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'automatedLatestContent.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
'type' => 'button',
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'automatedLatestContent.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#efe7f0',
),
),
'type' => 'divider',
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
'type' => 'automatedLatestContent',
'terms' =>
array (
),
),
'button' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
'type' => 'button',
),
'divider' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'footer' =>
array (
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Add your postal address here!</p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'none',
),
),
),
'posts' =>
array (
'amount' => '10',
'contentType' => 'post',
'postStatus' => 'publish',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'link',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'posts.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'posts.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'social' =>
array (
'iconSet' => 'default',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/01-social/Facebook.png?mailpoet_version=3.7.1',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/01-social/Twitter.png?mailpoet_version=3.7.1',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
),
),
'spacer' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
'header' =>
array (
'text' => 'Display problems?&nbsp;<a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser.</a>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'underline',
),
),
),
),
);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,712 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class Sunglasses {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/sunglasses';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Sunglasses", 'mailpoet'),
'categories' => json_encode(array('welcome', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/sunglasses.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Logo.jpg',
'alt' => 'Glasses-Logo',
'fullWidth' => false,
'width' => '250px',
'height' => '66px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
2 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'padding' => '17px',
'borderStyle' => 'solid',
'borderWidth' => '2px',
'borderColor' => '#f8b849',
),
),
),
3 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
4 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Header-2.jpg',
'alt' => 'Glasses-Header-2',
'fullWidth' => true,
'width' => '1280px',
'height' => '116px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
5 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;"><span style="color: #333333;"><strong>Here\'s what we sent you</strong></span></h3>',
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Images-1.jpg',
'alt' => 'Glasses-Images-1',
'fullWidth' => true,
'width' => '1280px',
'height' => '650px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center;"><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra.</span></p>',
),
2 =>
array (
'type' => 'button',
'text' => 'Choose These Frames',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8b849',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '195px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
3 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Images-2.jpg',
'alt' => 'Glasses-Images-2',
'fullWidth' => true,
'width' => '1280px',
'height' => '650px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
4 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center;"><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra.</span></p>',
),
5 =>
array (
'type' => 'button',
'text' => 'Choose These Frames',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8b849',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '195px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
6 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Images-3.jpg',
'alt' => 'Glasses-Images-3',
'fullWidth' => true,
'width' => '1280px',
'height' => '650px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
7 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center;"><span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra.</span></p>',
),
8 =>
array (
'type' => 'button',
'text' => 'Choose These Frames',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8b849',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '195px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
9 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'padding' => '34.5px',
'borderStyle' => 'solid',
'borderWidth' => '2px',
'borderColor' => '#f8b849',
),
),
),
),
),
),
),
3 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Glasses-Header.jpg',
'alt' => 'Glasses-Header',
'fullWidth' => true,
'width' => '640px',
'height' => '920px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '60px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<h3><strong>Our Summer Range Is Here</strong></h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur nec nisi quis ex pulvinar molestie. Sed pulvinar placerat justo eu viverra. Pellentesque in interdum eros, a venenatis velit.</p>
<p></p>
<p>Fusce finibus convallis augue, ut viverra felis placerat in. Curabitur et commodo ipsum. Mauris tellus metus, tristique vel sollicitudin ut, malesuada in augue.&nbsp;</p>',
),
2 =>
array (
'type' => 'button',
'text' => 'Find Out More',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f8b849',
'borderColor' => '#0074a2',
'borderWidth' => '0px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '137px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Arial',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'left',
),
),
),
),
),
),
),
4 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'padding' => '34.5px',
'borderStyle' => 'solid',
'borderWidth' => '2px',
'borderColor' => '#f8b849',
),
),
),
),
),
),
),
5 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<h2 style="text-align: center;"><span style="color: #333333;"><strong>Got any questions or need some help?</strong></span></h2>
<p style="text-align: center;"><span style="color: #333333;">We\'re just a click or a phone call away.</span></p>
<p style="text-align: center;"><span style="color: #333333;"></span></p>
<h3 style="text-align: center;"><span style="color: #333333;"><strong>Call Us:</strong> 08856877854</span></h3>
<h3 style="text-align: center;"></h3>',
),
1 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'padding' => '23.5px',
'borderStyle' => 'solid',
'borderWidth' => '2px',
'borderColor' => '#f8b849',
),
),
),
),
),
),
),
6 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'social',
'iconSet' => 'full-symbol-black',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Facebook.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Twitter.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/07-full-symbol-black/Instagram.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
3 =>
array (
'type' => 'socialIcon',
'iconType' => 'email',
'link' => '',
'image' => $this->social_icon_url . '/07-full-symbol-black/Email.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Email',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<p style="text-align: center; font-size: 11px;"><strong><span style="color: #808080;"><a href="[link:subscription_unsubscribe_url]" style="color: #808080;">Unsubscribe</a>&nbsp;|&nbsp;<a href="[link:subscription_manage_url]" style="color: #808080;">Manage your subscription</a></span></strong><br /><span style="color: #808080;">Add your postal address here!</span></p>',
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '15px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Arial',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Arial',
'fontSize' => '22px',
),
'link' =>
array (
'fontColor' => '#21759B',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#ffffff',
),
),
);
}
}

View File

@ -1,603 +0,0 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class TravelNomads {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/travel_nomads';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Travel Nomads", 'mailpoet'),
'categories' => json_encode(array('standard', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getBody() {
return array(
'content' => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/header-1.png',
'alt' => 'Travelling Tales with Jane & Steven',
'fullWidth' => true,
'width' => '660px',
'height' => '165px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
2 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;">Hi&nbsp;[subscriber:firstname | default:reader]!</h1>
<p></p>
<p>Donec viverra arcu nec elit congue pellentesque. In ac dictum magna. Morbi sit amet accumsan augue. Cras cursus viverra nulla non tempus. Curabitur sed neque vel sapien feugiat mattis. Morbi ullamcorper tellus diam, sed rutrum nisi faucibus at.</p>',
),
3 => array(
'type' => 'social',
'iconSet' => 'circles',
'icons' => array(
0 => array(
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://example.com',
'image' => $this->social_icon_url . '/03-circles/Twitter.png',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
),
),
4 => array(
'type' => 'text',
'text' => '<h1 style="text-align: center;"><strong>Photos from Rotarua</strong></h1>',
),
5 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/hot-thermals-1.jpg',
'alt' => 'hot thermals',
'fullWidth' => false,
'width' => '640px',
'height' => '425px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/5398660557_e5e338357e_z.jpg',
'alt' => 'The view from our campsite',
'fullWidth' => false,
'width' => '640px',
'height' => '425px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
),
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/5399212952_b3fea8fffb_z.jpg',
'alt' => 'Red sky at night',
'fullWidth' => false,
'width' => '640px',
'height' => '425px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/5399283298_0d2cd66e9f_z.jpg',
'alt' => 'Don\'t go chasing waterfalls',
'fullWidth' => false,
'width' => '640px',
'height' => '425px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
),
),
),
),
3 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 => array(
'type' => 'button',
'text' => 'View NZ Photo Gallery',
'url' => 'http://example.org',
'styles' => array(
'block' => array(
'backgroundColor' => '#f16161',
'borderColor' => '#ffffff',
'borderWidth' => '3px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '288px',
'lineHeight' => '48px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
),
),
),
),
4 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '23px',
'borderStyle' => 'double',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
1 => array(
'type' => 'text',
'text' => '<h2><em>Here\'s our top recommendations in Rotarua</em></h2>',
),
2 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
5 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/glow-worms.jpg',
'alt' => 'Glow worms, Waitomo Caves',
'fullWidth' => true,
'width' => '640px',
'height' => '428px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p><em><a href="http://www.waitomo.com/Waitomo-Glowworm-Caves/Pages/default.aspx"><strong>Waitomo Glow Worm Caves</strong></a></em></p>',
),
),
),
1 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/luge.jpg',
'alt' => 'luge',
'fullWidth' => false,
'width' => '375px',
'height' => '500px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p><em><strong><a href="http://www.skyline.co.nz/rotorua/ssr_luge/">Luge!</a></strong></em></p>',
),
),
),
2 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'image',
'link' => 'http://example.org',
'src' => $this->template_image_url . '/holiday-park.jpg',
'alt' => 'holiday-park',
'fullWidth' => true,
'width' => '640px',
'height' => '425px',
'styles' => array(
'block' => array(
'textAlign' => 'center',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p><em><strong><a href="http://rotoruathermal.co.nz/">Roturua Thermal Holiday Park</a></strong></em></p>',
),
),
),
),
),
6 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'spacer',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'height' => '21px',
),
),
),
1 => array(
'type' => 'text',
'text' => '<p>Morbi ex diam, venenatis a efficitur et, iaculis at nibh. Ut rhoncus, lacus vel fermentum aliquam, mi arcu pharetra metus, quis ullamcorper tortor ligula in diam. Fusce mi elit, finibus at lectus non, pulvinar fringilla risus. Integer porta vel quam et fringilla.</p>
<p></p>
<p>Morbi sit amet,</p>
<p>Jane &amp; Steven</p>',
),
),
),
),
),
7 => array(
'type' => 'container',
'orientation' => 'horizontal',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'container',
'orientation' => 'vertical',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
),
'blocks' => array(
0 => array(
'type' => 'divider',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'dotted',
'borderWidth' => '2px',
'borderColor' => '#aaaaaa',
),
),
),
1 => array(
'type' => 'header',
'text' => 'Display problems?&nbsp;<a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser</a>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#222222',
'fontFamily' => 'Courier New',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#343434',
'textDecoration' => 'underline',
),
),
),
2 => array(
'type' => 'footer',
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a></p>',
'styles' => array(
'block' => array(
'backgroundColor' => 'transparent',
),
'text' => array(
'fontColor' => '#343434',
'fontFamily' => 'Courier New',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' => array(
'fontColor' => '#343434',
'textDecoration' => 'underline',
),
),
),
),
),
),
),
),
),
'globalStyles' => array(
'text' => array(
'fontColor' => '#343434',
'fontFamily' => 'Courier New',
'fontSize' => '16px',
),
'h1' => array(
'fontColor' => '#180d6b',
'fontFamily' => 'Trebuchet MS',
'fontSize' => '26px',
),
'h2' => array(
'fontColor' => '#180d6b',
'fontFamily' => 'Trebuchet MS',
'fontSize' => '22px',
),
'h3' => array(
'fontColor' => '#343434',
'fontFamily' => 'Trebuchet MS',
'fontSize' => '18px',
),
'link' => array(
'fontColor' => '#f16161',
'textDecoration' => 'underline',
),
'wrapper' => array(
'backgroundColor' => '#daf3ff',
),
'body' => array(
'backgroundColor' => '#ffffff',
),
),
);
}
private function getThumbnail() {
return $this->template_image_url . '/travel-nomads.jpg';
}
}

View File

@ -0,0 +1,677 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class WideStoryLayout {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/wide-story-layout';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Wide Story Layout", 'mailpoet'),
'categories' => json_encode(array('notification', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/wide-story-layout.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f0f0f0',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '50px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Wide-Logo.png',
'alt' => 'Wide-Logo',
'fullWidth' => false,
'width' => '200px',
'height' => '37px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
2 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;"><span style="color: #808080;">Our Latest Posts</span></h3>',
),
3 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => 'http://mailpoet.info/cutting-through-the-smog-what-to-do-to-fight-air-pollution/',
'src' => $this->template_image_url . '/5_what_to_do_p352m1141746-800x533.jpg',
'alt' => 'Cutting through the smog: What to do to fight air pollution',
'fullWidth' => true,
'width' => 660,
'height' => 440,
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
1 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
2 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;" data-post-id="1997">Cutting through the smog: What to do to fight air pollution</h3>
<p class="mailpoet_wp_post" style="text-align: center;">Tackling our air problems starts with traffic control, but individual action to reduce energy use and intensive farming would also help clean our air.</p>',
),
3 =>
array (
'type' => 'button',
'text' => 'Read The Post',
'url' => 'http://mailpoet.info/cutting-through-the-smog-what-to-do-to-fight-air-pollution/',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#5ecd39',
'borderColor' => '#000000',
'borderWidth' => '0px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '288px',
'lineHeight' => '36px',
'fontColor' => '#ffffff',
'fontFamily' => 'Lucida',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
4 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f0f0f0',
'height' => '40px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => 'http://mailpoet.info/cutting-through-the-smog-what-to-do-to-fight-air-pollution/',
'src' => $this->template_image_url . '/gettyimages-578313682-800x533.jpg',
'alt' => 'gettyimages-578313682-800x533',
'fullWidth' => true,
'width' => '800px',
'height' => '533px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
2 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
3 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;" data-post-id="1997">Ladybird&rsquo;s transparent shell reveals how it folds its wings</h3>
<p class="mailpoet_wp_post" style="text-align: center;">They certainly know how to fold. A see-through artificial wing case has been used to watch for the first time as ladybirds put away their wings after flight.</p>',
),
4 =>
array (
'type' => 'button',
'text' => 'Read The Post',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#5ecd39',
'borderColor' => '#000000',
'borderWidth' => '0px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '288px',
'lineHeight' => '36px',
'fontColor' => '#ffffff',
'fontFamily' => 'Lucida',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
5 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
6 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f0f0f0',
'height' => '40px',
),
),
),
),
),
),
),
3 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => 'http://mailpoet.info/cutting-through-the-smog-what-to-do-to-fight-air-pollution/',
'src' => $this->template_image_url . '/plasma-stingray111-800x533.jpg',
'alt' => 'plasma-stingray111-800x533',
'fullWidth' => true,
'width' => '800px',
'height' => '533px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
1 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '30px',
),
),
),
2 =>
array (
'type' => 'text',
'text' => '<h3 style="text-align: center;" data-post-id="1997">Plasma jet engines that could take you from the ground to space</h3>
<p class="mailpoet_wp_post" style="text-align: center;">Forget fuel-powered jet engines. We&rsquo;re on the verge of having aircraft that can fly from the ground up to the edge of space using air and electricity alone.</p>',
),
3 =>
array (
'type' => 'button',
'text' => 'Read The Post',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#5ecd39',
'borderColor' => '#000000',
'borderWidth' => '0px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '288px',
'lineHeight' => '36px',
'fontColor' => '#ffffff',
'fontFamily' => 'Lucida',
'fontSize' => '16px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
4 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
5 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#f0f0f0',
'height' => '40px',
),
),
),
),
),
),
),
4 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Wide-Footer.jpg',
'alt' => 'Wide-Footer',
'fullWidth' => true,
'width' => '1280px',
'height' => '721px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'center',
),
),
),
),
),
),
),
5 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#5ecd39',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '21px',
),
),
),
1 =>
array (
'type' => 'social',
'iconSet' => 'full-symbol-grey',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Facebook.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Twitter.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'website',
'link' => '',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Website.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Website',
),
3 =>
array (
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/08-full-symbol-grey/Instagram.png?mailpoet_version=3.0.0-rc.2.0.0',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
),
2 =>
array (
'type' => 'footer',
'text' => '<p><span style="color: #ffffff;"><a href="[link:subscription_unsubscribe_url]" style="color: #ffffff;">Unsubscribe</a> | <a href="[link:subscription_manage_url]" style="color: #ffffff;">Manage subscription</a></span><br /><span style="color: #ffffff;">Add your postal address here!</span></p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'none',
),
),
),
3 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '40px',
),
),
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '15px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Lucida',
'fontSize' => '30px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Lucida',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Lucida',
'fontSize' => '18px',
),
'link' =>
array (
'fontColor' => '#5ecd39',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#f0f0f0',
),
),
);
}
}

View File

@ -0,0 +1,961 @@
<?php
namespace MailPoet\Config\PopulatorData\Templates;
class WineCity {
private $template_image_url;
private $social_icon_url;
function __construct($assets_url) {
$this->template_image_url = 'https://ps.w.org/mailpoet/assets/newsletter-templates/wine-city';
$this->social_icon_url = $assets_url . '/img/newsletter_editor/social-icons';
}
function get() {
return array(
'name' => __("Wine City", 'mailpoet'),
'categories' => json_encode(array('woocommerce', 'sample')),
'readonly' => 1,
'thumbnail' => $this->getThumbnail(),
'body' => json_encode($this->getBody()),
);
}
private function getThumbnail() {
return $this->template_image_url . '/wine-city.jpg';
}
private function getBody() {
return array (
'content' =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '37px',
),
),
),
1 =>
array (
'type' => 'image',
'link' => '',
'src' => $this->template_image_url . '/Wine-Logo.png',
'alt' => 'Wine-Logo',
'fullWidth' => false,
'width' => '136px',
'height' => '67px',
'styles' =>
array (
'block' =>
array (
'textAlign' => 'left',
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '31px',
),
),
),
1 =>
array (
'type' => 'social',
'iconSet' => 'circles',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/03-circles/Facebook.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/03-circles/Twitter.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/03-circles/Instagram.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
),
),
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#aaaaaa',
),
),
),
),
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<p style="text-align: left;"><span style="color: #6d6d6d;"><strong>Red Wine</strong></span></p>',
),
),
),
1 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<p style="text-align: left;"><span style="color: #6d6d6d;"><strong>White&nbsp;Wine</strong></span></p>',
),
),
),
2 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'text',
'text' => '<p style="text-align: left;"><span style="color: #6d6d6d;"><strong>Rose&nbsp;Wine</strong></span></p>',
),
),
),
),
),
3 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => $this->template_image_url . '/Wine-Header-1.jpg',
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<h1 style="text-align: center;"><span style="color: #ffffff;"><strong>Have a drink on us</strong></span></h1>',
),
2 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '231px',
),
),
),
),
),
),
),
4 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '34px',
),
),
),
1 =>
array (
'type' => 'text',
'text' => '<h2 style="text-align: center;"><span style="color: #6d6d6d;"><strong>You\'re our VIP - now it\'s time to celebrate!&nbsp;</strong></span></h2>
<p style="text-align: center;"><span style="color: #6d6d6d;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam a elementum ex. Aliquam mollis metus ac nisl luctus pulvinar. Donec tincidunt pharetra sem, nec eleifend augue.</span></p>',
),
2 =>
array (
'type' => 'button',
'text' => 'CoUponCoDE',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'borderColor' => '#6d6d6d',
'borderWidth' => '2px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '219px',
'lineHeight' => '50px',
'fontColor' => '#6d6d6d',
'fontFamily' => 'Courier New',
'fontSize' => '30px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
),
3 =>
array (
'type' => 'divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '17px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#aaaaaa',
),
),
),
4 =>
array (
'type' => 'footer',
'text' => '<p><strong><span style="color: #6d6d6d;"><a href="[link:subscription_unsubscribe_url]" style="color: #6d6d6d;">Unsubscribe</a> | <a href="[link:subscription_manage_url]" style="color: #6d6d6d;">Manage your subscription</a></span></strong><br /><span style="color: #6d6d6d;">Add your postal address here!</span></p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'none',
),
),
),
5 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
5 =>
array (
'type' => 'container',
'orientation' => 'horizontal',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#eeeeee',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'container',
'orientation' => 'vertical',
'image' =>
array (
'src' => NULL,
'display' => 'scale',
),
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
),
'blocks' =>
array (
0 =>
array (
'type' => 'spacer',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '20px',
),
),
),
),
),
),
),
),
),
'globalStyles' =>
array (
'text' =>
array (
'fontColor' => '#000000',
'fontFamily' => 'Arial',
'fontSize' => '14px',
),
'h1' =>
array (
'fontColor' => '#111111',
'fontFamily' => 'Arial',
'fontSize' => '40px',
),
'h2' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '24px',
),
'h3' =>
array (
'fontColor' => '#333333',
'fontFamily' => 'Arial',
'fontSize' => '22px',
),
'link' =>
array (
'fontColor' => '#21759B',
'textDecoration' => 'underline',
),
'wrapper' =>
array (
'backgroundColor' => '#ffffff',
),
'body' =>
array (
'backgroundColor' => '#eeeeee',
),
),
'blockDefaults' =>
array (
'automatedLatestContent' =>
array (
'amount' => '5',
'contentType' => 'post',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'button',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'automatedLatestContent.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'automatedLatestContent.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'automatedLatestContentLayout' =>
array (
'amount' => '5',
'withLayout' => true,
'contentType' => 'post',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'alternate',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'button',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'automatedLatestContentLayout.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'automatedLatestContentLayout.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'button' =>
array (
'text' => 'CoUponCoDE',
'url' => '',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#ffffff',
'borderColor' => '#6d6d6d',
'borderWidth' => '2px',
'borderRadius' => '0px',
'borderStyle' => 'solid',
'width' => '219px',
'lineHeight' => '50px',
'fontColor' => '#6d6d6d',
'fontFamily' => 'Courier New',
'fontSize' => '30px',
'fontWeight' => 'bold',
'textAlign' => 'center',
),
),
'type' => 'button',
),
'divider' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '17px',
'borderStyle' => 'solid',
'borderWidth' => '1px',
'borderColor' => '#aaaaaa',
),
),
'type' => 'divider',
),
'footer' =>
array (
'text' => '<p><a href="[link:subscription_unsubscribe_url]">Unsubscribe</a> | <a href="[link:subscription_manage_url]">Manage subscription</a><br />Add your postal address here!</p>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'none',
),
),
'type' => 'footer',
),
'posts' =>
array (
'amount' => '10',
'contentType' => 'post',
'postStatus' => 'publish',
'inclusionType' => 'include',
'displayType' => 'excerpt',
'titleFormat' => 'h1',
'titleAlignment' => 'left',
'titleIsLink' => false,
'imageFullWidth' => false,
'featuredImagePosition' => 'belowTitle',
'showAuthor' => 'no',
'authorPrecededBy' => 'Author:',
'showCategories' => 'no',
'categoriesPrecededBy' => 'Categories:',
'readMoreType' => 'link',
'readMoreText' => 'Read more',
'readMoreButton' =>
array (
'text' => 'Read more',
'url' => '[postLink]',
'context' => 'posts.readMoreButton',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => '#2ea1cd',
'borderColor' => '#0074a2',
'borderWidth' => '1px',
'borderRadius' => '5px',
'borderStyle' => 'solid',
'width' => '180px',
'lineHeight' => '40px',
'fontColor' => '#ffffff',
'fontFamily' => 'Verdana',
'fontSize' => '18px',
'fontWeight' => 'normal',
'textAlign' => 'center',
),
),
),
'sortBy' => 'newest',
'showDivider' => true,
'divider' =>
array (
'context' => 'posts.divider',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'padding' => '13px',
'borderStyle' => 'solid',
'borderWidth' => '3px',
'borderColor' => '#aaaaaa',
),
),
),
'backgroundColor' => '#ffffff',
'backgroundColorAlternate' => '#eeeeee',
),
'social' =>
array (
'iconSet' => 'circles',
'icons' =>
array (
0 =>
array (
'type' => 'socialIcon',
'iconType' => 'facebook',
'link' => 'http://www.facebook.com',
'image' => $this->social_icon_url . '/03-circles/Facebook.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Facebook',
),
1 =>
array (
'type' => 'socialIcon',
'iconType' => 'twitter',
'link' => 'http://www.twitter.com',
'image' => $this->social_icon_url . '/03-circles/Twitter.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Twitter',
),
2 =>
array (
'type' => 'socialIcon',
'iconType' => 'instagram',
'link' => 'http://instagram.com',
'image' => $this->social_icon_url . '/03-circles/Instagram.png?mailpoet_version=3.7.3',
'height' => '32px',
'width' => '32px',
'text' => 'Instagram',
),
),
'type' => 'social',
),
'spacer' =>
array (
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
'height' => '231px',
),
),
'type' => 'spacer',
),
'header' =>
array (
'text' => 'Display problems?&nbsp;<a href="[link:newsletter_view_in_browser_url]">Open this email in your web browser.</a>',
'styles' =>
array (
'block' =>
array (
'backgroundColor' => 'transparent',
),
'text' =>
array (
'fontColor' => '#222222',
'fontFamily' => 'Arial',
'fontSize' => '12px',
'textAlign' => 'center',
),
'link' =>
array (
'fontColor' => '#6cb7d4',
'textDecoration' => 'underline',
),
),
),
),
);
}
}

View File

@ -128,4 +128,4 @@ class Renderer {
$this->assets_manifest_css[$asset] :
$asset;
}
}
}

View File

@ -83,12 +83,12 @@ class CronHelper {
$result = self::queryCronUrl($url);
if(is_wp_error($result)) return $result->get_error_message();
$response = WPFunctions::wpRemoteRetrieveBody($result);
$response = substr(trim($response), -strlen(Daemon::PING_SUCCESS_RESPONSE)) === Daemon::PING_SUCCESS_RESPONSE ?
Daemon::PING_SUCCESS_RESPONSE :
$response = substr(trim($response), -strlen(DaemonHttpRunner::PING_SUCCESS_RESPONSE)) === DaemonHttpRunner::PING_SUCCESS_RESPONSE ?
DaemonHttpRunner::PING_SUCCESS_RESPONSE :
$response;
return (!$validate_response) ?
$response :
$response === Daemon::PING_SUCCESS_RESPONSE;
$response === DaemonHttpRunner::PING_SUCCESS_RESPONSE;
}
static function accessDaemon($token) {

View File

@ -10,6 +10,7 @@ class CronTrigger {
public static $available_methods = array(
'mailpoet' => 'MailPoet',
'wordpress' => 'WordPress',
'linux_cron' => 'Linux Cron',
'none' => 'Disabled'
);
const DEFAULT_METHOD = 'WordPress';
@ -37,4 +38,4 @@ class CronTrigger {
static function getCurrentMethod() {
return Setting::getValue(self::SETTING_NAME . '.method');
}
}
}

View File

@ -2,6 +2,7 @@
namespace MailPoet\Cron;
use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
use MailPoet\Cron\Workers\SendingQueue\Migration as MigrationWorker;
use MailPoet\Cron\Workers\SendingQueue\SendingErrorHandler;
use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
use MailPoet\Cron\Workers\Bounce as BounceWorker;
use MailPoet\Cron\Workers\KeyCheck\PremiumKeyCheck as PremiumKeyCheckWorker;
@ -11,50 +12,15 @@ if(!defined('ABSPATH')) exit;
require_once(ABSPATH . 'wp-includes/pluggable.php');
class Daemon {
public $daemon;
public $request_data;
public $timer;
const PING_SUCCESS_RESPONSE = 'pong';
function __construct($request_data = false) {
$this->request_data = $request_data;
$this->daemon = CronHelper::getDaemon();
$this->token = CronHelper::createToken();
function __construct() {
$this->timer = microtime(true);
}
function ping() {
$this->addCacheHeaders();
$this->terminateRequest(self::PING_SUCCESS_RESPONSE);
}
function run() {
ignore_user_abort(true);
if(strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
set_time_limit(0);
}
$this->addCacheHeaders();
if(!$this->request_data) {
$error = __('Invalid or missing request data.', 'mailpoet');
} else {
if(!$this->daemon) {
$error = __('Daemon does not exist.', 'mailpoet');
} else {
if(!isset($this->request_data['token']) ||
$this->request_data['token'] !== $this->daemon['token']
) {
$error = 'Invalid or missing token.';
}
}
}
if(!empty($error)) {
return $this->abortWithError($error);
}
$daemon = $this->daemon;
$daemon['token'] = $this->token;
$daemon['run_started_at'] = time();
CronHelper::saveDaemon($daemon);
function run($settings_daemon_data) {
$settings_daemon_data['run_started_at'] = time();
CronHelper::saveDaemon($settings_daemon_data);
try {
$this->executeMigrationWorker();
$this->executeScheduleWorker();
@ -67,22 +33,6 @@ class Daemon {
}
// Log successful execution
CronHelper::saveDaemonRunCompleted(time());
// if workers took less time to execute than the daemon execution limit,
// pause daemon execution to ensure that daemon runs only once every X seconds
$elapsed_time = microtime(true) - $this->timer;
if($elapsed_time < CronHelper::DAEMON_EXECUTION_LIMIT) {
$this->pauseExecution(CronHelper::DAEMON_EXECUTION_LIMIT - $elapsed_time);
}
// after each execution, re-read daemon data in case it changed
$daemon = CronHelper::getDaemon();
if($this->shouldTerminateExecution($daemon)) {
return $this->terminateRequest();
}
return $this->callSelf();
}
function pauseExecution($pause_time) {
return sleep($pause_time);
}
function executeScheduleWorker() {
@ -91,7 +41,7 @@ class Daemon {
}
function executeQueueWorker() {
$queue = new SendingQueueWorker($this->timer);
$queue = new SendingQueueWorker(new SendingErrorHandler(), $this->timer);
return $queue->process();
}
@ -115,38 +65,4 @@ class Daemon {
return $migration->process();
}
function callSelf() {
CronHelper::accessDaemon($this->token);
return $this->terminateRequest();
}
function abortWithError($message) {
status_header(404, $message);
exit;
}
function terminateRequest($message = false) {
die($message);
}
/**
* @return boolean
*/
private function shouldTerminateExecution(array $daemon = null) {
return !$daemon ||
$daemon['token'] !== $this->token ||
(isset($daemon['status']) && $daemon['status'] !== CronHelper::DAEMON_STATUS_ACTIVE);
}
private function addCacheHeaders() {
if(headers_sent()) {
return;
}
// Common Cache Control header. Should be respected by cache proxies and CDNs.
header('Cache-Control: no-cache');
// Mark as blacklisted for SG Optimizer for sites hosted on SiteGround.
header('X-Cache-Enabled: False');
// Set caching header for LiteSpeed server.
header('X-LiteSpeed-Cache-Control: no-cache');
}
}

View File

@ -0,0 +1,112 @@
<?php
namespace MailPoet\Cron;
if(!defined('ABSPATH')) exit;
require_once(ABSPATH . 'wp-includes/pluggable.php');
class DaemonHttpRunner {
public $settings_daemon_data;
public $request_data;
public $timer;
public $token;
/** @var Daemon */
private $daemon;
const PING_SUCCESS_RESPONSE = 'pong';
function __construct($request_data = false, $daemon = null) {
$this->request_data = $request_data;
$this->settings_daemon_data = CronHelper::getDaemon();
$this->token = CronHelper::createToken();
$this->timer = microtime(true);
$this->daemon = $daemon;
if(!$daemon) {
$this->daemon = new Daemon($this->settings_daemon_data);
}
}
function ping() {
$this->addCacheHeaders();
$this->terminateRequest(self::PING_SUCCESS_RESPONSE);
}
function run() {
ignore_user_abort(true);
if(strpos(@ini_get('disable_functions'), 'set_time_limit') === false) {
set_time_limit(0);
}
$this->addCacheHeaders();
if(!$this->request_data) {
$error = __('Invalid or missing request data.', 'mailpoet');
} else {
if(!$this->settings_daemon_data) {
$error = __('Daemon does not exist.', 'mailpoet');
} else {
if(!isset($this->request_data['token']) ||
$this->request_data['token'] !== $this->settings_daemon_data['token']
) {
$error = 'Invalid or missing token.';
}
}
}
if(!empty($error)) {
return $this->abortWithError($error);
}
$this->settings_daemon_data['token'] = $this->token;
$this->daemon->run($this->settings_daemon_data);
// if workers took less time to execute than the daemon execution limit,
// pause daemon execution to ensure that daemon runs only once every X seconds
$elapsed_time = microtime(true) - $this->timer;
if($elapsed_time < CronHelper::DAEMON_EXECUTION_LIMIT) {
$this->pauseExecution(CronHelper::DAEMON_EXECUTION_LIMIT - $elapsed_time);
}
// after each execution, re-read daemon data in case it changed
$settings_daemon_data = CronHelper::getDaemon();
if($this->shouldTerminateExecution($settings_daemon_data)) {
return $this->terminateRequest();
}
return $this->callSelf();
}
function pauseExecution($pause_time) {
return sleep($pause_time);
}
function callSelf() {
CronHelper::accessDaemon($this->token);
$this->terminateRequest();
}
function abortWithError($message) {
status_header(404, $message);
exit;
}
function terminateRequest($message = false) {
die($message);
}
/**
* @param array|null $settings_daemon_data
*
* @return boolean
*/
private function shouldTerminateExecution(array $settings_daemon_data = null) {
return !$settings_daemon_data ||
$settings_daemon_data['token'] !== $this->token ||
(isset($settings_daemon_data['status']) && $settings_daemon_data['status'] !== CronHelper::DAEMON_STATUS_ACTIVE);
}
private function addCacheHeaders() {
if(headers_sent()) {
return;
}
// Common Cache Control header. Should be respected by cache proxies and CDNs.
header('Cache-Control: no-cache');
// Mark as blacklisted for SG Optimizer for sites hosted on SiteGround.
header('X-Cache-Enabled: False');
// Set caching header for LiteSpeed server.
header('X-LiteSpeed-Cache-Control: no-cache');
}
}

View File

@ -39,4 +39,4 @@ class Supervisor {
}
return $daemon;
}
}
}

View File

@ -10,4 +10,4 @@ class MailPoet {
$supervisor = new Supervisor();
return $supervisor->checkDaemon();
}
}
}

View File

@ -4,6 +4,7 @@ namespace MailPoet\Cron\Workers;
use Carbon\Carbon;
use MailPoet\Cron\CronHelper;
use MailPoet\Logging\Logger;
use MailPoet\Models\Newsletter;
use MailPoet\Models\ScheduledTask;
use MailPoet\Models\Segment;
@ -75,9 +76,17 @@ class Scheduler {
}
function processPostNotificationNewsletter($newsletter, $queue) {
Logger::getLogger('post-notifications')->addInfo(
'process post notification in scheduler',
['newsletter_id' => $newsletter->id, 'task_id' => $queue->task_id]
);
// ensure that segments exist
$segments = $newsletter->segments()->findArray();
if(empty($segments)) {
Logger::getLogger('post-notifications')->addInfo(
'post notification no segments',
['newsletter_id' => $newsletter->id, 'task_id' => $queue->task_id]
);
return $this->deleteQueueOrUpdateNextRunDate($queue, $newsletter);
}
@ -87,6 +96,10 @@ class Scheduler {
$subscribers_count = $finder->addSubscribersToTaskFromSegments($queue->task(), $segments);
if(empty($subscribers_count)) {
Logger::getLogger('post-notifications')->addInfo(
'post notification no subscribers',
['newsletter_id' => $newsletter->id, 'task_id' => $queue->task_id]
);
return $this->deleteQueueOrUpdateNextRunDate($queue, $newsletter);
}
@ -100,6 +113,10 @@ class Scheduler {
$queue->save();
// update notification status
$notification_history->setStatus(Newsletter::STATUS_SENDING);
Logger::getLogger('post-notifications')->addInfo(
'post notification set status to sending',
['newsletter_id' => $newsletter->id, 'task_id' => $queue->task_id]
);
return true;
}

View File

@ -0,0 +1,36 @@
<?php
namespace MailPoet\Cron\Workers\SendingQueue;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\MailerLog;
use MailPoet\Tasks\Sending as SendingTask;
class SendingErrorHandler {
function processError(
MailerError $error,
SendingTask $sending_task,
array $prepared_subscribers_ids,
array $prepared_subscribers
) {
if($error->getLevel() === MailerError::LEVEL_HARD) {
return $this->processHardError($error);
}
$this->processSoftError($error, $sending_task, $prepared_subscribers_ids, $prepared_subscribers);
}
private function processHardError(MailerError $error) {
if($error->getRetryInterval() !== null) {
MailerLog::processNonBlockingError($error->getOperation(), $error->getMessageWithFailedSubscribers(), $error->getRetryInterval());
} else {
MailerLog::processError($error->getOperation(), $error->getMessageWithFailedSubscribers());
}
}
private function processSoftError(MailerError $error, SendingTask $sending_task, $prepared_subscribers_ids, $prepared_subscribers) {
foreach($error->getSubscriberErrors() as $subscriber_error) {
$subscriber_id_index = array_search($subscriber_error->getEmail(), $prepared_subscribers);
$message = $subscriber_error->getMessage() ?: $error->getMessage();
$sending_task->saveSubscriberError($prepared_subscribers_ids[$subscriber_id_index], $message);
}
}
}

View File

@ -5,6 +5,8 @@ use MailPoet\Cron\CronHelper;
use MailPoet\Cron\Workers\SendingQueue\Tasks\Links;
use MailPoet\Cron\Workers\SendingQueue\Tasks\Mailer as MailerTask;
use MailPoet\Cron\Workers\SendingQueue\Tasks\Newsletter as NewsletterTask;
use MailPoet\Logging\Logger;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\MailerLog;
use MailPoet\Models\ScheduledTask as ScheduledTaskModel;
use MailPoet\Models\StatisticsNewsletters as StatisticsNewslettersModel;
@ -23,7 +25,11 @@ class SendingQueue {
const BATCH_SIZE = 20;
const TASK_BATCH_SIZE = 5;
function __construct($timer = false, $mailer_task = false, $newsletter_task = false) {
/** @var SendingErrorHandler */
private $error_handler;
function __construct(SendingErrorHandler $error_handler, $timer = false, $mailer_task = false, $newsletter_task = false) {
$this->error_handler = $error_handler;
$this->mailer_task = ($mailer_task) ? $mailer_task : new MailerTask();
$this->newsletter_task = ($newsletter_task) ? $newsletter_task : new NewsletterTask();
$this->timer = ($timer) ? $timer : microtime(true);
@ -43,6 +49,10 @@ class SendingQueue {
// pre-process newsletter (render, replace shortcodes/links, etc.)
$newsletter = $this->newsletter_task->preProcessNewsletter($newsletter, $queue);
if(!$newsletter) {
Logger::getLogger('newsletters')->addInfo(
'delete task in sending queue',
['newsletter_id' => $newsletter->id(), 'task_id' => $queue->task_id]
);
$queue->delete();
continue;
}
@ -124,12 +134,12 @@ class SendingQueue {
'queue_id' => $queue->id
);
if($processing_method === 'individual') {
$queue = $this->sendNewsletters(
$queue = $this->sendNewsletter(
$queue,
$prepared_subscribers_ids,
$prepared_subscribers_ids[0],
$prepared_newsletters[0],
$prepared_subscribers[0],
$statistics,
$statistics[0],
array('unsubscribe_url' => $unsubscribe_urls[0])
);
$prepared_newsletters = array();
@ -152,29 +162,64 @@ class SendingQueue {
return $queue;
}
function sendNewsletters(
$queue, $prepared_subscribers_ids, $prepared_newsletters,
$prepared_subscribers, $statistics, $extra_params = array()
function sendNewsletter(
SendingTask $sending_task, $prepared_subscriber_id, $prepared_newsletter,
$prepared_subscriber, $statistics, $extra_params = array()
) {
// send newsletter
$send_result = $this->mailer_task->send(
$prepared_newsletter,
$prepared_subscriber,
$extra_params
);
return $this->processSendResult(
$sending_task,
$send_result,
[$prepared_subscriber],
[$prepared_subscriber_id],
[$statistics]
);
}
function sendNewsletters(
SendingTask $sending_task, $prepared_subscribers_ids, $prepared_newsletters,
$prepared_subscribers, $statistics, $extra_params = array()
) {
// send newsletters
$send_result = $this->mailer_task->sendBulk(
$prepared_newsletters,
$prepared_subscribers,
$extra_params
);
return $this->processSendResult(
$sending_task,
$send_result,
$prepared_subscribers,
$prepared_subscribers_ids,
$statistics
);
}
private function processSendResult(
SendingTask $sending_task,
$send_result,
array $prepared_subscribers,
array $prepared_subscribers_ids,
array $statistics
) {
// log error message and schedule retry/pause sending
if($send_result['response'] === false) {
if(isset($send_result['retry_interval'])) {
MailerLog::processNonBlockingError($send_result['operation'], $send_result['error_message'], $send_result['retry_interval']);
} else {
MailerLog::processError($send_result['operation'], $send_result['error_message']);
}
$error = $send_result['error'];
assert($error instanceof MailerError);
// Always switch error level to hard until we implement UI for individual subscriber errors
$error->switchLevelToHard();
$this->error_handler->processError($error, $sending_task, $prepared_subscribers_ids, $prepared_subscribers);
}
// update processed/to process list
if(!$queue->updateProcessedSubscribers($prepared_subscribers_ids)) {
if(!$sending_task->updateProcessedSubscribers($prepared_subscribers_ids)) {
MailerLog::processError(
'processed_list_update',
sprintf('QUEUE-%d-PROCESSED-LIST-UPDATE', $queue->id),
sprintf('QUEUE-%d-PROCESSED-LIST-UPDATE', $sending_task->id),
null,
true
);
@ -184,10 +229,10 @@ class SendingQueue {
// update the sent count
$this->mailer_task->updateSentCount();
// enforce execution limits if queue is still being processed
if($queue->status !== ScheduledTaskModel::STATUS_COMPLETED) {
if($sending_task->status !== ScheduledTaskModel::STATUS_COMPLETED) {
$this->enforceSendingAndExecutionLimits();
}
return $queue;
return $sending_task;
}
function enforceSendingAndExecutionLimits() {

View File

@ -54,11 +54,25 @@ class Mailer {
return $this->mailer->formatSubscriberNameAndEmailAddress($subscriber);
}
function send($prepared_newsletters, $prepared_subscribers, $extra_params = array()) {
function sendBulk($prepared_newsletters, $prepared_subscribers, $extra_params = array()) {
if($this->getProcessingMethod() === 'individual') {
throw new \LogicException('Trying to send a batch with individual processing method');
}
return $this->mailer->mailer_instance->send(
$prepared_newsletters,
$prepared_subscribers,
$extra_params
);
}
function send($prepared_newsletter, $prepared_subscriber, $extra_params = array()) {
if($this->getProcessingMethod() === 'bulk') {
throw new \LogicException('Trying to send an individual email with a bulk processing method');
}
return $this->mailer->mailer_instance->send(
$prepared_newsletter,
$prepared_subscriber,
$extra_params
);
}
}

View File

@ -53,7 +53,7 @@ class Newsletter {
return $newsletter;
}
function preProcessNewsletter($newsletter, $queue) {
function preProcessNewsletter(\MailPoet\Models\Newsletter $newsletter, $queue) {
// return the newsletter if it was previously rendered
if(!is_null($queue->getNewsletterRenderedBody())) {
return (!$queue->validate()) ?

View File

@ -1,6 +1,11 @@
<?php
namespace MailPoet\Mailer;
use MailPoet\Mailer\Methods\ErrorMappers\AmazonSESMapper;
use MailPoet\Mailer\Methods\ErrorMappers\MailPoetMapper;
use MailPoet\Mailer\Methods\ErrorMappers\PHPMailMapper;
use MailPoet\Mailer\Methods\ErrorMappers\SendGridMapper;
use MailPoet\Mailer\Methods\ErrorMappers\SMTPMapper;
use MailPoet\Models\Setting;
if(!defined('ABSPATH')) exit;
@ -42,28 +47,32 @@ class Mailer {
$this->mailer_config['secret_key'],
$this->sender,
$this->reply_to,
$this->return_path
$this->return_path,
new AmazonSESMapper()
);
break;
case self::METHOD_MAILPOET:
$mailer_instance = new $this->mailer_config['class'](
$this->mailer_config['mailpoet_api_key'],
$this->sender,
$this->reply_to
$this->reply_to,
new MailPoetMapper()
);
break;
case self::METHOD_SENDGRID:
$mailer_instance = new $this->mailer_config['class'](
$this->mailer_config['api_key'],
$this->sender,
$this->reply_to
$this->reply_to,
new SendGridMapper()
);
break;
case self::METHOD_PHPMAIL:
$mailer_instance = new $this->mailer_config['class'](
$this->sender,
$this->reply_to,
$this->return_path
$this->return_path,
new PHPMailMapper()
);
break;
case self::METHOD_SMTP:
@ -76,7 +85,8 @@ class Mailer {
$this->mailer_config['encryption'],
$this->sender,
$this->reply_to,
$this->return_path
$this->return_path,
new SMTPMapper()
);
break;
default:
@ -166,25 +176,16 @@ class Mailer {
return sprintf('=?utf-8?B?%s?=', base64_encode($name));
}
static function formatMailerConnectionErrorResult($error_message) {
return array(
static function formatMailerErrorResult(MailerError $error) {
return [
'response' => false,
'operation' => 'connect',
'error_message' => $error_message
);
}
static function formatMailerSendErrorResult($error_message) {
return array(
'response' => false,
'operation' => 'send',
'error_message' => $error_message
);
'error' => $error,
];
}
static function formatMailerSendSuccessResult() {
return array(
return [
'response' => true
);
];
}
}

105
lib/Mailer/MailerError.php Normal file
View File

@ -0,0 +1,105 @@
<?php
namespace MailPoet\Mailer;
class MailerError {
const OPERATION_CONNECT = 'connect';
const OPERATION_SEND = 'send';
const LEVEL_HARD = 'hard';
const LEVEL_SOFT = 'soft';
/** @var string */
private $operation;
/** @var string */
private $level;
/** @var string|null */
private $message;
/** @var int|null */
private $retry_interval;
/** @var array */
private $subscribers_errors = [];
/**
* @param string $operation
* @param string $level
* @param null|string $message
* @param int|null $retry_interval
* @param array $subscribers_errors
*/
function __construct($operation, $level, $message = null, $retry_interval = null, array $subscribers_errors = []) {
$this->operation = $operation;
$this->level = $level;
$this->message = $message;
$this->retry_interval = $retry_interval;
$this->subscribers_errors = $subscribers_errors;
}
/**
* @return string
*/
function getOperation() {
return $this->operation;
}
/**
* @return string
*/
function getLevel() {
return $this->level;
}
/**
* @return null|string
*/
function getMessage() {
return $this->message;
}
/**
* @return int|null
*/
function getRetryInterval() {
return $this->retry_interval;
}
/**
* @return SubscriberError[]
*/
function getSubscriberErrors() {
return $this->subscribers_errors;
}
/**
* Temporary method until we implement UI for subscriber errors
*/
function switchLevelToHard() {
$this->level = self::LEVEL_HARD;
}
function getMessageWithFailedSubscribers() {
$message = $this->message ?: '';
if(!$this->subscribers_errors) {
return $message;
}
$message .= $this->message ? ' ' : '';
if(count($this->subscribers_errors) === 1) {
$message .= __('Unprocessed subscriber:', 'mailpoet') . ' ';
} else {
$message .= __('Unprocessed subscribers:', 'mailpoet') . ' ';
}
$message .= implode(
', ',
array_map(function (SubscriberError $subscriber_error) {
return "($subscriber_error)";
}, $this->subscribers_errors)
);
return $message;
}
}

View File

@ -2,6 +2,7 @@
namespace MailPoet\Mailer\Methods;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\Methods\ErrorMappers\AmazonSESMapper;
use MailPoet\WP\Functions as WPFunctions;
if(!defined('ABSPATH')) exit;
@ -28,7 +29,18 @@ class AmazonSES {
'EU (Ireland)' => 'eu-west-1'
);
function __construct($region, $access_key, $secret_key, $sender, $reply_to, $return_path) {
/** @var AmazonSESMapper */
private $error_mapper;
function __construct(
$region,
$access_key,
$secret_key,
$sender,
$reply_to,
$return_path,
AmazonSESMapper $error_mapper
) {
$this->aws_access_key = $access_key;
$this->aws_secret_key = $secret_key;
$this->aws_region = (in_array($region, $this->available_regions)) ? $region : false;
@ -48,6 +60,7 @@ class AmazonSES {
$this->sender['from_email'];
$this->date = gmdate('Ymd\THis\Z');
$this->date_without_time = gmdate('Ymd');
$this->error_mapper = $error_mapper;
}
function send($newsletter, $subscriber, $extra_params = array()) {
@ -57,20 +70,17 @@ class AmazonSES {
$this->request($newsletter, $subscriber, $extra_params)
);
} catch(\Exception $e) {
return Mailer::formatMailerSendErrorResult($e->getMessage());
$error = $this->error_mapper->getErrorFromException($e, $subscriber);
return Mailer::formatMailerErrorResult($error);
}
if(is_wp_error($result)) {
return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
$error = $this->error_mapper->getConnectionError($result->get_error_message());
return Mailer::formatMailerErrorResult($error);
}
if(WPFunctions::wpRemoteRetrieveResponseCode($result) !== 200) {
$response = simplexml_load_string(WPFunctions::wpRemoteRetrieveBody($result));
$response = ($response) ?
$response->Error->Message->__toString() :
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
if(empty($extra_params['test_email'])) {
$response .= sprintf(' %s: %s', __('Unprocessed subscriber', 'mailpoet'), $subscriber);
}
return Mailer::formatMailerSendErrorResult($response);
$error = $this->error_mapper->getErrorFromResponse($response, $subscriber);
return Mailer::formatMailerErrorResult($error);
}
return Mailer::formatMailerSendSuccessResult();
}

View File

@ -0,0 +1,36 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\SubscriberError;
class AmazonSESMapper {
use ConnectionErrorMapperTrait;
function getErrorFromException(\Exception $e, $subscriber) {
$level = MailerError::LEVEL_HARD;
if($e instanceof \Swift_RfcComplianceException) {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $e->getMessage(), null, $subscriber_errors);
}
/**
* @see https://docs.aws.amazon.com/ses/latest/DeveloperGuide/api-error-codes.html
* @return MailerError
*/
function getErrorFromResponse($response, $subscriber) {
$message = ($response) ?
$response->Error->Message->__toString() :
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_AMAZONSES);
$level = MailerError::LEVEL_HARD;
if($response && $response->Error->Code->__toString() === 'MessageRejected') {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $message, null, $subscriber_errors);
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
trait ConnectionErrorMapperTrait {
function getConnectionError($message) {
return new MailerError(
MailerError::OPERATION_CONNECT,
MailerError::LEVEL_HARD,
$message
);
}
}

View File

@ -0,0 +1,77 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\SubscriberError;
use MailPoet\Services\Bridge\API;
use InvalidArgumentException;
if(!defined('ABSPATH')) exit;
class MailPoetMapper {
use ConnectionErrorMapperTrait;
const TEMPORARY_UNAVAILABLE_RETRY_INTERVAL = 300; // seconds
function getInvalidApiKeyError() {
return new MailerError(
MailerError::OPERATION_SEND,
MailerError::LEVEL_HARD,
__('MailPoet API key is invalid!', 'mailpoet')
);
}
function getErrorForResult(array $result, $subscribers) {
$level = MailerError::LEVEL_HARD;
$retry_interval = null;
$subscribers_errors = [];
$result_code = !empty($result['code']) ? $result['code'] : null;
switch($result_code) {
case API::RESPONSE_CODE_NOT_ARRAY:
$message = __('JSON input is not an array', 'mailpoet');
break;
case API::RESPONSE_CODE_PAYLOAD_ERROR:
$result_parsed = json_decode($result['message'], true);
$message = __('Error while sending.', 'mailpoet');
if(!is_array($result_parsed)) {
$message .= ' ' . $result['message'];
break;
}
try {
$subscribers_errors = $this->getSubscribersErrors($result_parsed, $subscribers);
$level = MailerError::LEVEL_SOFT;
} catch (InvalidArgumentException $e) {
$message .= ' ' . $e->getMessage();
}
break;
case API::RESPONSE_CODE_TEMPORARY_UNAVAILABLE:
$message = __('Email service is temporarily not available, please try again in a few minutes.', 'mailpoet');
$retry_interval = self::TEMPORARY_UNAVAILABLE_RETRY_INTERVAL;
break;
case API::RESPONSE_CODE_KEY_INVALID:
case API::RESPONSE_CODE_PAYLOAD_TOO_BIG:
default:
$message = $result['message'];
}
return new MailerError(MailerError::OPERATION_SEND, $level, $message, $retry_interval, $subscribers_errors);
}
private function getSubscribersErrors($result_parsed, $subscribers) {
$errors = [];
foreach($result_parsed as $result_error) {
if(!is_array($result_error) || !isset($result_error['index']) || !isset($subscribers[$result_error['index']])) {
throw new InvalidArgumentException( __('Invalid MSS response format.', 'mailpoet'));
}
$subscriber_errors = [];
if(isset($result_error['errors']) && is_array($result_error['errors'])) {
array_walk_recursive($result_error['errors'], function($item) use (&$subscriber_errors) {
$subscriber_errors[] = $item;
});
}
$message = join(', ', $subscriber_errors);
$errors[] = new SubscriberError($subscribers[$result_error['index']], $message);
}
return $errors;
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\SubscriberError;
class PHPMailMapper {
use ConnectionErrorMapperTrait;
function getErrorFromException(\Exception $e, $subscriber) {
$level = MailerError::LEVEL_HARD;
if(strpos($e->getMessage(), 'Invalid address') === 0) {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $e->getMessage(), null, $subscriber_errors);
}
function getErrorForSubscriber($subscriber) {
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_PHPMAIL);
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $message, null, $subscriber_errors);
}
}

View File

@ -0,0 +1,40 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\SubscriberError;
class SMTPMapper {
use ConnectionErrorMapperTrait;
/**
* @see https://swiftmailer.symfony.com/docs/sending.html
* @return MailerError
*/
function getErrorFromException(\Exception $e, $subscriber) {
// remove redundant information appended by Swift logger to exception messages
$message = explode(PHP_EOL, $e->getMessage());
$level = MailerError::LEVEL_HARD;
if($e instanceof \Swift_RfcComplianceException) {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $message[0], null, $subscriber_errors);
}
function getErrorFromLog($log, $subscriber) {
// extract error message from log
preg_match('/!! (.*?)>>/ism', $log, $message);
if(!empty($message[1])) {
$message = $message[1];
// remove line breaks from the message due to how logger's dump() method works
$message = preg_replace('/\r|\n/', '', $message);
} else {
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SMTP);
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, MailerError::LEVEL_HARD, $message, null, $subscriber_errors);
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace MailPoet\Mailer\Methods\ErrorMappers;
use MailPoet\Mailer\MailerError;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\SubscriberError;
class SendGridMapper {
use ConnectionErrorMapperTrait;
function getErrorFromResponse($response, $subscriber) {
$response = (!empty($response['errors'][0])) ?
$response['errors'][0] :
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SENDGRID);
$level = MailerError::LEVEL_HARD;
if(strpos($response, 'Invalid email address') === 0) {
$level = MailerError::LEVEL_SOFT;
}
$subscriber_errors = [new SubscriberError($subscriber, null)];
return new MailerError(MailerError::OPERATION_SEND, $level, $response, null, $subscriber_errors);
}
}

View File

@ -3,31 +3,32 @@ namespace MailPoet\Mailer\Methods;
use MailPoet\Mailer\Mailer;
use MailPoet\Config\ServicesChecker;
use MailPoet\Mailer\Methods\ErrorMappers\MailPoetMapper;
use MailPoet\Services\Bridge;
use MailPoet\Services\Bridge\API;
if(!defined('ABSPATH')) exit;
class MailPoet {
const TEMPORARY_UNAVAILABLE_RETRY_INTERVAL = 300; // seconds
public $api;
public $sender;
public $reply_to;
public $services_checker;
function __construct($api_key, $sender, $reply_to) {
/** @var MailPoetMapper */
private $error_mapper;
function __construct($api_key, $sender, $reply_to, MailPoetMapper $error_mapper) {
$this->api = new API($api_key);
$this->sender = $sender;
$this->reply_to = $reply_to;
$this->services_checker = new ServicesChecker(false);
$this->services_checker = new ServicesChecker();
$this->error_mapper = $error_mapper;
}
function send($newsletter, $subscriber, $extra_params = array()) {
if($this->services_checker->isMailPoetAPIKeyValid() === false) {
$response = __('MailPoet API key is invalid!', 'mailpoet');
return Mailer::formatMailerSendErrorResult($response);
return Mailer::formatMailerErrorResult($this->error_mapper->getInvalidApiKeyError());
}
$message_body = $this->getBody($newsletter, $subscriber, $extra_params);
@ -35,9 +36,11 @@ class MailPoet {
switch($result['status']) {
case API::SENDING_STATUS_CONNECTION_ERROR:
return Mailer::formatMailerConnectionErrorResult($result['message']);
$error = $this->error_mapper->getConnectionError($result['message']);
return Mailer::formatMailerErrorResult($error);
case API::SENDING_STATUS_SEND_ERROR:
return $this->processSendError($result, $subscriber);
$error = $this->processSendError($result, $subscriber);
return Mailer::formatMailerErrorResult($error);
case API::SENDING_STATUS_OK:
default:
return Mailer::formatMailerSendSuccessResult();
@ -45,27 +48,10 @@ class MailPoet {
}
function processSendError($result, $subscriber) {
if(!empty($result['code'])) {
switch($result['code']) {
case API::RESPONSE_CODE_NOT_ARRAY:
return Mailer::formatMailerSendErrorResult(__('JSON input is not an array', 'mailpoet'));
case API::RESPONSE_CODE_PAYLOAD_TOO_BIG:
return Mailer::formatMailerSendErrorResult($result['message']);
case API::RESPONSE_CODE_PAYLOAD_ERROR:
$error = $this->parseErrorResponse($result['message'], $subscriber);
return Mailer::formatMailerSendErrorResult($error);
case API::RESPONSE_CODE_TEMPORARY_UNAVAILABLE:
$error = Mailer::formatMailerSendErrorResult(__('Email service is temporarily not available, please try again in a few minutes.', 'mailpoet'));
$error['retry_interval'] = self::TEMPORARY_UNAVAILABLE_RETRY_INTERVAL;
return $error;
case API::RESPONSE_CODE_KEY_INVALID:
Bridge::invalidateKey();
break;
default:
return Mailer::formatMailerSendErrorResult($result['message']);
}
if(!empty($result['code']) && $result['code'] === API::RESPONSE_CODE_KEY_INVALID) {
Bridge::invalidateKey();
}
return Mailer::formatMailerSendErrorResult($result['message']);
return $this->error_mapper->getErrorForResult($result, $subscriber);
}
function processSubscriber($subscriber) {
@ -128,37 +114,4 @@ class MailPoet {
}
return $body;
}
private function parseErrorResponse($result, $subscriber) {
$result_parsed = json_decode($result, true);
$errors = [];
if(is_array($result_parsed)) {
foreach($result_parsed as $result_error) {
$errors[] = $this->processSingleSubscriberError($result_error, $subscriber);
}
}
if(!empty($errors)) {
return __('Error while sending: ', 'mailpoet') . join(', ', $errors);
} else {
return __('Error while sending newsletters. ', 'mailpoet') . $result;
}
}
private function processSingleSubscriberError($result_error, $subscriber) {
$error = '';
if(is_array($result_error)) {
$subscriber_errors = [];
if(isset($result_error['errors']) && is_array($result_error['errors'])) {
array_walk_recursive($result_error['errors'], function($item) use (&$subscriber_errors) {
$subscriber_errors[] = $item;
});
}
$error .= join(', ', $subscriber_errors);
if(isset($result_error['index']) && isset($subscriber[$result_error['index']])) {
$error = '(' . $subscriber[$result_error['index']] . ': ' . $error . ')';
}
}
return $error;
}
}

View File

@ -3,6 +3,7 @@
namespace MailPoet\Mailer\Methods;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\Methods\ErrorMappers\PHPMailMapper;
if(!defined('ABSPATH')) exit;
@ -14,13 +15,17 @@ class PHPMail {
public $return_path;
public $mailer;
function __construct($sender, $reply_to, $return_path) {
/** @var PHPMailMapper */
private $error_mapper;
function __construct($sender, $reply_to, $return_path, PHPMailMapper $error_mapper) {
$this->sender = $sender;
$this->reply_to = $reply_to;
$this->return_path = ($return_path) ?
$return_path :
$this->sender['from_email'];
$this->mailer = $this->buildMailer();
$this->error_mapper = $error_mapper;
}
function send($newsletter, $subscriber, $extra_params = array()) {
@ -28,16 +33,13 @@ class PHPMail {
$mailer = $this->configureMailerWithMessage($newsletter, $subscriber, $extra_params);
$result = $mailer->send();
} catch(\Exception $e) {
return Mailer::formatMailerSendErrorResult($e->getMessage());
return Mailer::formatMailerErrorResult($this->error_mapper->getErrorFromException($e, $subscriber));
}
if($result === true) {
return Mailer::formatMailerSendSuccessResult();
} else {
$result = sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_PHPMAIL);
if(empty($extra_params['test_email'])) {
$result .= sprintf(' %s: %s', __('Unprocessed subscriber', 'mailpoet'), $subscriber);
}
return Mailer::formatMailerSendErrorResult($result);
$error = $this->error_mapper->getErrorForSubscriber($subscriber);
return Mailer::formatMailerErrorResult($error);
}
}
@ -80,4 +82,4 @@ class PHPMail {
'name' => (isset($subscriber_data['name'])) ? $subscriber_data['name'] : ''
);
}
}
}

View File

@ -2,6 +2,7 @@
namespace MailPoet\Mailer\Methods;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\Methods\ErrorMappers\SMTPMapper;
use MailPoet\WP\Hooks;
if(!defined('ABSPATH')) exit;
@ -19,9 +20,12 @@ class SMTP {
public $mailer;
const SMTP_CONNECTION_TIMEOUT = 15; // seconds
/** @var SMTPMapper */
private $error_mapper;
function __construct(
$host, $port, $authentication, $login = null, $password = null, $encryption,
$sender, $reply_to, $return_path) {
$sender, $reply_to, $return_path, SMTPMapper $error_mapper) {
$this->host = $host;
$this->port = $port;
$this->authentication = $authentication;
@ -36,6 +40,7 @@ class SMTP {
$this->mailer = $this->buildMailer();
$this->mailer_logger = new \Swift_Plugins_Loggers_ArrayLogger();
$this->mailer->registerPlugin(new \Swift_Plugins_LoggerPlugin($this->mailer_logger));
$this->error_mapper = $error_mapper;
}
function send($newsletter, $subscriber, $extra_params = array()) {
@ -43,13 +48,16 @@ class SMTP {
$message = $this->createMessage($newsletter, $subscriber, $extra_params);
$result = $this->mailer->send($message);
} catch(\Exception $e) {
return Mailer::formatMailerSendErrorResult(
$this->processExceptionMessage($e->getMessage())
return Mailer::formatMailerErrorResult(
$this->error_mapper->getErrorFromException($e, $subscriber)
);
}
return ($result === 1) ?
Mailer::formatMailerSendSuccessResult() :
Mailer::formatMailerSendErrorResult($this->processLogMessage($subscriber, $extra_params));
if($result === 1) {
return Mailer::formatMailerSendSuccessResult();
} else {
$error = $this->error_mapper->getErrorFromLog($this->mailer_logger->dump(), $subscriber);
return Mailer::formatMailerErrorResult($error);
}
}
function buildMailer() {
@ -107,27 +115,4 @@ class SMTP {
(isset($subscriber_data['name'])) ? $subscriber_data['name'] : ''
);
}
function processLogMessage($subscriber, $extra_params = array(), $log = false) {
$log = ($log) ? $log : $this->mailer_logger->dump();
// extract error message from log
preg_match('/!! (.*?)>>/ism', $log, $message);
if(!empty($message[1])) {
$message = $message[1];
// remove line breaks from the message due to how logger's dump() method works
$message = preg_replace('/\r|\n/', '', $message);
} else {
$message = sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SMTP);
}
if(empty($extra_params['test_email'])) {
$message .= sprintf(' %s: %s', __('Unprocessed subscriber', 'mailpoet'), $subscriber);
}
return $message;
}
function processExceptionMessage($message) {
// remove redundant information appended by Swift logger to exception messages
$message = explode(PHP_EOL, $message);
return $message[0];
}
}

View File

@ -3,6 +3,7 @@
namespace MailPoet\Mailer\Methods;
use MailPoet\Mailer\Mailer;
use MailPoet\Mailer\Methods\ErrorMappers\SendGridMapper;
use MailPoet\WP\Functions as WPFunctions;
if(!defined('ABSPATH')) exit;
@ -13,10 +14,14 @@ class SendGrid {
public $sender;
public $reply_to;
function __construct($api_key, $sender, $reply_to) {
/** @var SendGridMapper */
private $error_mapper;
function __construct($api_key, $sender, $reply_to, SendGridMapper $error_mapper) {
$this->api_key = $api_key;
$this->sender = $sender;
$this->reply_to = $reply_to;
$this->error_mapper = $error_mapper;
}
function send($newsletter, $subscriber, $extra_params = array()) {
@ -25,17 +30,13 @@ class SendGrid {
$this->request($newsletter, $subscriber, $extra_params)
);
if(is_wp_error($result)) {
return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
$error = $this->error_mapper->getConnectionError($result->get_error_message());
return Mailer::formatMailerErrorResult($error);
}
if(WPFunctions::wpRemoteRetrieveResponseCode($result) !== 200) {
$response = json_decode($result['body'], true);
$response = (!empty($response['errors'][0])) ?
$response['errors'][0] :
sprintf(__('%s has returned an unknown error.', 'mailpoet'), Mailer::METHOD_SENDGRID);
if(empty($extra_params['test_email'])) {
$response .= sprintf(' %s: %s', __('Unprocessed subscriber', 'mailpoet'), $subscriber);
}
return Mailer::formatMailerSendErrorResult($response);
$error = $this->error_mapper->getErrorFromResponse($response, $subscriber);
return Mailer::formatMailerErrorResult($error);
}
return Mailer::formatMailerSendSuccessResult();
}
@ -80,4 +81,4 @@ class SendGrid {
'body' => http_build_query($body, null, '&')
);
}
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace MailPoet\Mailer;
class SubscriberError {
/** @var string */
private $email;
/** @var string|null */
private $message;
/**
* @param string $email
* @param string $message|null
*/
function __construct($email, $message = null) {
$this->email = $email;
$this->message = $message;
}
/**
* @return string
*/
function getEmail() {
return $this->email;
}
/**
* @return null|string
*/
function getMessage() {
return $this->message;
}
function __toString() {
return $this->message ? $this->email . ': ' . $this->message : $this->email;
}
}

View File

@ -556,6 +556,19 @@ class Newsletter extends Model {
return $result;
}
function wasScheduledForSubscriber($subscriber_id) {
$count = (int)SendingQueue::rawQuery(
"SELECT COUNT(*) as count
FROM `" . SendingQueue::$_table . "`
JOIN `" . ScheduledTask::$_table . "` ON " . SendingQueue::$_table . ".task_id = " . ScheduledTask::$_table . ".id
JOIN `" . ScheduledTaskSubscriber::$_table . "` ON " . ScheduledTask::$_table . ".id = " . ScheduledTaskSubscriber::$_table . ".task_id
WHERE " . ScheduledTaskSubscriber::$_table . ".subscriber_id = " . $subscriber_id . "
AND " . SendingQueue::$_table . ".newsletter_id = " . $this->id
)->findOne()->count;
return $count > 0;
}
static function getAnalytics() {
$welcome_newsletters_count = Newsletter::getPublished()
->filter('filterType', self::TYPE_WELCOME)

View File

@ -76,6 +76,18 @@ class ScheduledTask extends Model {
return $this;
}
function delete() {
try {
\ORM::get_db()->beginTransaction();
ScheduledTaskSubscriber::where('task_id', $this->id)->deleteMany();
parent::delete();
\ORM::get_db()->commit();
} catch(\Exception $error) {
\ORM::get_db()->rollBack();
throw $error;
}
}
static function touchAllByIds(array $ids) {
ScheduledTask::rawExecute(
'UPDATE `' . ScheduledTask::$_table . '`' .

View File

@ -7,6 +7,9 @@ class ScheduledTaskSubscriber extends Model {
const STATUS_UNPROCESSED = 0;
const STATUS_PROCESSED = 1;
const FAIL_STATUS_OK = 0;
const FAIL_STATUS_FAILED = 1;
public static $_table = MP_SCHEDULED_TASK_SUBSCRIBERS_TABLE;
public static $_id_column = array('task_id', 'subscriber_id');
@ -19,6 +22,7 @@ class ScheduledTaskSubscriber extends Model {
return;
}
$data['processed'] = !empty($data['processed']) ? self::STATUS_PROCESSED : self::STATUS_UNPROCESSED;
$data['failed'] = !empty($data['failed']) ? self::FAIL_STATUS_FAILED : self::FAIL_STATUS_OK;
return parent::_createOrUpdate($data, array(
'subscriber_id' => $data['subscriber_id'],
'task_id' => $data['task_id']

View File

@ -53,7 +53,10 @@ class Setting extends Model {
),
'analytics' => array(
'enabled' => false,
)
),
'in_app_announcements' => [
'displayed' => []
],
);
}

View File

@ -1,6 +1,7 @@
<?php
namespace MailPoet\Newsletter;
use MailPoet\Logging\Logger;
use MailPoet\Newsletter\Editor\Transformer;
if(!defined('ABSPATH')) exit;
@ -29,6 +30,10 @@ class AutomatedLatestContent {
}
function getPosts($args, $posts_to_exclude = array()) {
Logger::getLogger('post-notifications')->addInfo(
'loading automated latest content',
['args' => $args, 'posts_to_exclude' => $posts_to_exclude, 'newsletter_id' => $this->newsletter_id, 'newer_than_timestamp' => $this->newer_than_timestamp]
);
$posts_per_page = (!empty($args['amount']) && (int)$args['amount'] > 0)
? (int)$args['amount']
: self::DEFAULT_POSTS_PER_PAGE;
@ -70,7 +75,14 @@ class AutomatedLatestContent {
}
$this->_attachSentPostsFilter();
Logger::getLogger('post-notifications')->addInfo(
'getting automated latest content',
['parameters' => $parameters]
);
$posts = get_posts($parameters);
$this->logPosts($posts);
$this->_detachSentPostsFilter();
return $posts;
}
@ -126,4 +138,18 @@ class AutomatedLatestContent {
remove_action('posts_where', array($this, 'filterOutSentPosts'));
}
}
private function logPosts(array $posts) {
$posts_to_log = [];
foreach($posts as $post) {
$posts_to_log[] = [
'id' => $post->ID,
'post_date' => $post->post_date,
];
}
Logger::getLogger('post-notifications')->addInfo(
'automated latest content loaded posts',
['posts' => $posts_to_log]
);
}
}

View File

@ -3,6 +3,7 @@
namespace MailPoet\Newsletter\Scheduler;
use Carbon\Carbon;
use MailPoet\Logging\Logger;
use MailPoet\Models\Newsletter;
use MailPoet\Models\NewsletterOption;
use MailPoet\Models\NewsletterOptionField;
@ -23,6 +24,10 @@ class Scheduler {
const INTERVAL_NTHWEEKDAY = 'nthWeekDay';
static function schedulePostNotification($post_id) {
Logger::getLogger('post-notifications')->addInfo(
'schedule post notification hook',
['post_id' => $post_id]
);
$newsletters = self::getNewsletters(Newsletter::TYPE_NOTIFICATION);
if(!count($newsletters)) return false;
foreach($newsletters as $newsletter) {
@ -143,6 +148,10 @@ class Scheduler {
$sending_task->status = SendingQueue::STATUS_SCHEDULED;
$sending_task->scheduled_at = $next_run_date;
$sending_task->save();
Logger::getLogger('post-notifications')->addInfo(
'schedule post notification',
['sending_task' => $sending_task->id(), 'scheduled_at' => $next_run_date]
);
return $sending_task;
}

View File

@ -4,7 +4,7 @@ namespace MailPoet\Router\Endpoints;
use MailPoet\Config\AccessControl;
use MailPoet\Cron\CronHelper;
use MailPoet\Cron\Daemon;
use MailPoet\Cron\DaemonHttpRunner;
if(!defined('ABSPATH')) exit;
@ -28,7 +28,7 @@ class CronDaemon {
}
function run() {
$queue = new Daemon($this->data);
$queue = new DaemonHttpRunner($this->data);
$queue->run();
}
@ -37,7 +37,7 @@ class CronDaemon {
}
function pingResponse() {
$queue = new Daemon();
$queue = new DaemonHttpRunner();
$queue->ping();
}
}

View File

@ -45,7 +45,7 @@ class NewsletterClicksExporter {
'value' => $row['created_at'],
);
$newsletter_data[] = array(
'name' => __('Url', 'mailpoet'),
'name' => __('URL', 'mailpoet'),
'value' => $row['url'],
);
return array(
@ -56,4 +56,4 @@ class NewsletterClicksExporter {
);
}
}
}

View File

@ -166,6 +166,11 @@ class Sending {
return $this->updateCount()->getErrors() === false;
}
public function saveSubscriberError($subcriber_id, $error_message) {
$this->task_subscribers->saveSubscriberError($subcriber_id, $error_message);
return $this->updateCount()->getErrors() === false;
}
function updateCount() {
$this->queue->count_processed = ScheduledTaskSubscriber::getProcessedCount($this->task->id);
$this->queue->count_to_process = ScheduledTaskSubscriber::getUnprocessedCount($this->task->id);

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