MailPoet Newsletters (New) - Version 3.0.0-beta.17

Version Description

  • 2017-02-01 =
  • Added: send in style with MailPoet's own sending service. Visit your MailPoet Settings > Send with... tab.
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.0.0-beta.17
Comparing to
See all releases

Code changes from version 3.0.0-beta.16 to 3.0.0-beta.17

assets/css/admin.css CHANGED
@@ -2742,7 +2742,7 @@ textarea.parsley-error {
2742
  padding: 15px 15px 0 15px;
2743
  margin: 0 25px 25px 0;
2744
  width: 300px;
2745
- height: 250px;
2746
  border: 1px solid #dedede;
2747
  background-color: #fff;
2748
  }
2742
  padding: 15px 15px 0 15px;
2743
  margin: 0 25px 25px 0;
2744
  width: 300px;
2745
+ height: 300px;
2746
  border: 1px solid #dedede;
2747
  background-color: #fff;
2748
  }
lang/index.php CHANGED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+
3
+ // Silence is golden
lang/mailpoet.pot CHANGED
@@ -4,7 +4,7 @@ msgid ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
- "POT-Creation-Date: 2017-01-31 12:37:25+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -128,7 +128,27 @@ msgstr ""
128
  msgid "This newsletter has not been sent yet."
129
  msgstr ""
130
 
131
- #: lib/API/Endpoints/Settings.php:18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
132
  msgid "You have not specified any settings to be saved."
133
  msgstr ""
134
 
@@ -149,71 +169,71 @@ msgstr ""
149
  msgid "MailPoet Newsletter"
150
  msgstr ""
151
 
152
- #: lib/Config/Menu.php:62 lib/Config/Menu.php:63 views/newsletters.html:23
153
  msgid "Emails"
154
  msgstr ""
155
 
156
- #: lib/Config/Menu.php:85 lib/Config/Menu.php:86 views/forms.html:16
157
  msgid "Forms"
158
  msgstr ""
159
 
160
- #: lib/Config/Menu.php:107 lib/Config/Menu.php:108
161
  #: views/subscribers/subscribers.html:17
162
  msgid "Subscribers"
163
  msgstr ""
164
 
165
- #: lib/Config/Menu.php:129 lib/Config/Menu.php:130 views/forms.html:43
166
  #: views/newsletters.html:63 views/newsletters.html:150 views/segments.html:13
167
  #: views/subscribers/subscribers.html:62
168
  msgid "Lists"
169
  msgstr ""
170
 
171
- #: lib/Config/Menu.php:152 lib/Config/Menu.php:153 views/form/editor.html:37
172
  #: views/newsletters.html:64 views/settings.html:6
173
  msgid "Settings"
174
  msgstr ""
175
 
176
- #: lib/Config/Menu.php:163 lib/Config/Menu.php:164
177
  #: views/subscribers/importExport/import.html:7
178
  #: views/subscribers/subscribers.html:90
179
  msgid "Import"
180
  msgstr ""
181
 
182
- #: lib/Config/Menu.php:175 lib/Config/Menu.php:176
183
  #: views/subscribers/importExport/export.html:6
184
  #: views/subscribers/importExport/export.html:96
185
  #: views/subscribers/subscribers.html:91
186
  msgid "Export"
187
  msgstr ""
188
 
189
- #: lib/Config/Menu.php:187 lib/Config/Menu.php:188 views/update.html:20
190
  #: views/welcome.html:29
191
  msgid "Welcome"
192
  msgstr ""
193
 
194
- #: lib/Config/Menu.php:199 lib/Config/Menu.php:200 views/segments.html:43
195
  msgid "Update"
196
  msgstr ""
197
 
198
- #: lib/Config/Menu.php:211 lib/Config/Menu.php:212
199
  msgid "Form Editor"
200
  msgstr ""
201
 
202
- #: lib/Config/Menu.php:223 lib/Newsletter/Shortcodes/ShortcodesHelper.php:32
203
  #: views/newsletter/templates/components/sidebar/styles.hbs:74
204
  #: views/newsletters.html:106
205
  msgid "Newsletter"
206
  msgstr ""
207
 
208
- #: lib/Config/Menu.php:224
209
  msgid "Newsletter Editor"
210
  msgstr ""
211
 
212
- #: lib/Config/Menu.php:399
213
  msgid "In any WordPress role"
214
  msgstr ""
215
 
216
- #: lib/Config/Menu.php:474
217
  msgid "MailPoet"
218
  msgstr ""
219
 
@@ -957,6 +977,18 @@ msgid ""
957
  "fix this issue."
958
  msgstr ""
959
 
 
 
 
 
 
 
 
 
 
 
 
 
960
  #: lib/Config/Shortcodes.php:85
961
  msgid "Oops! There are no newsletters to display."
962
  msgstr ""
@@ -973,11 +1005,11 @@ msgstr ""
973
  msgid "Maximum execution time has been reached."
974
  msgstr ""
975
 
976
- #: lib/Cron/Daemon.php:30
977
  msgid "Invalid or missing request data."
978
  msgstr ""
979
 
980
- #: lib/Cron/Daemon.php:33
981
  msgid "Daemon does not exist."
982
  msgstr ""
983
 
@@ -1163,6 +1195,10 @@ msgstr ""
1163
  msgid "%s has returned an unknown error."
1164
  msgstr ""
1165
 
 
 
 
 
1166
  #: lib/Models/CustomField.php:14 lib/Models/Form.php:13
1167
  #: lib/Models/NewsletterOptionField.php:12 lib/Models/NewsletterTemplate.php:13
1168
  #: lib/Models/Segment.php:13 lib/Models/Setting.php:22
@@ -1585,19 +1621,19 @@ msgstr ""
1585
  msgid "Accidentally unsubscribed?"
1586
  msgstr ""
1587
 
1588
- #: lib/Twig/Functions.php:78 views/settings/mta.html:983
1589
  msgid "every minute"
1590
  msgstr ""
1591
 
1592
- #: lib/Twig/Functions.php:79 views/settings/mta.html:984
1593
  msgid "every %1$d minutes"
1594
  msgstr ""
1595
 
1596
- #: lib/Twig/Functions.php:80 views/settings/mta.html:985
1597
  msgid "every hour"
1598
  msgstr ""
1599
 
1600
- #: lib/Twig/Functions.php:81 views/settings/mta.html:986
1601
  msgid "every %1$d hours"
1602
  msgstr ""
1603
 
@@ -1779,7 +1815,7 @@ msgstr ""
1779
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:79
1780
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:221
1781
  #: views/settings/advanced.html:90 views/settings/advanced.html:130
1782
- #: views/settings/bounce.html:190 views/settings/mta.html:574
1783
  #: views/settings/signup.html:34 views/subscribers/importExport/export.html:33
1784
  #: views/subscribers/importExport/import/step2.html:66
1785
  msgid "Yes"
@@ -1798,7 +1834,7 @@ msgstr ""
1798
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:227
1799
  #: views/settings/advanced.html:101 views/settings/advanced.html:141
1800
  #: views/settings/bounce.html:148 views/settings/bounce.html:179
1801
- #: views/settings/mta.html:537 views/settings/mta.html:585
1802
  #: views/settings/signup.html:46 views/subscribers/importExport/export.html:38
1803
  #: views/subscribers/importExport/import/step2.html:70
1804
  msgid "No"
@@ -2119,6 +2155,18 @@ msgstr ""
2119
  msgid " %sSet up%s MailPoet and start sending."
2120
  msgstr ""
2121
 
 
 
 
 
 
 
 
 
 
 
 
 
2122
  #: views/layout.html:64
2123
  msgid ""
2124
  "Want to give feedback to the MailPoet team? Contact us here. Please provide "
@@ -3038,7 +3086,7 @@ msgid ""
3038
  "number."
3039
  msgstr ""
3040
 
3041
- #: views/newsletters.html:116 views/settings/mta.html:640
3042
  msgid "Activate"
3043
  msgstr ""
3044
 
@@ -3536,7 +3584,7 @@ msgid "Select what will activate your newsletter queue."
3536
  msgstr ""
3537
 
3538
  #: views/settings/advanced.html:34 views/settings/advanced.html:117
3539
- #: views/settings/mta.html:114
3540
  msgid "Read more."
3541
  msgstr ""
3542
 
@@ -3737,11 +3785,11 @@ msgstr ""
3737
  msgid "Hostname"
3738
  msgstr ""
3739
 
3740
- #: views/settings/bounce.html:50 views/settings/mta.html:498
3741
  msgid "Login"
3742
  msgstr ""
3743
 
3744
- #: views/settings/bounce.html:67 views/settings/mta.html:515
3745
  msgid "Password"
3746
  msgstr ""
3747
 
@@ -3793,199 +3841,228 @@ msgstr ""
3793
  msgid "Is it working? Try to connect"
3794
  msgstr ""
3795
 
3796
- #: views/settings/mta.html:58
3797
- msgid "Currently in Closed Beta"
3798
  msgstr ""
3799
 
3800
- #: views/settings/mta.html:60
 
 
 
 
 
 
 
 
3801
  msgid ""
3802
- "[link]Sign up to our newsletter[/link] to get our latest news on our "
3803
- "sending service plus other useful tips and tricks."
3804
  msgstr ""
3805
 
3806
- #: views/settings/mta.html:70 views/settings/mta.html:92
3807
- #: views/settings/mta.html:118
 
 
 
 
3808
  msgid "Activated"
3809
  msgstr ""
3810
 
3811
- #: views/settings/mta.html:76 views/settings/mta.html:98
3812
- #: views/settings/mta.html:124
3813
  msgid "Configure"
3814
  msgstr ""
3815
 
3816
- #: views/settings/mta.html:83
3817
  msgid "Your web host / web server"
3818
  msgstr ""
3819
 
3820
- #: views/settings/mta.html:86
3821
  msgid "Free, but not recommended"
3822
  msgstr ""
3823
 
3824
- #: views/settings/mta.html:88
3825
  msgid ""
3826
  "Web hosts generally have a bad reputation as a sender. Your newsletter will "
3827
  "probably be considered spam."
3828
  msgstr ""
3829
 
3830
- #: views/settings/mta.html:105
3831
  msgid "Third-party"
3832
  msgstr ""
3833
 
3834
- #: views/settings/mta.html:108
3835
- msgid "Currently the best solution"
3836
  msgstr ""
3837
 
3838
- #: views/settings/mta.html:110
3839
- msgid "Send with an external email provider. This is usually not free."
 
 
3840
  msgstr ""
3841
 
3842
- #: views/settings/mta.html:136
3843
  msgid "Already have a key?"
3844
  msgstr ""
3845
 
3846
- #: views/settings/mta.html:142
3847
  msgid "Your key"
3848
  msgstr ""
3849
 
3850
- #: views/settings/mta.html:169 views/settings/mta.html:302
 
 
 
 
 
3851
  msgid "Sending frequency"
3852
  msgstr ""
3853
 
3854
- #: views/settings/mta.html:180
3855
  msgid "Safe default values"
3856
  msgstr ""
3857
 
3858
- #: views/settings/mta.html:188
3859
  msgid "I'll set my own frequency"
3860
  msgstr ""
3861
 
3862
- #: views/settings/mta.html:193
3863
  msgid "Input your host's recommended sending frequency"
3864
  msgstr ""
3865
 
3866
- #: views/settings/mta.html:226 views/settings/mta.html:319
3867
  msgid "emails"
3868
  msgstr ""
3869
 
3870
- #: views/settings/mta.html:243 views/settings/mta.html:336
3871
  msgid "recommended"
3872
  msgstr ""
3873
 
3874
- #: views/settings/mta.html:252
3875
  msgid ""
3876
  "<strong>Warning!</strong> Sending more than the recommended amount of "
3877
  "emails? You may break the terms of your web host or provider!"
3878
  msgstr ""
3879
 
3880
- #: views/settings/mta.html:254
3881
  msgid ""
3882
  "Please ask your host for the maximum number of emails you are allowed to "
3883
  "send per day."
3884
  msgstr ""
3885
 
3886
- #: views/settings/mta.html:270
3887
  msgid "Provider"
3888
  msgstr ""
3889
 
3890
- #: views/settings/mta.html:280
3891
  msgid "Custom SMTP"
3892
  msgstr ""
3893
 
3894
- #: views/settings/mta.html:283
3895
  msgid "Select your provider"
3896
  msgstr ""
3897
 
3898
- #: views/settings/mta.html:349
3899
  msgid "SMTP Hostname"
3900
  msgstr ""
3901
 
3902
- #: views/settings/mta.html:352 views/settings/mta.html:463
3903
  msgid "e.g.: smtp.mydomain.com"
3904
  msgstr ""
3905
 
3906
- #: views/settings/mta.html:368
3907
  msgid "SMTP Port"
3908
  msgstr ""
3909
 
3910
- #: views/settings/mta.html:389
3911
  msgid "Region"
3912
  msgstr ""
3913
 
3914
- #: views/settings/mta.html:418
3915
  msgid "Access Key"
3916
  msgstr ""
3917
 
3918
- #: views/settings/mta.html:439
3919
  msgid "Secret Key"
3920
  msgstr ""
3921
 
3922
- #: views/settings/mta.html:460
3923
  msgid "Domain"
3924
  msgstr ""
3925
 
3926
- #: views/settings/mta.html:480
3927
  msgid "API Key"
3928
  msgstr ""
3929
 
3930
- #: views/settings/mta.html:532
3931
  msgid "Secure Connection"
3932
  msgstr ""
3933
 
3934
- #: views/settings/mta.html:557
3935
  msgid "Authentication"
3936
  msgstr ""
3937
 
3938
- #: views/settings/mta.html:560
3939
  msgid ""
3940
  "Leave this option set to Yes. Only a tiny portion of SMTP services prefer "
3941
  "Authentication to be turned off."
3942
  msgstr ""
3943
 
3944
- #: views/settings/mta.html:599
3945
  msgid "SPF Signature (Highly recommended!)"
3946
  msgstr ""
3947
 
3948
- #: views/settings/mta.html:602
3949
  msgid ""
3950
  "This improves your delivery rate by verifying that you're allowed to send "
3951
  "emails from your domain."
3952
  msgstr ""
3953
 
3954
- #: views/settings/mta.html:607
3955
  msgid ""
3956
  "SPF is set up in your DNS. Read your host's support documentation for more "
3957
  "information."
3958
  msgstr ""
3959
 
3960
- #: views/settings/mta.html:615
3961
  msgid "Test the sending method"
3962
  msgstr ""
3963
 
3964
- #: views/settings/mta.html:629
3965
  msgid "Send a test email"
3966
  msgstr ""
3967
 
3968
- #: views/settings/mta.html:645
3969
  msgid "or Cancel"
3970
  msgstr ""
3971
 
3972
- #: views/settings/mta.html:702
 
 
 
 
 
 
3973
  msgid "This is a Sending Method Test"
3974
  msgstr ""
3975
 
3976
- #: views/settings/mta.html:704
3977
  msgid "Yup, it works! You can start blasting away emails to the moon."
3978
  msgstr ""
3979
 
3980
- #: views/settings/mta.html:717
3981
  msgid "The email has been sent! Check your inbox."
3982
  msgstr ""
3983
 
3984
- #: views/settings/mta.html:759
 
 
 
 
3985
  msgid "You have selected an invalid sending method."
3986
  msgstr ""
3987
 
3988
- #: views/settings/mta.html:767
3989
  msgid "You need to specify a MailPoet account key."
3990
  msgstr ""
3991
 
@@ -4153,10 +4230,6 @@ msgstr ""
4153
  msgid "Enter your MailChimp API key"
4154
  msgstr ""
4155
 
4156
- #: views/subscribers/importExport/import/step1.html:84
4157
- msgid "Verify"
4158
- msgstr ""
4159
-
4160
  #: views/subscribers/importExport/import/step1.html:91
4161
  msgid "Select list(s)"
4162
  msgstr ""
@@ -4558,22 +4631,22 @@ msgid ""
4558
  "updates!"
4559
  msgstr ""
4560
 
4561
- #: lib/Config/Menu.php:75
4562
  msgctxt "newsletters per page (screen options)"
4563
  msgid "Number of newsletters per page"
4564
  msgstr ""
4565
 
4566
- #: lib/Config/Menu.php:97
4567
  msgctxt "forms per page (screen options)"
4568
  msgid "Number of forms per page"
4569
  msgstr ""
4570
 
4571
- #: lib/Config/Menu.php:119
4572
  msgctxt "subscribers per page (screen options)"
4573
  msgid "Number of subscribers per page"
4574
  msgstr ""
4575
 
4576
- #: lib/Config/Menu.php:142
4577
  msgctxt "segments per page (screen options)"
4578
  msgid "Number of segments per page"
4579
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2017-02-02 14:39:20+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
128
  msgid "This newsletter has not been sent yet."
129
  msgstr ""
130
 
131
+ #: lib/API/Endpoints/Services.php:23
132
+ msgid "Please specify a key."
133
+ msgstr ""
134
+
135
+ #: lib/API/Endpoints/Services.php:39
136
+ msgid "Your MailPoet API key is valid!"
137
+ msgstr ""
138
+
139
+ #: lib/API/Endpoints/Services.php:42
140
+ msgid "Your MailPoet key expires on %s!"
141
+ msgstr ""
142
+
143
+ #: lib/API/Endpoints/Services.php:54
144
+ msgid "Your MailPoet key is invalid!"
145
+ msgstr ""
146
+
147
+ #: lib/API/Endpoints/Services.php:59
148
+ msgid "Error validating API key, please try again later (code: %s)"
149
+ msgstr ""
150
+
151
+ #: lib/API/Endpoints/Settings.php:19
152
  msgid "You have not specified any settings to be saved."
153
  msgstr ""
154
 
169
  msgid "MailPoet Newsletter"
170
  msgstr ""
171
 
172
+ #: lib/Config/Menu.php:63 lib/Config/Menu.php:64 views/newsletters.html:23
173
  msgid "Emails"
174
  msgstr ""
175
 
176
+ #: lib/Config/Menu.php:86 lib/Config/Menu.php:87 views/forms.html:16
177
  msgid "Forms"
178
  msgstr ""
179
 
180
+ #: lib/Config/Menu.php:108 lib/Config/Menu.php:109
181
  #: views/subscribers/subscribers.html:17
182
  msgid "Subscribers"
183
  msgstr ""
184
 
185
+ #: lib/Config/Menu.php:130 lib/Config/Menu.php:131 views/forms.html:43
186
  #: views/newsletters.html:63 views/newsletters.html:150 views/segments.html:13
187
  #: views/subscribers/subscribers.html:62
188
  msgid "Lists"
189
  msgstr ""
190
 
191
+ #: lib/Config/Menu.php:153 lib/Config/Menu.php:154 views/form/editor.html:37
192
  #: views/newsletters.html:64 views/settings.html:6
193
  msgid "Settings"
194
  msgstr ""
195
 
196
+ #: lib/Config/Menu.php:164 lib/Config/Menu.php:165
197
  #: views/subscribers/importExport/import.html:7
198
  #: views/subscribers/subscribers.html:90
199
  msgid "Import"
200
  msgstr ""
201
 
202
+ #: lib/Config/Menu.php:176 lib/Config/Menu.php:177
203
  #: views/subscribers/importExport/export.html:6
204
  #: views/subscribers/importExport/export.html:96
205
  #: views/subscribers/subscribers.html:91
206
  msgid "Export"
207
  msgstr ""
208
 
209
+ #: lib/Config/Menu.php:188 lib/Config/Menu.php:189 views/update.html:20
210
  #: views/welcome.html:29
211
  msgid "Welcome"
212
  msgstr ""
213
 
214
+ #: lib/Config/Menu.php:200 lib/Config/Menu.php:201 views/segments.html:43
215
  msgid "Update"
216
  msgstr ""
217
 
218
+ #: lib/Config/Menu.php:212 lib/Config/Menu.php:213
219
  msgid "Form Editor"
220
  msgstr ""
221
 
222
+ #: lib/Config/Menu.php:224 lib/Newsletter/Shortcodes/ShortcodesHelper.php:32
223
  #: views/newsletter/templates/components/sidebar/styles.hbs:74
224
  #: views/newsletters.html:106
225
  msgid "Newsletter"
226
  msgstr ""
227
 
228
+ #: lib/Config/Menu.php:225
229
  msgid "Newsletter Editor"
230
  msgstr ""
231
 
232
+ #: lib/Config/Menu.php:404
233
  msgid "In any WordPress role"
234
  msgstr ""
235
 
236
+ #: lib/Config/Menu.php:479
237
  msgid "MailPoet"
238
  msgstr ""
239
 
977
  "fix this issue."
978
  msgstr ""
979
 
980
+ #: lib/Config/ServicesChecker.php:25
981
+ msgid ""
982
+ "All sending is currently paused! Your key to send with MailPoet is invalid. "
983
+ "[link]Visit MailPoet.com to purchase a key[/link]"
984
+ msgstr ""
985
+
986
+ #: lib/Config/ServicesChecker.php:37
987
+ msgid ""
988
+ "Your newsletters are awesome! Don't forget to [link]upgrade your MailPoet "
989
+ "email plan[/link] by %s to keep sending them to your subscribers."
990
+ msgstr ""
991
+
992
  #: lib/Config/Shortcodes.php:85
993
  msgid "Oops! There are no newsletters to display."
994
  msgstr ""
1005
  msgid "Maximum execution time has been reached."
1006
  msgstr ""
1007
 
1008
+ #: lib/Cron/Daemon.php:31
1009
  msgid "Invalid or missing request data."
1010
  msgstr ""
1011
 
1012
+ #: lib/Cron/Daemon.php:34
1013
  msgid "Daemon does not exist."
1014
  msgstr ""
1015
 
1195
  msgid "%s has returned an unknown error."
1196
  msgstr ""
1197
 
1198
+ #: lib/Mailer/Methods/MailPoet.php:26
1199
+ msgid "MailPoet API key is invalid!"
1200
+ msgstr ""
1201
+
1202
  #: lib/Models/CustomField.php:14 lib/Models/Form.php:13
1203
  #: lib/Models/NewsletterOptionField.php:12 lib/Models/NewsletterTemplate.php:13
1204
  #: lib/Models/Segment.php:13 lib/Models/Setting.php:22
1621
  msgid "Accidentally unsubscribed?"
1622
  msgstr ""
1623
 
1624
+ #: lib/Twig/Functions.php:78 views/settings/mta.html:1053
1625
  msgid "every minute"
1626
  msgstr ""
1627
 
1628
+ #: lib/Twig/Functions.php:79 views/settings/mta.html:1054
1629
  msgid "every %1$d minutes"
1630
  msgstr ""
1631
 
1632
+ #: lib/Twig/Functions.php:80 views/settings/mta.html:1055
1633
  msgid "every hour"
1634
  msgstr ""
1635
 
1636
+ #: lib/Twig/Functions.php:81 views/settings/mta.html:1056
1637
  msgid "every %1$d hours"
1638
  msgstr ""
1639
 
1815
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:79
1816
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:221
1817
  #: views/settings/advanced.html:90 views/settings/advanced.html:130
1818
+ #: views/settings/bounce.html:190 views/settings/mta.html:591
1819
  #: views/settings/signup.html:34 views/subscribers/importExport/export.html:33
1820
  #: views/subscribers/importExport/import/step2.html:66
1821
  msgid "Yes"
1834
  #: views/newsletter/templates/blocks/posts/settingsDisplayOptions.hbs:227
1835
  #: views/settings/advanced.html:101 views/settings/advanced.html:141
1836
  #: views/settings/bounce.html:148 views/settings/bounce.html:179
1837
+ #: views/settings/mta.html:554 views/settings/mta.html:602
1838
  #: views/settings/signup.html:46 views/subscribers/importExport/export.html:38
1839
  #: views/subscribers/importExport/import/step2.html:70
1840
  msgid "No"
2155
  msgid " %sSet up%s MailPoet and start sending."
2156
  msgstr ""
2157
 
2158
+ #: views/invalidkey.html:6
2159
+ msgid "All sending is currently paused!"
2160
+ msgstr ""
2161
+
2162
+ #: views/invalidkey.html:9
2163
+ msgid "Your key to send with MailPoet is invalid."
2164
+ msgstr ""
2165
+
2166
+ #: views/invalidkey.html:13
2167
+ msgid "Visit MailPoet.com to purchase a key"
2168
+ msgstr ""
2169
+
2170
  #: views/layout.html:64
2171
  msgid ""
2172
  "Want to give feedback to the MailPoet team? Contact us here. Please provide "
3086
  "number."
3087
  msgstr ""
3088
 
3089
+ #: views/newsletters.html:116 views/settings/mta.html:657
3090
  msgid "Activate"
3091
  msgstr ""
3092
 
3584
  msgstr ""
3585
 
3586
  #: views/settings/advanced.html:34 views/settings/advanced.html:117
3587
+ #: views/settings/mta.html:127
3588
  msgid "Read more."
3589
  msgstr ""
3590
 
3785
  msgid "Hostname"
3786
  msgstr ""
3787
 
3788
+ #: views/settings/bounce.html:50 views/settings/mta.html:515
3789
  msgid "Login"
3790
  msgstr ""
3791
 
3792
+ #: views/settings/bounce.html:67 views/settings/mta.html:532
3793
  msgid "Password"
3794
  msgstr ""
3795
 
3841
  msgid "Is it working? Try to connect"
3842
  msgstr ""
3843
 
3844
+ #: views/settings/mta.html:61
3845
+ msgid "You're now sending with MailPoet!"
3846
  msgstr ""
3847
 
3848
+ #: views/settings/mta.html:63
3849
+ msgid "Great, you're all set up. Your emails will now be sent quickly and reliably!"
3850
+ msgstr ""
3851
+
3852
+ #: views/settings/mta.html:70
3853
+ msgid "Solve all of your sending problems!"
3854
+ msgstr ""
3855
+
3856
+ #: views/settings/mta.html:72
3857
  msgid ""
3858
+ "We offer affordable email packages with speeds up to 50 times faster than "
3859
+ "the competition."
3860
  msgstr ""
3861
 
3862
+ #: views/settings/mta.html:79
3863
+ msgid "View Email Plans"
3864
+ msgstr ""
3865
+
3866
+ #: views/settings/mta.html:83 views/settings/mta.html:105
3867
+ #: views/settings/mta.html:131
3868
  msgid "Activated"
3869
  msgstr ""
3870
 
3871
+ #: views/settings/mta.html:89 views/settings/mta.html:111
3872
+ #: views/settings/mta.html:137
3873
  msgid "Configure"
3874
  msgstr ""
3875
 
3876
+ #: views/settings/mta.html:96
3877
  msgid "Your web host / web server"
3878
  msgstr ""
3879
 
3880
+ #: views/settings/mta.html:99
3881
  msgid "Free, but not recommended"
3882
  msgstr ""
3883
 
3884
+ #: views/settings/mta.html:101
3885
  msgid ""
3886
  "Web hosts generally have a bad reputation as a sender. Your newsletter will "
3887
  "probably be considered spam."
3888
  msgstr ""
3889
 
3890
+ #: views/settings/mta.html:118
3891
  msgid "Third-party"
3892
  msgstr ""
3893
 
3894
+ #: views/settings/mta.html:121
3895
+ msgid "For SMTP, SendGrid or Amazon SES"
3896
  msgstr ""
3897
 
3898
+ #: views/settings/mta.html:123
3899
+ msgid ""
3900
+ "We only recommend using a third-party service if you are a technical user. "
3901
+ "Tread carefully."
3902
  msgstr ""
3903
 
3904
+ #: views/settings/mta.html:149
3905
  msgid "Already have a key?"
3906
  msgstr ""
3907
 
3908
+ #: views/settings/mta.html:155
3909
  msgid "Your key"
3910
  msgstr ""
3911
 
3912
+ #: views/settings/mta.html:169
3913
+ #: views/subscribers/importExport/import/step1.html:84
3914
+ msgid "Verify"
3915
+ msgstr ""
3916
+
3917
+ #: views/settings/mta.html:186 views/settings/mta.html:319
3918
  msgid "Sending frequency"
3919
  msgstr ""
3920
 
3921
+ #: views/settings/mta.html:197
3922
  msgid "Safe default values"
3923
  msgstr ""
3924
 
3925
+ #: views/settings/mta.html:205
3926
  msgid "I'll set my own frequency"
3927
  msgstr ""
3928
 
3929
+ #: views/settings/mta.html:210
3930
  msgid "Input your host's recommended sending frequency"
3931
  msgstr ""
3932
 
3933
+ #: views/settings/mta.html:243 views/settings/mta.html:336
3934
  msgid "emails"
3935
  msgstr ""
3936
 
3937
+ #: views/settings/mta.html:260 views/settings/mta.html:353
3938
  msgid "recommended"
3939
  msgstr ""
3940
 
3941
+ #: views/settings/mta.html:269
3942
  msgid ""
3943
  "<strong>Warning!</strong> Sending more than the recommended amount of "
3944
  "emails? You may break the terms of your web host or provider!"
3945
  msgstr ""
3946
 
3947
+ #: views/settings/mta.html:271
3948
  msgid ""
3949
  "Please ask your host for the maximum number of emails you are allowed to "
3950
  "send per day."
3951
  msgstr ""
3952
 
3953
+ #: views/settings/mta.html:287
3954
  msgid "Provider"
3955
  msgstr ""
3956
 
3957
+ #: views/settings/mta.html:297
3958
  msgid "Custom SMTP"
3959
  msgstr ""
3960
 
3961
+ #: views/settings/mta.html:300
3962
  msgid "Select your provider"
3963
  msgstr ""
3964
 
3965
+ #: views/settings/mta.html:366
3966
  msgid "SMTP Hostname"
3967
  msgstr ""
3968
 
3969
+ #: views/settings/mta.html:369 views/settings/mta.html:480
3970
  msgid "e.g.: smtp.mydomain.com"
3971
  msgstr ""
3972
 
3973
+ #: views/settings/mta.html:385
3974
  msgid "SMTP Port"
3975
  msgstr ""
3976
 
3977
+ #: views/settings/mta.html:406
3978
  msgid "Region"
3979
  msgstr ""
3980
 
3981
+ #: views/settings/mta.html:435
3982
  msgid "Access Key"
3983
  msgstr ""
3984
 
3985
+ #: views/settings/mta.html:456
3986
  msgid "Secret Key"
3987
  msgstr ""
3988
 
3989
+ #: views/settings/mta.html:477
3990
  msgid "Domain"
3991
  msgstr ""
3992
 
3993
+ #: views/settings/mta.html:497
3994
  msgid "API Key"
3995
  msgstr ""
3996
 
3997
+ #: views/settings/mta.html:549
3998
  msgid "Secure Connection"
3999
  msgstr ""
4000
 
4001
+ #: views/settings/mta.html:574
4002
  msgid "Authentication"
4003
  msgstr ""
4004
 
4005
+ #: views/settings/mta.html:577
4006
  msgid ""
4007
  "Leave this option set to Yes. Only a tiny portion of SMTP services prefer "
4008
  "Authentication to be turned off."
4009
  msgstr ""
4010
 
4011
+ #: views/settings/mta.html:616
4012
  msgid "SPF Signature (Highly recommended!)"
4013
  msgstr ""
4014
 
4015
+ #: views/settings/mta.html:619
4016
  msgid ""
4017
  "This improves your delivery rate by verifying that you're allowed to send "
4018
  "emails from your domain."
4019
  msgstr ""
4020
 
4021
+ #: views/settings/mta.html:624
4022
  msgid ""
4023
  "SPF is set up in your DNS. Read your host's support documentation for more "
4024
  "information."
4025
  msgstr ""
4026
 
4027
+ #: views/settings/mta.html:632
4028
  msgid "Test the sending method"
4029
  msgstr ""
4030
 
4031
+ #: views/settings/mta.html:646
4032
  msgid "Send a test email"
4033
  msgstr ""
4034
 
4035
+ #: views/settings/mta.html:662
4036
  msgid "or Cancel"
4037
  msgstr ""
4038
 
4039
+ #: views/settings/mta.html:707
4040
+ msgid ""
4041
+ "The email could not be sent. Make sure the option \"Email notifications\" "
4042
+ "has a FROM email address in the Basics tab."
4043
+ msgstr ""
4044
+
4045
+ #: views/settings/mta.html:719
4046
  msgid "This is a Sending Method Test"
4047
  msgstr ""
4048
 
4049
+ #: views/settings/mta.html:721
4050
  msgid "Yup, it works! You can start blasting away emails to the moon."
4051
  msgstr ""
4052
 
4053
+ #: views/settings/mta.html:734
4054
  msgid "The email has been sent! Check your inbox."
4055
  msgstr ""
4056
 
4057
+ #: views/settings/mta.html:755
4058
+ msgid "Please specify an API key before validating it."
4059
+ msgstr ""
4060
+
4061
+ #: views/settings/mta.html:815
4062
  msgid "You have selected an invalid sending method."
4063
  msgstr ""
4064
 
4065
+ #: views/settings/mta.html:823
4066
  msgid "You need to specify a MailPoet account key."
4067
  msgstr ""
4068
 
4230
  msgid "Enter your MailChimp API key"
4231
  msgstr ""
4232
 
 
 
 
 
4233
  #: views/subscribers/importExport/import/step1.html:91
4234
  msgid "Select list(s)"
4235
  msgstr ""
4631
  "updates!"
4632
  msgstr ""
4633
 
4634
+ #: lib/Config/Menu.php:76
4635
  msgctxt "newsletters per page (screen options)"
4636
  msgid "Number of newsletters per page"
4637
  msgstr ""
4638
 
4639
+ #: lib/Config/Menu.php:98
4640
  msgctxt "forms per page (screen options)"
4641
  msgid "Number of forms per page"
4642
  msgstr ""
4643
 
4644
+ #: lib/Config/Menu.php:120
4645
  msgctxt "subscribers per page (screen options)"
4646
  msgid "Number of subscribers per page"
4647
  msgstr ""
4648
 
4649
+ #: lib/Config/Menu.php:143
4650
  msgctxt "segments per page (screen options)"
4651
  msgid "Number of segments per page"
4652
  msgstr ""
lib/API/Endpoints/Services.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\API\Endpoints;
3
+
4
+ use Carbon\Carbon;
5
+ use MailPoet\API\Endpoint as APIEndpoint;
6
+ use MailPoet\API\Error as APIError;
7
+ use MailPoet\Services\Bridge;
8
+
9
+ if(!defined('ABSPATH')) exit;
10
+
11
+ class Services extends APIEndpoint {
12
+ public $bridge;
13
+
14
+ function __construct() {
15
+ $this->bridge = new Bridge();
16
+ }
17
+
18
+ function verifyMailPoetKey($data = array()) {
19
+ $key = isset($data['key']) ? trim($data['key']) : null;
20
+
21
+ if(!$key) {
22
+ return $this->badRequest(array(
23
+ APIError::BAD_REQUEST => __('Please specify a key.', 'mailpoet')
24
+ ));
25
+ }
26
+
27
+ try {
28
+ $result = $this->bridge->checkKey($key);
29
+ } catch(\Exception $e) {
30
+ return $this->errorResponse(array(
31
+ $e->getCode() => $e->getMessage()
32
+ ));
33
+ }
34
+
35
+ $state = !empty($result['state']) ? $result['state'] : null;
36
+
37
+ $success_message = null;
38
+ if($state == Bridge::MAILPOET_KEY_VALID) {
39
+ $success_message = __('Your MailPoet API key is valid!', 'mailpoet');
40
+ } elseif($state == Bridge::MAILPOET_KEY_EXPIRING) {
41
+ $success_message = sprintf(
42
+ __('Your MailPoet key expires on %s!', 'mailpoet'),
43
+ Carbon::createFromTimestamp(strtotime($result['data']['expire_at']))
44
+ ->format('Y-m-d')
45
+ );
46
+ }
47
+
48
+ if($success_message) {
49
+ return $this->successResponse(array('message' => $success_message));
50
+ }
51
+
52
+ switch($state) {
53
+ case Bridge::MAILPOET_KEY_INVALID:
54
+ $error = __('Your MailPoet key is invalid!', 'mailpoet');
55
+ break;
56
+ default:
57
+ $code = !empty($result['code']) ? $result['code'] : Bridge::CHECK_ERROR_UNKNOWN;
58
+ $error = sprintf(
59
+ __('Error validating API key, please try again later (code: %s)', 'mailpoet'),
60
+ $code
61
+ );
62
+ break;
63
+ }
64
+
65
+ return $this->errorResponse(array(APIError::BAD_REQUEST => $error));
66
+ }
67
+ }
lib/API/Endpoints/Settings.php CHANGED
@@ -3,6 +3,7 @@ namespace MailPoet\API\Endpoints;
3
  use MailPoet\API\Endpoint as APIEndpoint;
4
  use MailPoet\API\Error as APIError;
5
  use MailPoet\Models\Setting;
 
6
 
7
  if(!defined('ABSPATH')) exit;
8
 
@@ -21,6 +22,13 @@ class Settings extends APIEndpoint {
21
  foreach($settings as $name => $value) {
22
  Setting::setValue($name, $value);
23
  }
 
 
 
 
 
 
 
24
  return $this->successResponse(Setting::getAll());
25
  }
26
  }
3
  use MailPoet\API\Endpoint as APIEndpoint;
4
  use MailPoet\API\Error as APIError;
5
  use MailPoet\Models\Setting;
6
+ use MailPoet\Services\Bridge;
7
 
8
  if(!defined('ABSPATH')) exit;
9
 
22
  foreach($settings as $name => $value) {
23
  Setting::setValue($name, $value);
24
  }
25
+ if(!empty($settings['mta']['mailpoet_api_key'])
26
+ && Bridge::isMPSendingServiceEnabled()
27
+ ) {
28
+ $bridge = new Bridge();
29
+ $result = $bridge->checkKey($settings['mta']['mailpoet_api_key']);
30
+ $bridge->updateSubscriberCount($result);
31
+ }
32
  return $this->successResponse(Setting::getAll());
33
  }
34
  }
lib/Config/Menu.php CHANGED
@@ -27,6 +27,7 @@ class Menu {
27
  $this->assets_url = $assets_url;
28
  $subscribers_feature = new SubscribersFeature();
29
  $this->subscribers_over_limit = $subscribers_feature->check();
 
30
  }
31
 
32
  function init() {
@@ -302,6 +303,7 @@ class Menu {
302
  'settings' => $settings,
303
  'segments' => Segment::getSegmentsWithSubscriberCount(),
304
  'cron_trigger' => CronTrigger::getAvailableMethods(),
 
305
  'pages' => Pages::getAll(),
306
  'flags' => $flags,
307
  'current_user' => wp_get_current_user(),
@@ -387,6 +389,9 @@ class Menu {
387
 
388
  function newsletters() {
389
  if($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
 
 
 
390
 
391
  global $wp_roles;
392
 
@@ -483,6 +488,39 @@ class Menu {
483
  exit;
484
  }
485
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
486
  private function getLimitPerPage($model = null) {
487
  if($model === null) {
488
  return Listing\Handler::DEFAULT_LIMIT_PER_PAGE;
@@ -504,8 +542,4 @@ class Menu {
504
  $notice->displayWPNotice();
505
  }
506
  }
507
-
508
- static function isOnMailPoetAdminPage() {
509
- return (!empty($_REQUEST['page']) && stripos($_REQUEST['page'], 'mailpoet-') !== false);
510
- }
511
  }
27
  $this->assets_url = $assets_url;
28
  $subscribers_feature = new SubscribersFeature();
29
  $this->subscribers_over_limit = $subscribers_feature->check();
30
+ $this->checkMailPoetAPIKey();
31
  }
32
 
33
  function init() {
303
  'settings' => $settings,
304
  'segments' => Segment::getSegmentsWithSubscriberCount(),
305
  'cron_trigger' => CronTrigger::getAvailableMethods(),
306
+ 'total_subscribers' => Subscriber::getTotalSubscribers(),
307
  'pages' => Pages::getAll(),
308
  'flags' => $flags,
309
  'current_user' => wp_get_current_user(),
389
 
390
  function newsletters() {
391
  if($this->subscribers_over_limit) return $this->displaySubscriberLimitExceededTemplate();
392
+ if(isset($this->mp_api_key_valid) && $this->mp_api_key_valid === false) {
393
+ return $this->displayMailPoetAPIKeyInvalidTemplate();
394
+ }
395
 
396
  global $wp_roles;
397
 
488
  exit;
489
  }
490
 
491
+ function displayMailPoetAPIKeyInvalidTemplate() {
492
+ $this->displayPage('invalidkey.html', array(
493
+ 'subscriber_count' => Subscriber::getTotalSubscribers()
494
+ ));
495
+ exit;
496
+ }
497
+
498
+ static function isOnMailPoetAdminPage(array $exclude = null, $screen_id = null) {
499
+ if(is_null($screen_id)) {
500
+ if(empty($_REQUEST['page'])) {
501
+ return false;
502
+ }
503
+ $screen_id = $_REQUEST['page'];
504
+ }
505
+ if(!empty($exclude)) {
506
+ foreach($exclude as $slug) {
507
+ if(stripos($screen_id, $slug) !== false) {
508
+ return false;
509
+ }
510
+ }
511
+ }
512
+ return (stripos($screen_id, 'mailpoet-') !== false);
513
+ }
514
+
515
+ function checkMailPoetAPIKey(ServicesChecker $checker = null) {
516
+ if(self::isOnMailPoetAdminPage()) {
517
+ $show_notices = isset($_REQUEST['page'])
518
+ && stripos($_REQUEST['page'], 'mailpoet-newsletters') === false;
519
+ $checker = $checker ?: new ServicesChecker();
520
+ $this->mp_api_key_valid = $checker->checkMailPoetAPIKeyValid($show_notices);
521
+ }
522
+ }
523
+
524
  private function getLimitPerPage($model = null) {
525
  if($model === null) {
526
  return Listing\Handler::DEFAULT_LIMIT_PER_PAGE;
542
  $notice->displayWPNotice();
543
  }
544
  }
 
 
 
 
545
  }
lib/Config/Migrator.php CHANGED
@@ -106,7 +106,7 @@ class Migrator {
106
  function sendingQueues() {
107
  $attributes = array(
108
  'id mediumint(9) NOT NULL AUTO_INCREMENT,',
109
- 'type varchar(12) NULL DEFAULT NULL,',
110
  'newsletter_id mediumint(9) NOT NULL,',
111
  'newsletter_rendered_body longtext,',
112
  'newsletter_rendered_subject varchar(250) NULL DEFAULT NULL,',
106
  function sendingQueues() {
107
  $attributes = array(
108
  'id mediumint(9) NOT NULL AUTO_INCREMENT,',
109
+ 'type varchar(90) NULL DEFAULT NULL,',
110
  'newsletter_id mediumint(9) NOT NULL,',
111
  'newsletter_rendered_body longtext,',
112
  'newsletter_rendered_subject varchar(250) NULL DEFAULT NULL,',
lib/Config/ServicesChecker.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\Config;
3
+
4
+ use MailPoet\Models\Setting;
5
+ use MailPoet\Models\Subscriber;
6
+ use MailPoet\Services\Bridge;
7
+ use MailPoet\Util\Helpers;
8
+ use MailPoet\WP\Notice as WPNotice;
9
+
10
+ if(!defined('ABSPATH')) exit;
11
+
12
+ class ServicesChecker {
13
+ function checkMailPoetAPIKeyValid($display_error_notice = true) {
14
+ if(!Bridge::isMPSendingServiceEnabled()) {
15
+ return null;
16
+ }
17
+
18
+ $result = Setting::getValue(Bridge::API_KEY_STATE_SETTING_NAME);
19
+ if(empty($result['state']) || $result['state'] == Bridge::MAILPOET_KEY_VALID) {
20
+ return true;
21
+ }
22
+
23
+ if($result['state'] == Bridge::MAILPOET_KEY_INVALID) {
24
+ $error = Helpers::replaceLinkTags(
25
+ __('All sending is currently paused! Your key to send with MailPoet is invalid. [link]Visit MailPoet.com to purchase a key[/link]', 'mailpoet'),
26
+ 'https://account.mailpoet.com?s=' . Subscriber::getTotalSubscribers()
27
+ );
28
+ if($display_error_notice) {
29
+ WPNotice::displayError($error);
30
+ }
31
+ return false;
32
+ } elseif($result['state'] == Bridge::MAILPOET_KEY_EXPIRING
33
+ && !empty($result['data']['expire_at'])
34
+ ) {
35
+ $date = date('Y-m-d', strtotime($result['data']['expire_at']));
36
+ $error = Helpers::replaceLinkTags(
37
+ __('Your newsletters are awesome! Don\'t forget to [link]upgrade your MailPoet email plan[/link] by %s to keep sending them to your subscribers.', 'mailpoet'),
38
+ 'https://account.mailpoet.com?s=' . Subscriber::getTotalSubscribers()
39
+ );
40
+ $error = sprintf($error, $date);
41
+ if($display_error_notice) {
42
+ WPNotice::displayWarning($error);
43
+ }
44
+ return true;
45
+ }
46
+
47
+ return true;
48
+ }
49
+ }
lib/Cron/Daemon.php CHANGED
@@ -3,6 +3,7 @@ namespace MailPoet\Cron;
3
  use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
4
  use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
5
  use MailPoet\Cron\Workers\Bounce as BounceWorker;
 
6
 
7
  if(!defined('ABSPATH')) exit;
8
  require_once(ABSPATH . 'wp-includes/pluggable.php');
@@ -48,6 +49,7 @@ class Daemon {
48
  try {
49
  $this->executeScheduleWorker();
50
  $this->executeQueueWorker();
 
51
  $this->executeBounceWorker();
52
  } catch(\Exception $e) {
53
  // continue processing, no need to handle errors
@@ -80,6 +82,11 @@ class Daemon {
80
  return $queue->process();
81
  }
82
 
 
 
 
 
 
83
  function executeBounceWorker() {
84
  $bounce = new BounceWorker($this->timer);
85
  return $bounce->process();
3
  use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
4
  use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
5
  use MailPoet\Cron\Workers\Bounce as BounceWorker;
6
+ use MailPoet\Cron\Workers\SendingServiceKeyCheck as SendingServiceKeyCheckWorker;
7
 
8
  if(!defined('ABSPATH')) exit;
9
  require_once(ABSPATH . 'wp-includes/pluggable.php');
49
  try {
50
  $this->executeScheduleWorker();
51
  $this->executeQueueWorker();
52
+ $this->executeSendingServiceKeyCheckWorker();
53
  $this->executeBounceWorker();
54
  } catch(\Exception $e) {
55
  // continue processing, no need to handle errors
82
  return $queue->process();
83
  }
84
 
85
+ function executeSendingServiceKeyCheckWorker() {
86
+ $worker = new SendingServiceKeyCheckWorker($this->timer);
87
+ return $worker->process();
88
+ }
89
+
90
  function executeBounceWorker() {
91
  $bounce = new BounceWorker($this->timer);
92
  return $bounce->process();
lib/Cron/Triggers/WordPress.php CHANGED
@@ -5,7 +5,9 @@ use MailPoet\Cron\CronHelper;
5
  use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
6
  use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
7
  use MailPoet\Cron\Workers\Bounce as BounceWorker;
 
8
  use MailPoet\Mailer\MailerLog;
 
9
 
10
  if(!defined('ABSPATH')) exit;
11
 
@@ -17,14 +19,24 @@ class WordPress {
17
  }
18
 
19
  static function checkExecutionRequirements() {
 
20
  $scheduled_queues = SchedulerWorker::getScheduledQueues();
21
  $running_queues = SendingQueueWorker::getRunningQueues();
22
  $sending_limit_reached = MailerLog::isSendingLimitReached();
23
- $bounce_sync_available = BounceWorker::checkBounceSyncAvailable();
 
 
24
  $bounce_due_queues = BounceWorker::getAllDueQueues();
25
  $bounce_future_queues = BounceWorker::getFutureQueues();
26
- return (($scheduled_queues || $running_queues) && !$sending_limit_reached)
27
- || ($bounce_sync_available && ($bounce_due_queues || !$bounce_future_queues));
 
 
 
 
 
 
 
28
  }
29
 
30
  static function cleanup() {
5
  use MailPoet\Cron\Workers\Scheduler as SchedulerWorker;
6
  use MailPoet\Cron\Workers\SendingQueue\SendingQueue as SendingQueueWorker;
7
  use MailPoet\Cron\Workers\Bounce as BounceWorker;
8
+ use MailPoet\Cron\Workers\SendingServiceKeyCheck as SendingServiceKeyCheckWorker;
9
  use MailPoet\Mailer\MailerLog;
10
+ use MailPoet\Services\Bridge;
11
 
12
  if(!defined('ABSPATH')) exit;
13
 
19
  }
20
 
21
  static function checkExecutionRequirements() {
22
+ // sending queue
23
  $scheduled_queues = SchedulerWorker::getScheduledQueues();
24
  $running_queues = SendingQueueWorker::getRunningQueues();
25
  $sending_limit_reached = MailerLog::isSendingLimitReached();
26
+ // sending service
27
+ $mp_sending_enabled = Bridge::isMPSendingServiceEnabled();
28
+ // bounce sync
29
  $bounce_due_queues = BounceWorker::getAllDueQueues();
30
  $bounce_future_queues = BounceWorker::getFutureQueues();
31
+ // sending service key check
32
+ $sskeycheck_due_queues = SendingServiceKeyCheckWorker::getAllDueQueues();
33
+ $sskeycheck_future_queues = SendingServiceKeyCheckWorker::getFutureQueues();
34
+ // check requirements for each worker
35
+ $sending_queue_active = (($scheduled_queues || $running_queues) && !$sending_limit_reached);
36
+ $bounce_sync_active = ($mp_sending_enabled && ($bounce_due_queues || !$bounce_future_queues));
37
+ $sending_service_key_check_active = ($mp_sending_enabled && ($sskeycheck_due_queues || !$sskeycheck_future_queues));
38
+
39
+ return ($sending_queue_active || $bounce_sync_active || $sending_service_key_check_active);
40
  }
41
 
42
  static function cleanup() {
lib/Cron/Workers/Bounce.php CHANGED
@@ -6,15 +6,19 @@ use MailPoet\Cron\CronHelper;
6
  use MailPoet\Mailer\Mailer;
7
  use MailPoet\Models\SendingQueue;
8
  use MailPoet\Models\Subscriber;
 
 
9
  use MailPoet\Util\Helpers;
10
 
11
  if(!defined('ABSPATH')) exit;
12
 
13
  class Bounce {
 
 
 
14
  const BOUNCED_HARD = 'hard';
15
  const BOUNCED_SOFT = 'soft';
16
  const NOT_BOUNCED = null;
17
- const BATCH_SIZE = 100;
18
 
19
  public $timer;
20
  public $api;
@@ -25,21 +29,15 @@ class Bounce {
25
  CronHelper::enforceExecutionLimit($this->timer);
26
  }
27
 
28
- static function checkBounceSyncAvailable() {
29
- $mailer_config = Mailer::getMailerConfig();
30
- return !empty($mailer_config['method'])
31
- && $mailer_config['method'] === Mailer::METHOD_MAILPOET;
32
- }
33
-
34
  function initApi() {
35
  if(!$this->api) {
36
  $mailer_config = Mailer::getMailerConfig();
37
- $this->api = new Bounce\API($mailer_config['mailpoet_api_key']);
38
  }
39
  }
40
 
41
  function process() {
42
- if(!self::checkBounceSyncAvailable()) {
43
  return false;
44
  }
45
 
@@ -64,7 +62,7 @@ class Bounce {
64
  }
65
 
66
  static function scheduleBounceSync() {
67
- $already_scheduled = SendingQueue::where('type', 'bounce')
68
  ->whereNull('deleted_at')
69
  ->where('status', SendingQueue::STATUS_SCHEDULED)
70
  ->findMany();
@@ -72,7 +70,7 @@ class Bounce {
72
  return false;
73
  }
74
  $queue = SendingQueue::create();
75
- $queue->type = 'bounce';
76
  $queue->status = SendingQueue::STATUS_SCHEDULED;
77
  $queue->priority = SendingQueue::PRIORITY_LOW;
78
  $queue->scheduled_at = self::getNextRunDate();
@@ -143,7 +141,7 @@ class Bounce {
143
  }
144
 
145
  function processEmails(array $subscriber_emails) {
146
- $checked_emails = $this->api->check($subscriber_emails);
147
  $this->processApiResponse((array)$checked_emails);
148
  }
149
 
@@ -170,7 +168,7 @@ class Bounce {
170
 
171
  static function getScheduledQueues($future = false) {
172
  $dateWhere = ($future) ? 'whereGt' : 'whereLte';
173
- return SendingQueue::where('type', 'bounce')
174
  ->$dateWhere('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
175
  ->whereNull('deleted_at')
176
  ->where('status', SendingQueue::STATUS_SCHEDULED)
@@ -178,7 +176,7 @@ class Bounce {
178
  }
179
 
180
  static function getRunningQueues() {
181
- return SendingQueue::where('type', 'bounce')
182
  ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
183
  ->whereNull('deleted_at')
184
  ->whereNull('status')
6
  use MailPoet\Mailer\Mailer;
7
  use MailPoet\Models\SendingQueue;
8
  use MailPoet\Models\Subscriber;
9
+ use MailPoet\Services\Bridge;
10
+ use MailPoet\Services\Bridge\API;
11
  use MailPoet\Util\Helpers;
12
 
13
  if(!defined('ABSPATH')) exit;
14
 
15
  class Bounce {
16
+ const TASK_TYPE = 'bounce';
17
+ const BATCH_SIZE = 100;
18
+
19
  const BOUNCED_HARD = 'hard';
20
  const BOUNCED_SOFT = 'soft';
21
  const NOT_BOUNCED = null;
 
22
 
23
  public $timer;
24
  public $api;
29
  CronHelper::enforceExecutionLimit($this->timer);
30
  }
31
 
 
 
 
 
 
 
32
  function initApi() {
33
  if(!$this->api) {
34
  $mailer_config = Mailer::getMailerConfig();
35
+ $this->api = new API($mailer_config['mailpoet_api_key']);
36
  }
37
  }
38
 
39
  function process() {
40
+ if(!Bridge::isMPSendingServiceEnabled()) {
41
  return false;
42
  }
43
 
62
  }
63
 
64
  static function scheduleBounceSync() {
65
+ $already_scheduled = SendingQueue::where('type', self::TASK_TYPE)
66
  ->whereNull('deleted_at')
67
  ->where('status', SendingQueue::STATUS_SCHEDULED)
68
  ->findMany();
70
  return false;
71
  }
72
  $queue = SendingQueue::create();
73
+ $queue->type = self::TASK_TYPE;
74
  $queue->status = SendingQueue::STATUS_SCHEDULED;
75
  $queue->priority = SendingQueue::PRIORITY_LOW;
76
  $queue->scheduled_at = self::getNextRunDate();
141
  }
142
 
143
  function processEmails(array $subscriber_emails) {
144
+ $checked_emails = $this->api->checkBounces($subscriber_emails);
145
  $this->processApiResponse((array)$checked_emails);
146
  }
147
 
168
 
169
  static function getScheduledQueues($future = false) {
170
  $dateWhere = ($future) ? 'whereGt' : 'whereLte';
171
+ return SendingQueue::where('type', self::TASK_TYPE)
172
  ->$dateWhere('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
173
  ->whereNull('deleted_at')
174
  ->where('status', SendingQueue::STATUS_SCHEDULED)
176
  }
177
 
178
  static function getRunningQueues() {
179
+ return SendingQueue::where('type', self::TASK_TYPE)
180
  ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
181
  ->whereNull('deleted_at')
182
  ->whereNull('status')
lib/Cron/Workers/Bounce/API.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- namespace MailPoet\Cron\Workers\Bounce;
3
-
4
- if(!defined('ABSPATH')) exit;
5
-
6
- class API {
7
- public $url = 'https://bridge.mailpoet.com/api/v0/bounces/search';
8
- public $api_key;
9
-
10
- function __construct($api_key) {
11
- $this->api_key = $api_key;
12
- }
13
-
14
- function check(array $emails) {
15
- $result = wp_remote_post(
16
- $this->url,
17
- $this->request($emails)
18
- );
19
- if(wp_remote_retrieve_response_code($result) === 200) {
20
- return json_decode(wp_remote_retrieve_body($result), true);
21
- }
22
- return false;
23
- }
24
-
25
- private function auth() {
26
- return 'Basic ' . base64_encode('api:' . $this->api_key);
27
- }
28
-
29
- private function request($body) {
30
- return array(
31
- 'timeout' => 10,
32
- 'httpversion' => '1.0',
33
- 'method' => 'POST',
34
- 'headers' => array(
35
- 'Content-Type' => 'application/json',
36
- 'Authorization' => $this->auth()
37
- ),
38
- 'body' => json_encode($body)
39
- );
40
- }
41
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Cron/Workers/SendingServiceKeyCheck.php ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\Cron\Workers;
3
+
4
+ use Carbon\Carbon;
5
+ use MailPoet\Cron\CronHelper;
6
+ use MailPoet\Mailer\Mailer;
7
+ use MailPoet\Models\SendingQueue;
8
+ use MailPoet\Services\Bridge;
9
+
10
+ if(!defined('ABSPATH')) exit;
11
+
12
+ class SendingServiceKeyCheck {
13
+ const TASK_TYPE = 'sending_service_key_check';
14
+ const UNAVAILABLE_SERVICE_RESCHEDULE_TIMEOUT = 60;
15
+
16
+ public $timer;
17
+ public $bridge;
18
+
19
+ function __construct($timer = false) {
20
+ $this->timer = ($timer) ? $timer : microtime(true);
21
+ // abort if execution limit is reached
22
+ CronHelper::enforceExecutionLimit($this->timer);
23
+ }
24
+
25
+ function initApi() {
26
+ if(!$this->bridge) {
27
+ $this->bridge = new Bridge();
28
+ }
29
+ }
30
+
31
+ function process() {
32
+ if(!Bridge::isMPSendingServiceEnabled()) {
33
+ return false;
34
+ }
35
+
36
+ $this->initApi();
37
+
38
+ $scheduled_queues = self::getScheduledQueues();
39
+ $running_queues = self::getRunningQueues();
40
+
41
+ if(!$scheduled_queues && !$running_queues) {
42
+ self::schedule();
43
+ return false;
44
+ }
45
+
46
+ foreach($scheduled_queues as $i => $queue) {
47
+ $this->prepareQueue($queue);
48
+ }
49
+ foreach($running_queues as $i => $queue) {
50
+ $this->processQueue($queue);
51
+ }
52
+
53
+ return true;
54
+ }
55
+
56
+ static function schedule() {
57
+ $already_scheduled = SendingQueue::where('type', self::TASK_TYPE)
58
+ ->whereNull('deleted_at')
59
+ ->where('status', SendingQueue::STATUS_SCHEDULED)
60
+ ->findMany();
61
+ if($already_scheduled) {
62
+ return false;
63
+ }
64
+ $queue = SendingQueue::create();
65
+ $queue->type = self::TASK_TYPE;
66
+ $queue->status = SendingQueue::STATUS_SCHEDULED;
67
+ $queue->priority = SendingQueue::PRIORITY_LOW;
68
+ $queue->scheduled_at = self::getNextRunDate();
69
+ $queue->newsletter_id = 0;
70
+ $queue->save();
71
+ return $queue;
72
+ }
73
+
74
+ function prepareQueue(SendingQueue $queue) {
75
+ $queue->status = null;
76
+ $queue->save();
77
+
78
+ // abort if execution limit is reached
79
+ CronHelper::enforceExecutionLimit($this->timer);
80
+
81
+ return true;
82
+ }
83
+
84
+ function processQueue(SendingQueue $queue) {
85
+ // abort if execution limit is reached
86
+ CronHelper::enforceExecutionLimit($this->timer);
87
+
88
+ try {
89
+ $mailer_config = Mailer::getMailerConfig();
90
+ $result = $this->bridge->checkKey($mailer_config['mailpoet_api_key']);
91
+ $this->bridge->updateSubscriberCount($result);
92
+ } catch (\Exception $e) {
93
+ $result = false;
94
+ }
95
+
96
+ if(empty($result['code']) || $result['code'] == Bridge::CHECK_ERROR_UNAVAILABLE) {
97
+ // reschedule the check
98
+ $scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
99
+ $queue->scheduled_at = $scheduled_at->addMinutes(
100
+ self::UNAVAILABLE_SERVICE_RESCHEDULE_TIMEOUT
101
+ );
102
+ $queue->save();
103
+ return false;
104
+ }
105
+
106
+ $queue->processed_at = current_time('mysql');
107
+ $queue->status = SendingQueue::STATUS_COMPLETED;
108
+ $queue->save();
109
+
110
+ return true;
111
+ }
112
+
113
+ static function getNextRunDate() {
114
+ $date = Carbon::createFromTimestamp(current_time('timestamp'));
115
+ // Random day of the next week
116
+ $date->setISODate($date->format('o'), $date->format('W') + 1, mt_rand(1, 7));
117
+ $date->startOfDay();
118
+ return $date;
119
+ }
120
+
121
+ static function getScheduledQueues($future = false) {
122
+ $dateWhere = ($future) ? 'whereGt' : 'whereLte';
123
+ return SendingQueue::where('type', self::TASK_TYPE)
124
+ ->$dateWhere('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
125
+ ->whereNull('deleted_at')
126
+ ->where('status', SendingQueue::STATUS_SCHEDULED)
127
+ ->findMany();
128
+ }
129
+
130
+ static function getRunningQueues() {
131
+ return SendingQueue::where('type', self::TASK_TYPE)
132
+ ->whereLte('scheduled_at', Carbon::createFromTimestamp(current_time('timestamp')))
133
+ ->whereNull('deleted_at')
134
+ ->whereNull('status')
135
+ ->findMany();
136
+ }
137
+
138
+ static function getAllDueQueues() {
139
+ $scheduled_queues = self::getScheduledQueues();
140
+ $running_queues = self::getRunningQueues();
141
+ return array_merge((array)$scheduled_queues, (array)$running_queues);
142
+ }
143
+
144
+ static function getFutureQueues() {
145
+ return self::getScheduledQueues(true);
146
+ }
147
+ }
lib/Mailer/Methods/MailPoet.php CHANGED
@@ -2,37 +2,46 @@
2
  namespace MailPoet\Mailer\Methods;
3
 
4
  use MailPoet\Mailer\Mailer;
 
 
 
5
 
6
  if(!defined('ABSPATH')) exit;
7
 
8
  class MailPoet {
9
- public $url = 'https://bridge.mailpoet.com/api/messages';
10
- public $api_key;
11
  public $sender;
12
  public $reply_to;
 
13
 
14
  function __construct($api_key, $sender, $reply_to) {
15
- $this->api_key = $api_key;
16
  $this->sender = $sender;
17
  $this->reply_to = $reply_to;
 
18
  }
19
 
20
  function send($newsletter, $subscriber, $extra_params = array()) {
21
- $message_body = $this->getBody($newsletter, $subscriber);
22
- $result = wp_remote_post(
23
- $this->url,
24
- $this->request($message_body)
25
- );
26
- if(is_wp_error($result)) {
27
- return Mailer::formatMailerConnectionErrorResult($result->get_error_message());
28
- }
29
- if(wp_remote_retrieve_response_code($result) !== 201) {
30
- $response = (wp_remote_retrieve_body($result)) ?
31
- wp_remote_retrieve_body($result) :
32
- wp_remote_retrieve_response_message($result);
33
  return Mailer::formatMailerSendErrorResult($response);
34
  }
35
- return Mailer::formatMailerSendSuccessResult();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  }
37
 
38
  function processSubscriber($subscriber) {
@@ -86,21 +95,4 @@ class MailPoet {
86
  }
87
  return $body;
88
  }
89
-
90
- function auth() {
91
- return 'Basic ' . base64_encode('api:' . $this->api_key);
92
- }
93
-
94
- function request($body) {
95
- return array(
96
- 'timeout' => 10,
97
- 'httpversion' => '1.0',
98
- 'method' => 'POST',
99
- 'headers' => array(
100
- 'Content-Type' => 'application/json',
101
- 'Authorization' => $this->auth()
102
- ),
103
- 'body' => json_encode($body)
104
- );
105
- }
106
  }
2
  namespace MailPoet\Mailer\Methods;
3
 
4
  use MailPoet\Mailer\Mailer;
5
+ use MailPoet\Config\ServicesChecker;
6
+ use MailPoet\Services\Bridge;
7
+ use MailPoet\Services\Bridge\API;
8
 
9
  if(!defined('ABSPATH')) exit;
10
 
11
  class MailPoet {
12
+ public $api;
 
13
  public $sender;
14
  public $reply_to;
15
+ public $services_checker;
16
 
17
  function __construct($api_key, $sender, $reply_to) {
18
+ $this->api = new API($api_key);
19
  $this->sender = $sender;
20
  $this->reply_to = $reply_to;
21
+ $this->services_checker = new ServicesChecker(false);
22
  }
23
 
24
  function send($newsletter, $subscriber, $extra_params = array()) {
25
+ if($this->services_checker->checkMailPoetAPIKeyValid() === false) {
26
+ $response = __('MailPoet API key is invalid!', 'mailpoet');
 
 
 
 
 
 
 
 
 
 
27
  return Mailer::formatMailerSendErrorResult($response);
28
  }
29
+
30
+ $message_body = $this->getBody($newsletter, $subscriber);
31
+ $result = $this->api->sendMessages($message_body);
32
+
33
+ switch($result['status']) {
34
+ case API::SENDING_STATUS_CONNECTION_ERROR:
35
+ return Mailer::formatMailerConnectionErrorResult($result['message']);
36
+ case API::SENDING_STATUS_SEND_ERROR:
37
+ if(!empty($result['code']) && $result['code'] === API::RESPONSE_CODE_KEY_INVALID) {
38
+ Bridge::invalidateKey();
39
+ }
40
+ return Mailer::formatMailerSendErrorResult($result['message']);
41
+ case API::SENDING_STATUS_OK:
42
+ default:
43
+ return Mailer::formatMailerSendSuccessResult();
44
+ }
45
  }
46
 
47
  function processSubscriber($subscriber) {
95
  }
96
  return $body;
97
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
lib/Services/Bridge.php ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\Services;
3
+
4
+ use MailPoet\Mailer\Mailer;
5
+ use MailPoet\Models\Setting;
6
+ use MailPoet\Models\Subscriber;
7
+
8
+ if(!defined('ABSPATH')) exit;
9
+
10
+ class Bridge {
11
+ const API_KEY_STATE_SETTING_NAME = 'mta.mailpoet_api_key_state';
12
+
13
+ const MAILPOET_KEY_VALID = 'valid';
14
+ const MAILPOET_KEY_INVALID = 'invalid';
15
+ const MAILPOET_KEY_EXPIRING = 'expiring';
16
+
17
+ const MAILPOET_KEY_CHECK_ERROR = 'check_error';
18
+
19
+ const CHECK_ERROR_UNAVAILABLE = 503;
20
+ const CHECK_ERROR_UNKNOWN = 'unknown';
21
+
22
+ public $api;
23
+
24
+ static function isMPSendingServiceEnabled() {
25
+ try {
26
+ $mailer_config = Mailer::getMailerConfig();
27
+ return !empty($mailer_config['method'])
28
+ && $mailer_config['method'] === Mailer::METHOD_MAILPOET;
29
+ } catch (\Exception $e) {
30
+ return false;
31
+ }
32
+ }
33
+
34
+ function initApi($api_key) {
35
+ if($this->api) {
36
+ $this->api->setKey($api_key);
37
+ } else {
38
+ $this->api = new Bridge\API($api_key);
39
+ }
40
+ }
41
+
42
+ function checkKey($api_key) {
43
+ $this->initApi($api_key);
44
+ $result = $this->api->checkKey();
45
+ return $this->processResult($result);
46
+ }
47
+
48
+ function processResult(array $result) {
49
+ $state_map = array(
50
+ 200 => self::MAILPOET_KEY_VALID,
51
+ 401 => self::MAILPOET_KEY_INVALID,
52
+ 402 => self::MAILPOET_KEY_EXPIRING
53
+ );
54
+
55
+ $update_settings = false;
56
+
57
+ if(!empty($result['code']) && isset($state_map[$result['code']])) {
58
+ $key_state = $state_map[$result['code']];
59
+ $update_settings = true;
60
+ } else {
61
+ $key_state = self::MAILPOET_KEY_CHECK_ERROR;
62
+ }
63
+
64
+ $state = array(
65
+ 'state' => $key_state,
66
+ 'data' => !empty($result['data']) ? $result['data'] : null,
67
+ 'code' => !empty($result['code']) ? $result['code'] : self::CHECK_ERROR_UNKNOWN
68
+ );
69
+
70
+ if($update_settings) {
71
+ Setting::setValue(
72
+ self::API_KEY_STATE_SETTING_NAME,
73
+ $state
74
+ );
75
+ }
76
+
77
+ return $state;
78
+ }
79
+
80
+ function updateSubscriberCount($result) {
81
+ if(!empty($result['state'])
82
+ && ($result['state'] === self::MAILPOET_KEY_VALID
83
+ || $result['state'] === self::MAILPOET_KEY_EXPIRING)
84
+ ) {
85
+ return $this->api->updateSubscriberCount(Subscriber::getTotalSubscribers());
86
+ }
87
+ return null;
88
+ }
89
+
90
+ static function invalidateKey() {
91
+ Setting::setValue(
92
+ self::API_KEY_STATE_SETTING_NAME,
93
+ array('state' => self::MAILPOET_KEY_INVALID)
94
+ );
95
+ }
96
+ }
lib/Services/Bridge/API.php ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace MailPoet\Services\Bridge;
3
+
4
+ if(!defined('ABSPATH')) exit;
5
+
6
+ class API {
7
+ const SENDING_STATUS_OK = 'ok';
8
+ const SENDING_STATUS_CONNECTION_ERROR = 'connection_error';
9
+ const SENDING_STATUS_SEND_ERROR = 'send_error';
10
+
11
+ const RESPONSE_CODE_KEY_INVALID = 401;
12
+
13
+ const RESPONSE_CODE_STATS_SAVED = 204;
14
+
15
+ private $api_key;
16
+
17
+ public $url_me = 'https://bridge.mailpoet.com/api/v0/me';
18
+ public $url_messages = 'https://bridge.mailpoet.com/api/v0/messages';
19
+ public $url_bounces = 'https://bridge.mailpoet.com/api/v0/bounces/search';
20
+ public $url_stats = 'https://bridge.mailpoet.com/api/v0/stats';
21
+
22
+ function __construct($api_key) {
23
+ $this->setKey($api_key);
24
+ }
25
+
26
+ function checkKey() {
27
+ $result = $this->request(
28
+ $this->url_me,
29
+ array('site' => home_url())
30
+ );
31
+
32
+ $code = wp_remote_retrieve_response_code($result);
33
+ switch($code) {
34
+ case 200:
35
+ case 402:
36
+ $body = json_decode(wp_remote_retrieve_body($result), true);
37
+ break;
38
+ case 401:
39
+ $body = wp_remote_retrieve_body($result);
40
+ break;
41
+ default:
42
+ $body = null;
43
+ break;
44
+ }
45
+
46
+ return array('code' => $code, 'data' => $body);
47
+ }
48
+
49
+ function sendMessages($message_body) {
50
+ $result = $this->request(
51
+ $this->url_messages,
52
+ $message_body
53
+ );
54
+ if(is_wp_error($result)) {
55
+ return array(
56
+ 'status' => self::SENDING_STATUS_CONNECTION_ERROR,
57
+ 'message' => $result->get_error_message()
58
+ );
59
+ }
60
+ $response_code = wp_remote_retrieve_response_code($result);
61
+ if($response_code !== 201) {
62
+ $response = (wp_remote_retrieve_body($result)) ?
63
+ wp_remote_retrieve_body($result) :
64
+ wp_remote_retrieve_response_message($result);
65
+ return array(
66
+ 'status' => self::SENDING_STATUS_SEND_ERROR,
67
+ 'message' => $response,
68
+ 'code' => $response_code
69
+ );
70
+ }
71
+ return array('status' => self::SENDING_STATUS_OK);
72
+ }
73
+
74
+ function checkBounces(array $emails) {
75
+ $result = $this->request(
76
+ $this->url_bounces,
77
+ $emails
78
+ );
79
+ if(wp_remote_retrieve_response_code($result) === 200) {
80
+ return json_decode(wp_remote_retrieve_body($result), true);
81
+ }
82
+ return false;
83
+ }
84
+
85
+ function updateSubscriberCount($count) {
86
+ $result = $this->request(
87
+ $this->url_stats,
88
+ array('subscriber_count' => (int)$count),
89
+ 'PUT'
90
+ );
91
+ return wp_remote_retrieve_response_code($result) === self::RESPONSE_CODE_STATS_SAVED;
92
+ }
93
+
94
+ function setKey($api_key) {
95
+ $this->api_key = $api_key;
96
+ }
97
+
98
+ function getKey() {
99
+ return $this->api_key;
100
+ }
101
+
102
+ private function auth() {
103
+ return 'Basic ' . base64_encode('api:' . $this->api_key);
104
+ }
105
+
106
+ private function request($url, $body, $method = 'POST') {
107
+ $params = array(
108
+ 'timeout' => 10,
109
+ 'httpversion' => '1.0',
110
+ 'method' => $method,
111
+ 'headers' => array(
112
+ 'Content-Type' => 'application/json',
113
+ 'Authorization' => $this->auth()
114
+ ),
115
+ 'body' => json_encode($body)
116
+ );
117
+ return wp_remote_post($url, $params);
118
+ }
119
+ }
lib/{Cron/Workers/Bounce → Services/Bridge}/index.php RENAMED
File without changes
lib/Services/index.php ADDED
File without changes
lib/Util/ConflictResolver.php CHANGED
@@ -8,7 +8,8 @@ class ConflictResolver {
8
  '^/wp-admin',
9
  '^/wp-includes',
10
  // third-party
11
- 'query-monitor'
 
12
  ),
13
  'scripts' => array(
14
  // WP default
@@ -16,7 +17,8 @@ class ConflictResolver {
16
  '^/wp-includes',
17
  'googleapis.com/ajax/libs',
18
  // third-party
19
- 'query-monitor'
 
20
  )
21
  );
22
 
@@ -85,4 +87,4 @@ class ConflictResolver {
85
  add_action('wp_print_scripts', $dequeue_scripts, PHP_INT_MAX);
86
  add_action('admin_print_footer_scripts', $dequeue_scripts, PHP_INT_MAX);
87
  }
88
- }
8
  '^/wp-admin',
9
  '^/wp-includes',
10
  // third-party
11
+ 'query-monitor',
12
+ 'wpt-tx-updater-network'
13
  ),
14
  'scripts' => array(
15
  // WP default
17
  '^/wp-includes',
18
  'googleapis.com/ajax/libs',
19
  // third-party
20
+ 'query-monitor',
21
+ 'wpt-tx-updater-network'
22
  )
23
  );
24
 
87
  add_action('wp_print_scripts', $dequeue_scripts, PHP_INT_MAX);
88
  add_action('admin_print_footer_scripts', $dequeue_scripts, PHP_INT_MAX);
89
  }
90
+ }
lib/WP/Notice.php CHANGED
@@ -43,7 +43,7 @@ class Notice {
43
  }
44
 
45
  function displayWPNotice() {
46
- $class = sprintf('notice notice-%s', $this->type);
47
  $message = nl2br($this->message);
48
 
49
  printf('<div class="%1$s"><p>%2$s</p></div>', $class, $message);
43
  }
44
 
45
  function displayWPNotice() {
46
+ $class = sprintf('notice notice-%s mailpoet_notice_server', $this->type);
47
  $message = nl2br($this->message);
48
 
49
  printf('<div class="%1$s"><p>%2$s</p></div>', $class, $message);
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet
7
- * Version: 3.0.0-beta.16
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send beautiful email newsletters, autoresponders, and post notifications without leaving WordPress. This is a beta version of our brand new plugin!
10
  * Author: MailPoet
@@ -21,7 +21,7 @@ if(!defined('ABSPATH')) exit;
21
  */
22
 
23
  $mailpoet_plugin = array(
24
- 'version' => '3.0.0-beta.16',
25
  'filename' => __FILE__,
26
  'path' => dirname(__FILE__),
27
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet
7
+ * Version: 3.0.0-beta.17
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send beautiful email newsletters, autoresponders, and post notifications without leaving WordPress. This is a beta version of our brand new plugin!
10
  * Author: MailPoet
21
  */
22
 
23
  $mailpoet_plugin = array(
24
+ 'version' => '3.0.0-beta.17',
25
  'filename' => __FILE__,
26
  'path' => dirname(__FILE__),
27
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === MailPoet 3 - Beta Version ===
2
  Contributors: mailpoet, wysija
3
- Tags: newsletter, email, welcome email, post notification, autoresponder, mailchimp, signup, smtp
4
  Requires at least: 4.6
5
  Tested up to: 4.7.2
6
- Stable tag: 3.0.0-beta.16
7
  Create and send beautiful emails and newsletters from WordPress.
8
 
9
  == Description ==
@@ -83,13 +83,16 @@ Our [support site](https://docs.mailpoet.com/) has plenty of articles. You can w
83
 
84
  == Changelog ==
85
 
 
 
 
86
  = 3.0.0-beta.16 - 2017-01-31 =
87
- - Improved: Updated language strings for better translation support;
88
- - Fixed: subscription forms now allow to subscribe only to specified lists. Thanks Paul!
89
- - Fixed: subscription forms now ignore any extra fields added not via the Form editor. Thx again Paul!
90
- - Fixed: previewing sent welcome emails now display latest email version. Thanks Tim!
91
- - Fixed: plugin no longer triggers a PHP error during initialization on hosts using PHP 5.3;
92
- - Fixed: plugin warns about missing required PDO_MYSQL extension.
93
 
94
  = 3.0.0-beta.15 - 2017-01-24 =
95
  * Fixed: plugin no longer throws a fatal exception error on (prehistoric :)) hosts running older versions than PHP 5.3. Thanks Otto & jtm12!;
1
  === MailPoet 3 - Beta Version ===
2
  Contributors: mailpoet, wysija
3
+ Tags: newsletter, email, welcome email, post notification, autoresponder, signup, smtp
4
  Requires at least: 4.6
5
  Tested up to: 4.7.2
6
+ Stable tag: 3.0.0-beta.17
7
  Create and send beautiful emails and newsletters from WordPress.
8
 
9
  == Description ==
83
 
84
  == Changelog ==
85
 
86
+ = 3.0.0-beta.17 - 2017-02-01 =
87
+ * Added: send in style with MailPoet's own sending service. Visit your MailPoet Settings > Send with... tab.
88
+
89
  = 3.0.0-beta.16 - 2017-01-31 =
90
+ * Improved: Updated language strings for better translation support;
91
+ * Fixed: subscription forms now allow to subscribe only to specified lists. Thanks Paul!
92
+ * Fixed: subscription forms now ignore any extra fields added not via the Form editor. Thx again Paul!
93
+ * Fixed: previewing sent welcome emails now displays latest email version. Thanks Tim!
94
+ * Fixed: plugin no longer triggers a PHP error during initialization on hosts using PHP 5.3;
95
+ * Fixed: plugin warns about missing required PDO_MYSQL extension.
96
 
97
  = 3.0.0-beta.15 - 2017-01-24 =
98
  * Fixed: plugin no longer throws a fatal exception error on (prehistoric :)) hosts running older versions than PHP 5.3. Thanks Otto & jtm12!;
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInit1cede32ff3b7e24593849743769fc31a::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -55,7 +55,6 @@ class ClassLoader
55
  private $classMap = array();
56
  private $classMapAuthoritative = false;
57
  private $missingClasses = array();
58
- private $apcuPrefix;
59
 
60
  public function getPrefixes()
61
  {
@@ -272,26 +271,6 @@ class ClassLoader
272
  return $this->classMapAuthoritative;
273
  }
274
 
275
- /**
276
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
- *
278
- * @param string|null $apcuPrefix
279
- */
280
- public function setApcuPrefix($apcuPrefix)
281
- {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
283
- }
284
-
285
- /**
286
- * The APCu prefix in use, or null if APCu caching is not enabled.
287
- *
288
- * @return string|null
289
- */
290
- public function getApcuPrefix()
291
- {
292
- return $this->apcuPrefix;
293
- }
294
-
295
  /**
296
  * Registers this instance as an autoloader.
297
  *
@@ -334,6 +313,11 @@ class ClassLoader
334
  */
335
  public function findFile($class)
336
  {
 
 
 
 
 
337
  // class map lookup
338
  if (isset($this->classMap[$class])) {
339
  return $this->classMap[$class];
@@ -341,12 +325,6 @@ class ClassLoader
341
  if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
  return false;
343
  }
344
- if (null !== $this->apcuPrefix) {
345
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
- if ($hit) {
347
- return $file;
348
- }
349
- }
350
 
351
  $file = $this->findFileWithExtension($class, '.php');
352
 
@@ -355,10 +333,6 @@ class ClassLoader
355
  $file = $this->findFileWithExtension($class, '.hh');
356
  }
357
 
358
- if (null !== $this->apcuPrefix) {
359
- apcu_add($this->apcuPrefix.$class, $file);
360
- }
361
-
362
  if (false === $file) {
363
  // Remember that this class does not exist.
364
  $this->missingClasses[$class] = true;
55
  private $classMap = array();
56
  private $classMapAuthoritative = false;
57
  private $missingClasses = array();
 
58
 
59
  public function getPrefixes()
60
  {
271
  return $this->classMapAuthoritative;
272
  }
273
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
274
  /**
275
  * Registers this instance as an autoloader.
276
  *
313
  */
314
  public function findFile($class)
315
  {
316
+ // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
317
+ if ('\\' == $class[0]) {
318
+ $class = substr($class, 1);
319
+ }
320
+
321
  // class map lookup
322
  if (isset($this->classMap[$class])) {
323
  return $this->classMap[$class];
325
  if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
326
  return false;
327
  }
 
 
 
 
 
 
328
 
329
  $file = $this->findFileWithExtension($class, '.php');
330
 
333
  $file = $this->findFileWithExtension($class, '.hh');
334
  }
335
 
 
 
 
 
336
  if (false === $file) {
337
  // Remember that this class does not exist.
338
  $this->missingClasses[$class] = true;
vendor/composer/autoload_classmap.php CHANGED
@@ -36,6 +36,7 @@ return array(
36
  'MailPoet\\API\\Endpoints\\Newsletters' => $baseDir . '/lib/API/Endpoints/Newsletters.php',
37
  'MailPoet\\API\\Endpoints\\Segments' => $baseDir . '/lib/API/Endpoints/Segments.php',
38
  'MailPoet\\API\\Endpoints\\SendingQueue' => $baseDir . '/lib/API/Endpoints/SendingQueue.php',
 
39
  'MailPoet\\API\\Endpoints\\Settings' => $baseDir . '/lib/API/Endpoints/Settings.php',
40
  'MailPoet\\API\\Endpoints\\Setup' => $baseDir . '/lib/API/Endpoints/Setup.php',
41
  'MailPoet\\API\\Endpoints\\Subscribers' => $baseDir . '/lib/API/Endpoints/Subscribers.php',
@@ -69,6 +70,7 @@ return array(
69
  'MailPoet\\Config\\PopulatorData\\Templates\\WelcomeBlank1Column' => $baseDir . '/lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php',
70
  'MailPoet\\Config\\Renderer' => $baseDir . '/lib/Config/Renderer.php',
71
  'MailPoet\\Config\\RequirementsChecker' => $baseDir . '/lib/Config/RequirementsChecker.php',
 
72
  'MailPoet\\Config\\Shortcodes' => $baseDir . '/lib/Config/Shortcodes.php',
73
  'MailPoet\\Config\\Widget' => $baseDir . '/lib/Config/Widget.php',
74
  'MailPoet\\Cron\\CronHelper' => $baseDir . '/lib/Cron/CronHelper.php',
@@ -78,7 +80,6 @@ return array(
78
  'MailPoet\\Cron\\Triggers\\MailPoet' => $baseDir . '/lib/Cron/Triggers/MailPoet.php',
79
  'MailPoet\\Cron\\Triggers\\WordPress' => $baseDir . '/lib/Cron/Triggers/WordPress.php',
80
  'MailPoet\\Cron\\Workers\\Bounce' => $baseDir . '/lib/Cron/Workers/Bounce.php',
81
- 'MailPoet\\Cron\\Workers\\Bounce\\API' => $baseDir . '/lib/Cron/Workers/Bounce/API.php',
82
  'MailPoet\\Cron\\Workers\\Scheduler' => $baseDir . '/lib/Cron/Workers/Scheduler.php',
83
  'MailPoet\\Cron\\Workers\\SendingQueue\\SendingQueue' => $baseDir . '/lib/Cron/Workers/SendingQueue/SendingQueue.php',
84
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Links' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Links.php',
@@ -86,6 +87,7 @@ return array(
86
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Newsletter' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Newsletter.php',
87
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Posts' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Posts.php',
88
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Shortcodes' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Shortcodes.php',
 
89
  'MailPoet\\Form\\Block\\Base' => $baseDir . '/lib/Form/Block/Base.php',
90
  'MailPoet\\Form\\Block\\Checkbox' => $baseDir . '/lib/Form/Block/Checkbox.php',
91
  'MailPoet\\Form\\Block\\Date' => $baseDir . '/lib/Form/Block/Date.php',
@@ -170,6 +172,8 @@ return array(
170
  'MailPoet\\Router\\Endpoints\\ViewInBrowser' => $baseDir . '/lib/Router/Endpoints/ViewInBrowser.php',
171
  'MailPoet\\Router\\Router' => $baseDir . '/lib/Router/Router.php',
172
  'MailPoet\\Segments\\WP' => $baseDir . '/lib/Segments/WP.php',
 
 
173
  'MailPoet\\Settings\\Charsets' => $baseDir . '/lib/Settings/Charsets.php',
174
  'MailPoet\\Settings\\Hosts' => $baseDir . '/lib/Settings/Hosts.php',
175
  'MailPoet\\Settings\\Pages' => $baseDir . '/lib/Settings/Pages.php',
36
  'MailPoet\\API\\Endpoints\\Newsletters' => $baseDir . '/lib/API/Endpoints/Newsletters.php',
37
  'MailPoet\\API\\Endpoints\\Segments' => $baseDir . '/lib/API/Endpoints/Segments.php',
38
  'MailPoet\\API\\Endpoints\\SendingQueue' => $baseDir . '/lib/API/Endpoints/SendingQueue.php',
39
+ 'MailPoet\\API\\Endpoints\\Services' => $baseDir . '/lib/API/Endpoints/Services.php',
40
  'MailPoet\\API\\Endpoints\\Settings' => $baseDir . '/lib/API/Endpoints/Settings.php',
41
  'MailPoet\\API\\Endpoints\\Setup' => $baseDir . '/lib/API/Endpoints/Setup.php',
42
  'MailPoet\\API\\Endpoints\\Subscribers' => $baseDir . '/lib/API/Endpoints/Subscribers.php',
70
  'MailPoet\\Config\\PopulatorData\\Templates\\WelcomeBlank1Column' => $baseDir . '/lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php',
71
  'MailPoet\\Config\\Renderer' => $baseDir . '/lib/Config/Renderer.php',
72
  'MailPoet\\Config\\RequirementsChecker' => $baseDir . '/lib/Config/RequirementsChecker.php',
73
+ 'MailPoet\\Config\\ServicesChecker' => $baseDir . '/lib/Config/ServicesChecker.php',
74
  'MailPoet\\Config\\Shortcodes' => $baseDir . '/lib/Config/Shortcodes.php',
75
  'MailPoet\\Config\\Widget' => $baseDir . '/lib/Config/Widget.php',
76
  'MailPoet\\Cron\\CronHelper' => $baseDir . '/lib/Cron/CronHelper.php',
80
  'MailPoet\\Cron\\Triggers\\MailPoet' => $baseDir . '/lib/Cron/Triggers/MailPoet.php',
81
  'MailPoet\\Cron\\Triggers\\WordPress' => $baseDir . '/lib/Cron/Triggers/WordPress.php',
82
  'MailPoet\\Cron\\Workers\\Bounce' => $baseDir . '/lib/Cron/Workers/Bounce.php',
 
83
  'MailPoet\\Cron\\Workers\\Scheduler' => $baseDir . '/lib/Cron/Workers/Scheduler.php',
84
  'MailPoet\\Cron\\Workers\\SendingQueue\\SendingQueue' => $baseDir . '/lib/Cron/Workers/SendingQueue/SendingQueue.php',
85
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Links' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Links.php',
87
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Newsletter' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Newsletter.php',
88
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Posts' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Posts.php',
89
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Shortcodes' => $baseDir . '/lib/Cron/Workers/SendingQueue/Tasks/Shortcodes.php',
90
+ 'MailPoet\\Cron\\Workers\\SendingServiceKeyCheck' => $baseDir . '/lib/Cron/Workers/SendingServiceKeyCheck.php',
91
  'MailPoet\\Form\\Block\\Base' => $baseDir . '/lib/Form/Block/Base.php',
92
  'MailPoet\\Form\\Block\\Checkbox' => $baseDir . '/lib/Form/Block/Checkbox.php',
93
  'MailPoet\\Form\\Block\\Date' => $baseDir . '/lib/Form/Block/Date.php',
172
  'MailPoet\\Router\\Endpoints\\ViewInBrowser' => $baseDir . '/lib/Router/Endpoints/ViewInBrowser.php',
173
  'MailPoet\\Router\\Router' => $baseDir . '/lib/Router/Router.php',
174
  'MailPoet\\Segments\\WP' => $baseDir . '/lib/Segments/WP.php',
175
+ 'MailPoet\\Services\\Bridge' => $baseDir . '/lib/Services/Bridge.php',
176
+ 'MailPoet\\Services\\Bridge\\API' => $baseDir . '/lib/Services/Bridge/API.php',
177
  'MailPoet\\Settings\\Charsets' => $baseDir . '/lib/Settings/Charsets.php',
178
  'MailPoet\\Settings\\Hosts' => $baseDir . '/lib/Settings/Hosts.php',
179
  'MailPoet\\Settings\\Pages' => $baseDir . '/lib/Settings/Pages.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7', 'loadClassLoader'));
25
 
26
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
- call_user_func(\Composer\Autoload\ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInitbc6a71515c63313e189bde6b793cf9a7
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequirebc6a71515c63313e189bde6b793cf9a7($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequirebc6a71515c63313e189bde6b793cf9a7($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInit1cede32ff3b7e24593849743769fc31a
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInit1cede32ff3b7e24593849743769fc31a', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInit1cede32ff3b7e24593849743769fc31a', 'loadClassLoader'));
25
 
26
+ $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION');
27
  if ($useStaticLoader) {
28
  require_once __DIR__ . '/autoload_static.php';
29
 
30
+ call_user_func(\Composer\Autoload\ComposerStaticInit1cede32ff3b7e24593849743769fc31a::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
+ $includeFiles = Composer\Autoload\ComposerStaticInit1cede32ff3b7e24593849743769fc31a::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequire1cede32ff3b7e24593849743769fc31a($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequire1cede32ff3b7e24593849743769fc31a($fileIdentifier, $file)
64
  {
65
  if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
66
  require $file;
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -114,6 +114,7 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
114
  'MailPoet\\API\\Endpoints\\Newsletters' => __DIR__ . '/../..' . '/lib/API/Endpoints/Newsletters.php',
115
  'MailPoet\\API\\Endpoints\\Segments' => __DIR__ . '/../..' . '/lib/API/Endpoints/Segments.php',
116
  'MailPoet\\API\\Endpoints\\SendingQueue' => __DIR__ . '/../..' . '/lib/API/Endpoints/SendingQueue.php',
 
117
  'MailPoet\\API\\Endpoints\\Settings' => __DIR__ . '/../..' . '/lib/API/Endpoints/Settings.php',
118
  'MailPoet\\API\\Endpoints\\Setup' => __DIR__ . '/../..' . '/lib/API/Endpoints/Setup.php',
119
  'MailPoet\\API\\Endpoints\\Subscribers' => __DIR__ . '/../..' . '/lib/API/Endpoints/Subscribers.php',
@@ -147,6 +148,7 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
147
  'MailPoet\\Config\\PopulatorData\\Templates\\WelcomeBlank1Column' => __DIR__ . '/../..' . '/lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php',
148
  'MailPoet\\Config\\Renderer' => __DIR__ . '/../..' . '/lib/Config/Renderer.php',
149
  'MailPoet\\Config\\RequirementsChecker' => __DIR__ . '/../..' . '/lib/Config/RequirementsChecker.php',
 
150
  'MailPoet\\Config\\Shortcodes' => __DIR__ . '/../..' . '/lib/Config/Shortcodes.php',
151
  'MailPoet\\Config\\Widget' => __DIR__ . '/../..' . '/lib/Config/Widget.php',
152
  'MailPoet\\Cron\\CronHelper' => __DIR__ . '/../..' . '/lib/Cron/CronHelper.php',
@@ -156,7 +158,6 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
156
  'MailPoet\\Cron\\Triggers\\MailPoet' => __DIR__ . '/../..' . '/lib/Cron/Triggers/MailPoet.php',
157
  'MailPoet\\Cron\\Triggers\\WordPress' => __DIR__ . '/../..' . '/lib/Cron/Triggers/WordPress.php',
158
  'MailPoet\\Cron\\Workers\\Bounce' => __DIR__ . '/../..' . '/lib/Cron/Workers/Bounce.php',
159
- 'MailPoet\\Cron\\Workers\\Bounce\\API' => __DIR__ . '/../..' . '/lib/Cron/Workers/Bounce/API.php',
160
  'MailPoet\\Cron\\Workers\\Scheduler' => __DIR__ . '/../..' . '/lib/Cron/Workers/Scheduler.php',
161
  'MailPoet\\Cron\\Workers\\SendingQueue\\SendingQueue' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/SendingQueue.php',
162
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Links' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Links.php',
@@ -164,6 +165,7 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
164
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Newsletter' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Newsletter.php',
165
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Posts' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Posts.php',
166
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Shortcodes' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Shortcodes.php',
 
167
  'MailPoet\\Form\\Block\\Base' => __DIR__ . '/../..' . '/lib/Form/Block/Base.php',
168
  'MailPoet\\Form\\Block\\Checkbox' => __DIR__ . '/../..' . '/lib/Form/Block/Checkbox.php',
169
  'MailPoet\\Form\\Block\\Date' => __DIR__ . '/../..' . '/lib/Form/Block/Date.php',
@@ -248,6 +250,8 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
248
  'MailPoet\\Router\\Endpoints\\ViewInBrowser' => __DIR__ . '/../..' . '/lib/Router/Endpoints/ViewInBrowser.php',
249
  'MailPoet\\Router\\Router' => __DIR__ . '/../..' . '/lib/Router/Router.php',
250
  'MailPoet\\Segments\\WP' => __DIR__ . '/../..' . '/lib/Segments/WP.php',
 
 
251
  'MailPoet\\Settings\\Charsets' => __DIR__ . '/../..' . '/lib/Settings/Charsets.php',
252
  'MailPoet\\Settings\\Hosts' => __DIR__ . '/../..' . '/lib/Settings/Hosts.php',
253
  'MailPoet\\Settings\\Pages' => __DIR__ . '/../..' . '/lib/Settings/Pages.php',
@@ -602,10 +606,10 @@ class ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7
602
  public static function getInitializer(ClassLoader $loader)
603
  {
604
  return \Closure::bind(function () use ($loader) {
605
- $loader->prefixLengthsPsr4 = ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::$prefixLengthsPsr4;
606
- $loader->prefixDirsPsr4 = ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::$prefixDirsPsr4;
607
- $loader->prefixesPsr0 = ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::$prefixesPsr0;
608
- $loader->classMap = ComposerStaticInitbc6a71515c63313e189bde6b793cf9a7::$classMap;
609
 
610
  }, null, ClassLoader::class);
611
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInit1cede32ff3b7e24593849743769fc31a
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
114
  'MailPoet\\API\\Endpoints\\Newsletters' => __DIR__ . '/../..' . '/lib/API/Endpoints/Newsletters.php',
115
  'MailPoet\\API\\Endpoints\\Segments' => __DIR__ . '/../..' . '/lib/API/Endpoints/Segments.php',
116
  'MailPoet\\API\\Endpoints\\SendingQueue' => __DIR__ . '/../..' . '/lib/API/Endpoints/SendingQueue.php',
117
+ 'MailPoet\\API\\Endpoints\\Services' => __DIR__ . '/../..' . '/lib/API/Endpoints/Services.php',
118
  'MailPoet\\API\\Endpoints\\Settings' => __DIR__ . '/../..' . '/lib/API/Endpoints/Settings.php',
119
  'MailPoet\\API\\Endpoints\\Setup' => __DIR__ . '/../..' . '/lib/API/Endpoints/Setup.php',
120
  'MailPoet\\API\\Endpoints\\Subscribers' => __DIR__ . '/../..' . '/lib/API/Endpoints/Subscribers.php',
148
  'MailPoet\\Config\\PopulatorData\\Templates\\WelcomeBlank1Column' => __DIR__ . '/../..' . '/lib/Config/PopulatorData/Templates/WelcomeBlank1Column.php',
149
  'MailPoet\\Config\\Renderer' => __DIR__ . '/../..' . '/lib/Config/Renderer.php',
150
  'MailPoet\\Config\\RequirementsChecker' => __DIR__ . '/../..' . '/lib/Config/RequirementsChecker.php',
151
+ 'MailPoet\\Config\\ServicesChecker' => __DIR__ . '/../..' . '/lib/Config/ServicesChecker.php',
152
  'MailPoet\\Config\\Shortcodes' => __DIR__ . '/../..' . '/lib/Config/Shortcodes.php',
153
  'MailPoet\\Config\\Widget' => __DIR__ . '/../..' . '/lib/Config/Widget.php',
154
  'MailPoet\\Cron\\CronHelper' => __DIR__ . '/../..' . '/lib/Cron/CronHelper.php',
158
  'MailPoet\\Cron\\Triggers\\MailPoet' => __DIR__ . '/../..' . '/lib/Cron/Triggers/MailPoet.php',
159
  'MailPoet\\Cron\\Triggers\\WordPress' => __DIR__ . '/../..' . '/lib/Cron/Triggers/WordPress.php',
160
  'MailPoet\\Cron\\Workers\\Bounce' => __DIR__ . '/../..' . '/lib/Cron/Workers/Bounce.php',
 
161
  'MailPoet\\Cron\\Workers\\Scheduler' => __DIR__ . '/../..' . '/lib/Cron/Workers/Scheduler.php',
162
  'MailPoet\\Cron\\Workers\\SendingQueue\\SendingQueue' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/SendingQueue.php',
163
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Links' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Links.php',
165
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Newsletter' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Newsletter.php',
166
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Posts' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Posts.php',
167
  'MailPoet\\Cron\\Workers\\SendingQueue\\Tasks\\Shortcodes' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingQueue/Tasks/Shortcodes.php',
168
+ 'MailPoet\\Cron\\Workers\\SendingServiceKeyCheck' => __DIR__ . '/../..' . '/lib/Cron/Workers/SendingServiceKeyCheck.php',
169
  'MailPoet\\Form\\Block\\Base' => __DIR__ . '/../..' . '/lib/Form/Block/Base.php',
170
  'MailPoet\\Form\\Block\\Checkbox' => __DIR__ . '/../..' . '/lib/Form/Block/Checkbox.php',
171
  'MailPoet\\Form\\Block\\Date' => __DIR__ . '/../..' . '/lib/Form/Block/Date.php',
250
  'MailPoet\\Router\\Endpoints\\ViewInBrowser' => __DIR__ . '/../..' . '/lib/Router/Endpoints/ViewInBrowser.php',
251
  'MailPoet\\Router\\Router' => __DIR__ . '/../..' . '/lib/Router/Router.php',
252
  'MailPoet\\Segments\\WP' => __DIR__ . '/../..' . '/lib/Segments/WP.php',
253
+ 'MailPoet\\Services\\Bridge' => __DIR__ . '/../..' . '/lib/Services/Bridge.php',
254
+ 'MailPoet\\Services\\Bridge\\API' => __DIR__ . '/../..' . '/lib/Services/Bridge/API.php',
255
  'MailPoet\\Settings\\Charsets' => __DIR__ . '/../..' . '/lib/Settings/Charsets.php',
256
  'MailPoet\\Settings\\Hosts' => __DIR__ . '/../..' . '/lib/Settings/Hosts.php',
257
  'MailPoet\\Settings\\Pages' => __DIR__ . '/../..' . '/lib/Settings/Pages.php',
606
  public static function getInitializer(ClassLoader $loader)
607
  {
608
  return \Closure::bind(function () use ($loader) {
609
+ $loader->prefixLengthsPsr4 = ComposerStaticInit1cede32ff3b7e24593849743769fc31a::$prefixLengthsPsr4;
610
+ $loader->prefixDirsPsr4 = ComposerStaticInit1cede32ff3b7e24593849743769fc31a::$prefixDirsPsr4;
611
+ $loader->prefixesPsr0 = ComposerStaticInit1cede32ff3b7e24593849743769fc31a::$prefixesPsr0;
612
+ $loader->classMap = ComposerStaticInit1cede32ff3b7e24593849743769fc31a::$classMap;
613
 
614
  }, null, ClassLoader::class);
615
  }
vendor/composer/installed.json CHANGED
@@ -14,7 +14,7 @@
14
  "reference": "b0c1bda3be5a35da44ba1ac28cc61c67d2ada465",
15
  "shasum": ""
16
  },
17
- "time": "2015-11-28T21:47:43+00:00",
18
  "type": "library",
19
  "installation-source": "dist",
20
  "autoload": {
@@ -55,7 +55,7 @@
55
  "require-dev": {
56
  "phpunit/phpunit": "^5.6"
57
  },
58
- "time": "2016-12-14T06:28:26+00:00",
59
  "type": "library",
60
  "installation-source": "dist",
61
  "autoload": {
@@ -116,7 +116,7 @@
116
  "j4mie/idiorm": "1.5.*",
117
  "php": ">=5.2.0"
118
  },
119
- "time": "2014-09-23T10:49:36+00:00",
120
  "type": "library",
121
  "installation-source": "dist",
122
  "autoload": {
@@ -180,7 +180,7 @@
180
  "require-dev": {
181
  "phpunit/phpunit": "~4.0|~5.0"
182
  },
183
- "time": "2016-01-26T21:23:30+00:00",
184
  "type": "library",
185
  "installation-source": "dist",
186
  "autoload": {
@@ -226,7 +226,7 @@
226
  "suggest": {
227
  "ext-mbstring": "For best performance"
228
  },
229
- "time": "2016-11-14T01:06:16+00:00",
230
  "type": "library",
231
  "extra": {
232
  "branch-alias": {
@@ -299,7 +299,7 @@
299
  "symfony/config": "",
300
  "symfony/yaml": ""
301
  },
302
- "time": "2017-01-02T20:30:24+00:00",
303
  "type": "library",
304
  "extra": {
305
  "branch-alias": {
@@ -354,7 +354,7 @@
354
  "require-dev": {
355
  "phpunit/phpunit": "~4.0|~5.0"
356
  },
357
- "time": "2015-11-04T20:07:17+00:00",
358
  "type": "library",
359
  "installation-source": "dist",
360
  "autoload": {
@@ -402,7 +402,7 @@
402
  "require-dev": {
403
  "phpunit/phpunit": "*"
404
  },
405
- "time": "2016-07-19T19:14:21+00:00",
406
  "type": "library",
407
  "installation-source": "dist",
408
  "autoload": {
@@ -451,7 +451,7 @@
451
  "phpunit/phpunit": ">=4.0",
452
  "soundasleep/component-tests": "dev-master"
453
  },
454
- "time": "2016-07-28T01:09:53+00:00",
455
  "type": "library",
456
  "installation-source": "dist",
457
  "autoload": {
@@ -504,7 +504,7 @@
504
  "mockery/mockery": "~0.9.1",
505
  "symfony/phpunit-bridge": "~3.2"
506
  },
507
- "time": "2016-12-29T10:02:40+00:00",
508
  "type": "library",
509
  "extra": {
510
  "branch-alias": {
@@ -559,7 +559,7 @@
559
  "require-dev": {
560
  "htmlawed/htmlawed": "dev-master"
561
  },
562
- "time": "2016-01-14T20:55:00+00:00",
563
  "type": "library",
564
  "installation-source": "dist",
565
  "autoload": {
@@ -614,7 +614,7 @@
614
  "symfony/debug": "~2.7",
615
  "symfony/phpunit-bridge": "~3.2"
616
  },
617
- "time": "2017-01-11T19:36:15+00:00",
618
  "type": "library",
619
  "extra": {
620
  "branch-alias": {
14
  "reference": "b0c1bda3be5a35da44ba1ac28cc61c67d2ada465",
15
  "shasum": ""
16
  },
17
+ "time": "2015-11-28 21:47:43",
18
  "type": "library",
19
  "installation-source": "dist",
20
  "autoload": {
55
  "require-dev": {
56
  "phpunit/phpunit": "^5.6"
57
  },
58
+ "time": "2016-12-14 06:28:26",
59
  "type": "library",
60
  "installation-source": "dist",
61
  "autoload": {
116
  "j4mie/idiorm": "1.5.*",
117
  "php": ">=5.2.0"
118
  },
119
+ "time": "2014-09-23 10:49:36",
120
  "type": "library",
121
  "installation-source": "dist",
122
  "autoload": {
180
  "require-dev": {
181
  "phpunit/phpunit": "~4.0|~5.0"
182
  },
183
+ "time": "2016-01-26 21:23:30",
184
  "type": "library",
185
  "installation-source": "dist",
186
  "autoload": {
226
  "suggest": {
227
  "ext-mbstring": "For best performance"
228
  },
229
+ "time": "2016-11-14 01:06:16",
230
  "type": "library",
231
  "extra": {
232
  "branch-alias": {
299
  "symfony/config": "",
300
  "symfony/yaml": ""
301
  },
302
+ "time": "2017-01-02 20:30:24",
303
  "type": "library",
304
  "extra": {
305
  "branch-alias": {
354
  "require-dev": {
355
  "phpunit/phpunit": "~4.0|~5.0"
356
  },
357
+ "time": "2015-11-04 20:07:17",
358
  "type": "library",
359
  "installation-source": "dist",
360
  "autoload": {
402
  "require-dev": {
403
  "phpunit/phpunit": "*"
404
  },
405
+ "time": "2016-07-19 19:14:21",
406
  "type": "library",
407
  "installation-source": "dist",
408
  "autoload": {
451
  "phpunit/phpunit": ">=4.0",
452
  "soundasleep/component-tests": "dev-master"
453
  },
454
+ "time": "2016-07-28 01:09:53",
455
  "type": "library",
456
  "installation-source": "dist",
457
  "autoload": {
504
  "mockery/mockery": "~0.9.1",
505
  "symfony/phpunit-bridge": "~3.2"
506
  },
507
+ "time": "2016-12-29 10:02:40",
508
  "type": "library",
509
  "extra": {
510
  "branch-alias": {
559
  "require-dev": {
560
  "htmlawed/htmlawed": "dev-master"
561
  },
562
+ "time": "2016-01-14 20:55:00",
563
  "type": "library",
564
  "installation-source": "dist",
565
  "autoload": {
614
  "symfony/debug": "~2.7",
615
  "symfony/phpunit-bridge": "~3.2"
616
  },
617
+ "time": "2017-01-11 19:36:15",
618
  "type": "library",
619
  "extra": {
620
  "branch-alias": {
views/invalidkey.html ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <% extends 'layout.html' %>
2
+
3
+ <% block content %>
4
+
5
+ <div class="wrap about-wrap">
6
+ <h1><%= __("All sending is currently paused!") %></h1>
7
+
8
+ <p class="about-text">
9
+ <%= __("Your key to send with MailPoet is invalid.") %>
10
+ </p>
11
+
12
+ <p>
13
+ <a class="button button-primary" target="_blank" href="https://account.mailpoet.com?s=<%= subscriber_count %>"><%= __('Visit MailPoet.com to purchase a key') %></a>
14
+ </p>
15
+ </div>
16
+ <% endblock %>
views/settings/mta.html CHANGED
@@ -54,16 +54,29 @@
54
  />
55
  </h3>
56
 
57
- <p class="mailpoet_description">
58
- <strong><%= __('Currently in Closed Beta') %></strong>
 
 
 
59
  <br />
60
- <%= __('[link]Sign up to our newsletter[/link] to get our latest news on our sending service plus other useful tips and tricks.')
61
- | replace({
62
- '[link]': '<a href="http://www.mailpoet.com/subscribe/" target="_blank">',
63
- '[/link]': '</a>'
64
- })
65
- | raw
66
- %>
 
 
 
 
 
 
 
 
 
 
67
  </p>
68
 
69
  <div class="mailpoet_status">
@@ -105,9 +118,9 @@
105
  <h3><%= __('Third-party') %></h3>
106
 
107
  <p class="mailpoet_description">
108
- <strong><%= __('Currently the best solution') %></strong>
109
  <br />
110
- <%= __('Send with an external email provider. This is usually not free.') %>
111
  <a
112
  href="http://docs.mailpoet.com/article/154-why-use-an-email-service-provider"
113
  target="_blank"
@@ -150,6 +163,10 @@
150
  name="mta[mailpoet_api_key]"
151
  value="<%=- settings.mta.mailpoet_api_key -%>"
152
  />
 
 
 
 
153
  </td>
154
  </tr>
155
  </tbody>
@@ -687,7 +704,7 @@
687
  if(settings.sender.address.length === 0) {
688
  // validation
689
  return MailPoet.Notice.error(
690
- 'The email could not be sent. Make sure the option "Email notifications" has a FROM email address in the Basics tab.',
691
  { scroll: true, static: true }
692
  );
693
  }
@@ -727,6 +744,45 @@
727
  });
728
  });
729
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
730
  // sending frequency update based on selected provider
731
  $('#mailpoet_smtp_provider').on('change keyup', setProviderForm);
732
  $('#mailpoet_web_host').on('change keyup', renderHostSendingFrequency);
@@ -825,6 +881,20 @@
825
  var method = getMethodFromGroup(group);
826
 
827
  $('#mta_method').val(method);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
828
  }
829
 
830
  function getMethodFromGroup(group) {
54
  />
55
  </h3>
56
 
57
+ <p
58
+ class="mailpoet_description<% if(settings.mta_group != 'mailpoet') %> mailpoet_hidden<% endif %>"
59
+ id="mailpoet_sending_method_active_text"
60
+ >
61
+ <strong><%= __("You're now sending with MailPoet!") %></strong>
62
  <br />
63
+ <%= __("Great, you're all set up. Your emails will now be sent quickly and reliably!") %>
64
+ </p>
65
+
66
+ <p
67
+ class="mailpoet_description<% if(settings.mta_group == 'mailpoet') %> mailpoet_hidden<% endif %>"
68
+ id="mailpoet_sending_method_inactive_text"
69
+ >
70
+ <strong><%= __("Solve all of your sending problems!") %></strong>
71
+ <br />
72
+ <%= __("We offer affordable email packages with speeds up to 50 times faster than the competition.") %>
73
+ <br/>
74
+ <br/>
75
+ <a
76
+ href="https://account.mailpoet.com?s=<%= total_subscribers %>"
77
+ class="button button-primary"
78
+ target="_blank"
79
+ ><%= __('View Email Plans') %></a>
80
  </p>
81
 
82
  <div class="mailpoet_status">
118
  <h3><%= __('Third-party') %></h3>
119
 
120
  <p class="mailpoet_description">
121
+ <strong><%= __('For SMTP, SendGrid or Amazon SES') %></strong>
122
  <br />
123
+ <%= __('We only recommend using a third-party service if you are a technical user. Tread carefully.') %>
124
  <a
125
  href="http://docs.mailpoet.com/article/154-why-use-an-email-service-provider"
126
  target="_blank"
163
  name="mta[mailpoet_api_key]"
164
  value="<%=- settings.mta.mailpoet_api_key -%>"
165
  />
166
+ <a
167
+ id="mailpoet_api_key_verify"
168
+ class="button-secondary"
169
+ ><%= __('Verify') %></a>
170
  </td>
171
  </tr>
172
  </tbody>
704
  if(settings.sender.address.length === 0) {
705
  // validation
706
  return MailPoet.Notice.error(
707
+ '<%= __('The email could not be sent. Make sure the option "Email notifications" has a FROM email address in the Basics tab.') %>',
708
  { scroll: true, static: true }
709
  );
710
  }
744
  });
745
  });
746
 
747
+ // verifying api key
748
+ $('#mailpoet_api_key_verify').on('click', function() {
749
+ // get api key
750
+ var key = $('#mailpoet_api_key').val();
751
+
752
+ if(key.length === 0) {
753
+ // validation
754
+ return MailPoet.Notice.error(
755
+ '<%= __('Please specify an API key before validating it.') %>',
756
+ { scroll: true, static: true }
757
+ );
758
+ }
759
+
760
+ MailPoet.Modal.loading(true);
761
+ MailPoet.Ajax.post({
762
+ endpoint: 'services',
763
+ action: 'verifyMailPoetKey',
764
+ data: {
765
+ key: key
766
+ }
767
+ }).always(function() {
768
+ MailPoet.Modal.loading(false);
769
+ }).done(function(response) {
770
+ // Hide server error notices
771
+ $('.mailpoet_notice_server').hide();
772
+ MailPoet.Notice.success(
773
+ response.data.message,
774
+ { scroll: true }
775
+ );
776
+ }).fail(function(response) {
777
+ if (response.errors.length > 0) {
778
+ MailPoet.Notice.error(
779
+ response.errors.map(function(error) { return error.message; }),
780
+ { scroll: true }
781
+ );
782
+ }
783
+ });
784
+ });
785
+
786
  // sending frequency update based on selected provider
787
  $('#mailpoet_smtp_provider').on('change keyup', setProviderForm);
788
  $('#mailpoet_web_host').on('change keyup', renderHostSendingFrequency);
881
  var method = getMethodFromGroup(group);
882
 
883
  $('#mta_method').val(method);
884
+
885
+ // set MailPoet method description
886
+ $('#mailpoet_sending_method_active_text')
887
+ .toggleClass('mailpoet_hidden', group !== 'mailpoet');
888
+ $('#mailpoet_sending_method_inactive_text')
889
+ .toggleClass('mailpoet_hidden', group === 'mailpoet');
890
+
891
+ if(group === 'mailpoet') {
892
+ // Verify key on saving
893
+ $('#mailpoet_api_key_verify').trigger('click');
894
+ } else {
895
+ // Hide server error notices
896
+ $('.mailpoet_notice_server').hide();
897
+ }
898
  }
899
 
900
  function getMethodFromGroup(group) {