MailPoet Newsletters (New) - Version 3.8.1

Version Description

  • 2018-07-24 =
  • Added: images can be used as backgrounds for column layout blocks;
  • Added: notification if cron ping does not work correctly during first sending attempt;
  • Added: new, prettier email type icon;
  • Added: TLS 1.2 support to Swiftmailer to prevent SMTP sending issues;
  • Added: updated error messages coming from the sending service;
  • Added: clarified sending tab to encourage using our free sending service;
  • Fixed: "Create New Form" link in subscription widget now creates a new form again;
  • Fixed: removed call to action for MSS service for users already using MSS.
Download this release

Release Info

Developer wysija
Plugin Icon 128x128 MailPoet Newsletters (New)
Version 3.8.1
Comparing to
See all releases

Code changes from version 3.8 to 3.8.1

Files changed (55) hide show
  1. assets/js/{admin.c2004602.js → admin.2c99c664.js} +9 -6
  2. assets/js/{admin_vendor.d548ad76.js → admin_vendor.61bce094.js} +6 -3
  3. assets/js/lib/analytics.js +17 -2
  4. assets/js/lib/mailpoet_shortcodes/plugin.js +21 -20
  5. assets/js/{mailpoet.268ef52f.js → mailpoet.2657b5cc.js} +0 -0
  6. assets/js/manifest.json +5 -5
  7. assets/js/{newsletter_editor.8d56ced0.js → newsletter_editor.3c3003a1.js} +455 -387
  8. assets/js/{vendor.04cc71ee.js → vendor.b1917743.js} +0 -0
  9. lang/mailpoet-ca.mo +0 -0
  10. lang/mailpoet-da_DK.mo +0 -0
  11. lang/mailpoet-de_DE.mo +0 -0
  12. lang/mailpoet-en_GB.mo +0 -0
  13. lang/mailpoet-es_ES.mo +0 -0
  14. lang/mailpoet-fa_IR.mo +0 -0
  15. lang/mailpoet-fr_CA.mo +0 -0
  16. lang/mailpoet-fr_FR.mo +0 -0
  17. lang/mailpoet-it_IT.mo +0 -0
  18. lang/mailpoet-ja.mo +0 -0
  19. lang/mailpoet-nl_NL.mo +0 -0
  20. lang/mailpoet-pl_PL.mo +0 -0
  21. lang/mailpoet-pt_BR.mo +0 -0
  22. lang/mailpoet-pt_PT.mo +0 -0
  23. lang/mailpoet-ru_RU.mo +0 -0
  24. lang/mailpoet-sq.mo +0 -0
  25. lang/mailpoet-sv_SE.mo +0 -0
  26. lang/mailpoet-tr_TR.mo +0 -0
  27. lang/mailpoet-zh_CN.mo +0 -0
  28. lang/mailpoet.pot +80 -37
  29. lib/API/JSON/v1/Services.php +10 -0
  30. lib/Analytics/Analytics.php +37 -0
  31. lib/Cron/Daemon.php +1 -1
  32. lib/Cron/Workers/Scheduler.php.orig +0 -212
  33. lib/Cron/Workers/SendingQueue/SendingQueue.php +5 -4
  34. lib/Form/Widget.php +2 -1
  35. lib/Mailer/MailerLog.php +30 -3
  36. lib/Mailer/Methods/MailPoet.php +62 -5
  37. lib/Newsletter/Renderer/Columns/Renderer.php +26 -16
  38. lib/Newsletter/Renderer/Renderer.php +2 -0
  39. lib/Services/Bridge/API.php +5 -1
  40. lib/Twig/Analytics.php +10 -0
  41. mailpoet.php +2 -2
  42. readme.txt +63 -25
  43. vendor/autoload.php +1 -1
  44. vendor/composer/autoload_real.php +7 -7
  45. vendor/composer/autoload_static.php +6 -6
  46. vendor/composer/installed.json +16 -9
  47. vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php +1 -1
  48. views/layout.html +2 -0
  49. views/newsletter/editor.html +4 -0
  50. views/newsletter/templates/blocks/container/block.hbs +20 -6
  51. views/newsletter/templates/blocks/container/settings.hbs +33 -3
  52. views/newsletter/templates/blocks/image/block.hbs +1 -1
  53. views/newsletter/templates/blocks/image/settings.hbs +1 -1
  54. views/settings.html +1 -1
  55. views/settings/premium.html +7 -4
assets/js/{admin.c2004602.js → admin.2c99c664.js} RENAMED
@@ -15624,7 +15624,8 @@ var NotificationScheduling = _react2.default.createClass({
15624
  _react2.default.createElement(_select2.default, {
15625
  field: intervalField,
15626
  item: this.getCurrentValue(),
15627
- onValueChange: this.handleIntervalChange
 
15628
  }),
15629
  nthWeekDaySelection,
15630
  monthDaySelection,
@@ -18496,6 +18497,7 @@ var NewsletterSend = _react2.default.createClass({
18496
  {
18497
  id: 'mailpoet_newsletter',
18498
  fields: fields,
 
18499
  item: this.state.item,
18500
  loading: this.state.loading,
18501
  onChange: this.handleFormChange,
@@ -21264,10 +21266,14 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
21264
 
21265
  MailPoet.Router = new (Backbone.Router.extend({
21266
  routes: {
21267
- '': 'sendingMethodGroup', // the default tab is currently mta, needs its own method
21268
  'mta(/:group)': 'sendingMethodGroup',
21269
  '(:tab)': 'tabs'
21270
  },
 
 
 
 
21271
  sendingMethodGroup: function (group) { // eslint-disable-line func-names
21272
  // display mta tab
21273
  this.tabs('mta');
@@ -21299,10 +21305,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_
21299
  jQuery('#mailpoet_sending_method_setup').fadeIn();
21300
  }
21301
  },
21302
- tabs: function (tabStr) { // eslint-disable-line func-names
21303
- // set default tab
21304
- var tab = tabStr || 'mta';
21305
-
21306
  // reset all active tabs
21307
  jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
21308
 
15624
  _react2.default.createElement(_select2.default, {
15625
  field: intervalField,
15626
  item: this.getCurrentValue(),
15627
+ onValueChange: this.handleIntervalChange,
15628
+ automationId: 'newsletter_interval_type'
15629
  }),
15630
  nthWeekDaySelection,
15631
  monthDaySelection,
18497
  {
18498
  id: 'mailpoet_newsletter',
18499
  fields: fields,
18500
+ automationId: 'newsletter_send_form',
18501
  item: this.state.item,
18502
  loading: this.state.loading,
18503
  onChange: this.handleFormChange,
21266
 
21267
  MailPoet.Router = new (Backbone.Router.extend({
21268
  routes: {
21269
+ '': 'defaultRoute',
21270
  'mta(/:group)': 'sendingMethodGroup',
21271
  '(:tab)': 'tabs'
21272
  },
21273
+ defaultRoute: function () { // eslint-disable-line func-names
21274
+ // display basics tab as default
21275
+ this.tabs('basics');
21276
+ },
21277
  sendingMethodGroup: function (group) { // eslint-disable-line func-names
21278
  // display mta tab
21279
  this.tabs('mta');
21305
  jQuery('#mailpoet_sending_method_setup').fadeIn();
21306
  }
21307
  },
21308
+ tabs: function (tab) { // eslint-disable-line func-names
 
 
 
21309
  // reset all active tabs
21310
  jQuery('.nav-tab-wrapper a').removeClass('nav-tab-active');
21311
 
assets/js/{admin_vendor.d548ad76.js → admin_vendor.61bce094.js} RENAMED
@@ -51254,7 +51254,8 @@ var FormFieldSelect = _react2.default.createClass({
51254
  name: this.props.field.name,
51255
  id: 'field_' + this.props.field.name,
51256
  value: this.props.item[this.props.field.name] || '',
51257
- onChange: this.props.onValueChange
 
51258
  }, this.props.field.validation),
51259
  placeholder,
51260
  options
@@ -60989,7 +60990,8 @@ var ListingGroups = function (_React$Component) {
60989
  className: classes,
60990
  onClick: function onClick() {
60991
  return _this2.handleSelect(group.name);
60992
- }
 
60993
  },
60994
  group.label,
60995
  _react2.default.createElement(
@@ -61401,7 +61403,8 @@ var Form = _react2.default.createClass({
61401
  _this5.form = c;
61402
  },
61403
  className: formClasses,
61404
- onSubmit: this.props.onSubmit !== undefined ? this.props.onSubmit : this.handleSubmit
 
61405
  },
61406
  errors,
61407
  _react2.default.createElement(
51254
  name: this.props.field.name,
51255
  id: 'field_' + this.props.field.name,
51256
  value: this.props.item[this.props.field.name] || '',
51257
+ onChange: this.props.onValueChange,
51258
+ 'data-automation-id': this.props.automationId
51259
  }, this.props.field.validation),
51260
  placeholder,
51261
  options
60990
  className: classes,
60991
  onClick: function onClick() {
60992
  return _this2.handleSelect(group.name);
60993
+ },
60994
+ 'data-automation-id': 'filters_' + group.label.replace(' ', '_').toLowerCase()
60995
  },
60996
  group.label,
60997
  _react2.default.createElement(
61403
  _this5.form = c;
61404
  },
61405
  className: formClasses,
61406
+ onSubmit: this.props.onSubmit !== undefined ? this.props.onSubmit : this.handleSubmit,
61407
+ 'data-automation-id': this.props.automationId
61408
  },
61409
  errors,
61410
  _react2.default.createElement(
assets/js/lib/analytics.js CHANGED
@@ -6,10 +6,25 @@ window.mixpanelTrackingId = "8cce373b255e5a76fb22d57b85db0c92";
6
 
7
  if (mailpoet_analytics_enabled) {
8
 
9
- mixpanel.init(window.mixpanelTrackingId);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  if (mailpoet_analytics_data != null) {
12
- mixpanel.track('MailPoet 3', mailpoet_analytics_data);
13
  }
14
 
15
  }
6
 
7
  if (mailpoet_analytics_enabled) {
8
 
9
+ mixpanel.init(window.mixpanelTrackingId, {
10
+ loaded: function(mixpanel) {
11
+ // used in lib/Analytics/Analytics.php
12
+ document.cookie = "mixpanel_distinct_id=" + mixpanel.get_distinct_id();
13
+ }
14
+ });
15
+
16
+ mixpanel.register({'Platform': 'Plugin'});
17
+
18
+ if(typeof window.mailpoet_analytics_public_id === 'string' && window.mailpoet_analytics_public_id.length > 0) {
19
+ if(window.mailpoet_analytics_new_public_id === true) {
20
+ mixpanel.alias(window.mailpoet_analytics_public_id);
21
+ } else {
22
+ mixpanel.identify(window.mailpoet_analytics_public_id);
23
+ }
24
+ }
25
 
26
  if (mailpoet_analytics_data != null) {
27
+ mixpanel.people.set(mailpoet_analytics_data);
28
  }
29
 
30
  }
assets/js/lib/mailpoet_shortcodes/plugin.js CHANGED
@@ -8,33 +8,34 @@
8
  * its placeholder into editor text.
9
  */
10
 
11
- /*jshint unused:false */
12
- /*global tinymce:true */
13
- tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
14
- var appendLabelAndClose = function(shortcode) {
15
- editor.insertContent(shortcode);
16
- editor.windowManager.close();
17
- },
18
- generateOnClickFunc = function(shortcode) {
19
- return function() {
20
- appendLabelAndClose(shortcode);
21
- };
22
  };
 
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
- onclick: function() {
27
- var shortcodes = [],
28
- configShortcodes = editor.settings.mailpoet_shortcodes;
 
29
 
30
- for (var segment in configShortcodes) {
31
- if (configShortcodes.hasOwnProperty(segment)) {
32
  shortcodes.push({
33
  type: 'label',
34
  text: segment
35
  });
36
 
37
- for (var i = 0; i < configShortcodes[segment].length; i += 1) {
38
  shortcodes.push({
39
  type: 'button',
40
  text: configShortcodes[segment][i].text,
@@ -42,12 +43,12 @@ tinymce.PluginManager.add('mailpoet_shortcodes', function(editor, url) {
42
  });
43
  }
44
  }
45
- }
46
 
47
  // Open window
48
  editor.windowManager.open({
49
- height: parseInt(editor.getParam('plugin_mailpoet_shortcodes_height', 400)),
50
- width: parseInt(editor.getParam('plugin_mailpoet_shortcodes_width', 450)),
51
  autoScroll: true,
52
  title: editor.settings.mailpoet_shortcodes_window_title,
53
  body: shortcodes,
8
  * its placeholder into editor text.
9
  */
10
 
11
+ /* jshint unused:false */
12
+ /* global tinymce:true */
13
+ tinymce.PluginManager.add('mailpoet_shortcodes', function tinyMceAdd(editor) {
14
+ var appendLabelAndClose = function appendLabelAndCLose(shortcode) {
15
+ editor.insertContent(shortcode);
16
+ editor.windowManager.close();
17
+ };
18
+ var generateOnClickFunc = function generateOnClickFunc(shortcode) {
19
+ return function appendAndClose() {
20
+ appendLabelAndClose(shortcode);
 
21
  };
22
+ };
23
 
24
  editor.addButton('mailpoet_shortcodes', {
25
  icon: 'mailpoet_shortcodes',
26
+ onclick: function onClick() {
27
+ var shortcodes = [];
28
+ var configShortcodes = editor.settings.mailpoet_shortcodes;
29
+ var i;
30
 
31
+ Object.keys(configShortcodes).forEach(function configShortcodesLoop(segment) {
32
+ if (Object.prototype.hasOwnProperty.call(configShortcodes, segment)) {
33
  shortcodes.push({
34
  type: 'label',
35
  text: segment
36
  });
37
 
38
+ for (i = 0; i < configShortcodes[segment].length; i += 1) {
39
  shortcodes.push({
40
  type: 'button',
41
  text: configShortcodes[segment][i].text,
43
  });
44
  }
45
  }
46
+ });
47
 
48
  // Open window
49
  editor.windowManager.open({
50
+ height: parseInt(editor.getParam('plugin_mailpoet_shortcodes_height', 400), 10),
51
+ width: parseInt(editor.getParam('plugin_mailpoet_shortcodes_width', 450), 10),
52
  autoScroll: true,
53
  title: editor.settings.mailpoet_shortcodes_window_title,
54
  body: shortcodes,
assets/js/{mailpoet.268ef52f.js → mailpoet.2657b5cc.js} RENAMED
File without changes
assets/js/manifest.json CHANGED
@@ -1,10 +1,10 @@
1
  {
2
  "mp2migrator.js": "mp2migrator.b51cde67.js",
3
  "public.js": "public.0ac1326d.js",
4
- "admin.js": "admin.c2004602.js",
5
- "admin_vendor.js": "admin_vendor.d548ad76.js",
6
  "form_editor.js": "form_editor.72f36d4f.js",
7
- "mailpoet.js": "mailpoet.268ef52f.js",
8
- "newsletter_editor.js": "newsletter_editor.8d56ced0.js",
9
- "vendor.js": "vendor.04cc71ee.js"
10
  }
1
  {
2
  "mp2migrator.js": "mp2migrator.b51cde67.js",
3
  "public.js": "public.0ac1326d.js",
4
+ "admin.js": "admin.2c99c664.js",
5
+ "admin_vendor.js": "admin_vendor.61bce094.js",
6
  "form_editor.js": "form_editor.72f36d4f.js",
7
+ "mailpoet.js": "mailpoet.2657b5cc.js",
8
+ "newsletter_editor.js": "newsletter_editor.3c3003a1.js",
9
+ "vendor.js": "vendor.b1917743.js"
10
  }
assets/js/{newsletter_editor.8d56ced0.js → newsletter_editor.3c3003a1.js} RENAMED
@@ -12,7 +12,7 @@ module.exports = jQuery;
12
 
13
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
14
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
15
- __webpack_require__(22),
16
  __webpack_require__(7),
17
  __webpack_require__(5),
18
  __webpack_require__(291)
@@ -1681,53 +1681,6 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscor
1681
  /***/ 22:
1682
  /***/ (function(module, exports, __webpack_require__) {
1683
 
1684
- var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
1685
- __webpack_require__(38),
1686
- __webpack_require__(23),
1687
- __webpack_require__(287)
1688
- ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Backbone, Marionette, BackboneRadio) { // eslint-disable-line func-names
1689
- var Radio = BackboneRadio;
1690
-
1691
- var AppView = Marionette.View.extend({
1692
- el: '#mailpoet_editor',
1693
- regions: {
1694
- stylesRegion: '#mailpoet_editor_styles',
1695
- contentRegion: '#mailpoet_editor_content',
1696
- sidebarRegion: '#mailpoet_editor_sidebar',
1697
- bottomRegion: '#mailpoet_editor_bottom',
1698
- headingRegion: '#mailpoet_editor_heading'
1699
- }
1700
- });
1701
-
1702
- var EditorApplication = Marionette.Application.extend({
1703
- region: '#mailpoet_editor',
1704
-
1705
- onStart: function () { // eslint-disable-line func-names
1706
- this._appView = new AppView();
1707
- this.showView(this._appView);
1708
- },
1709
-
1710
- getChannel: function (channel) { // eslint-disable-line func-names
1711
- if (channel === undefined) {
1712
- return Radio.channel('global');
1713
- }
1714
- return Radio.channel(channel);
1715
- }
1716
- });
1717
-
1718
- var app = new EditorApplication();
1719
- window.EditorApplication = app;
1720
-
1721
- return app;
1722
- }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
1723
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
1724
-
1725
-
1726
- /***/ }),
1727
-
1728
- /***/ 23:
1729
- /***/ (function(module, exports, __webpack_require__) {
1730
-
1731
  // MarionetteJS (Backbone.Marionette)
1732
  // ----------------------------------
1733
  // v3.2.0
@@ -5218,6 +5171,53 @@ return Marionette;
5218
  //# sourceMappingURL=backbone.marionette.js.map
5219
 
5220
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5221
  /***/ }),
5222
 
5223
  /***/ 284:
@@ -17324,7 +17324,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
17324
  * Button content block
17325
  */
17326
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
17327
- __webpack_require__(22),
17328
  __webpack_require__(39),
17329
  __webpack_require__(5),
17330
  __webpack_require__(7),
@@ -17483,7 +17483,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
17483
  * Divider content block
17484
  */
17485
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
17486
- __webpack_require__(22),
17487
  __webpack_require__(39),
17488
  __webpack_require__(7),
17489
  __webpack_require__(10)
@@ -18628,8 +18628,8 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
18628
  * BlockToolsView, BlockSettingsView and BlockWidgetView are optional.
18629
  */
18630
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
18631
- __webpack_require__(22),
18632
  __webpack_require__(23),
 
18633
  __webpack_require__(58),
18634
  __webpack_require__(7),
18635
  __webpack_require__(10),
@@ -18968,7 +18968,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
18968
  * For more check: http://marionettejs.com/docs/marionette.behaviors.html#behaviorslookup
18969
  */
18970
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
18971
- __webpack_require__(23)
18972
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (BackboneMarionette) { // eslint-disable-line func-names
18973
  var Marionette = BackboneMarionette;
18974
  var BehaviorsLookup = {};
@@ -31500,7 +31500,7 @@ module.exports = Backbone.SuperModel;
31500
 
31501
  __webpack_require__(7);
31502
  __webpack_require__(38);
31503
- __webpack_require__(23);
31504
  __webpack_require__(58);
31505
  __webpack_require__(288);
31506
  __webpack_require__(287);
@@ -31510,7 +31510,7 @@ __webpack_require__(659);
31510
  __webpack_require__(514);
31511
  __webpack_require__(515);
31512
  __webpack_require__(661);
31513
- __webpack_require__(22);
31514
  __webpack_require__(662);
31515
  __webpack_require__(663);
31516
  __webpack_require__(664);
@@ -31528,19 +31528,20 @@ __webpack_require__(673);
31528
  __webpack_require__(674);
31529
  __webpack_require__(675);
31530
  __webpack_require__(676);
31531
- __webpack_require__(39);
31532
  __webpack_require__(677);
31533
- __webpack_require__(289);
31534
  __webpack_require__(678);
31535
- __webpack_require__(290);
31536
  __webpack_require__(679);
 
31537
  __webpack_require__(680);
31538
  __webpack_require__(681);
31539
  __webpack_require__(682);
31540
  __webpack_require__(683);
31541
  __webpack_require__(684);
31542
  __webpack_require__(685);
31543
- module.exports = __webpack_require__(686);
 
31544
 
31545
 
31546
  /***/ }),
@@ -35730,7 +35731,7 @@ will produce an inaccurate conversion value. The same issue exists with the cx/c
35730
  /***/ (function(module, exports, __webpack_require__) {
35731
 
35732
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35733
- __webpack_require__(22),
35734
  __webpack_require__(58),
35735
  __webpack_require__(7)
35736
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (App, SuperModel, _) { // eslint-disable-line func-names
@@ -35785,8 +35786,8 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
35785
 
35786
 
35787
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35788
- __webpack_require__(22),
35789
  __webpack_require__(23),
 
35790
  __webpack_require__(58),
35791
  __webpack_require__(7)
35792
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (App, Marionette, SuperModel, _) { // eslint-disable-line func-names
@@ -35883,11 +35884,11 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
35883
 
35884
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
35885
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35886
- __webpack_require__(22),
35887
  __webpack_require__(101),
35888
  __webpack_require__(5),
35889
  __webpack_require__(38),
35890
- __webpack_require__(23),
35891
  __webpack_require__(58),
35892
  __webpack_require__(7),
35893
  __webpack_require__(10)
@@ -36282,7 +36283,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
36282
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36283
 
36284
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36285
- __webpack_require__(22),
36286
  __webpack_require__(58),
36287
  __webpack_require__(7),
36288
  __webpack_require__(5)
@@ -36397,9 +36398,9 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36397
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36398
 
36399
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36400
- __webpack_require__(22),
36401
- __webpack_require__(38),
36402
  __webpack_require__(23),
 
 
36403
  __webpack_require__(7),
36404
  __webpack_require__(10),
36405
  __webpack_require__(5)
@@ -36449,12 +36450,12 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36449
 
36450
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
36451
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36452
- __webpack_require__(22),
36453
  __webpack_require__(101),
36454
  __webpack_require__(5),
36455
  __webpack_require__(294),
36456
  __webpack_require__(38),
36457
- __webpack_require__(23),
36458
  __webpack_require__(10),
36459
  __webpack_require__(514),
36460
  __webpack_require__(515),
@@ -36793,7 +36794,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
36793
  * Adds a color picker integration with the view
36794
  */
36795
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36796
- __webpack_require__(23),
36797
  __webpack_require__(47),
36798
  __webpack_require__(5),
36799
  __webpack_require__(513)
@@ -36851,7 +36852,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
36851
  * accept droppables
36852
  */
36853
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36854
- __webpack_require__(23),
36855
  __webpack_require__(7),
36856
  __webpack_require__(10),
36857
  __webpack_require__(47),
@@ -37342,7 +37343,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37342
  * Part of the drag&drop behavior.
37343
  */
37344
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37345
- __webpack_require__(23),
37346
  __webpack_require__(7),
37347
  __webpack_require__(10),
37348
  __webpack_require__(47),
@@ -37498,7 +37499,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37498
  * Highlights a container block when hovering over its tools
37499
  */
37500
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37501
- __webpack_require__(23),
37502
  __webpack_require__(47)
37503
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
37504
  var BL = BehaviorsLookup;
@@ -37532,7 +37533,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37532
  * Highlights a block that is being edited
37533
  */
37534
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37535
- __webpack_require__(23),
37536
  __webpack_require__(47)
37537
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
37538
  var BL = BehaviorsLookup;
@@ -37560,13 +37561,334 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37560
  /***/ 673:
37561
  /***/ (function(module, exports, __webpack_require__) {
37562
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37563
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37564
  * ResizableBehavior
37565
  *
37566
  * Allows resizing elements within a block
37567
  */
37568
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37569
- __webpack_require__(23),
37570
  __webpack_require__(47),
37571
  __webpack_require__(288)
37572
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup, interact) { // eslint-disable-line func-names
@@ -37645,7 +37967,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37645
 
37646
  /***/ }),
37647
 
37648
- /***/ 674:
37649
  /***/ (function(module, exports, __webpack_require__) {
37650
 
37651
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -37654,7 +37976,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37654
  * Allows sorting elements within a collection
37655
  */
37656
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37657
- __webpack_require__(23),
37658
  __webpack_require__(7),
37659
  __webpack_require__(47)
37660
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, _, BehaviorsLookup) { // eslint-disable-line func-names
@@ -37694,7 +38016,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37694
 
37695
  /***/ }),
37696
 
37697
- /***/ 675:
37698
  /***/ (function(module, exports, __webpack_require__) {
37699
 
37700
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -37703,7 +38025,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37703
  * Opens up settings of a BlockView if contents are clicked upon
37704
  */
37705
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37706
- __webpack_require__(23),
37707
  __webpack_require__(10),
37708
  __webpack_require__(47)
37709
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, jQuery, BehaviorsLookup) { // eslint-disable-line func-names
@@ -37734,7 +38056,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37734
 
37735
  /***/ }),
37736
 
37737
- /***/ 676:
37738
  /***/ (function(module, exports, __webpack_require__) {
37739
 
37740
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
@@ -37743,7 +38065,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37743
  * Adds TinyMCE text editing capabilities to a view
37744
  */
37745
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37746
- __webpack_require__(23),
37747
  __webpack_require__(7),
37748
  __webpack_require__(47)
37749
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function textEditorBehavior(Marionette, _, BehaviorsLookup) {
@@ -37832,7 +38154,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37832
 
37833
  /***/ }),
37834
 
37835
- /***/ 677:
37836
  /***/ (function(module, exports, __webpack_require__) {
37837
 
37838
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -37843,10 +38165,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
37843
  */
37844
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37845
  __webpack_require__(38),
37846
- __webpack_require__(23),
37847
  __webpack_require__(7),
37848
  __webpack_require__(10),
37849
- __webpack_require__(22),
37850
  __webpack_require__(39)
37851
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Backbone, Marionette, _, jQuery, App, BaseBlock) {
37852
  'use strict';
@@ -37877,6 +38199,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
37877
  return this._getDefaults({
37878
  type: 'container',
37879
  orientation: 'vertical',
 
 
 
 
37880
  styles: {
37881
  block: {
37882
  backgroundColor: 'transparent'
@@ -38076,16 +38402,19 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38076
  });
38077
 
38078
  Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
 
 
 
 
 
38079
  getTemplate: function () { return window.templates.containerBlockSettings; },
38080
  events: function () {
38081
  return {
38082
  'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
38083
- 'click .mailpoet_done_editing': 'close'
 
38084
  };
38085
  },
38086
- regions: {
38087
- columnsSettingsRegion: '.mailpoet_container_columns_settings'
38088
- },
38089
  initialize: function () {
38090
  base.BlockSettingsView.prototype.initialize.apply(this, arguments);
38091
 
@@ -38093,8 +38422,14 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38093
  collection: this.model.get('blocks')
38094
  });
38095
  },
38096
- onRender: function () {
38097
- this.showChildView('columnsSettingsRegion', this._columnsSettingsView);
 
 
 
 
 
 
38098
  }
38099
  });
38100
 
@@ -38209,7 +38544,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38209
 
38210
  /***/ }),
38211
 
38212
- /***/ 678:
38213
  /***/ (function(module, exports, __webpack_require__) {
38214
 
38215
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -38217,7 +38552,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38217
  * Image content block
38218
  */
38219
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38220
- __webpack_require__(22),
38221
  __webpack_require__(39),
38222
  __webpack_require__(7),
38223
  __webpack_require__(5),
@@ -38289,6 +38624,11 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38289
  });
38290
 
38291
  Module.ImageBlockSettingsView = base.BlockSettingsView.extend({
 
 
 
 
 
38292
  onRender: function () {
38293
  MailPoet.helpTooltip.show(document.getElementById('tooltip-designer-full-width'), {
38294
  tooltipId: 'tooltip-editor-full-width',
@@ -38303,11 +38643,9 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38303
  events: function () {
38304
  return {
38305
  'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
38306
- 'input .mailpoet_field_image_address': 'changeAddress',
38307
  'input .mailpoet_field_image_alt_text': _.partial(this.changeField, 'alt'),
38308
  'change .mailpoet_field_image_full_width': _.partial(this.changeBoolCheckboxField, 'fullWidth'),
38309
  'change .mailpoet_field_image_alignment': _.partial(this.changeField, 'styles.block.textAlign'),
38310
- 'click .mailpoet_field_image_select_another_image': 'showMediaManager',
38311
  'click .mailpoet_done_editing': 'close',
38312
  'input .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
38313
  'change .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
@@ -38334,284 +38672,14 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38334
  this.$('.mailpoet_field_image_width').val(width);
38335
  this.$('.mailpoet_field_image_width_input').val(width);
38336
  },
38337
- initialize: function (options) {
38338
- base.BlockSettingsView.prototype.initialize.apply(this, arguments);
38339
-
38340
- if (options.showImageManager) {
38341
- this.showMediaManager();
38342
- }
38343
- },
38344
- showMediaManager: function () {
38345
- var that = this;
38346
- var MediaManager;
38347
- var theFrame;
38348
- if (this._mediaManager) {
38349
- this._mediaManager.resetSelections();
38350
- this._mediaManager.open();
38351
- return;
38352
- }
38353
-
38354
- MediaManager = window.wp.media.view.MediaFrame.Select.extend({
38355
-
38356
- initialize: function () {
38357
- window.wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
38358
-
38359
- _.defaults(this.options, {
38360
- multiple: true,
38361
- editing: false,
38362
- state: 'insert'
38363
- });
38364
-
38365
- this.createSelection();
38366
- this.createStates();
38367
- this.bindHandlers();
38368
- this.createIframeStates();
38369
-
38370
- // Hide title
38371
- this.$el.addClass('hide-title');
38372
- },
38373
-
38374
- resetSelections: function () {
38375
- this.state().get('selection').reset();
38376
- },
38377
-
38378
- createQuery: function (options) {
38379
- var query = window.wp.media.query(options);
38380
- return query;
38381
- },
38382
-
38383
- createStates: function () {
38384
- var options = this.options;
38385
-
38386
- // Add the default states.
38387
- this.states.add([
38388
- // Main states.
38389
- new window.wp.media.controller.Library({
38390
- id: 'insert',
38391
- title: 'Add images',
38392
- priority: 20,
38393
- toolbar: 'main-insert',
38394
- filterable: 'image',
38395
- library: this.createQuery(options.library),
38396
- multiple: options.multiple ? 'reset' : false,
38397
- editable: false,
38398
-
38399
- // If the user isn't allowed to edit fields,
38400
- // can they still edit it locally?
38401
- allowLocalEdits: false,
38402
-
38403
- // Show the attachment display settings.
38404
- displaySettings: false,
38405
- // Update user settings when users adjust the
38406
- // attachment display settings.
38407
- displayUserSettings: false
38408
- })
38409
- ]);
38410
-
38411
- if (window.wp.media.view.settings.post.featuredImageId) {
38412
- this.states.add(new window.wp.media.controller.FeaturedImage());
38413
- }
38414
- },
38415
-
38416
- bindHandlers: function () {
38417
- var handlers;
38418
- // from Select
38419
- this.on('router:create:browse', this.createRouter, this);
38420
- this.on('router:render:browse', this.browseRouter, this);
38421
- this.on('content:create:browse', this.browseContent, this);
38422
- this.on('content:render:upload', this.uploadContent, this);
38423
- this.on('toolbar:create:select', this.createSelectToolbar, this);
38424
-
38425
- this.on('menu:create:gallery', this.createMenu, this);
38426
- this.on('toolbar:create:main-insert', this.createToolbar, this);
38427
- this.on('toolbar:create:main-gallery', this.createToolbar, this);
38428
- this.on('toolbar:create:main-embed', this.mainEmbedToolbar, this);
38429
-
38430
- this.on('updateExcluded', this.browseContent, this);
38431
-
38432
- handlers = {
38433
- content: {
38434
- embed: 'embedContent',
38435
- 'edit-selection': 'editSelectionContent'
38436
- },
38437
- toolbar: {
38438
- 'main-insert': 'mainInsertToolbar'
38439
- }
38440
- };
38441
-
38442
- _.each(handlers, function (regionHandlers, region) {
38443
- _.each(regionHandlers, function (callback, handler) {
38444
- this.on(region + ':render:' + handler, this[callback], this);
38445
- }, this);
38446
- }, this);
38447
- },
38448
-
38449
- uploadContent: function () {
38450
- window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
38451
- this.$el.addClass('hide-toolbar');
38452
- },
38453
-
38454
- // Content
38455
- embedContent: function () {
38456
- var view = new window.wp.media.view.Embed({
38457
- controller: this,
38458
- model: this.state()
38459
- }).render();
38460
-
38461
- this.content.set(view);
38462
- view.url.focus();
38463
- },
38464
-
38465
- editSelectionContent: function () {
38466
- var state = this.state();
38467
- var selection = state.get('selection');
38468
- var view;
38469
-
38470
- view = new window.wp.media.view.AttachmentsBrowser({
38471
- controller: this,
38472
- collection: selection,
38473
- selection: selection,
38474
- model: state,
38475
- sortable: true,
38476
- search: false,
38477
- dragInfo: true,
38478
-
38479
- AttachmentView: window.wp.media.view.Attachment.EditSelection
38480
- }).render();
38481
-
38482
- view.toolbar.set('backToLibrary', {
38483
- text: 'Return to library',
38484
- priority: -100,
38485
-
38486
- click: function () {
38487
- this.controller.content.mode('browse');
38488
- }
38489
- });
38490
-
38491
- // Browse our library of attachments.
38492
- this.content.set(view);
38493
- },
38494
-
38495
- // Toolbars
38496
- selectionStatusToolbar: function (view) {
38497
- var editable = this.state().get('editable');
38498
-
38499
- view.set('selection', new window.wp.media.view.Selection({
38500
- controller: this,
38501
- collection: this.state().get('selection'),
38502
- priority: -40,
38503
-
38504
- // If the selection is editable, pass the callback to
38505
- // switch the content mode.
38506
- editable: editable && function () {
38507
- this.controller.content.mode('edit-selection');
38508
- }
38509
- }).render());
38510
- },
38511
-
38512
- mainInsertToolbar: function (view) {
38513
- var controller = this;
38514
-
38515
- this.selectionStatusToolbar(view);
38516
-
38517
- view.set('insert', {
38518
- style: 'primary',
38519
- priority: 80,
38520
- text: 'Select Image',
38521
- requires: { selection: true },
38522
-
38523
- click: function () {
38524
- var state = controller.state();
38525
- var selection = state.get('selection');
38526
-
38527
- controller.close();
38528
- state.trigger('insert', selection).reset();
38529
- }
38530
- });
38531
- },
38532
-
38533
- mainEmbedToolbar: function (toolbar) {
38534
- var tbar = toolbar;
38535
- tbar.view = new window.wp.media.view.Toolbar.Embed({
38536
- controller: this,
38537
- text: 'Add images'
38538
- });
38539
- }
38540
-
38541
- });
38542
-
38543
- theFrame = new MediaManager({
38544
- id: 'mailpoet-media-manager',
38545
- frame: 'select',
38546
- title: 'Select image',
38547
- editing: false,
38548
- multiple: false,
38549
- library: {
38550
- type: 'image'
38551
- },
38552
- displaySettings: false,
38553
- button: {
38554
- text: 'Select'
38555
- }
38556
- });
38557
- this._mediaManager = theFrame;
38558
-
38559
- this._mediaManager.on('insert', function () {
38560
- // Append media manager image selections to Images tab
38561
- var selection = theFrame.state().get('selection');
38562
- selection.each(function (attachment) {
38563
- var sizes = attachment.get('sizes');
38564
- // Following advice from Becs, the target width should
38565
- // be a double of one column width to render well on
38566
- // retina screen devices
38567
- var targetImageWidth = 1320;
38568
-
38569
- // Pick the width that is closest to target width
38570
- var increasingByWidthDifference = _.sortBy(
38571
- _.keys(sizes),
38572
- function (size) { return Math.abs(targetImageWidth - sizes[size].width); }
38573
- );
38574
- var bestWidth = sizes[_.first(increasingByWidthDifference)].width;
38575
- var imagesOfBestWidth = _.filter(
38576
- _.values(sizes),
38577
- function (size) { return size.width === bestWidth; }
38578
- );
38579
-
38580
- // Maximize the height if there are multiple images with same width
38581
- var mainSize = _.max(imagesOfBestWidth, function (size) { return size.height; });
38582
-
38583
- that.model.set({
38584
- height: mainSize.height + 'px',
38585
- width: mainSize.width + 'px',
38586
- src: mainSize.url,
38587
- alt: (attachment.get('alt') !== '' && attachment.get('alt') !== undefined) ? attachment.get('alt') : attachment.get('title')
38588
- });
38589
- // Rerender settings view due to changes from outside of settings view
38590
- that.render();
38591
- });
38592
- });
38593
-
38594
- this._mediaManager.open();
38595
- },
38596
- changeAddress: function (event) {
38597
- var src = jQuery(event.target).val();
38598
- var image = new Image();
38599
-
38600
- image.onload = function () {
38601
- this.model.set({
38602
- src: src,
38603
- width: image.naturalWidth + 'px',
38604
- height: image.naturalHeight + 'px'
38605
- });
38606
- }.bind(this);
38607
-
38608
- image.src = src;
38609
- },
38610
- onBeforeDestroy: function () {
38611
- base.BlockSettingsView.prototype.onBeforeDestroy.apply(this, arguments);
38612
- if (typeof this._mediaManager === 'object') {
38613
- this._mediaManager.remove();
38614
  }
 
 
38615
  }
38616
  });
38617
 
@@ -38651,7 +38719,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
38651
 
38652
  /***/ }),
38653
 
38654
- /***/ 679:
38655
  /***/ (function(module, exports, __webpack_require__) {
38656
 
38657
  "use strict";
@@ -38661,7 +38729,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
38661
  * Text content block
38662
  */
38663
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38664
- __webpack_require__(22),
38665
  __webpack_require__(39),
38666
  __webpack_require__(7),
38667
  __webpack_require__(5)
@@ -38772,7 +38840,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
38772
 
38773
  /***/ }),
38774
 
38775
- /***/ 680:
38776
  /***/ (function(module, exports, __webpack_require__) {
38777
 
38778
  "use strict";
@@ -38782,7 +38850,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
38782
  * Spacer content block
38783
  */
38784
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38785
- __webpack_require__(22),
38786
  __webpack_require__(39),
38787
  __webpack_require__(7)
38788
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function spacerBlock(App, BaseBlock, _) {
@@ -38884,7 +38952,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
38884
 
38885
  /***/ }),
38886
 
38887
- /***/ 681:
38888
  /***/ (function(module, exports, __webpack_require__) {
38889
 
38890
  "use strict";
@@ -38894,7 +38962,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
38894
  * Footer content block
38895
  */
38896
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38897
- __webpack_require__(22),
38898
  __webpack_require__(39),
38899
  __webpack_require__(7),
38900
  __webpack_require__(5)
@@ -39022,7 +39090,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
39022
 
39023
  /***/ }),
39024
 
39025
- /***/ 682:
39026
  /***/ (function(module, exports, __webpack_require__) {
39027
 
39028
  "use strict";
@@ -39032,7 +39100,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
39032
  * Header content block
39033
  */
39034
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39035
- __webpack_require__(22),
39036
  __webpack_require__(39),
39037
  __webpack_require__(7),
39038
  __webpack_require__(5)
@@ -39160,7 +39228,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
39160
 
39161
  /***/ }),
39162
 
39163
- /***/ 683:
39164
  /***/ (function(module, exports, __webpack_require__) {
39165
 
39166
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -39173,7 +39241,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
39173
  * block settings view.
39174
  */
39175
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39176
- __webpack_require__(22),
39177
  __webpack_require__(39),
39178
  __webpack_require__(289),
39179
  __webpack_require__(290),
@@ -39566,7 +39634,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
39566
 
39567
  /***/ }),
39568
 
39569
- /***/ 684:
39570
  /***/ (function(module, exports, __webpack_require__) {
39571
 
39572
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -39574,7 +39642,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
39574
  * Automated latest content block with image alignment.
39575
  */
39576
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39577
- __webpack_require__(22),
39578
  __webpack_require__(39),
39579
  __webpack_require__(289),
39580
  __webpack_require__(290),
@@ -39974,7 +40042,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
39974
 
39975
  /***/ }),
39976
 
39977
- /***/ 685:
39978
  /***/ (function(module, exports, __webpack_require__) {
39979
 
39980
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -39992,12 +40060,12 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
39992
  */
39993
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39994
  __webpack_require__(38),
39995
- __webpack_require__(23),
39996
  __webpack_require__(287),
39997
  __webpack_require__(7),
39998
  __webpack_require__(10),
39999
  __webpack_require__(5),
40000
- __webpack_require__(22),
40001
  __webpack_require__(101),
40002
  __webpack_require__(39),
40003
  __webpack_require__(289),
@@ -40595,7 +40663,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
40595
 
40596
  /***/ }),
40597
 
40598
- /***/ 686:
40599
  /***/ (function(module, exports, __webpack_require__) {
40600
 
40601
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
@@ -40603,10 +40671,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disabl
40603
  * Social icons content block
40604
  */
40605
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
40606
- __webpack_require__(22),
40607
  __webpack_require__(39),
40608
  __webpack_require__(38),
40609
- __webpack_require__(23),
40610
  __webpack_require__(58),
40611
  __webpack_require__(7),
40612
  __webpack_require__(10)
12
 
13
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
14
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
15
+ __webpack_require__(23),
16
  __webpack_require__(7),
17
  __webpack_require__(5),
18
  __webpack_require__(291)
1681
  /***/ 22:
1682
  /***/ (function(module, exports, __webpack_require__) {
1683
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1684
  // MarionetteJS (Backbone.Marionette)
1685
  // ----------------------------------
1686
  // v3.2.0
5171
  //# sourceMappingURL=backbone.marionette.js.map
5172
 
5173
 
5174
+ /***/ }),
5175
+
5176
+ /***/ 23:
5177
+ /***/ (function(module, exports, __webpack_require__) {
5178
+
5179
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
5180
+ __webpack_require__(38),
5181
+ __webpack_require__(22),
5182
+ __webpack_require__(287)
5183
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Backbone, Marionette, BackboneRadio) { // eslint-disable-line func-names
5184
+ var Radio = BackboneRadio;
5185
+
5186
+ var AppView = Marionette.View.extend({
5187
+ el: '#mailpoet_editor',
5188
+ regions: {
5189
+ stylesRegion: '#mailpoet_editor_styles',
5190
+ contentRegion: '#mailpoet_editor_content',
5191
+ sidebarRegion: '#mailpoet_editor_sidebar',
5192
+ bottomRegion: '#mailpoet_editor_bottom',
5193
+ headingRegion: '#mailpoet_editor_heading'
5194
+ }
5195
+ });
5196
+
5197
+ var EditorApplication = Marionette.Application.extend({
5198
+ region: '#mailpoet_editor',
5199
+
5200
+ onStart: function () { // eslint-disable-line func-names
5201
+ this._appView = new AppView();
5202
+ this.showView(this._appView);
5203
+ },
5204
+
5205
+ getChannel: function (channel) { // eslint-disable-line func-names
5206
+ if (channel === undefined) {
5207
+ return Radio.channel('global');
5208
+ }
5209
+ return Radio.channel(channel);
5210
+ }
5211
+ });
5212
+
5213
+ var app = new EditorApplication();
5214
+ window.EditorApplication = app;
5215
+
5216
+ return app;
5217
+ }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
5218
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
5219
+
5220
+
5221
  /***/ }),
5222
 
5223
  /***/ 284:
17324
  * Button content block
17325
  */
17326
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
17327
+ __webpack_require__(23),
17328
  __webpack_require__(39),
17329
  __webpack_require__(5),
17330
  __webpack_require__(7),
17483
  * Divider content block
17484
  */
17485
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
17486
+ __webpack_require__(23),
17487
  __webpack_require__(39),
17488
  __webpack_require__(7),
17489
  __webpack_require__(10)
18628
  * BlockToolsView, BlockSettingsView and BlockWidgetView are optional.
18629
  */
18630
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
18631
  __webpack_require__(23),
18632
+ __webpack_require__(22),
18633
  __webpack_require__(58),
18634
  __webpack_require__(7),
18635
  __webpack_require__(10),
18968
  * For more check: http://marionettejs.com/docs/marionette.behaviors.html#behaviorslookup
18969
  */
18970
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
18971
+ __webpack_require__(22)
18972
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (BackboneMarionette) { // eslint-disable-line func-names
18973
  var Marionette = BackboneMarionette;
18974
  var BehaviorsLookup = {};
31500
 
31501
  __webpack_require__(7);
31502
  __webpack_require__(38);
31503
+ __webpack_require__(22);
31504
  __webpack_require__(58);
31505
  __webpack_require__(288);
31506
  __webpack_require__(287);
31510
  __webpack_require__(514);
31511
  __webpack_require__(515);
31512
  __webpack_require__(661);
31513
+ __webpack_require__(23);
31514
  __webpack_require__(662);
31515
  __webpack_require__(663);
31516
  __webpack_require__(664);
31528
  __webpack_require__(674);
31529
  __webpack_require__(675);
31530
  __webpack_require__(676);
 
31531
  __webpack_require__(677);
31532
+ __webpack_require__(39);
31533
  __webpack_require__(678);
31534
+ __webpack_require__(289);
31535
  __webpack_require__(679);
31536
+ __webpack_require__(290);
31537
  __webpack_require__(680);
31538
  __webpack_require__(681);
31539
  __webpack_require__(682);
31540
  __webpack_require__(683);
31541
  __webpack_require__(684);
31542
  __webpack_require__(685);
31543
+ __webpack_require__(686);
31544
+ module.exports = __webpack_require__(687);
31545
 
31546
 
31547
  /***/ }),
35731
  /***/ (function(module, exports, __webpack_require__) {
35732
 
35733
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35734
+ __webpack_require__(23),
35735
  __webpack_require__(58),
35736
  __webpack_require__(7)
35737
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (App, SuperModel, _) { // eslint-disable-line func-names
35786
 
35787
 
35788
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
35789
  __webpack_require__(23),
35790
+ __webpack_require__(22),
35791
  __webpack_require__(58),
35792
  __webpack_require__(7)
35793
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (App, Marionette, SuperModel, _) { // eslint-disable-line func-names
35884
 
35885
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
35886
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
35887
+ __webpack_require__(23),
35888
  __webpack_require__(101),
35889
  __webpack_require__(5),
35890
  __webpack_require__(38),
35891
+ __webpack_require__(22),
35892
  __webpack_require__(58),
35893
  __webpack_require__(7),
35894
  __webpack_require__(10)
36283
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36284
 
36285
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36286
+ __webpack_require__(23),
36287
  __webpack_require__(58),
36288
  __webpack_require__(7),
36289
  __webpack_require__(5)
36398
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
36399
 
36400
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
 
 
36401
  __webpack_require__(23),
36402
+ __webpack_require__(38),
36403
+ __webpack_require__(22),
36404
  __webpack_require__(7),
36405
  __webpack_require__(10),
36406
  __webpack_require__(5)
36450
 
36451
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
36452
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36453
+ __webpack_require__(23),
36454
  __webpack_require__(101),
36455
  __webpack_require__(5),
36456
  __webpack_require__(294),
36457
  __webpack_require__(38),
36458
+ __webpack_require__(22),
36459
  __webpack_require__(10),
36460
  __webpack_require__(514),
36461
  __webpack_require__(515),
36794
  * Adds a color picker integration with the view
36795
  */
36796
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36797
+ __webpack_require__(22),
36798
  __webpack_require__(47),
36799
  __webpack_require__(5),
36800
  __webpack_require__(513)
36852
  * accept droppables
36853
  */
36854
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
36855
+ __webpack_require__(22),
36856
  __webpack_require__(7),
36857
  __webpack_require__(10),
36858
  __webpack_require__(47),
37343
  * Part of the drag&drop behavior.
37344
  */
37345
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37346
+ __webpack_require__(22),
37347
  __webpack_require__(7),
37348
  __webpack_require__(10),
37349
  __webpack_require__(47),
37499
  * Highlights a container block when hovering over its tools
37500
  */
37501
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37502
+ __webpack_require__(22),
37503
  __webpack_require__(47)
37504
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
37505
  var BL = BehaviorsLookup;
37533
  * Highlights a block that is being edited
37534
  */
37535
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37536
+ __webpack_require__(22),
37537
  __webpack_require__(47)
37538
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup) { // eslint-disable-line func-names
37539
  var BL = BehaviorsLookup;
37561
  /***/ 673:
37562
  /***/ (function(module, exports, __webpack_require__) {
37563
 
37564
+ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
37565
+ /**
37566
+ * Media manager behaviour
37567
+ *
37568
+ * Adds a media manager integration with the view
37569
+ */
37570
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37571
+ __webpack_require__(22),
37572
+ __webpack_require__(7),
37573
+ __webpack_require__(47),
37574
+ __webpack_require__(10)
37575
+ ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, _, BehaviorsLookup, jQuery) {
37576
+ var BL = BehaviorsLookup;
37577
+
37578
+ BL.MediaManagerBehavior = Marionette.Behavior.extend({
37579
+ ui: {
37580
+ 'select-image': '.mailpoet_field_image_select_image',
37581
+ 'address-input': '.mailpoet_field_image_address'
37582
+ },
37583
+ events: {
37584
+ 'click @ui.select-image': 'showMediaManager',
37585
+ 'input @ui.address-input': 'changeAddress'
37586
+ },
37587
+ initialize: function () {
37588
+ if (this.view.options.showImageManager) {
37589
+ this.showMediaManager();
37590
+ }
37591
+ },
37592
+ changeAddress: function (event) {
37593
+ var src = jQuery(event.target).val();
37594
+ var image = new Image();
37595
+
37596
+ if (!src && this.options.onSelect) {
37597
+ this.view[this.options.onSelect]({
37598
+ src: null,
37599
+ width: null,
37600
+ height: null
37601
+ });
37602
+ return;
37603
+ }
37604
+
37605
+ image.onload = function () {
37606
+ if (this.options.onSelect) {
37607
+ this.view[this.options.onSelect]({
37608
+ src: src,
37609
+ width: image.naturalWidth + 'px',
37610
+ height: image.naturalHeight + 'px'
37611
+ });
37612
+ }
37613
+ }.bind(this);
37614
+
37615
+ image.src = src;
37616
+ },
37617
+ showMediaManager: function () {
37618
+ var that = this;
37619
+ var MediaManager;
37620
+ var theFrame;
37621
+ if (this._mediaManager) {
37622
+ this._mediaManager.resetSelections();
37623
+ this._mediaManager.open();
37624
+ return;
37625
+ }
37626
+
37627
+ MediaManager = window.wp.media.view.MediaFrame.Select.extend({
37628
+
37629
+ initialize: function () {
37630
+ window.wp.media.view.MediaFrame.prototype.initialize.apply(this, arguments);
37631
+
37632
+ _.defaults(this.options, {
37633
+ multiple: true,
37634
+ editing: false,
37635
+ state: 'insert'
37636
+ });
37637
+
37638
+ this.createSelection();
37639
+ this.createStates();
37640
+ this.bindHandlers();
37641
+ this.createIframeStates();
37642
+
37643
+ // Hide title
37644
+ this.$el.addClass('hide-title');
37645
+ },
37646
+
37647
+ resetSelections: function () {
37648
+ this.state().get('selection').reset();
37649
+ },
37650
+
37651
+ createQuery: function (options) {
37652
+ var query = window.wp.media.query(options);
37653
+ return query;
37654
+ },
37655
+
37656
+ createStates: function () {
37657
+ var options = this.options;
37658
+
37659
+ // Add the default states.
37660
+ this.states.add([
37661
+ // Main states.
37662
+ new window.wp.media.controller.Library({
37663
+ id: 'insert',
37664
+ title: 'Add images',
37665
+ priority: 20,
37666
+ toolbar: 'main-insert',
37667
+ filterable: 'image',
37668
+ library: this.createQuery(options.library),
37669
+ multiple: options.multiple ? 'reset' : false,
37670
+ editable: false,
37671
+
37672
+ // If the user isn't allowed to edit fields,
37673
+ // can they still edit it locally?
37674
+ allowLocalEdits: false,
37675
+
37676
+ // Show the attachment display settings.
37677
+ displaySettings: false,
37678
+ // Update user settings when users adjust the
37679
+ // attachment display settings.
37680
+ displayUserSettings: false
37681
+ })
37682
+ ]);
37683
+
37684
+ if (window.wp.media.view.settings.post.featuredImageId) {
37685
+ this.states.add(new window.wp.media.controller.FeaturedImage());
37686
+ }
37687
+ },
37688
+
37689
+ bindHandlers: function () {
37690
+ var handlers;
37691
+ // from Select
37692
+ this.on('router:create:browse', this.createRouter, this);
37693
+ this.on('router:render:browse', this.browseRouter, this);
37694
+ this.on('content:create:browse', this.browseContent, this);
37695
+ this.on('content:render:upload', this.uploadContent, this);
37696
+ this.on('toolbar:create:select', this.createSelectToolbar, this);
37697
+
37698
+ this.on('menu:create:gallery', this.createMenu, this);
37699
+ this.on('toolbar:create:main-insert', this.createToolbar, this);
37700
+ this.on('toolbar:create:main-gallery', this.createToolbar, this);
37701
+ this.on('toolbar:create:main-embed', this.mainEmbedToolbar, this);
37702
+
37703
+ this.on('updateExcluded', this.browseContent, this);
37704
+
37705
+ handlers = {
37706
+ content: {
37707
+ embed: 'embedContent',
37708
+ 'edit-selection': 'editSelectionContent'
37709
+ },
37710
+ toolbar: {
37711
+ 'main-insert': 'mainInsertToolbar'
37712
+ }
37713
+ };
37714
+
37715
+ _.each(handlers, function (regionHandlers, region) {
37716
+ _.each(regionHandlers, function (callback, handler) {
37717
+ this.on(region + ':render:' + handler, this[callback], this);
37718
+ }, this);
37719
+ }, this);
37720
+ },
37721
+
37722
+ uploadContent: function () {
37723
+ window.wp.media.view.MediaFrame.Select.prototype.uploadContent.apply(this, arguments);
37724
+ this.$el.addClass('hide-toolbar');
37725
+ },
37726
+
37727
+ // Content
37728
+ embedContent: function () {
37729
+ var view = new window.wp.media.view.Embed({
37730
+ controller: this,
37731
+ model: this.state()
37732
+ }).render();
37733
+
37734
+ this.content.set(view);
37735
+ view.url.focus();
37736
+ },
37737
+
37738
+ editSelectionContent: function () {
37739
+ var state = this.state();
37740
+ var selection = state.get('selection');
37741
+ var view;
37742
+
37743
+ view = new window.wp.media.view.AttachmentsBrowser({
37744
+ controller: this,
37745
+ collection: selection,
37746
+ selection: selection,
37747
+ model: state,
37748
+ sortable: true,
37749
+ search: false,
37750
+ dragInfo: true,
37751
+
37752
+ AttachmentView: window.wp.media.view.Attachment.EditSelection
37753
+ }).render();
37754
+
37755
+ view.toolbar.set('backToLibrary', {
37756
+ text: 'Return to library',
37757
+ priority: -100,
37758
+
37759
+ click: function () {
37760
+ this.controller.content.mode('browse');
37761
+ }
37762
+ });
37763
+
37764
+ // Browse our library of attachments.
37765
+ this.content.set(view);
37766
+ },
37767
+
37768
+ // Toolbars
37769
+ selectionStatusToolbar: function (view) {
37770
+ var editable = this.state().get('editable');
37771
+
37772
+ view.set('selection', new window.wp.media.view.Selection({
37773
+ controller: this,
37774
+ collection: this.state().get('selection'),
37775
+ priority: -40,
37776
+
37777
+ // If the selection is editable, pass the callback to
37778
+ // switch the content mode.
37779
+ editable: editable && function () {
37780
+ this.controller.content.mode('edit-selection');
37781
+ }
37782
+ }).render());
37783
+ },
37784
+
37785
+ mainInsertToolbar: function (view) {
37786
+ var controller = this;
37787
+
37788
+ this.selectionStatusToolbar(view);
37789
+
37790
+ view.set('insert', {
37791
+ style: 'primary',
37792
+ priority: 80,
37793
+ text: 'Select Image',
37794
+ requires: { selection: true },
37795
+
37796
+ click: function () {
37797
+ var state = controller.state();
37798
+ var selection = state.get('selection');
37799
+
37800
+ controller.close();
37801
+ state.trigger('insert', selection).reset();
37802
+ }
37803
+ });
37804
+ },
37805
+
37806
+ mainEmbedToolbar: function (toolbar) {
37807
+ var tbar = toolbar;
37808
+ tbar.view = new window.wp.media.view.Toolbar.Embed({
37809
+ controller: this,
37810
+ text: 'Add images'
37811
+ });
37812
+ }
37813
+
37814
+ });
37815
+
37816
+ theFrame = new MediaManager({
37817
+ id: 'mailpoet-media-manager',
37818
+ frame: 'select',
37819
+ title: 'Select image',
37820
+ editing: false,
37821
+ multiple: false,
37822
+ library: {
37823
+ type: 'image'
37824
+ },
37825
+ displaySettings: false,
37826
+ button: {
37827
+ text: 'Select'
37828
+ }
37829
+ });
37830
+ this._mediaManager = theFrame;
37831
+
37832
+ this._mediaManager.on('insert', function () {
37833
+ // Append media manager image selections to Images tab
37834
+ var selection = theFrame.state().get('selection');
37835
+ selection.each(function (attachment) {
37836
+ var sizes = attachment.get('sizes');
37837
+ // Following advice from Becs, the target width should
37838
+ // be a double of one column width to render well on
37839
+ // retina screen devices
37840
+ var targetImageWidth = 1320;
37841
+
37842
+ // Pick the width that is closest to target width
37843
+ var increasingByWidthDifference = _.sortBy(
37844
+ _.keys(sizes),
37845
+ function (size) {
37846
+ return Math.abs(targetImageWidth - sizes[size].width);
37847
+ }
37848
+ );
37849
+ var bestWidth = sizes[_.first(increasingByWidthDifference)].width;
37850
+ var imagesOfBestWidth = _.filter(
37851
+ _.values(sizes),
37852
+ function (size) { return size.width === bestWidth; }
37853
+ );
37854
+
37855
+ // Maximize the height if there are multiple images with same width
37856
+ var mainSize = _.max(imagesOfBestWidth, function (size) { return size.height; });
37857
+
37858
+ if (that.options.onSelect) {
37859
+ that.view[that.options.onSelect]({
37860
+ height: mainSize.height + 'px',
37861
+ width: mainSize.width + 'px',
37862
+ src: mainSize.url,
37863
+ alt: (attachment.get('alt') !== '' && attachment.get('alt') !== undefined) ? attachment.get('alt') : attachment.get('title')
37864
+ });
37865
+ }
37866
+ });
37867
+ });
37868
+ this._mediaManager.open();
37869
+ },
37870
+ onBeforeDestroy: function () {
37871
+ if (typeof this._mediaManager === 'object') {
37872
+ this._mediaManager.remove();
37873
+ }
37874
+ }
37875
+ });
37876
+ }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
37877
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
37878
+
37879
+
37880
+ /***/ }),
37881
+
37882
+ /***/ 674:
37883
+ /***/ (function(module, exports, __webpack_require__) {
37884
+
37885
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37886
  * ResizableBehavior
37887
  *
37888
  * Allows resizing elements within a block
37889
  */
37890
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37891
+ __webpack_require__(22),
37892
  __webpack_require__(47),
37893
  __webpack_require__(288)
37894
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, BehaviorsLookup, interact) { // eslint-disable-line func-names
37967
 
37968
  /***/ }),
37969
 
37970
+ /***/ 675:
37971
  /***/ (function(module, exports, __webpack_require__) {
37972
 
37973
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
37976
  * Allows sorting elements within a collection
37977
  */
37978
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
37979
+ __webpack_require__(22),
37980
  __webpack_require__(7),
37981
  __webpack_require__(47)
37982
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, _, BehaviorsLookup) { // eslint-disable-line func-names
38016
 
38017
  /***/ }),
38018
 
38019
+ /***/ 676:
38020
  /***/ (function(module, exports, __webpack_require__) {
38021
 
38022
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
38025
  * Opens up settings of a BlockView if contents are clicked upon
38026
  */
38027
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38028
+ __webpack_require__(22),
38029
  __webpack_require__(10),
38030
  __webpack_require__(47)
38031
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Marionette, jQuery, BehaviorsLookup) { // eslint-disable-line func-names
38056
 
38057
  /***/ }),
38058
 
38059
+ /***/ 677:
38060
  /***/ (function(module, exports, __webpack_require__) {
38061
 
38062
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
38065
  * Adds TinyMCE text editing capabilities to a view
38066
  */
38067
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38068
+ __webpack_require__(22),
38069
  __webpack_require__(7),
38070
  __webpack_require__(47)
38071
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function textEditorBehavior(Marionette, _, BehaviorsLookup) {
38154
 
38155
  /***/ }),
38156
 
38157
+ /***/ 678:
38158
  /***/ (function(module, exports, __webpack_require__) {
38159
 
38160
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
38165
  */
38166
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38167
  __webpack_require__(38),
38168
+ __webpack_require__(22),
38169
  __webpack_require__(7),
38170
  __webpack_require__(10),
38171
+ __webpack_require__(23),
38172
  __webpack_require__(39)
38173
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function (Backbone, Marionette, _, jQuery, App, BaseBlock) {
38174
  'use strict';
38199
  return this._getDefaults({
38200
  type: 'container',
38201
  orientation: 'vertical',
38202
+ image: {
38203
+ src: null,
38204
+ display: 'scale'
38205
+ },
38206
  styles: {
38207
  block: {
38208
  backgroundColor: 'transparent'
38402
  });
38403
 
38404
  Module.ContainerBlockSettingsView = base.BlockSettingsView.extend({
38405
+ behaviors: _.extend({}, base.BlockSettingsView.prototype.behaviors, {
38406
+ MediaManagerBehavior: {
38407
+ onSelect: 'onImageSelect'
38408
+ }
38409
+ }),
38410
  getTemplate: function () { return window.templates.containerBlockSettings; },
38411
  events: function () {
38412
  return {
38413
  'change .mailpoet_field_container_background_color': _.partial(this.changeColorField, 'styles.block.backgroundColor'),
38414
+ 'click .mailpoet_done_editing': 'close',
38415
+ 'change .mailpoet_field_display_type': 'changeDisplayType'
38416
  };
38417
  },
 
 
 
38418
  initialize: function () {
38419
  base.BlockSettingsView.prototype.initialize.apply(this, arguments);
38420
 
38422
  collection: this.model.get('blocks')
38423
  });
38424
  },
38425
+ changeDisplayType: function (event) {
38426
+ this.model.get('image').set('display', event.target.value);
38427
+ this.model.trigger('change');
38428
+ },
38429
+ onImageSelect: function (image) {
38430
+ this.model.set('image.src', image.src);
38431
+ this.model.trigger('change');
38432
+ this.render();
38433
  }
38434
  });
38435
 
38544
 
38545
  /***/ }),
38546
 
38547
+ /***/ 679:
38548
  /***/ (function(module, exports, __webpack_require__) {
38549
 
38550
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
38552
  * Image content block
38553
  */
38554
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38555
+ __webpack_require__(23),
38556
  __webpack_require__(39),
38557
  __webpack_require__(7),
38558
  __webpack_require__(5),
38624
  });
38625
 
38626
  Module.ImageBlockSettingsView = base.BlockSettingsView.extend({
38627
+ behaviors: _.extend({}, base.BlockSettingsView.prototype.behaviors, {
38628
+ MediaManagerBehavior: {
38629
+ onSelect: 'onImageSelect'
38630
+ }
38631
+ }),
38632
  onRender: function () {
38633
  MailPoet.helpTooltip.show(document.getElementById('tooltip-designer-full-width'), {
38634
  tooltipId: 'tooltip-editor-full-width',
38643
  events: function () {
38644
  return {
38645
  'input .mailpoet_field_image_link': _.partial(this.changeField, 'link'),
 
38646
  'input .mailpoet_field_image_alt_text': _.partial(this.changeField, 'alt'),
38647
  'change .mailpoet_field_image_full_width': _.partial(this.changeBoolCheckboxField, 'fullWidth'),
38648
  'change .mailpoet_field_image_alignment': _.partial(this.changeField, 'styles.block.textAlign'),
 
38649
  'click .mailpoet_done_editing': 'close',
38650
  'input .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
38651
  'change .mailpoet_field_image_width': _.partial(this.updateValueAndCall, '.mailpoet_field_image_width_input', _.partial(this.changePixelField, 'width').bind(this)),
38672
  this.$('.mailpoet_field_image_width').val(width);
38673
  this.$('.mailpoet_field_image_width_input').val(width);
38674
  },
38675
+ onImageSelect: function (image) {
38676
+ if (image.src === null) {
38677
+ this.model.set({ src: '' });
38678
+ } else {
38679
+ this.model.set(image);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38680
  }
38681
+ // Rerender settings view due to changes from outside of settings view
38682
+ this.render();
38683
  }
38684
  });
38685
 
38719
 
38720
  /***/ }),
38721
 
38722
+ /***/ 680:
38723
  /***/ (function(module, exports, __webpack_require__) {
38724
 
38725
  "use strict";
38729
  * Text content block
38730
  */
38731
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38732
+ __webpack_require__(23),
38733
  __webpack_require__(39),
38734
  __webpack_require__(7),
38735
  __webpack_require__(5)
38840
 
38841
  /***/ }),
38842
 
38843
+ /***/ 681:
38844
  /***/ (function(module, exports, __webpack_require__) {
38845
 
38846
  "use strict";
38850
  * Spacer content block
38851
  */
38852
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38853
+ __webpack_require__(23),
38854
  __webpack_require__(39),
38855
  __webpack_require__(7)
38856
  ], __WEBPACK_AMD_DEFINE_RESULT__ = (function spacerBlock(App, BaseBlock, _) {
38952
 
38953
  /***/ }),
38954
 
38955
+ /***/ 682:
38956
  /***/ (function(module, exports, __webpack_require__) {
38957
 
38958
  "use strict";
38962
  * Footer content block
38963
  */
38964
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
38965
+ __webpack_require__(23),
38966
  __webpack_require__(39),
38967
  __webpack_require__(7),
38968
  __webpack_require__(5)
39090
 
39091
  /***/ }),
39092
 
39093
+ /***/ 683:
39094
  /***/ (function(module, exports, __webpack_require__) {
39095
 
39096
  "use strict";
39100
  * Header content block
39101
  */
39102
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39103
+ __webpack_require__(23),
39104
  __webpack_require__(39),
39105
  __webpack_require__(7),
39106
  __webpack_require__(5)
39228
 
39229
  /***/ }),
39230
 
39231
+ /***/ 684:
39232
  /***/ (function(module, exports, __webpack_require__) {
39233
 
39234
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
39241
  * block settings view.
39242
  */
39243
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39244
+ __webpack_require__(23),
39245
  __webpack_require__(39),
39246
  __webpack_require__(289),
39247
  __webpack_require__(290),
39634
 
39635
  /***/ }),
39636
 
39637
+ /***/ 685:
39638
  /***/ (function(module, exports, __webpack_require__) {
39639
 
39640
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
39642
  * Automated latest content block with image alignment.
39643
  */
39644
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
39645
+ __webpack_require__(23),
39646
  __webpack_require__(39),
39647
  __webpack_require__(289),
39648
  __webpack_require__(290),
40042
 
40043
  /***/ }),
40044
 
40045
+ /***/ 686:
40046
  /***/ (function(module, exports, __webpack_require__) {
40047
 
40048
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
40060
  */
40061
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
40062
  __webpack_require__(38),
40063
+ __webpack_require__(22),
40064
  __webpack_require__(287),
40065
  __webpack_require__(7),
40066
  __webpack_require__(10),
40067
  __webpack_require__(5),
40068
+ __webpack_require__(23),
40069
  __webpack_require__(101),
40070
  __webpack_require__(39),
40071
  __webpack_require__(289),
40663
 
40664
  /***/ }),
40665
 
40666
+ /***/ 687:
40667
  /***/ (function(module, exports, __webpack_require__) {
40668
 
40669
  var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* eslint-disable func-names */
40671
  * Social icons content block
40672
  */
40673
  !(__WEBPACK_AMD_DEFINE_ARRAY__ = [
40674
+ __webpack_require__(23),
40675
  __webpack_require__(39),
40676
  __webpack_require__(38),
40677
+ __webpack_require__(22),
40678
  __webpack_require__(58),
40679
  __webpack_require__(7),
40680
  __webpack_require__(10)
assets/js/{vendor.04cc71ee.js → vendor.b1917743.js} RENAMED
File without changes
lang/mailpoet-ca.mo CHANGED
Binary file
lang/mailpoet-da_DK.mo CHANGED
Binary file
lang/mailpoet-de_DE.mo CHANGED
Binary file
lang/mailpoet-en_GB.mo CHANGED
Binary file
lang/mailpoet-es_ES.mo CHANGED
Binary file
lang/mailpoet-fa_IR.mo CHANGED
Binary file
lang/mailpoet-fr_CA.mo CHANGED
Binary file
lang/mailpoet-fr_FR.mo CHANGED
Binary file
lang/mailpoet-it_IT.mo CHANGED
Binary file
lang/mailpoet-ja.mo CHANGED
Binary file
lang/mailpoet-nl_NL.mo CHANGED
Binary file
lang/mailpoet-pl_PL.mo CHANGED
Binary file
lang/mailpoet-pt_BR.mo CHANGED
Binary file
lang/mailpoet-pt_PT.mo CHANGED
Binary file
lang/mailpoet-ru_RU.mo CHANGED
Binary file
lang/mailpoet-sq.mo CHANGED
Binary file
lang/mailpoet-sv_SE.mo CHANGED
Binary file
lang/mailpoet-tr_TR.mo CHANGED
Binary file
lang/mailpoet-zh_CN.mo CHANGED
Binary file
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: 2018-07-17 19:45:44+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -148,59 +148,59 @@ msgstr ""
148
  msgid "This newsletter has not been sent yet."
149
  msgstr ""
150
 
151
- #: lib/API/JSON/v1/Services.php:31 lib/API/JSON/v1/Services.php:89
152
  msgid "Please specify a key."
153
  msgstr ""
154
 
155
- #: lib/API/JSON/v1/Services.php:48 views/settings/premium.html:40
156
  msgid "Your MailPoet Sending Service key has been successfully validated."
157
  msgstr ""
158
 
159
- #: lib/API/JSON/v1/Services.php:51
160
  msgid "Your MailPoet Sending Service key expires on %s!"
161
  msgstr ""
162
 
163
- #: lib/API/JSON/v1/Services.php:62
164
  msgid "Your MailPoet Sending Service key is invalid."
165
  msgstr ""
166
 
167
- #: lib/API/JSON/v1/Services.php:65
168
  msgid "Your MailPoet Sending Service key is already used on another site."
169
  msgstr ""
170
 
171
- #: lib/API/JSON/v1/Services.php:69
172
  msgid "Error validating MailPoet Sending Service key, please try again later (%s)."
173
  msgstr ""
174
 
175
- #: lib/API/JSON/v1/Services.php:72
176
  msgid "Note that it doesn't work on localhost."
177
  msgstr ""
178
 
179
- #: lib/API/JSON/v1/Services.php:106 views/settings/premium.html:30
180
  msgid "Your Premium key has been successfully validated."
181
  msgstr ""
182
 
183
- #: lib/API/JSON/v1/Services.php:109
184
  msgid "Your Premium key expires on %s."
185
  msgstr ""
186
 
187
- #: lib/API/JSON/v1/Services.php:123
188
  msgid "Your Premium key is invalid."
189
  msgstr ""
190
 
191
- #: lib/API/JSON/v1/Services.php:126
192
  msgid "Your Premium key is already used on another site."
193
  msgstr ""
194
 
195
- #: lib/API/JSON/v1/Services.php:131
196
  msgid "Error validating Premium key, please try again later (%s)"
197
  msgstr ""
198
 
199
- #: lib/API/JSON/v1/Services.php:143
200
  msgid "Service unavailable"
201
  msgstr ""
202
 
203
- #: lib/API/JSON/v1/Services.php:146
204
  msgid ""
205
  "Contact your hosting support to check the connection between your host and "
206
  "https://bridge.mailpoet.com"
@@ -865,13 +865,13 @@ msgstr ""
865
 
866
  #: lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php:161
867
  #: views/newsletter/editor.html:997 views/newsletter/editor.html:1052
868
- #: views/newsletter/editor.html:1177
869
  msgid "Author:"
870
  msgstr ""
871
 
872
  #: lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php:163
873
  #: views/newsletter/editor.html:999 views/newsletter/editor.html:1054
874
- #: views/newsletter/editor.html:1179
875
  msgid "Categories:"
876
  msgstr ""
877
 
@@ -1351,10 +1351,28 @@ msgstr ""
1351
  msgid "Unprocessed subscriber"
1352
  msgstr ""
1353
 
1354
- #: lib/Mailer/Methods/MailPoet.php:26
1355
  msgid "MailPoet API key is invalid!"
1356
  msgstr ""
1357
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1358
  #: lib/Models/CustomField.php:20 lib/Models/Form.php:13
1359
  #: lib/Models/NewsletterOptionField.php:12 lib/Models/NewsletterTemplate.php:16
1360
  #: lib/Models/Segment.php:15 lib/Models/Setting.php:22
@@ -1585,7 +1603,7 @@ msgid "Unsubscribe link"
1585
  msgstr ""
1586
 
1587
  #: lib/Newsletter/Shortcodes/ShortcodesHelper.php:85
1588
- #: views/newsletter/editor.html:1134
1589
  msgid "Unsubscribe"
1590
  msgstr ""
1591
 
@@ -1594,7 +1612,7 @@ msgid "Edit subscription page link"
1594
  msgstr ""
1595
 
1596
  #: lib/Newsletter/Shortcodes/ShortcodesHelper.php:93
1597
- #: views/newsletter/editor.html:1134
1598
  msgid "Manage subscription"
1599
  msgstr ""
1600
 
@@ -2182,7 +2200,7 @@ msgstr ""
2182
  #: views/newsletter/templates/blocks/automatedLatestContent/settings.hbs:299
2183
  #: views/newsletter/templates/blocks/automatedLatestContentLayout/settings.hbs:311
2184
  #: views/newsletter/templates/blocks/button/settings.hbs:117
2185
- #: views/newsletter/templates/blocks/container/settings.hbs:14
2186
  #: views/newsletter/templates/blocks/divider/settings.hbs:37
2187
  #: views/newsletter/templates/blocks/footer/settings.hbs:59
2188
  #: views/newsletter/templates/blocks/header/settings.hbs:59
@@ -2536,13 +2554,13 @@ msgstr ""
2536
  msgid "Visit MailPoet.com to purchase a key"
2537
  msgstr ""
2538
 
2539
- #: views/layout.html:62
2540
  msgid ""
2541
  "An error has happened while performing a request, the server has responded "
2542
  "with response code %d"
2543
  msgstr ""
2544
 
2545
- #: views/layout.html:96
2546
  msgid ""
2547
  "Want to give feedback to the MailPoet team? Contact us here. Please provide "
2548
  "as much information as possible!"
@@ -2864,7 +2882,7 @@ msgstr ""
2864
 
2865
  #: views/newsletter/editor.html:1001 views/newsletter/editor.html:1003
2866
  #: views/newsletter/editor.html:1056 views/newsletter/editor.html:1058
2867
- #: views/newsletter/editor.html:1181 views/newsletter/editor.html:1183
2868
  msgid "Read more"
2869
  msgstr ""
2870
 
@@ -2877,31 +2895,31 @@ msgstr ""
2877
  msgid "Button"
2878
  msgstr ""
2879
 
2880
- #: views/newsletter/editor.html:1134
2881
  msgid "Add your postal address here!"
2882
  msgstr ""
2883
 
2884
- #: views/newsletter/editor.html:1154
2885
  msgid "An image of..."
2886
  msgstr ""
2887
 
2888
- #: views/newsletter/editor.html:1232
2889
  msgid "Facebook"
2890
  msgstr ""
2891
 
2892
- #: views/newsletter/editor.html:1243
2893
  msgid "Twitter"
2894
  msgstr ""
2895
 
2896
- #: views/newsletter/editor.html:1256
2897
  msgid "Edit this to insert text."
2898
  msgstr ""
2899
 
2900
- #: views/newsletter/editor.html:1259
2901
  msgid "Display problems?"
2902
  msgstr ""
2903
 
2904
- #: views/newsletter/editor.html:1260
2905
  msgid "Open this email in your web browser."
2906
  msgstr ""
2907
 
@@ -2947,6 +2965,7 @@ msgstr ""
2947
 
2948
  #: views/newsletter/templates/blocks/automatedLatestContent/settings.hbs:41
2949
  #: views/newsletter/templates/blocks/automatedLatestContentLayout/settings.hbs:41
 
2950
  #: views/newsletter/templates/blocks/posts/settings.hbs:7
2951
  msgid "Display options"
2952
  msgstr ""
@@ -3235,7 +3254,6 @@ msgid "Bold"
3235
  msgstr ""
3236
 
3237
  #: views/newsletter/templates/blocks/button/settings.hbs:71
3238
- #: views/newsletter/templates/blocks/container/settings.hbs:7
3239
  #: views/newsletter/templates/blocks/divider/settings.hbs:28
3240
  #: views/newsletter/templates/blocks/footer/settings.hbs:34
3241
  #: views/newsletter/templates/blocks/header/settings.hbs:34
@@ -3281,6 +3299,35 @@ msgstr ""
3281
  msgid "Columns"
3282
  msgstr ""
3283
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3284
  #: views/newsletter/templates/blocks/container/threeColumnLayoutWidget.hbs:4
3285
  msgid "3 columns"
3286
  msgstr ""
@@ -3339,10 +3386,6 @@ msgstr ""
3339
  msgid "Alternative text"
3340
  msgstr ""
3341
 
3342
- #: views/newsletter/templates/blocks/image/settings.hbs:83
3343
- msgid "Select another image"
3344
- msgstr ""
3345
-
3346
  #: views/newsletter/templates/blocks/posts/settings.hbs:6
3347
  msgid "Back to selection"
3348
  msgstr ""
@@ -5628,7 +5671,7 @@ msgstr ""
5628
  msgid "Awesome! Now, take me to MailPoet"
5629
  msgstr ""
5630
 
5631
- #: lib/API/JSON/v1/Services.php:149
5632
  msgctxt "Error code (inside parentheses)"
5633
  msgid "code: %s"
5634
  msgstr ""
4
  msgstr ""
5
  "Project-Id-Version: \n"
6
  "Report-Msgid-Bugs-To: http://support.mailpoet.com/\n"
7
+ "POT-Creation-Date: 2018-07-24 12:17:51+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
148
  msgid "This newsletter has not been sent yet."
149
  msgstr ""
150
 
151
+ #: lib/API/JSON/v1/Services.php:33 lib/API/JSON/v1/Services.php:95
152
  msgid "Please specify a key."
153
  msgstr ""
154
 
155
+ #: lib/API/JSON/v1/Services.php:50 views/settings/premium.html:40
156
  msgid "Your MailPoet Sending Service key has been successfully validated."
157
  msgstr ""
158
 
159
+ #: lib/API/JSON/v1/Services.php:53
160
  msgid "Your MailPoet Sending Service key expires on %s!"
161
  msgstr ""
162
 
163
+ #: lib/API/JSON/v1/Services.php:68
164
  msgid "Your MailPoet Sending Service key is invalid."
165
  msgstr ""
166
 
167
+ #: lib/API/JSON/v1/Services.php:71
168
  msgid "Your MailPoet Sending Service key is already used on another site."
169
  msgstr ""
170
 
171
+ #: lib/API/JSON/v1/Services.php:75
172
  msgid "Error validating MailPoet Sending Service key, please try again later (%s)."
173
  msgstr ""
174
 
175
+ #: lib/API/JSON/v1/Services.php:78
176
  msgid "Note that it doesn't work on localhost."
177
  msgstr ""
178
 
179
+ #: lib/API/JSON/v1/Services.php:112 views/settings/premium.html:30
180
  msgid "Your Premium key has been successfully validated."
181
  msgstr ""
182
 
183
+ #: lib/API/JSON/v1/Services.php:115
184
  msgid "Your Premium key expires on %s."
185
  msgstr ""
186
 
187
+ #: lib/API/JSON/v1/Services.php:133
188
  msgid "Your Premium key is invalid."
189
  msgstr ""
190
 
191
+ #: lib/API/JSON/v1/Services.php:136
192
  msgid "Your Premium key is already used on another site."
193
  msgstr ""
194
 
195
+ #: lib/API/JSON/v1/Services.php:141
196
  msgid "Error validating Premium key, please try again later (%s)"
197
  msgstr ""
198
 
199
+ #: lib/API/JSON/v1/Services.php:153
200
  msgid "Service unavailable"
201
  msgstr ""
202
 
203
+ #: lib/API/JSON/v1/Services.php:156
204
  msgid ""
205
  "Contact your hosting support to check the connection between your host and "
206
  "https://bridge.mailpoet.com"
865
 
866
  #: lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php:161
867
  #: views/newsletter/editor.html:997 views/newsletter/editor.html:1052
868
+ #: views/newsletter/editor.html:1181
869
  msgid "Author:"
870
  msgstr ""
871
 
872
  #: lib/Config/PopulatorData/Templates/PostNotificationsBlank1Column.php:163
873
  #: views/newsletter/editor.html:999 views/newsletter/editor.html:1054
874
+ #: views/newsletter/editor.html:1183
875
  msgid "Categories:"
876
  msgstr ""
877
 
1351
  msgid "Unprocessed subscriber"
1352
  msgstr ""
1353
 
1354
+ #: lib/Mailer/Methods/MailPoet.php:29
1355
  msgid "MailPoet API key is invalid!"
1356
  msgstr ""
1357
 
1358
+ #: lib/Mailer/Methods/MailPoet.php:51
1359
+ msgid "JSON input is not an array"
1360
+ msgstr ""
1361
+
1362
+ #: lib/Mailer/Methods/MailPoet.php:58
1363
+ msgid ""
1364
+ "Email service is temporarily not available, please try again in a few "
1365
+ "minutes."
1366
+ msgstr ""
1367
+
1368
+ #: lib/Mailer/Methods/MailPoet.php:141
1369
+ msgid "Error while sending: "
1370
+ msgstr ""
1371
+
1372
+ #: lib/Mailer/Methods/MailPoet.php:143
1373
+ msgid "Error while sending newsletters. "
1374
+ msgstr ""
1375
+
1376
  #: lib/Models/CustomField.php:20 lib/Models/Form.php:13
1377
  #: lib/Models/NewsletterOptionField.php:12 lib/Models/NewsletterTemplate.php:16
1378
  #: lib/Models/Segment.php:15 lib/Models/Setting.php:22
1603
  msgstr ""
1604
 
1605
  #: lib/Newsletter/Shortcodes/ShortcodesHelper.php:85
1606
+ #: views/newsletter/editor.html:1138
1607
  msgid "Unsubscribe"
1608
  msgstr ""
1609
 
1612
  msgstr ""
1613
 
1614
  #: lib/Newsletter/Shortcodes/ShortcodesHelper.php:93
1615
+ #: views/newsletter/editor.html:1138
1616
  msgid "Manage subscription"
1617
  msgstr ""
1618
 
2200
  #: views/newsletter/templates/blocks/automatedLatestContent/settings.hbs:299
2201
  #: views/newsletter/templates/blocks/automatedLatestContentLayout/settings.hbs:311
2202
  #: views/newsletter/templates/blocks/button/settings.hbs:117
2203
+ #: views/newsletter/templates/blocks/container/settings.hbs:44
2204
  #: views/newsletter/templates/blocks/divider/settings.hbs:37
2205
  #: views/newsletter/templates/blocks/footer/settings.hbs:59
2206
  #: views/newsletter/templates/blocks/header/settings.hbs:59
2554
  msgid "Visit MailPoet.com to purchase a key"
2555
  msgstr ""
2556
 
2557
+ #: views/layout.html:64
2558
  msgid ""
2559
  "An error has happened while performing a request, the server has responded "
2560
  "with response code %d"
2561
  msgstr ""
2562
 
2563
+ #: views/layout.html:98
2564
  msgid ""
2565
  "Want to give feedback to the MailPoet team? Contact us here. Please provide "
2566
  "as much information as possible!"
2882
 
2883
  #: views/newsletter/editor.html:1001 views/newsletter/editor.html:1003
2884
  #: views/newsletter/editor.html:1056 views/newsletter/editor.html:1058
2885
+ #: views/newsletter/editor.html:1185 views/newsletter/editor.html:1187
2886
  msgid "Read more"
2887
  msgstr ""
2888
 
2895
  msgid "Button"
2896
  msgstr ""
2897
 
2898
+ #: views/newsletter/editor.html:1138
2899
  msgid "Add your postal address here!"
2900
  msgstr ""
2901
 
2902
+ #: views/newsletter/editor.html:1158
2903
  msgid "An image of..."
2904
  msgstr ""
2905
 
2906
+ #: views/newsletter/editor.html:1236
2907
  msgid "Facebook"
2908
  msgstr ""
2909
 
2910
+ #: views/newsletter/editor.html:1247
2911
  msgid "Twitter"
2912
  msgstr ""
2913
 
2914
+ #: views/newsletter/editor.html:1260
2915
  msgid "Edit this to insert text."
2916
  msgstr ""
2917
 
2918
+ #: views/newsletter/editor.html:1263
2919
  msgid "Display problems?"
2920
  msgstr ""
2921
 
2922
+ #: views/newsletter/editor.html:1264
2923
  msgid "Open this email in your web browser."
2924
  msgstr ""
2925
 
2965
 
2966
  #: views/newsletter/templates/blocks/automatedLatestContent/settings.hbs:41
2967
  #: views/newsletter/templates/blocks/automatedLatestContentLayout/settings.hbs:41
2968
+ #: views/newsletter/templates/blocks/container/settings.hbs:22
2969
  #: views/newsletter/templates/blocks/posts/settings.hbs:7
2970
  msgid "Display options"
2971
  msgstr ""
3254
  msgstr ""
3255
 
3256
  #: views/newsletter/templates/blocks/button/settings.hbs:71
 
3257
  #: views/newsletter/templates/blocks/divider/settings.hbs:28
3258
  #: views/newsletter/templates/blocks/footer/settings.hbs:34
3259
  #: views/newsletter/templates/blocks/header/settings.hbs:34
3299
  msgid "Columns"
3300
  msgstr ""
3301
 
3302
+ #: views/newsletter/templates/blocks/container/settings.hbs:7
3303
+ msgid "Background color"
3304
+ msgstr ""
3305
+
3306
+ #: views/newsletter/templates/blocks/container/settings.hbs:12
3307
+ msgid "Background image"
3308
+ msgstr ""
3309
+
3310
+ #: views/newsletter/templates/blocks/container/settings.hbs:19
3311
+ #: views/newsletter/templates/blocks/image/settings.hbs:83
3312
+ msgid "Select another image"
3313
+ msgstr ""
3314
+
3315
+ #: views/newsletter/templates/blocks/container/settings.hbs:19
3316
+ msgid "Select image"
3317
+ msgstr ""
3318
+
3319
+ #: views/newsletter/templates/blocks/container/settings.hbs:26
3320
+ msgid "Scale"
3321
+ msgstr ""
3322
+
3323
+ #: views/newsletter/templates/blocks/container/settings.hbs:32
3324
+ msgid "Fit"
3325
+ msgstr ""
3326
+
3327
+ #: views/newsletter/templates/blocks/container/settings.hbs:38
3328
+ msgid "Tile"
3329
+ msgstr ""
3330
+
3331
  #: views/newsletter/templates/blocks/container/threeColumnLayoutWidget.hbs:4
3332
  msgid "3 columns"
3333
  msgstr ""
3386
  msgid "Alternative text"
3387
  msgstr ""
3388
 
 
 
 
 
3389
  #: views/newsletter/templates/blocks/posts/settings.hbs:6
3390
  msgid "Back to selection"
3391
  msgstr ""
5671
  msgid "Awesome! Now, take me to MailPoet"
5672
  msgstr ""
5673
 
5674
+ #: lib/API/JSON/v1/Services.php:159
5675
  msgctxt "Error code (inside parentheses)"
5676
  msgid "code: %s"
5677
  msgstr ""
lib/API/JSON/v1/Services.php CHANGED
@@ -2,10 +2,12 @@
2
 
3
  namespace MailPoet\API\JSON\v1;
4
 
 
5
  use MailPoet\API\JSON\Endpoint as APIEndpoint;
6
  use MailPoet\API\JSON\Error as APIError;
7
  use MailPoet\Config\AccessControl;
8
  use MailPoet\Config\Installer;
 
9
  use MailPoet\Services\Bridge;
10
  use MailPoet\WP\DateTime;
11
 
@@ -53,6 +55,10 @@ class Services extends APIEndpoint {
53
  );
54
  }
55
 
 
 
 
 
56
  if($success_message) {
57
  return $this->successResponse(array('message' => $success_message));
58
  }
@@ -111,6 +117,10 @@ class Services extends APIEndpoint {
111
  );
112
  }
113
 
 
 
 
 
114
  if($success_message) {
115
  return $this->successResponse(
116
  array('message' => $success_message),
2
 
3
  namespace MailPoet\API\JSON\v1;
4
 
5
+ use MailPoet\Analytics\Analytics;
6
  use MailPoet\API\JSON\Endpoint as APIEndpoint;
7
  use MailPoet\API\JSON\Error as APIError;
8
  use MailPoet\Config\AccessControl;
9
  use MailPoet\Config\Installer;
10
+ use MailPoet\Models\Setting;
11
  use MailPoet\Services\Bridge;
12
  use MailPoet\WP\DateTime;
13
 
55
  );
56
  }
57
 
58
+ if(!empty($result['data']['public_id'])) {
59
+ Analytics::setPublicId($result['data']['public_id']);
60
+ }
61
+
62
  if($success_message) {
63
  return $this->successResponse(array('message' => $success_message));
64
  }
117
  );
118
  }
119
 
120
+ if(!empty($result['data']['public_id'])) {
121
+ Analytics::setPublicId($result['data']['public_id']);
122
+ }
123
+
124
  if($success_message) {
125
  return $this->successResponse(
126
  array('message' => $success_message),
lib/Analytics/Analytics.php CHANGED
@@ -34,6 +34,43 @@ class Analytics {
34
  return !empty($analytics_settings['enabled']) === true;
35
  }
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  private function shouldSend() {
38
  if(!$this->isEnabled()) {
39
  return false;
34
  return !empty($analytics_settings['enabled']) === true;
35
  }
36
 
37
+ static function setPublicId($new_public_id) {
38
+ $current_public_id = Setting::getValue('public_id');
39
+ if($current_public_id !== $new_public_id) {
40
+ Setting::setValue('public_id', $new_public_id);
41
+ Setting::setValue('new_public_id', 'true');
42
+ // Force user data to be resent
43
+ Setting::deleteValue(Analytics::SETTINGS_LAST_SENT_KEY);
44
+ }
45
+ }
46
+
47
+ /** @return string */
48
+ function getPublicId() {
49
+ $public_id = Setting::getValue('public_id', '');
50
+ // if we didn't get the user public_id from the shop yet : we create one based on mixpanel distinct_id
51
+ if(empty($public_id) && !empty($_COOKIE['mixpanel_distinct_id'])) {
52
+ // the public id has to be diffent that mixpanel_distinct_id in order to be used on different browser
53
+ $mixpanel_distinct_id = md5($_COOKIE['mixpanel_distinct_id']);
54
+ Setting::setValue('public_id', $mixpanel_distinct_id);
55
+ Setting::setValue('new_public_id', 'true');
56
+ return $mixpanel_distinct_id;
57
+ }
58
+ return $public_id;
59
+ }
60
+
61
+ /**
62
+ * Returns true if a the public_id was added and update new_public_id to false
63
+ * @return boolean
64
+ */
65
+ function isPublicIdNew() {
66
+ $new_public_id = Setting::getValue('new_public_id');
67
+ if($new_public_id === 'true') {
68
+ Setting::setValue('new_public_id', 'false');
69
+ return true;
70
+ }
71
+ return false;
72
+ }
73
+
74
  private function shouldSend() {
75
  if(!$this->isEnabled()) {
76
  return false;
lib/Cron/Daemon.php CHANGED
@@ -128,4 +128,4 @@ class Daemon {
128
  function terminateRequest($message = false) {
129
  die($message);
130
  }
131
- }
128
  function terminateRequest($message = false) {
129
  die($message);
130
  }
131
+ }
lib/Cron/Workers/Scheduler.php.orig DELETED
@@ -1,212 +0,0 @@
1
- <?php
2
-
3
- namespace MailPoet\Cron\Workers;
4
-
5
- use Carbon\Carbon;
6
- use MailPoet\Cron\CronHelper;
7
- use MailPoet\Models\Newsletter;
8
- <<<<<<< HEAD
9
- use MailPoet\Models\ScheduledTask;
10
- =======
11
- use MailPoet\Models\Segment;
12
- >>>>>>> Adds newsletter/cron scheduler for automatic emails
13
- use MailPoet\Models\Subscriber;
14
- use MailPoet\Models\SubscriberSegment;
15
- use MailPoet\Segments\SubscribersFinder;
16
- use MailPoet\Tasks\Sending as SendingTask;
17
- use MailPoet\Newsletter\Scheduler\Scheduler as NewsletterScheduler;
18
- use MailPoet\WP\Functions as WPFunctions;
19
-
20
- if(!defined('ABSPATH')) exit;
21
- require_once(ABSPATH . 'wp-includes/pluggable.php');
22
-
23
- class Scheduler {
24
- public $timer;
25
- const UNCONFIRMED_SUBSCRIBER_RESCHEDULE_TIMEOUT = 5;
26
- const TASK_BATCH_SIZE = 5;
27
-
28
- function __construct($timer = false) {
29
- $this->timer = ($timer) ? $timer : microtime(true);
30
- // abort if execution limit is reached
31
- CronHelper::enforceExecutionLimit($this->timer);
32
- }
33
-
34
- function process() {
35
- $scheduled_queues = self::getScheduledQueues();
36
- if(!count($scheduled_queues)) return false;
37
- $this->updateTasks($scheduled_queues);
38
- foreach($scheduled_queues as $i => $queue) {
39
- $newsletter = Newsletter::filter('filterWithOptions')->findOne($queue->newsletter_id);
40
- if(!$newsletter || $newsletter->deleted_at !== null) {
41
- $queue->delete();
42
- } elseif($newsletter->status !== Newsletter::STATUS_ACTIVE && $newsletter->status !== Newsletter::STATUS_SCHEDULED) {
43
- continue;
44
- } elseif($newsletter->type === Newsletter::TYPE_WELCOME) {
45
- $this->processWelcomeNewsletter($newsletter, $queue);
46
- } elseif($newsletter->type === Newsletter::TYPE_NOTIFICATION) {
47
- $this->processPostNotificationNewsletter($newsletter, $queue);
48
- } elseif($newsletter->type === Newsletter::TYPE_STANDARD) {
49
- $this->processScheduledStandardNewsletter($newsletter, $queue);
50
- } elseif($newsletter->type === Newsletter::TYPE_AUTOMATIC) {
51
- $this->processScheduledAutomaticEmail($newsletter, $queue);
52
- }
53
- CronHelper::enforceExecutionLimit($this->timer);
54
- }
55
- }
56
-
57
- function processWelcomeNewsletter($newsletter, $queue) {
58
- $subscribers = $queue->getSubscribers();
59
- if(empty($subscribers[0])) {
60
- $queue->delete();
61
- return false;
62
- }
63
- $subscriber_id = (int)$subscribers[0];
64
- if($newsletter->event === 'segment') {
65
- if($this->verifyMailpoetSubscriber($subscriber_id, $newsletter, $queue) === false) {
66
- return false;
67
- }
68
- } else {
69
- if($newsletter->event === 'user') {
70
- if($this->verifyWPSubscriber($subscriber_id, $newsletter, $queue) === false) {
71
- return false;
72
- }
73
- }
74
- }
75
- $queue->status = null;
76
- $queue->save();
77
- return true;
78
- }
79
-
80
- function processPostNotificationNewsletter($newsletter, $queue) {
81
- // ensure that segments exist
82
- $segments = $newsletter->segments()->findArray();
83
- if(empty($segments)) {
84
- return $this->deleteQueueOrUpdateNextRunDate($queue, $newsletter);
85
- }
86
-
87
- // ensure that subscribers are in segments
88
- $finder = new SubscribersFinder();
89
- $subscribers_count = $finder->addSubscribersToTaskFromSegments($queue->task(), $segments);
90
-
91
- if(empty($subscribers_count)) {
92
- return $this->deleteQueueOrUpdateNextRunDate($queue, $newsletter);
93
- }
94
-
95
- // create a duplicate newsletter that acts as a history record
96
- $notification_history = $this->createNotificationHistory($newsletter->id);
97
- if(!$notification_history) return false;
98
-
99
- // queue newsletter for delivery
100
- $queue->newsletter_id = $notification_history->id;
101
- $queue->status = null;
102
- $queue->save();
103
- // update notification status
104
- $notification_history->setStatus(Newsletter::STATUS_SENDING);
105
- return true;
106
- }
107
-
108
- function processScheduledAutomaticEmail($newsletter, $queue) {
109
- if($newsletter->sendTo === 'segment') {
110
- $segment = Segment::findOne($newsletter->segment)->asArray();
111
- $finder = new SubscribersFinder();
112
- $result = $finder->addSubscribersToTaskFromSegments($queue->task(), array($segment));
113
- if(empty($result)) {
114
- $queue->delete();
115
- return false;
116
- }
117
- }
118
-
119
- $queue->status = null;
120
- $queue->save();
121
- return true;
122
- }
123
-
124
- function processScheduledStandardNewsletter($newsletter, $queue) {
125
- $segments = $newsletter->segments()->findArray();
126
- $finder = new SubscribersFinder();
127
- $subscribers_count = $finder->addSubscribersToTaskFromSegments($queue->task(), $segments);
128
- // update current queue
129
- $queue->updateCount();
130
- $queue->status = null;
131
- $queue->save();
132
- // update newsletter status
133
- $newsletter->setStatus(Newsletter::STATUS_SENDING);
134
- return true;
135
- }
136
-
137
- function verifyMailpoetSubscriber($subscriber_id, $newsletter, $queue) {
138
- $subscriber = Subscriber::findOne($subscriber_id);
139
- // check if subscriber is in proper segment
140
- $subscriber_in_segment =
141
- SubscriberSegment::where('subscriber_id', $subscriber_id)
142
- ->where('segment_id', $newsletter->segment)
143
- ->where('status', 'subscribed')
144
- ->findOne();
145
- if(!$subscriber || !$subscriber_in_segment) {
146
- $queue->delete();
147
- return false;
148
- }
149
- // check if subscriber is confirmed (subscribed)
150
- if($subscriber->status !== Subscriber::STATUS_SUBSCRIBED) {
151
- // reschedule delivery in 5 minutes
152
- $scheduled_at = Carbon::createFromTimestamp(WPFunctions::currentTime('timestamp'));
153
- $queue->scheduled_at = $scheduled_at->addMinutes(
154
- self::UNCONFIRMED_SUBSCRIBER_RESCHEDULE_TIMEOUT
155
- );
156
- $queue->save();
157
- return false;
158
- }
159
- return true;
160
- }
161
-
162
- function verifyWPSubscriber($subscriber_id, $newsletter, $queue) {
163
- // check if user has the proper role
164
- $subscriber = Subscriber::findOne($subscriber_id);
165
- if(!$subscriber || $subscriber->isWPUser() === false) {
166
- $queue->delete();
167
- return false;
168
- }
169
- $wp_user = (array)get_userdata($subscriber->wp_user_id);
170
- if($newsletter->role !== \MailPoet\Newsletter\Scheduler\Scheduler::WORDPRESS_ALL_ROLES
171
- && !in_array($newsletter->role, $wp_user['roles'])
172
- ) {
173
- $queue->delete();
174
- return false;
175
- }
176
- return true;
177
- }
178
-
179
- function deleteQueueOrUpdateNextRunDate($queue, $newsletter) {
180
- if($newsletter->intervalType === NewsletterScheduler::INTERVAL_IMMEDIATELY) {
181
- $queue->delete();
182
- return;
183
- } else {
184
- $next_run_date = NewsletterScheduler::getNextRunDate($newsletter->schedule);
185
- if(!$next_run_date) {
186
- $queue->delete();
187
- return;
188
- }
189
- $queue->scheduled_at = $next_run_date;
190
- $queue->save();
191
- }
192
- }
193
-
194
- function createNotificationHistory($newsletter_id) {
195
- $newsletter = Newsletter::findOne($newsletter_id);
196
- $notification_history = $newsletter->createNotificationHistory();
197
- return ($notification_history->getErrors() === false) ?
198
- $notification_history :
199
- false;
200
- }
201
-
202
- private function updateTasks(array $scheduled_queues) {
203
- $ids = array_map(function ($queue) {
204
- return $queue->task_id;
205
- }, $scheduled_queues);
206
- ScheduledTask::touchAllByIds($ids);
207
- }
208
-
209
- static function getScheduledQueues() {
210
- return SendingTask::getScheduledQueues(self::TASK_BATCH_SIZE);
211
- }
212
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lib/Cron/Workers/SendingQueue/SendingQueue.php CHANGED
@@ -164,10 +164,11 @@ class SendingQueue {
164
  );
165
  // log error message and schedule retry/pause sending
166
  if($send_result['response'] === false) {
167
- MailerLog::processError(
168
- $send_result['operation'],
169
- $send_result['error_message']
170
- );
 
171
  }
172
  // update processed/to process list
173
  if(!$queue->updateProcessedSubscribers($prepared_subscribers_ids)) {
164
  );
165
  // log error message and schedule retry/pause sending
166
  if($send_result['response'] === false) {
167
+ if(isset($send_result['retry_interval'])) {
168
+ MailerLog::processNonBlockingError($send_result['operation'], $send_result['error_message'], $send_result['retry_interval']);
169
+ } else {
170
+ MailerLog::processError($send_result['operation'], $send_result['error_message']);
171
+ }
172
  }
173
  // update processed/to process list
174
  if(!$queue->updateProcessedSubscribers($prepared_subscribers_ids)) {
lib/Form/Widget.php CHANGED
@@ -221,7 +221,8 @@ EOL;
221
  function createSubscriptionForm() {
222
  MailPoet.Ajax.post({
223
  endpoint: 'forms',
224
- action: 'create'
 
225
  }).done(function(response) {
226
  if(response.data && response.data.id) {
227
  window.location =
221
  function createSubscriptionForm() {
222
  MailPoet.Ajax.post({
223
  endpoint: 'forms',
224
+ action: 'create',
225
+ api_version: window.mailpoet_api_version
226
  }).done(function(response) {
227
  if(response.data && response.data.id) {
228
  window.location =
lib/Mailer/MailerLog.php CHANGED
@@ -75,16 +75,43 @@ class MailerLog {
75
  return self::resetMailerLog();
76
  }
77
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  static function processError($operation, $error_message, $error_code = null, $pause_sending = false) {
79
  $mailer_log = self::getMailerLog();
80
- (int)$mailer_log['retry_attempt']++;
81
  $mailer_log['retry_at'] = time() + self::RETRY_INTERVAL;
82
  $mailer_log = self::setError($mailer_log, $operation, $error_message, $error_code);
83
  self::updateMailerLog($mailer_log);
84
  if($pause_sending) {
85
  self::pauseSending($mailer_log);
86
  }
87
- return self::enforceExecutionRequirements();
88
  }
89
 
90
  static function setError($mailer_log, $operation, $error_message, $error_code = null) {
@@ -140,4 +167,4 @@ class MailerLog {
140
  $mailer_log = self::getMailerLog($mailer_log);
141
  return $mailer_log['status'] === self::STATUS_PAUSED;
142
  }
143
- }
75
  return self::resetMailerLog();
76
  }
77
 
78
+ /**
79
+ * Process error, doesn't increase retry_attempt so it will not block sending
80
+ *
81
+ * @param string $operation
82
+ * @param string $error_message
83
+ * @param int $retry_interval
84
+ *
85
+ * @throws \Exception
86
+ */
87
+ static function processNonBlockingError($operation, $error_message, $retry_interval = self::RETRY_INTERVAL) {
88
+ $mailer_log = self::getMailerLog();
89
+ $mailer_log['retry_at'] = time() + $retry_interval;
90
+ $mailer_log = self::setError($mailer_log, $operation, $error_message);
91
+ self::updateMailerLog($mailer_log);
92
+ self::enforceExecutionRequirements();
93
+ }
94
+
95
+ /**
96
+ * Process error, increase retry_attempt and block sending if it goes above RETRY_INTERVAL
97
+ *
98
+ * @param string $operation
99
+ * @param string $error_message
100
+ * @param string $error_code
101
+ * @param bool $pause_sending
102
+ *
103
+ * @throws \Exception
104
+ */
105
  static function processError($operation, $error_message, $error_code = null, $pause_sending = false) {
106
  $mailer_log = self::getMailerLog();
107
+ $mailer_log['retry_attempt']++;
108
  $mailer_log['retry_at'] = time() + self::RETRY_INTERVAL;
109
  $mailer_log = self::setError($mailer_log, $operation, $error_message, $error_code);
110
  self::updateMailerLog($mailer_log);
111
  if($pause_sending) {
112
  self::pauseSending($mailer_log);
113
  }
114
+ self::enforceExecutionRequirements();
115
  }
116
 
117
  static function setError($mailer_log, $operation, $error_message, $error_code = null) {
167
  $mailer_log = self::getMailerLog($mailer_log);
168
  return $mailer_log['status'] === self::STATUS_PAUSED;
169
  }
170
+ }
lib/Mailer/Methods/MailPoet.php CHANGED
@@ -9,6 +9,9 @@ use MailPoet\Services\Bridge\API;
9
  if(!defined('ABSPATH')) exit;
10
 
11
  class MailPoet {
 
 
 
12
  public $api;
13
  public $sender;
14
  public $reply_to;
@@ -34,16 +37,37 @@ class MailPoet {
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) {
48
  preg_match('!(?P<name>.*?)\s<(?P<email>.*?)>!', $subscriber, $subscriber_data);
49
  if(!isset($subscriber_data['email'])) {
@@ -104,4 +128,37 @@ class MailPoet {
104
  }
105
  return $body;
106
  }
107
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  if(!defined('ABSPATH')) exit;
10
 
11
  class MailPoet {
12
+
13
+ const TEMPORARY_UNAVAILABLE_RETRY_INTERVAL = 300; // seconds
14
+
15
  public $api;
16
  public $sender;
17
  public $reply_to;
37
  case API::SENDING_STATUS_CONNECTION_ERROR:
38
  return Mailer::formatMailerConnectionErrorResult($result['message']);
39
  case API::SENDING_STATUS_SEND_ERROR:
40
+ return $this->processSendError($result, $subscriber);
 
 
 
41
  case API::SENDING_STATUS_OK:
42
  default:
43
  return Mailer::formatMailerSendSuccessResult();
44
  }
45
  }
46
 
47
+ function processSendError($result, $subscriber) {
48
+ if(!empty($result['code'])) {
49
+ switch($result['code']) {
50
+ case API::RESPONSE_CODE_NOT_ARRAY:
51
+ return Mailer::formatMailerSendErrorResult(__('JSON input is not an array', 'mailpoet'));
52
+ case API::RESPONSE_CODE_PAYLOAD_TOO_BIG:
53
+ return Mailer::formatMailerSendErrorResult($result['message']);
54
+ case API::RESPONSE_CODE_PAYLOAD_ERROR:
55
+ $error = $this->parseErrorResponse($result['message'], $subscriber);
56
+ return Mailer::formatMailerSendErrorResult($error);
57
+ case API::RESPONSE_CODE_TEMPORARY_UNAVAILABLE:
58
+ $error = Mailer::formatMailerSendErrorResult(__('Email service is temporarily not available, please try again in a few minutes.', 'mailpoet'));
59
+ $error['retry_interval'] = self::TEMPORARY_UNAVAILABLE_RETRY_INTERVAL;
60
+ return $error;
61
+ case API::RESPONSE_CODE_KEY_INVALID:
62
+ Bridge::invalidateKey();
63
+ break;
64
+ default:
65
+ return Mailer::formatMailerSendErrorResult($result['message']);
66
+ }
67
+ }
68
+ return Mailer::formatMailerSendErrorResult($result['message']);
69
+ }
70
+
71
  function processSubscriber($subscriber) {
72
  preg_match('!(?P<name>.*?)\s<(?P<email>.*?)>!', $subscriber, $subscriber_data);
73
  if(!isset($subscriber_data['email'])) {
128
  }
129
  return $body;
130
  }
131
+
132
+ private function parseErrorResponse($result, $subscriber) {
133
+ $result_parsed = json_decode($result, true);
134
+ $errors = [];
135
+ if(is_array($result_parsed)) {
136
+ foreach($result_parsed as $result_error) {
137
+ $errors[] = $this->processSingleSubscriberError($result_error, $subscriber);
138
+ }
139
+ }
140
+ if(!empty($errors)) {
141
+ return __('Error while sending: ', 'mailpoet') . join(', ', $errors);
142
+ } else {
143
+ return __('Error while sending newsletters. ', 'mailpoet') . $result;
144
+ }
145
+ }
146
+
147
+ private function processSingleSubscriberError($result_error, $subscriber) {
148
+ $error = '';
149
+ if(is_array($result_error)) {
150
+ $subscriber_errors = [];
151
+ if(isset($result_error['errors']) && is_array($result_error['errors'])) {
152
+ array_walk_recursive($result_error['errors'], function($item) use (&$subscriber_errors) {
153
+ $subscriber_errors[] = $item;
154
+ });
155
+ }
156
+ $error .= join(', ', $subscriber_errors);
157
+
158
+ if(isset($result_error['index']) && isset($subscriber[$result_error['index']])) {
159
+ $error = '(' . $subscriber[$result_error['index']] . ': ' . $error . ')';
160
+ }
161
+ }
162
+ return $error;
163
+ }
164
+ }
lib/Newsletter/Renderer/Columns/Renderer.php CHANGED
@@ -2,14 +2,14 @@
2
  namespace MailPoet\Newsletter\Renderer\Columns;
3
 
4
  class Renderer {
5
- function render($column_styles, $columns_count, $columns_data) {
6
  $styles = $column_styles['block'];
7
  $width = ColumnsHelper::columnWidth($columns_count);
8
  $class = ColumnsHelper::columnClass($columns_count);
9
  $alignment = ColumnsHelper::columnAlignment($columns_count);
10
  $template = ($columns_count === 1) ?
11
- $this->getOneColumnTemplate($styles, $class) :
12
- $this->getMultipleColumnsTemplate($styles, $width, $alignment, $class);
13
  $result = array_map(function($content) use ($template) {
14
  return $template['content_start'] . $content . $template['content_end'];
15
  }, $columns_data);
@@ -20,16 +20,16 @@ class Renderer {
20
  return $result;
21
  }
22
 
23
- function getOneColumnTemplate($styles, $class) {
24
- $background_color = $this->getBackgroundColor($styles);
25
  $template['content_start'] = '
26
  <tr>
27
- <td class="mailpoet_content" align="center" style="border-collapse:collapse">
28
  <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
29
  <tbody>
30
  <tr>
31
  <td style="padding-left:0;padding-right:0">
32
- <table width="100%" border="0" cellpadding="0" cellspacing="0" class="mailpoet_' . $class . '" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0;table-layout:fixed;margin-left:auto;margin-right:auto;padding-left:0;padding-right:0;' . $background_color . '">
33
  <tbody>';
34
  $template['content_end'] = '
35
  </tbody>
@@ -43,11 +43,11 @@ class Renderer {
43
  return $template;
44
  }
45
 
46
- function getMultipleColumnsTemplate($styles, $width, $alignment, $class) {
47
- $background_color = $this->getBackgroundColor($styles);
48
  $template['container_start'] = '
49
  <tr>
50
- <td class="mailpoet_content-' . $class . '" align="left" style="border-collapse:collapse;' . $background_color . '">
51
  <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
52
  <tbody>
53
  <tr>
@@ -78,11 +78,21 @@ class Renderer {
78
  return $template;
79
  }
80
 
81
- function getBackgroundColor($styles) {
82
- if(!isset($styles['backgroundColor'])) return false;
83
- $background_color = $styles['backgroundColor'];
84
- return ($background_color !== 'transparent') ?
85
- sprintf('background-color:%s!important;" bgcolor="%s', $background_color, $background_color) :
86
- false;
 
 
 
 
 
 
 
 
 
 
87
  }
88
  }
2
  namespace MailPoet\Newsletter\Renderer\Columns;
3
 
4
  class Renderer {
5
+ function render($column_styles, $column_image, $columns_count, $columns_data) {
6
  $styles = $column_styles['block'];
7
  $width = ColumnsHelper::columnWidth($columns_count);
8
  $class = ColumnsHelper::columnClass($columns_count);
9
  $alignment = ColumnsHelper::columnAlignment($columns_count);
10
  $template = ($columns_count === 1) ?
11
+ $this->getOneColumnTemplate($styles, $column_image, $class) :
12
+ $this->getMultipleColumnsTemplate($styles, $column_image, $width, $alignment, $class);
13
  $result = array_map(function($content) use ($template) {
14
  return $template['content_start'] . $content . $template['content_end'];
15
  }, $columns_data);
20
  return $result;
21
  }
22
 
23
+ function getOneColumnTemplate($styles, $image, $class) {
24
+ $background_css = $this->getBackgroundCss($styles, $image);
25
  $template['content_start'] = '
26
  <tr>
27
+ <td class="mailpoet_content" align="center" style="border-collapse:collapse;' . $background_css . '">
28
  <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
29
  <tbody>
30
  <tr>
31
  <td style="padding-left:0;padding-right:0">
32
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" class="mailpoet_' . $class . '" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0;table-layout:fixed;margin-left:auto;margin-right:auto;padding-left:0;padding-right:0;">
33
  <tbody>';
34
  $template['content_end'] = '
35
  </tbody>
43
  return $template;
44
  }
45
 
46
+ function getMultipleColumnsTemplate($styles, $image, $width, $alignment, $class) {
47
+ $background_css = $this->getBackgroundCss($styles, $image);
48
  $template['container_start'] = '
49
  <tr>
50
+ <td class="mailpoet_content-' . $class . '" align="left" style="border-collapse:collapse;' . $background_css . '">
51
  <table width="100%" border="0" cellpadding="0" cellspacing="0" style="border-spacing:0;mso-table-lspace:0;mso-table-rspace:0">
52
  <tbody>
53
  <tr>
78
  return $template;
79
  }
80
 
81
+ private function getBackgroundCss($styles, $image) {
82
+ if($image !== null && $image['src'] !== null) {
83
+ $background_color = isset($styles['backgroundColor']) && $styles['backgroundColor'] !== 'transparent' ? $styles['backgroundColor'] : '#ffffff';
84
+ $repeat = $image['display'] === 'tile' ? 'repeat' : 'no-repeat';
85
+ $size = $image['display'] === 'scale' ? 'cover' : 'contain';
86
+ return sprintf(
87
+ 'background: %s url(%s) %s center/%s;background-color: %s;background-image: url(%s);background-repeat: %s;background-position: center;background-size: %s;',
88
+ $background_color, $image['src'], $repeat, $size, $background_color, $image['src'], $repeat, $size
89
+ );
90
+ } else {
91
+ if(!isset($styles['backgroundColor'])) return false;
92
+ $background_color = $styles['backgroundColor'];
93
+ return ($background_color !== 'transparent') ?
94
+ sprintf('background-color:%s!important;" bgcolor="%s', $background_color, $background_color) :
95
+ false;
96
+ }
97
  }
98
  }
lib/Newsletter/Renderer/Renderer.php CHANGED
@@ -102,8 +102,10 @@ class Renderer {
102
  $content_block,
103
  $column_count
104
  );
 
105
  return $_this->columns_renderer->render(
106
  $content_block['styles'],
 
107
  $column_count,
108
  $column_data
109
  );
102
  $content_block,
103
  $column_count
104
  );
105
+ $content_block_image = isset($content_block['image'])?$content_block['image']:null;
106
  return $_this->columns_renderer->render(
107
  $content_block['styles'],
108
+ $content_block_image,
109
  $column_count,
110
  $column_data
111
  );
lib/Services/Bridge/API.php CHANGED
@@ -16,6 +16,10 @@ class API {
16
 
17
  const RESPONSE_CODE_KEY_INVALID = 401;
18
  const RESPONSE_CODE_STATS_SAVED = 204;
 
 
 
 
19
 
20
  private $api_key;
21
 
@@ -140,4 +144,4 @@ class API {
140
  );
141
  return WPFunctions::wpRemotePost($url, $params);
142
  }
143
- }
16
 
17
  const RESPONSE_CODE_KEY_INVALID = 401;
18
  const RESPONSE_CODE_STATS_SAVED = 204;
19
+ const RESPONSE_CODE_TEMPORARY_UNAVAILABLE = 503;
20
+ const RESPONSE_CODE_NOT_ARRAY = 422;
21
+ const RESPONSE_CODE_PAYLOAD_TOO_BIG = 413;
22
+ const RESPONSE_CODE_PAYLOAD_ERROR = 400;
23
 
24
  private $api_key;
25
 
144
  );
145
  return WPFunctions::wpRemotePost($url, $params);
146
  }
147
+ }
lib/Twig/Analytics.php CHANGED
@@ -21,6 +21,16 @@ class Analytics extends \Twig_Extension {
21
  array($analytics, 'isEnabled'),
22
  array('is_safe' => array('all'))
23
  ),
 
 
 
 
 
 
 
 
 
 
24
  );
25
  }
26
  }
21
  array($analytics, 'isEnabled'),
22
  array('is_safe' => array('all'))
23
  ),
24
+ new \Twig_SimpleFunction(
25
+ 'get_analytics_public_id',
26
+ array($analytics, 'getPublicId'),
27
+ array('is_safe' => array('all'))
28
+ ),
29
+ new \Twig_SimpleFunction(
30
+ 'is_analytics_public_id_new',
31
+ array($analytics, 'isPublicIdNew'),
32
+ array('is_safe' => array('all'))
33
+ )
34
  );
35
  }
36
  }
mailpoet.php CHANGED
@@ -4,7 +4,7 @@ if(!defined('ABSPATH')) exit;
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
- * Version: 3.8
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
@@ -18,7 +18,7 @@ if(!defined('ABSPATH')) exit;
18
  */
19
 
20
  $mailpoet_plugin = array(
21
- 'version' => '3.8',
22
  'filename' => __FILE__,
23
  'path' => dirname(__FILE__),
24
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
4
 
5
  /*
6
  * Plugin Name: MailPoet 3 (New)
7
+ * Version: 3.8.1
8
  * Plugin URI: http://www.mailpoet.com
9
  * Description: Create and send newsletters, post notifications and welcome emails from your WordPress.
10
  * Author: MailPoet
18
  */
19
 
20
  $mailpoet_plugin = array(
21
+ 'version' => '3.8.1',
22
  'filename' => __FILE__,
23
  'path' => dirname(__FILE__),
24
  'autoloader' => dirname(__FILE__) . '/vendor/autoload.php',
readme.txt CHANGED
@@ -1,55 +1,83 @@
1
- === MailPoet Newsletters (New) ===
2
- Contributors: mailpoet, wysija
3
- Tags: newsletter, email, welcome email, post notification, autoresponder, signup, subscription, SMTP
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
- Stable tag: 3.8
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
11
- Create and send beautiful emails and newsletters from WordPress.
12
 
13
  == Description ==
14
 
15
- The new MailPoet is here! With our new free sending plan, send unlimited emails to up to 2,000 subscribers. All without ever leaving WordPress.
16
 
17
- = What's inside? =
18
 
19
- * New designer with responsive templates
20
- * Send your emails with MailPoet’s Sending Service (optional)
21
- * Improved user experience
22
- * Easy configuration
23
- * Solid reliability
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  * GDPR compliant
25
- * Weekly releases
26
 
27
- = See it in action. =
 
28
  [Test the demo](http://demo.mailpoet.com/) or [see the 2 min. video](https://vimeo.com/223581490)
29
  [vimeo https://vimeo.com/223581490]
30
 
31
  = Before you install =
32
 
33
- Take note:
34
 
35
  * Not optimized for right-to-left (RTL) languages yet
36
- * Multisite works, but is not officially supported
37
  * Review [our minimum requirements](http://beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3)
38
 
39
- = What about the Premium? =
40
 
41
- MailPoet is fully featured in its free version and works up until you have "2000" subscribers.
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  The Premium version adds the following features:
44
 
45
- * for each newsletter, see which subscribers opened it and which links they clicked
46
- * ability to send Welcome Emails automatically; i.e. "Welcome to my Newsletter” autoresponders or multi-email courses
47
- * removes the small MailPoet logo in the footer of your emails
48
- * same day support (Monday to Friday)
49
- * send to over "2000" subscribers with your own sending method
50
- * see the [short video summary on the Premium](http://beta.docs.mailpoet.com/article/208-video-overview-of-mailpoet-premium)
 
 
51
 
52
- Plus: if you sign up to one of our sending plans, you’ll get all of these fancy features for free. Visit the Premium page inside the plugin for more info.
53
 
54
  = Translations =
55
 
@@ -118,6 +146,16 @@ Stop by our [support site](https://www.mailpoet.com/support).
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
 
 
 
 
121
  = 3.8 - 2018-07-17 =
122
  * Fixed: proper spacing between paragraphs in full post is now respected;
123
  * Fixed: deleting users who have opened one newsletter correctly records data for GDPR;
1
+ === MailPoet - emails and newsletters in WordPress ===
2
+ Contributors: mailpoet, wysija, kgjerstad
3
+ Tags: newsletter, newsletter subscribers, email, welcome email, post notification, WooCommerce emails, newsletter builder, mailing list
4
  Requires at least: 4.7
5
  Tested up to: 4.9
6
  Requires PHP: 5.6
7
+ Stable tag: 3.8.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
11
+ Send beautiful newsletters directly from WordPress. Add a signup form, manage your subscribers, automate your emails including WooCommerce & more.
12
 
13
  == Description ==
14
 
15
+ With MailPoet, your website visitors can sign up as newsletter subscribers and build your mailing list, all without leaving your WordPress admin.
16
 
17
+ Our newsletter builder integrates perfectly with WordPress so any website owner can create beautiful emails from scratch or by using our responsive templates that display flawlessly across all devices.
18
 
19
+ Schedule your newsletters, send them right away or set it up to send new blog post notifications automatically in just a few clicks.
20
+
21
+ Trusted by 300,000 WordPress websites since 2011.
22
+
23
+ = All features =
24
+
25
+ * Create and add a newsletter subscription form to your website
26
+ * Manage your subscribers and subscriber lists in WordPress
27
+ * Build and send newsletters with WordPress
28
+ * Create automatic emails to send new post notifications
29
+ * Send automated signup welcome emails (Premium)
30
+ * Increase your sales with our emails for WooCommerce (Premium)
31
+ * Insightful stats on your audience engagement (Premium)
32
+
33
+ = Why choose MailPoet =
34
+
35
+ * Easy to use WordPress newsletter builder
36
+ * Beautiful responsive templates
37
+ * No configuration needed: works out of the box
38
+ * We offer a free sending plan for those with 2,000 subscribers or less
39
  * GDPR compliant
 
40
 
41
+ = See it in action =
42
+
43
  [Test the demo](http://demo.mailpoet.com/) or [see the 2 min. video](https://vimeo.com/223581490)
44
  [vimeo https://vimeo.com/223581490]
45
 
46
  = Before you install =
47
 
48
+ Please note:
49
 
50
  * Not optimized for right-to-left (RTL) languages yet
51
+ * Multisite not officially supported
52
  * Review [our minimum requirements](http://beta.docs.mailpoet.com/article/152-minimum-requirements-for-mailpoet-3)
53
 
54
+ = WooCommerce emails (Premium) =
55
 
56
+ Increase your sales and stay in touch with your customers with our emails for WooCommerce !
57
+
58
+ With our WooCommerce emails, you can :
59
+
60
+ * Welcome your new customers when they make their first purchase
61
+ * Upsell by sending emails to customers who purchased a specific product or a specific product category
62
+ * Convert more customers by reaching those who abandoned their cart (soon)
63
+ * Reward and engage your customers who have spent a certain amount on your shop (soon)
64
+
65
+ = Premium details =
66
+
67
+ MailPoet's free version is fully featured, and comes with access to a free sending plan for up to 2,000 subscribers.
68
 
69
  The Premium version adds the following features:
70
 
71
+ * For each newsletter, see which subscribers opened it and which links got the most clicks
72
+ * Ability to send Welcome Emails automatically; i.e. Welcome to my Newsletter” autoresponders or multi-email courses
73
+ * All WooCommerce emails features
74
+ * Removes the small MailPoet logo in the footer of your emails
75
+ * Same day support (Monday to Friday)
76
+ * Send to over 2,000 subscribers with your own sending method (host, SendGrid, Amazon SES)
77
+
78
+ See the [short video summary on the Premium](http://beta.docs.mailpoet.com/article/208-video-overview-of-mailpoet-premium)
79
 
80
+ Visit the Premium page inside the plugin for more info.
81
 
82
  = Translations =
83
 
146
 
147
  == Changelog ==
148
 
149
+ = 3.8.1 - 2018-07-24 =
150
+ * Added: images can be used as backgrounds for column layout blocks;
151
+ * Added: notification if cron ping does not work correctly during first sending attempt;
152
+ * Added: new, prettier email type icon;
153
+ * Added: TLS 1.2 support to Swiftmailer to prevent SMTP sending issues;
154
+ * Added: updated error messages coming from the sending service;
155
+ * Added: clarified sending tab to encourage using our free sending service;
156
+ * Fixed: "Create New Form" link in subscription widget now creates a new form again;
157
+ * Fixed: removed call to action for MSS service for users already using MSS.
158
+
159
  = 3.8 - 2018-07-17 =
160
  * Fixed: proper spacing between paragraphs in full post is now respected;
161
  * Fixed: deleting users who have opened one newsletter correctly records data for GDPR;
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitc8840b8185e49c79bdb0b315255645e8::getLoader();
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81
6
  {
7
  private static $loader;
8
 
@@ -19,15 +19,15 @@ class ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81
19
  return self::$loader;
20
  }
21
 
22
- spl_autoload_register(array('ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81', '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\ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::getInitializer($loader));
31
  } else {
32
  $map = require __DIR__ . '/autoload_namespaces.php';
33
  foreach ($map as $namespace => $path) {
@@ -48,19 +48,19 @@ class ComposerAutoloaderInit9433abca1d6b02fe8c901dc92f264b81
48
  $loader->register(true);
49
 
50
  if ($useStaticLoader) {
51
- $includeFiles = Composer\Autoload\ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
- composerRequire9433abca1d6b02fe8c901dc92f264b81($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
- function composerRequire9433abca1d6b02fe8c901dc92f264b81($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 ComposerAutoloaderInitc8840b8185e49c79bdb0b315255645e8
6
  {
7
  private static $loader;
8
 
19
  return self::$loader;
20
  }
21
 
22
+ spl_autoload_register(array('ComposerAutoloaderInitc8840b8185e49c79bdb0b315255645e8', 'loadClassLoader'), true, true);
23
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
+ spl_autoload_unregister(array('ComposerAutoloaderInitc8840b8185e49c79bdb0b315255645e8', '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\ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::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\ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$files;
52
  } else {
53
  $includeFiles = require __DIR__ . '/autoload_files.php';
54
  }
55
  foreach ($includeFiles as $fileIdentifier => $file) {
56
+ composerRequirec8840b8185e49c79bdb0b315255645e8($fileIdentifier, $file);
57
  }
58
 
59
  return $loader;
60
  }
61
  }
62
 
63
+ function composerRequirec8840b8185e49c79bdb0b315255645e8($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 ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
@@ -1000,11 +1000,11 @@ class ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81
1000
  public static function getInitializer(ClassLoader $loader)
1001
  {
1002
  return \Closure::bind(function () use ($loader) {
1003
- $loader->prefixLengthsPsr4 = ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$prefixLengthsPsr4;
1004
- $loader->prefixDirsPsr4 = ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$prefixDirsPsr4;
1005
- $loader->fallbackDirsPsr4 = ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$fallbackDirsPsr4;
1006
- $loader->prefixesPsr0 = ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$prefixesPsr0;
1007
- $loader->classMap = ComposerStaticInit9433abca1d6b02fe8c901dc92f264b81::$classMap;
1008
 
1009
  }, null, ClassLoader::class);
1010
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitc8840b8185e49c79bdb0b315255645e8
8
  {
9
  public static $files = array (
10
  '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
1000
  public static function getInitializer(ClassLoader $loader)
1001
  {
1002
  return \Closure::bind(function () use ($loader) {
1003
+ $loader->prefixLengthsPsr4 = ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$prefixLengthsPsr4;
1004
+ $loader->prefixDirsPsr4 = ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$prefixDirsPsr4;
1005
+ $loader->fallbackDirsPsr4 = ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$fallbackDirsPsr4;
1006
+ $loader->prefixesPsr0 = ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$prefixesPsr0;
1007
+ $loader->classMap = ComposerStaticInitc8840b8185e49c79bdb0b315255645e8::$classMap;
1008
 
1009
  }, null, ClassLoader::class);
1010
  }
vendor/composer/installed.json CHANGED
@@ -777,17 +777,17 @@
777
  },
778
  {
779
  "name": "swiftmailer/swiftmailer",
780
- "version": "v5.4.9",
781
- "version_normalized": "5.4.9.0",
782
  "source": {
783
  "type": "git",
784
- "url": "https://github.com/swiftmailer/swiftmailer.git",
785
- "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91"
786
  },
787
  "dist": {
788
  "type": "zip",
789
- "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7ffc1ea296ed14bf8260b6ef11b80208dbadba91",
790
- "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91",
791
  "shasum": ""
792
  },
793
  "require": {
@@ -797,7 +797,7 @@
797
  "mockery/mockery": "~0.9.1",
798
  "symfony/phpunit-bridge": "~3.2"
799
  },
800
- "time": "2018-01-23T07:37:21+00:00",
801
  "type": "library",
802
  "extra": {
803
  "branch-alias": {
@@ -810,7 +810,11 @@
810
  "lib/swift_required.php"
811
  ]
812
  },
813
- "notification-url": "https://packagist.org/downloads/",
 
 
 
 
814
  "license": [
815
  "MIT"
816
  ],
@@ -829,7 +833,10 @@
829
  "email",
830
  "mail",
831
  "mailer"
832
- ]
 
 
 
833
  },
834
  {
835
  "name": "symfony/polyfill-php72",
777
  },
778
  {
779
  "name": "swiftmailer/swiftmailer",
780
+ "version": "dev-tls",
781
+ "version_normalized": "dev-tls",
782
  "source": {
783
  "type": "git",
784
+ "url": "https://github.com/mailpoet/swiftmailer.git",
785
+ "reference": "e6963324036afd178d3a8356e5c705ae4a442ef9"
786
  },
787
  "dist": {
788
  "type": "zip",
789
+ "url": "https://api.github.com/repos/mailpoet/swiftmailer/zipball/e6963324036afd178d3a8356e5c705ae4a442ef9",
790
+ "reference": "e6963324036afd178d3a8356e5c705ae4a442ef9",
791
  "shasum": ""
792
  },
793
  "require": {
797
  "mockery/mockery": "~0.9.1",
798
  "symfony/phpunit-bridge": "~3.2"
799
  },
800
+ "time": "2018-07-09T16:02:27+00:00",
801
  "type": "library",
802
  "extra": {
803
  "branch-alias": {
810
  "lib/swift_required.php"
811
  ]
812
  },
813
+ "autoload-dev": {
814
+ "psr-0": {
815
+ "Swift_": "tests/unit"
816
+ }
817
+ },
818
  "license": [
819
  "MIT"
820
  ],
833
  "email",
834
  "mail",
835
  "mailer"
836
+ ],
837
+ "support": {
838
+ "source": "https://github.com/mailpoet/swiftmailer/tree/tls"
839
+ }
840
  },
841
  {
842
  "name": "symfony/polyfill-php72",
vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php CHANGED
@@ -91,7 +91,7 @@ class Swift_Transport_StreamBuffer extends Swift_ByteStream_AbstractFilterableIn
91
 
92
  public function startTLS()
93
  {
94
- return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT);
95
  }
96
 
97
  /**
91
 
92
  public function startTLS()
93
  {
94
+ return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT);
95
  }
96
 
97
  /**
views/layout.html CHANGED
@@ -48,6 +48,8 @@ jQuery('.toplevel_page_mailpoet-newsletters.menu-top-last')
48
  var mailpoet_premium_version = <%= json_encode(mailpoet_premium_version()) %>;
49
  var mailpoet_analytics_enabled = <%= is_analytics_enabled() | json_encode %>;
50
  var mailpoet_analytics_data = <%= json_encode(get_analytics_data()) %>;
 
 
51
  // RFC 5322 standard; http://emailregex.com/ combined with https://google.github.io/closure-library/api/goog.format.EmailAddress.html#isValid
52
  var mailpoet_email_regex = /(?=^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$)(?=^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/;
53
  </script>
48
  var mailpoet_premium_version = <%= json_encode(mailpoet_premium_version()) %>;
49
  var mailpoet_analytics_enabled = <%= is_analytics_enabled() | json_encode %>;
50
  var mailpoet_analytics_data = <%= json_encode(get_analytics_data()) %>;
51
+ var mailpoet_analytics_public_id = <%= json_encode(get_analytics_public_id()) %>;
52
+ var mailpoet_analytics_new_public_id = <%= is_analytics_public_id_new() | json_encode %>;
53
  // RFC 5322 standard; http://emailregex.com/ combined with https://google.github.io/closure-library/api/goog.format.EmailAddress.html#isValid
54
  var mailpoet_email_regex = /(?=^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$)(?=^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,})))/;
55
  </script>
views/newsletter/editor.html CHANGED
@@ -1113,6 +1113,10 @@
1113
  },
1114
  },
1115
  container: {
 
 
 
 
1116
  styles: {
1117
  block: {
1118
  backgroundColor: 'transparent',
1113
  },
1114
  },
1115
  container: {
1116
+ image: {
1117
+ src: null,
1118
+ display: 'scale',
1119
+ },
1120
  styles: {
1121
  block: {
1122
  backgroundColor: 'transparent',
views/newsletter/templates/blocks/container/block.hbs CHANGED
@@ -1,8 +1,22 @@
1
- {{#ifCond model.styles.block.backgroundColor '!=' 'transparent'}}
2
- <style type="text/css">
3
- .mailpoet_editor_view_{{ viewCid }} { background-color: {{ model.styles.block.backgroundColor }}; }
4
- .mailpoet_editor_view_{{ viewCid }} .mailpoet_container { background-color: {{ model.styles.block.backgroundColor }}; }
5
- </style>
6
- {{/ifCond}}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  <div class="mailpoet_container {{#ifCond model.orientation '===' 'horizontal'}}mailpoet_container_horizontal{{/ifCond}}{{#ifCond model.orientation '===' 'vertical'}}mailpoet_container_vertical{{/ifCond}}"></div>
8
  <div class="mailpoet_tools"></div><div class="mailpoet_block_highlight">
1
+ {{#if model.image.src}}
2
+ <style type="text/css">
3
+ .mailpoet_editor_view_{{ viewCid }} {
4
+ background-color: {{#ifCond model.styles.block.backgroundColor '!=' 'transparent'}}{{ model.styles.block.backgroundColor }}{{else}}#ffffff{{/ifCond}} !important;
5
+ background-image: url({{ model.image.src }});
6
+ background-position: center;
7
+ background-repeat: {{#ifCond model.image.display '==' 'tile'}}repeat{{else}}no-repeat{{/ifCond}};
8
+ background-size: {{#ifCond model.image.display '==' 'scale'}}cover{{else}}contain{{/ifCond}};
9
+ }
10
+ .mailpoet_editor_view_{{ viewCid }} .mailpoet_container { background: transparent; }
11
+ </style>
12
+ {{else}}
13
+ {{#ifCond model.styles.block.backgroundColor '!=' 'transparent'}}
14
+ <style type="text/css">
15
+ .mailpoet_editor_view_{{ viewCid }} { background-color: {{ model.styles.block.backgroundColor }}; }
16
+ .mailpoet_editor_view_{{ viewCid }} .mailpoet_container { background-color: {{ model.styles.block.backgroundColor }}; }
17
+ </style>
18
+ {{/ifCond}}
19
+ {{/if}}
20
+
21
  <div class="mailpoet_container {{#ifCond model.orientation '===' 'horizontal'}}mailpoet_container_horizontal{{/ifCond}}{{#ifCond model.orientation '===' 'vertical'}}mailpoet_container_vertical{{/ifCond}}"></div>
22
  <div class="mailpoet_tools"></div><div class="mailpoet_block_highlight">
views/newsletter/templates/blocks/container/settings.hbs CHANGED
@@ -4,11 +4,41 @@
4
  <div class="mailpoet_form_field_input_option">
5
  <input type="text" name="background-color" class="mailpoet_field_container_background_color mailpoet_color" value="{{ model.styles.block.backgroundColor }}" />
6
  </div>
7
- <div class="mailpoet_form_field_title mailpoet_form_field_title_inline"><%= __('Background') %></div>
8
  </label>
9
  </div>
10
-
11
- <div class="mailpoet_container_columns_settings"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  <div class="mailpoet_form_field">
14
  <input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') | escape('html_attr') %>" />
4
  <div class="mailpoet_form_field_input_option">
5
  <input type="text" name="background-color" class="mailpoet_field_container_background_color mailpoet_color" value="{{ model.styles.block.backgroundColor }}" />
6
  </div>
7
+ <div class="mailpoet_form_field_title mailpoet_form_field_title_inline"><%= __('Background color') %></div>
8
  </label>
9
  </div>
10
+ <div class="mailpoet_form_field">
11
+ <label>
12
+ <div class="mailpoet_form_field_title"><%= __('Background image') %></div>
13
+ <div class="mailpoet_form_field_input_option">
14
+ <input type="text" name="src" class="mailpoet_input mailpoet_field_image_address" value="{{ model.image.src }}" placeholder="http://" /><br />
15
+ </div>
16
+ </label>
17
+ </div>
18
+ <div class="mailpoet_form_field">
19
+ <input type="button" name="select-image" class="button button-secondary mailpoet_button_full mailpoet_field_image_select_image" value="{{#if model.image.src}}<%= __('Select another image') | escape('html_attr') %>{{else}}<%= __('Select image') | escape('html_attr') %>{{/if}}" />
20
+ </div>
21
+ <div class="mailpoet_form_field">
22
+ <div class="mailpoet_form_field_title"><%= __('Display options') %></div>
23
+ <div class="mailpoet_form_field_radio_option">
24
+ <label>
25
+ <input type="radio" name="display_type" class="mailpoet_field_display_type" value="scale" {{#ifCond model.image.display '===' 'scale'}}CHECKED{{/ifCond}}/>
26
+ <%= __('Scale') %>
27
+ </label>
28
+ </div>
29
+ <div class="mailpoet_form_field_radio_option">
30
+ <label>
31
+ <input type="radio" name="display_type" class="mailpoet_field_display_type" value="fit" {{#ifCond model.image.display '===' 'fit'}}CHECKED{{/ifCond}}/>
32
+ <%= __('Fit') %>
33
+ </label>
34
+ </div>
35
+ <div class="mailpoet_form_field_radio_option">
36
+ <label>
37
+ <input type="radio" name="display_type" class="mailpoet_field_display_type" value="tile" {{#ifCond model.image.display '===' 'tile'}}CHECKED{{/ifCond}}/>
38
+ <%= __('Tile') %>
39
+ </label>
40
+ </div>
41
+ </div>
42
 
43
  <div class="mailpoet_form_field">
44
  <input type="button" class="button button-primary mailpoet_done_editing" value="<%= __('Done') | escape('html_attr') %>" />
views/newsletter/templates/blocks/image/block.hbs CHANGED
@@ -2,7 +2,7 @@
2
  <div class="mailpoet_content" style="{{#ifCond model.styles.block.textAlign '==' 'left'}}margin: 0 auto 0 0; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'center'}}margin: auto; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'right'}}margin: 0 0 0 auto; {{/ifCond}}width: {{model.width}}">
3
  <div class="mailpoet_image">
4
  <a href="{{ model.link }}" onClick="return false;">
5
- <img src="{{#ifCond model.src '!=' ''}}{{ model.src }}{{ else }}{{ imageMissingSrc }}{{/ifCond}}" alt="{{ model.alt }}" onerror="if(this.src != '{{ imageMissingSrc }}') {this.src = '{{ imageMissingSrc }}'; this.style.width='auto';}" width="{{model.width}}" />
6
  </a>
7
  <div class="mailpoet_image_resize_handle_container">
8
  <div class="mailpoet_image_resize_handle">
2
  <div class="mailpoet_content" style="{{#ifCond model.styles.block.textAlign '==' 'left'}}margin: 0 auto 0 0; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'center'}}margin: auto; {{/ifCond}}{{#ifCond model.styles.block.textAlign '==' 'right'}}margin: 0 0 0 auto; {{/ifCond}}width: {{model.width}}">
3
  <div class="mailpoet_image">
4
  <a href="{{ model.link }}" onClick="return false;">
5
+ <img src="{{#ifCond model.src '!=' ''}}{{ model.src }}{{ else }}{{ imageMissingSrc }}{{/ifCond}}" alt="{{ model.alt }}" onerror="if(this.src != '{{ imageMissingSrc }}') {this.src = '{{ imageMissingSrc }}';}" width="{{model.width}}" />
6
  </a>
7
  <div class="mailpoet_image_resize_handle_container">
8
  <div class="mailpoet_image_resize_handle">
views/newsletter/templates/blocks/image/settings.hbs CHANGED
@@ -80,7 +80,7 @@
80
  </div>
81
  <hr />
82
  <div class="mailpoet_form_field">
83
- <input type="button" name="select-another-image" class="button button-secondary mailpoet_button_full mailpoet_field_image_select_another_image" value="<%= __('Select another image') | escape('html_attr') %>" />
84
  </div>
85
 
86
  <div class="mailpoet_form_field">
80
  </div>
81
  <hr />
82
  <div class="mailpoet_form_field">
83
+ <input type="button" name="select-image" class="button button-secondary mailpoet_button_full mailpoet_field_image_select_image" value="<%= __('Select another image') | escape('html_attr') %>" />
84
  </div>
85
 
86
  <div class="mailpoet_form_field">
views/settings.html CHANGED
@@ -94,7 +94,7 @@
94
  // sync mss key with premium key
95
  $('#mailpoet_api_key').val(mailpoet_premium_key);
96
  if (mailpoet_premium_key.length > 0) {
97
- $('#mailpoet_premium_key_verify').trigger('click');
98
  }
99
  saveSettings();
100
  return false;
94
  // sync mss key with premium key
95
  $('#mailpoet_api_key').val(mailpoet_premium_key);
96
  if (mailpoet_premium_key.length > 0) {
97
+ $('#mailpoet_premium_key_verify').trigger('click', false);
98
  }
99
  saveSettings();
100
  return false;
views/settings/premium.html CHANGED
@@ -83,7 +83,7 @@
83
  jQuery(function($) {
84
  $(function() {
85
  // verifying license key
86
- $('#mailpoet_premium_key_verify').on('click', function () {
87
  // get license key
88
  var key = $('#mailpoet_premium_key').val();
89
 
@@ -98,11 +98,16 @@
98
  MailPoet.Modal.loading(true);
99
 
100
  var promise1 = verifyMailPoetPremiumKey(key);
101
- var promise2 = verifyMailPoetSendingServiceKey(key);
102
 
103
  // wait until both requests are completed before hiding the loading modal
104
  promise1.always(function() {
105
  promise2.always(function() {
 
 
 
 
 
106
  MailPoet.Modal.loading(false);
107
  });
108
  });
@@ -173,8 +178,6 @@
173
  $('.mailpoet_notice_server').hide();
174
  $('.mailpoet_mss_key_valid').text(response.data.message);
175
  $('.mailpoet_mss_key_valid').removeClass('mailpoet_hidden');
176
- $('#mta_group').val('mailpoet');
177
- $('.mailpoet_sending_service_activate').trigger('click', false);
178
  }).fail(function(response) {
179
  if (response.errors.length > 0) {
180
  $('.mailpoet_mss_key_invalid').text(
83
  jQuery(function($) {
84
  $(function() {
85
  // verifying license key
86
+ $('#mailpoet_premium_key_verify').on('click', function (e, activateMSS) {
87
  // get license key
88
  var key = $('#mailpoet_premium_key').val();
89
 
98
  MailPoet.Modal.loading(true);
99
 
100
  var promise1 = verifyMailPoetPremiumKey(key);
101
+ var promise2 = verifyMailPoetSendingServiceKey(key, activateMSS);
102
 
103
  // wait until both requests are completed before hiding the loading modal
104
  promise1.always(function() {
105
  promise2.always(function() {
106
+ // activate MSS by default
107
+ if (activateMSS === undefined || activateMSS) {
108
+ $('#mta_group').val('mailpoet');
109
+ $('.mailpoet_sending_service_activate').trigger('click', false);
110
+ }
111
  MailPoet.Modal.loading(false);
112
  });
113
  });
178
  $('.mailpoet_notice_server').hide();
179
  $('.mailpoet_mss_key_valid').text(response.data.message);
180
  $('.mailpoet_mss_key_valid').removeClass('mailpoet_hidden');
 
 
181
  }).fail(function(response) {
182
  if (response.errors.length > 0) {
183
  $('.mailpoet_mss_key_invalid').text(