Newsletter - Version 6.5.8

Version Description

  • Improvements on controls
  • Delivery test mode fix for Autoresponder
  • Fixed link to documentation on status panel
  • Added link to documentation on SMTP page
  • Reorganized status page with more links to the documentation
  • Improved image block dimensions management for Outlook
  • Fixed the mobile preview in the composer
  • Added "image to the right" in the hero block
  • Fixed dark color schema in hero block
Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 6.5.8
Comparing to
See all releases

Code changes from version 6.5.7 to 6.5.8

admin.css CHANGED
@@ -1179,6 +1179,9 @@ span.wp-media-buttons-icon:before {
1179
  background-color: #27AE60;
1180
  padding: 2px 10px;
1181
  border-radius: 10px;
 
 
 
1182
  }
1183
 
1184
  #tnp-status-table .tnp-ko {
@@ -1188,6 +1191,9 @@ span.wp-media-buttons-icon:before {
1188
  background-color: #E74C41;
1189
  padding: 2px 10px;
1190
  border-radius: 10px;
 
 
 
1191
  }
1192
 
1193
  #tnp-status-table .tnp-maybe {
@@ -1197,6 +1203,9 @@ span.wp-media-buttons-icon:before {
1197
  background-color: #F1C40F;
1198
  padding: 2px 10px;
1199
  border-radius: 10px;
 
 
 
1200
  }
1201
 
1202
  .tnp-main-status .tnp-log-files li {
1179
  background-color: #27AE60;
1180
  padding: 2px 10px;
1181
  border-radius: 10px;
1182
+ display: inline-block;
1183
+ width: 75px;
1184
+ text-align: center;
1185
  }
1186
 
1187
  #tnp-status-table .tnp-ko {
1191
  background-color: #E74C41;
1192
  padding: 2px 10px;
1193
  border-radius: 10px;
1194
+ display: inline-block;
1195
+ width: 75px;
1196
+ text-align: center;
1197
  }
1198
 
1199
  #tnp-status-table .tnp-maybe {
1203
  background-color: #F1C40F;
1204
  padding: 2px 10px;
1205
  border-radius: 10px;
1206
+ display: inline-block;
1207
+ width: 75px;
1208
+ text-align: center;
1209
  }
1210
 
1211
  .tnp-main-status .tnp-log-files li {
changelog.txt CHANGED
@@ -1,3 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
  = 5.9.5 =
3
 
1
+ = 6.3.9 =
2
+
3
+ * Improved antibot and/or spam subscription checks (please review your security configuration)
4
+
5
+ = 6.3.8 =
6
+
7
+ * Fixed email encoding when sent with wp_mail() and an encoding is selected on main settings
8
+ * Optimization on sending process
9
+ * Test newsletter stats cleared when real delivery starts
10
+ * Improved image resize
11
+ * Fixed security page help texts
12
+
13
+ = 6.3.7 =
14
+
15
+ * Schedules registration fix
16
+
17
+ = 6.3.6 =
18
+
19
+ * Improved error detection
20
+ * Fixed stats collection for Autoresponder
21
+ * Changed the init sequence to grant full load of other plugins (newsletter preview problems on some installations)
22
+ * Better reporting on tests
23
+
24
+ = 6.3.5 =
25
+
26
+ * New addons panel
27
+
28
+ = 6.3.4 =
29
+
30
+ * Fixes
31
+
32
+ = 6.3.3 =
33
+
34
+ * Fixed the missing admin notification when using the internal SMTP
35
+
36
+ = 6.3.2 =
37
+
38
+ * Fixed the admin notification email not sent or bot correctly formatted
39
+
40
+ = 6.3.1 =
41
+
42
+ * Empty subject fix
43
+
44
+ = 6.3.0 =
45
+
46
+ * New mailer infrastructure: better compatibility and performance
47
+ * New [TEST] prefix for newsletter tests
48
+ * Fix on composer subject saving
49
+ * General performance improvements
50
+ * Fixed title display in header composer block
51
+
52
+ = 6.2.2 =
53
+
54
+ * Fixed custom blocks style.css loading
55
+ * Fixed loading sequence for Archive Addon
56
+ * Labels translation on profile panel
57
+
58
+ = 6.2.1 =
59
+
60
+ * Fixed foreach warning
61
+ * Added IP on subscription via API
62
+ * All addons update logics moved to our free [Addons Manager](https://www.thenewsletterplugin.com/documentation/how-to-install-the-addons-manager) to make Newsletter even lighter
63
+
64
+ = 6.2.0 =
65
+
66
+ * Fixed integration with addons manager
67
+ * Support for new addon format
68
+ * Added PHP minimum version declaration
69
+
70
+ = 6.1.9 =
71
+
72
+ * Fixed a missing default on profile configuration
73
+ * Fixed the default message template
74
+ * Added image alt on image block
75
+ * Improved addons version check and performances
76
+ * Post block and image block fixes
77
+
78
+ = 6.1.8 =
79
+
80
+ * Fixed a version check on main settings
81
+
82
+ = 6.1.7 =
83
+
84
+ * Fix for Automated
85
+
86
+ = 6.1.6 =
87
+
88
+ * Fixed roles management
89
+
90
+ = 6.1.5 =
91
+
92
+ * Improved the Gutenberg block
93
+
94
+ = 6.1.4 =
95
+
96
+ * Support for Automated theme regeneration
97
+ * Fixed link tracking
98
+
99
+ = 6.1.3 =
100
+
101
+ * Fix to avoid third party plugin notices to interfere with the composer
102
+ * NEW! Added subscription block to the Gutenberg editor
103
+ * Code cleanup
104
+
105
+ = 6.1.2 =
106
+
107
+ * Added support for roles
108
+
109
+ = 6.1.1 =
110
+
111
+ * Added support for custom blocks
112
+
113
+ = 6.1.0 =
114
+
115
+ * Fixed data cleanup for non utf8mb4 database. Emoji not saved solved.
116
+ * Small changes to the addons panel
117
+
118
+ = 6.0.9 =
119
+
120
+ * Changed the access control for editors
121
+ * Added the convert to utf8mb4 on status panel
122
+ * Small loading improvements
123
+ * API Subscribe activation message fix
124
+ * Fixed debug notice on composer
125
+ * Fixed alt attribute on social block
126
+
127
+ = 6.0.8 =
128
+
129
+ * Specific link tracking patch for ElasticEmail
130
+ * Compatibility code for WP 4.7
131
+ * Fixed minimal widget subscribe button
132
+
133
+ = 6.0.7 =
134
+
135
+ * Fixed the wrong edit mode of duplicated newsletters
136
+ * Fixed the alignment of small images on composer
137
+ * Added addons update notice on status panel
138
+
139
+ = 6.0.6 =
140
+
141
+ * Fixed the textual part saving
142
+ * Fixed required check on extra field of type "select"
143
+ * Fixed old CTA theme text part
144
+
145
+ = 6.0.5 =
146
+
147
+ * Fixed repated CSS inclusion in emails
148
+ * Email body weight optimization
149
+ * Fix warning on posts block
150
+
151
+ = 6.0.4 =
152
+
153
+ * Fixed the hero block
154
+
155
+ = 6.0.3 =
156
+
157
+ * Fixed link and color picker on text block
158
+
159
+ = 6.0.2 =
160
+
161
+ * Fixed posts block (link missing)
162
+
163
+ = 6.0.1 =
164
+
165
+ * Fixed new newsletter creating panel "proceed" button
166
+
167
+ = 6.0.0 =
168
+
169
+ * The Newsletter Plugin Composer - A new revamped drag & drop composer
170
+ * Several improvements and fixes
171
 
172
  = 5.9.5 =
173
 
emails/blocks/hero/block.php CHANGED
@@ -79,7 +79,8 @@ if (!empty($options['image']['id'])) {
79
  if ($layout == 'full') {
80
  $media = tnp_resize($options['image']['id'], array(600, 0));
81
  } else {
82
- $media = tnp_resize($options['image']['id'], array(300, 200, true));
 
83
  }
84
  $media->alt = $options['title'];
85
  } else {
@@ -155,7 +156,7 @@ if (!empty($options['image']['id'])) {
155
  <style>
156
  .hero-title {
157
  font-size: <?php echo $title_font_size ?>px;
158
- color: #333333;
159
  padding-top: 0;
160
  font-family: <?php echo $title_font_family ?>;
161
  font-weight: <?php echo $title_font_weight ?>;
@@ -164,7 +165,7 @@ if (!empty($options['image']['id'])) {
164
  padding: 20px 0 0 0;
165
  font-size: <?php echo $font_size ?>px;
166
  line-height: 150%;
167
- color: #666666;
168
  font-family: <?php echo $font_family ?>;
169
  font-weight: <?php echo $font_weight ?>;
170
  }
@@ -211,3 +212,71 @@ if (!empty($options['image']['id'])) {
211
 
212
  <?php } ?>
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  if ($layout == 'full') {
80
  $media = tnp_resize($options['image']['id'], array(600, 0));
81
  } else {
82
+ $media = tnp_resize($options['image']['id'], array(600, 0));
83
+ $media->set_width(300-$options['block_padding_left']);
84
  }
85
  $media->alt = $options['title'];
86
  } else {
156
  <style>
157
  .hero-title {
158
  font-size: <?php echo $title_font_size ?>px;
159
+ color: <?php echo $title_font_color ?>;
160
  padding-top: 0;
161
  font-family: <?php echo $title_font_family ?>;
162
  font-weight: <?php echo $title_font_weight ?>;
165
  padding: 20px 0 0 0;
166
  font-size: <?php echo $font_size ?>px;
167
  line-height: 150%;
168
+ color: <?php echo $font_color ?>;
169
  font-family: <?php echo $font_family ?>;
170
  font-weight: <?php echo $font_weight ?>;
171
  }
212
 
213
  <?php } ?>
214
 
215
+
216
+ <?php if ($layout == 'right') { ?>
217
+
218
+ <style>
219
+ .hero-title {
220
+ font-size: <?php echo $title_font_size ?>px;
221
+ color: <?php echo $title_font_color ?>;
222
+ padding-top: 0;
223
+ font-family: <?php echo $title_font_family ?>;
224
+ font-weight: <?php echo $title_font_weight ?>;
225
+ line-height: normal;
226
+ margin: 0;
227
+ }
228
+ .hero-text {
229
+ padding: 20px 0 0 0;
230
+ font-size: <?php echo $font_size ?>px;
231
+ line-height: 150%;
232
+ color: <?php echo $font_color ?>;
233
+ font-family: <?php echo $font_family ?>;
234
+ font-weight: <?php echo $font_weight ?>;
235
+ }
236
+ .image {
237
+ max-width: 100%!important;
238
+ display: block;
239
+ }
240
+ </style>
241
+
242
+ <table width="48%" align="left" class="hero-table hero-table-right">
243
+ <tr>
244
+ <td align="center" style="text-align: center">
245
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
246
+ <tr>
247
+ <td align="center" inline-class="hero-title">
248
+ <span><?php echo $options['title'] ?></span>
249
+ </td>
250
+ </tr>
251
+ <tr>
252
+ <td align="center" inline-class="hero-text">
253
+ <span><?php echo $options['text'] ?></span>
254
+ </td>
255
+ </tr>
256
+ </table>
257
+ <br>
258
+ <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
259
+ <tr>
260
+ <td align="center" vertical-align="middle" style="font-size:0px;padding:10px 25px;word-break:break-word;">
261
+
262
+ <?php echo tnpc_button($options)?>
263
+ </td>
264
+ </tr>
265
+ </table>
266
+
267
+
268
+ </td>
269
+ </tr>
270
+ </table>
271
+
272
+ <table width="48%" align="right" class="hero-table">
273
+ <tr>
274
+ <td align="center" valign="top">
275
+ <img src="<?php echo $media->url ?>" border="0" alt="<?php echo esc_attr($media->alt) ?>" width="<?php echo $media->width ?>" height="<?php echo $media->height ?>" inline-class="image">
276
+ </td>
277
+ </tr>
278
+ </table>
279
+
280
+
281
+ <?php } ?>
282
+
emails/blocks/hero/options.php CHANGED
@@ -10,7 +10,7 @@ $fields->controls->data['schema'] = '';
10
 
11
  <div class="tnp-field-row">
12
  <div class="tnp-field-col-2">
13
- <?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Left'))?>
14
  </div>
15
  <div class="tnp-field-col-2">
16
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering'=>'reload'])?>
10
 
11
  <div class="tnp-field-row">
12
  <div class="tnp-field-col-2">
13
+ <?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Image left', 'right' => 'Image right'))?>
14
  </div>
15
  <div class="tnp-field-col-2">
16
  <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering'=>'reload'])?>
emails/blocks/image/block.php CHANGED
@@ -39,16 +39,20 @@ if (empty($options['image']['id'])) {
39
  $media->alt = $options['image_alt'];
40
  }
41
 
 
 
 
 
42
  $url = $options['url'];
43
  ?>
44
  <style>
45
  .image {
46
  max-width: 100%!important;
47
  height: auto!important;
48
- display: inline-block;
49
- <?php if (!empty($options['width'])) { ?>
50
- width: <?php echo $options['width']?>px;
51
- <?php } ?>
52
  }
53
  </style>
54
  <?php if (!empty($url)) { ?>
39
  $media->alt = $options['image_alt'];
40
  }
41
 
42
+ if (!empty($options['width'])) {
43
+ $media->set_width($options['width']);
44
+ }
45
+
46
  $url = $options['url'];
47
  ?>
48
  <style>
49
  .image {
50
  max-width: 100%!important;
51
  height: auto!important;
52
+ display: block;
53
+ width: <?php echo $media->width?>px;
54
+ line-height: 0;
55
+ margin: 0 auto;
56
  }
57
  </style>
58
  <?php if (!empty($url)) { ?>
emails/tnp-composer/_css/newsletter-builder-v2.css CHANGED
@@ -156,15 +156,16 @@
156
  }
157
 
158
  iframe#tnpc-mobile-preview {
159
- height: 500px;
160
  box-sizing: border-box;
161
  width: 320px;
162
- border-radius: 30px;
163
  margin-top: 20px;
164
  margin-left: 20px;
165
  background-color: #F6F8FD;
166
  }
167
 
 
168
  .tnpc-row {
169
  -webkit-transition: box-shadow 0.5s;
170
  -moz-transition: box-shadow 0.5s;
156
  }
157
 
158
  iframe#tnpc-mobile-preview {
159
+ height: 550px;
160
  box-sizing: border-box;
161
  width: 320px;
162
+ border-radius: 10px;
163
  margin-top: 20px;
164
  margin-left: 20px;
165
  background-color: #F6F8FD;
166
  }
167
 
168
+
169
  .tnpc-row {
170
  -webkit-transition: box-shadow 0.5s;
171
  -moz-transition: box-shadow 0.5s;
emails/tnp-composer/_scripts/newsletter-builder-v2.js CHANGED
@@ -141,15 +141,6 @@ jQuery(function () {
141
 
142
  jQuery('#newsletter-builder-area-center-frame-content').css('background-color', jQuery('#options-options_composer_background').val());
143
 
144
- // Init global styles values
145
- /*
146
- let globalStyles = JSON.parse(jQuery('#tnpc-form input[name="options[global-styles]"]').val());
147
- if ('global-styles-bgcolor' in globalStyles) {
148
- jQuery('#options-global-styles-bgcolor').val(globalStyles['global-styles-bgcolor']);
149
- jQuery('#newsletter-builder-area-center-frame-content').css('background-color', globalStyles['global-styles-bgcolor']);
150
- }
151
- */
152
-
153
  });
154
 
155
  function start_composer() {
@@ -270,7 +261,7 @@ function start_composer() {
270
  alert("Block rendering failed");
271
  });
272
 
273
-
274
 
275
  });
276
 
@@ -290,7 +281,9 @@ function tnpc_mobile_preview() {
290
 
291
  d.write("<!DOCTYPE html>\n<html>\n<head>\n");
292
  d.write("<link rel='stylesheet' href='" + TNP_HOME_URL + "?na=emails-composer-css&ver=" + Math.random() + "' type='text/css'>");
293
- d.write("<style type='text/css'>.tnpc-row-delete, .tnpc-row-edit-block, .tnpc-row-clone { display: none; }</style>");
 
 
294
  d.write("</head>\n<body style='margin: 0; padding: 0;'><div style='width: 320px!important'>");
295
  d.write(jQuery("#newsletter-builder-area-center-frame-content").html());
296
  d.write("</div>\n</body>\n</html>");
@@ -312,9 +305,9 @@ function tnpc_save(form) {
312
  } else {
313
  form.elements["options[subject]"].value = "";
314
  }
315
- form.elements["options[global-styles]"].value = JSON.stringify(jQuery('#tnpc-global-styles-form').serializeArray());
316
 
317
  var global_form = document.getElementById("tnpc-global-styles-form");
 
318
  tnpc_copy_form(global_form, form);
319
 
320
  jQuery("#newsletter-preloaded-export").html(' ');
@@ -322,10 +315,9 @@ function tnpc_save(form) {
322
 
323
  function tnpc_copy_form(source, dest) {
324
  for (var i = 0; i < source.elements.length; i++) {
325
- var e = source.elements[i];
326
- if (dest.elements[e.name]) {
327
- dest.elements[e.name].value = e.value;
328
- }
329
  }
330
  }
331
 
@@ -395,7 +387,7 @@ function tnpc_reload_options(e) {
395
  options[i].value = 'tnpc_options';
396
  }
397
  }
398
-
399
  jQuery("#tnpc-block-options-form").load(ajaxurl, options);
400
  }
401
 
@@ -485,7 +477,7 @@ jQuery(document).ready(function () {
485
 
486
  function submit(e, elementToDeleteAfterSubmit, elementToShow) {
487
  e.preventDefault();
488
-
489
  var id = elementToDeleteAfterSubmit.find('form input[name=id]').val();
490
  var type = elementToDeleteAfterSubmit.find('form input[name=type]').val();
491
  var newValue = elementToDeleteAfterSubmit.find('form [name="' + newInputName + '"]').val();
141
 
142
  jQuery('#newsletter-builder-area-center-frame-content').css('background-color', jQuery('#options-options_composer_background').val());
143
 
 
 
 
 
 
 
 
 
 
144
  });
145
 
146
  function start_composer() {
261
  alert("Block rendering failed");
262
  });
263
 
264
+
265
 
266
  });
267
 
281
 
282
  d.write("<!DOCTYPE html>\n<html>\n<head>\n");
283
  d.write("<link rel='stylesheet' href='" + TNP_HOME_URL + "?na=emails-composer-css&ver=" + Math.random() + "' type='text/css'>");
284
+ d.write("<style>.tnpc-row-delete, .tnpc-row-edit-block, .tnpc-row-clone { display: none; }</style>");
285
+ d.write("<style>body::-webkit-scrollbar {width: 0px;background: transparent;}</style>");
286
+ d.write("<style>body{scrollbar-width: none; -ms-overflow-style: none;}</style>");
287
  d.write("</head>\n<body style='margin: 0; padding: 0;'><div style='width: 320px!important'>");
288
  d.write(jQuery("#newsletter-builder-area-center-frame-content").html());
289
  d.write("</div>\n</body>\n</html>");
305
  } else {
306
  form.elements["options[subject]"].value = "";
307
  }
 
308
 
309
  var global_form = document.getElementById("tnpc-global-styles-form");
310
+ //Copy "Global styles" form inputs into main form
311
  tnpc_copy_form(global_form, form);
312
 
313
  jQuery("#newsletter-preloaded-export").html(' ');
315
 
316
  function tnpc_copy_form(source, dest) {
317
  for (var i = 0; i < source.elements.length; i++) {
318
+ var clonedEl = source.elements[i].cloneNode();
319
+ clonedEl.style.display = 'none';
320
+ dest.appendChild(clonedEl);
 
321
  }
322
  }
323
 
387
  options[i].value = 'tnpc_options';
388
  }
389
  }
390
+
391
  jQuery("#tnpc-block-options-form").load(ajaxurl, options);
392
  }
393
 
477
 
478
  function submit(e, elementToDeleteAfterSubmit, elementToShow) {
479
  e.preventDefault();
480
+
481
  var id = elementToDeleteAfterSubmit.find('form input[name=id]').val();
482
  var type = elementToDeleteAfterSubmit.find('form input[name=type]').val();
483
  var newValue = elementToDeleteAfterSubmit.find('form [name="' + newInputName + '"]').val();
includes/addon.php CHANGED
@@ -43,6 +43,10 @@ class NewsletterAddon {
43
  return $this->logger;
44
  }
45
 
 
 
 
 
46
  function get_admin_logger() {
47
  if (!$this->admin_logger) {
48
  $this->admin_logger = new NewsletterLogger($this->name . '-admin');
43
  return $this->logger;
44
  }
45
 
46
+ /**
47
+ *
48
+ * @return NewsletterLogger
49
+ */
50
  function get_admin_logger() {
51
  if (!$this->admin_logger) {
52
  $this->admin_logger = new NewsletterLogger($this->name . '-admin');
includes/composer.php CHANGED
@@ -8,7 +8,7 @@ function tnp_register_block($dir) {
8
  /**
9
  * Generates and HTML button for email using the values found on $options and
10
  * prefixed by $prefix, with the standard syntax of NewsletterFields::button().
11
- *
12
  * @param array $options
13
  * @param string $prefix
14
  * @return string
@@ -98,7 +98,7 @@ class TNP_Composer {
98
  }
99
 
100
  /**
101
- *
102
  * @param TNP_Email $email
103
  * @return string
104
  */
@@ -115,7 +115,7 @@ class TNP_Composer {
115
  }
116
 
117
  /**
118
- *
119
  * @param TNP_Email $email
120
  * @return string
121
  */
@@ -128,7 +128,7 @@ class TNP_Composer {
128
 
129
  /**
130
  * Remove <doctype>, <body> and unnecessary envelopes for editing with composer
131
- *
132
  * @param string $html_email
133
  *
134
  * @return string
@@ -172,7 +172,7 @@ class TNP_Composer {
172
  * Using the data collected inside $controls (and submitted by a form containing the
173
  * composer fields), updates the email. The message body is completed with doctype,
174
  * head, style and the main wrapper.
175
- *
176
  * @param TNP_Email $email
177
  * @param NewsletterControls $controls
178
  */
@@ -197,15 +197,15 @@ class TNP_Composer {
197
  /**
198
  * Prepares a controls object injecting the relevant fields from an email
199
  * which cannot be directly used by controls.
200
- *
201
  * @param Newsletter $controls
202
  * @param TNP_Email $email
203
  */
204
  static function prepare_controls($controls, $email) {
205
  foreach ($email->options as $name => $value) {
206
- if (strpos($name, 'composer_') === 0) {
207
  $controls->data['options_' . $name] = $value;
208
- }
209
  }
210
 
211
  $controls->data['message'] = TNP_Composer::unwrap_email($email->message);
8
  /**
9
  * Generates and HTML button for email using the values found on $options and
10
  * prefixed by $prefix, with the standard syntax of NewsletterFields::button().
11
+ *
12
  * @param array $options
13
  * @param string $prefix
14
  * @return string
98
  }
99
 
100
  /**
101
+ *
102
  * @param TNP_Email $email
103
  * @return string
104
  */
115
  }
116
 
117
  /**
118
+ *
119
  * @param TNP_Email $email
120
  * @return string
121
  */
128
 
129
  /**
130
  * Remove <doctype>, <body> and unnecessary envelopes for editing with composer
131
+ *
132
  * @param string $html_email
133
  *
134
  * @return string
172
  * Using the data collected inside $controls (and submitted by a form containing the
173
  * composer fields), updates the email. The message body is completed with doctype,
174
  * head, style and the main wrapper.
175
+ *
176
  * @param TNP_Email $email
177
  * @param NewsletterControls $controls
178
  */
197
  /**
198
  * Prepares a controls object injecting the relevant fields from an email
199
  * which cannot be directly used by controls.
200
+ *
201
  * @param Newsletter $controls
202
  * @param TNP_Email $email
203
  */
204
  static function prepare_controls($controls, $email) {
205
  foreach ($email->options as $name => $value) {
206
+ //if (strpos($name, 'composer_') === 0) {
207
  $controls->data['options_' . $name] = $value;
208
+ //}
209
  }
210
 
211
  $controls->data['message'] = TNP_Composer::unwrap_email($email->message);
includes/controls.php CHANGED
@@ -11,9 +11,12 @@ class NewsletterControls {
11
  var $button_data = '';
12
  var $errors = '';
13
  /**
14
- * @var string
15
  */
16
  var $messages = '';
 
 
 
17
  var $warnings = array();
18
  var $countries = array(
19
  'AF' => 'Afghanistan',
@@ -378,13 +381,13 @@ class NewsletterControls {
378
  echo '</div>';
379
  }
380
  }
381
-
382
  function add_message($text) {
383
  if (!empty($this->messages)) {
384
  $this->messages .= '<br><br>';
385
  }
386
  $this->messages .= $text;
387
- }
388
 
389
  function add_message_saved() {
390
  if (!empty($this->messages)) {
@@ -830,11 +833,14 @@ class NewsletterControls {
830
  echo '<a href="', esc_attr($url), '" class="button-primary"><i class="fas fa-cog"></i>', _e('Configure', 'newsletter'), '</a>';
831
  }
832
 
833
- function button_back($url) {
834
  echo '<a href="';
835
  echo esc_attr($url);
836
- echo '" class="button-primary"><i class="fas fa-chevron-left"></i>&nbsp;';
837
- _e('Back', 'newsletter');
 
 
 
838
  echo '</a>';
839
  }
840
 
@@ -860,13 +866,32 @@ class NewsletterControls {
860
  }
861
  echo '</button>';
862
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
863
 
864
  /**
865
  * Creates a button with "delete" action.
866
  * @param type $data
867
  */
868
  function button_delete($data = '', $label = null) {
869
- echo '<button class="button-secondary" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'delete\';if (!confirm(\'';
870
  echo esc_attr(esc_js(__('Proceed with delete?', 'newsletter')));
871
  echo '\')) return false;"';
872
  if (empty($label)) {
@@ -900,6 +925,10 @@ class NewsletterControls {
900
  echo '<input class="button-primary" type="button" value="' . esc_attr($label) . '" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'' . esc_attr($action) . '\';if (confirm(\'' .
901
  esc_attr(esc_js($message)) . '\')) this.form.submit()"/>';
902
  }
 
 
 
 
903
 
904
  function editor($name, $rows = 5, $cols = 75) {
905
  echo '<textarea class="visual" name="options[' . esc_attr($name) . ']" style="width: 100%" wrap="off" rows="' . esc_attr($rows) . '">';
@@ -1041,12 +1070,12 @@ class NewsletterControls {
1041
  echo '<div style="clear: both"></div>';
1042
  echo '</div>';
1043
  }
1044
-
1045
  function color($name, $default = '') {
1046
 
1047
  $value = $this->get_value($name);
1048
  if (empty($value) && $default) $value = $default;
1049
-
1050
  //echo '<input id="options-', esc_attr($name), '" class="tnp-controls-color" name="options[' . $name . ']" type="text" value="';
1051
  echo '<input id="options-', esc_attr($name), '" name="options[' . $name . ']" type="color" value="';
1052
  echo esc_attr($value);
@@ -1153,7 +1182,7 @@ class NewsletterControls {
1153
  }
1154
 
1155
  /**
1156
- * Creates a single select with the active preferences.
1157
  */
1158
  function preferences_select($name = 'preference', $empty_label = null) {
1159
  $lists = $this->get_list_options($empty_label);
@@ -1405,7 +1434,7 @@ class NewsletterControls {
1405
  * Attributes:
1406
  * weight: [true|false]
1407
  * color: [true|false]
1408
- *
1409
  * @param string $name
1410
  * @param array $attrs
1411
  */
@@ -1455,14 +1484,14 @@ class NewsletterControls {
1455
  function css_font_family($name = 'font_family') {
1456
  $value = $this->get_value($name);
1457
 
1458
- $fonts = array('Helvetica, Arial, sans-serif'=>'Helvetica, Arial',
1459
- 'Arial Black, Gadget, sans-serif'=>'Arial Black, Gadget',
1460
- 'Garamond, serif'=>'Garamond',
1461
- 'Courier, monospace'=>'Courier',
1462
- 'Comic Sans MS, cursive'=>'Comic Sans MS',
1463
  'Impact, Charcoal, sans-serif'=>'Impact, Charcoal',
1464
- 'Tahoma, Geneva, sans-serif'=>'Tahoma, Geneva',
1465
- 'Times New Roman, Times, serif'=>'Times New Roman, Times',
1466
  'Verdana, Geneva, sans-serif'=>'Verdana, Geneva');
1467
 
1468
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
@@ -1514,7 +1543,7 @@ class NewsletterControls {
1514
 
1515
  /**
1516
  * Media selector using the media library of WP. Produces a field which values is an array containing 'id' and 'url'.
1517
- *
1518
  * @param string $name
1519
  */
1520
  function media($name) {
@@ -1574,7 +1603,7 @@ class NewsletterControls {
1574
  /**
1575
  * Creates a checkbox group with all active languages. Each checkbox is named
1576
  * $name[] and values with the relative language code.
1577
- *
1578
  * @param string $name
1579
  */
1580
  function languages($name = 'languages') {
@@ -1596,7 +1625,7 @@ class NewsletterControls {
1596
  /**
1597
  * Prints a formatted date using the formats and timezone of WP, including the current date and time and the
1598
  * time left to the passed time.
1599
- *
1600
  * @param int $time
1601
  * @param int $now
1602
  * @param bool $left
@@ -1625,10 +1654,21 @@ class NewsletterControls {
1625
  }
1626
  return $buffer;
1627
  }
1628
-
 
 
 
 
 
 
 
 
 
 
 
1629
  /**
1630
  * Prints the help button near a form field. The label is used as icon title.
1631
- *
1632
  * @param string $url
1633
  * @param string $label
1634
  */
@@ -1646,7 +1686,7 @@ class NewsletterControls {
1646
 
1647
  /**
1648
  * Prints a panel link to the documentation.
1649
- *
1650
  * @param type $url
1651
  * @param type $text
1652
  */
@@ -1692,7 +1732,7 @@ class NewsletterControls {
1692
 
1693
  /**
1694
  * Adds the fields used by the composer (version 1) in the page form.
1695
- *
1696
  * @param type $name
1697
  */
1698
  function composer_fields($name = 'body') {
@@ -1745,24 +1785,8 @@ class NewsletterControls {
1745
  * Adds the fields used by the composer (version 2) in the page form.
1746
  */
1747
  function composer_fields_v2($name = 'message') {
1748
- //TODO [Gioacchino] check su dove è richiamata questa funzione
1749
-
1750
- /*foreach ($this->data as $key=>$value) {
1751
- if (strpos($key, 'options_composer_') === 0) {
1752
- $this->hidden($key);
1753
- }
1754
- }*/
1755
- $this->hidden('options_composer_background');
1756
- //$this->hidden('options_composer_background_image');
1757
  $this->hidden('subject');
1758
  $this->hidden('message');
1759
-
1760
- // Global style background color
1761
- $value = $this->get_value('options');
1762
- //var_dump($value);
1763
- //die();
1764
- $value = isset($value['global-styles']) ? $value['global-styles'] : ['global-styles-bgcolor' => '#ECF0F1'];
1765
- echo '<input type="hidden" name="options[global-styles]" id="options-global-styles" value="', esc_attr(json_encode($value)), '">';
1766
  }
1767
 
1768
  function composer_load_v2($show_subject = false, $show_test = true, $context_type = '') {
11
  var $button_data = '';
12
  var $errors = '';
13
  /**
14
+ * @var string
15
  */
16
  var $messages = '';
17
+ /**
18
+ * @var array
19
+ */
20
  var $warnings = array();
21
  var $countries = array(
22
  'AF' => 'Afghanistan',
381
  echo '</div>';
382
  }
383
  }
384
+
385
  function add_message($text) {
386
  if (!empty($this->messages)) {
387
  $this->messages .= '<br><br>';
388
  }
389
  $this->messages .= $text;
390
+ }
391
 
392
  function add_message_saved() {
393
  if (!empty($this->messages)) {
833
  echo '<a href="', esc_attr($url), '" class="button-primary"><i class="fas fa-cog"></i>', _e('Configure', 'newsletter'), '</a>';
834
  }
835
 
836
+ function button_back($url, $label = null) {
837
  echo '<a href="';
838
  echo esc_attr($url);
839
+ echo '" class="button-primary"><i class="fas fa-chevron-left"></i>';
840
+ if (is_null($label)) {
841
+ echo '&nbsp;';
842
+ _e('Back', 'newsletter');
843
+ }
844
  echo '</a>';
845
  }
846
 
866
  }
867
  echo '</button>';
868
  }
869
+
870
+ function button_test($action = 'test', $label = 'Test') {
871
+ echo '<button class="button-secondary" onclick="this.form.act.value=\'' . esc_attr($action) . '\';if (!confirm(\'';
872
+ echo esc_attr(esc_js(__('Proceed with a test?', 'newsletter')));
873
+ echo '\')) return false;"';
874
+ if (empty($label)) {
875
+ echo 'title="', esc_attr(__('Run a test', 'newsletter')), '"';
876
+ }
877
+ echo '>';
878
+ echo '<i class="fas fa-vial"></i>';
879
+ if (is_null($label)) {
880
+ echo ' ', esc_html(__('Run a test', 'newsletter'));
881
+ } else {
882
+ if (!empty($label)) {
883
+ echo ' ' , $label;
884
+ }
885
+ }
886
+ echo '</button>';
887
+ }
888
 
889
  /**
890
  * Creates a button with "delete" action.
891
  * @param type $data
892
  */
893
  function button_delete($data = '', $label = null) {
894
+ echo '<button class="button-secondary" style="background-color: darkred; color: #ffffff" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'delete\';if (!confirm(\'';
895
  echo esc_attr(esc_js(__('Proceed with delete?', 'newsletter')));
896
  echo '\')) return false;"';
897
  if (empty($label)) {
925
  echo '<input class="button-primary" type="button" value="' . esc_attr($label) . '" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'' . esc_attr($action) . '\';if (confirm(\'' .
926
  esc_attr(esc_js($message)) . '\')) this.form.submit()"/>';
927
  }
928
+
929
+ function button_statistics($url) {
930
+ echo '<a class="button-primary" href="' . $url . '" title="Statistics"><i class="fas fa-chart-bar"></i></a>';
931
+ }
932
 
933
  function editor($name, $rows = 5, $cols = 75) {
934
  echo '<textarea class="visual" name="options[' . esc_attr($name) . ']" style="width: 100%" wrap="off" rows="' . esc_attr($rows) . '">';
1070
  echo '<div style="clear: both"></div>';
1071
  echo '</div>';
1072
  }
1073
+
1074
  function color($name, $default = '') {
1075
 
1076
  $value = $this->get_value($name);
1077
  if (empty($value) && $default) $value = $default;
1078
+
1079
  //echo '<input id="options-', esc_attr($name), '" class="tnp-controls-color" name="options[' . $name . ']" type="text" value="';
1080
  echo '<input id="options-', esc_attr($name), '" name="options[' . $name . ']" type="color" value="';
1081
  echo esc_attr($value);
1182
  }
1183
 
1184
  /**
1185
+ * Creates a single select with the active preferences.
1186
  */
1187
  function preferences_select($name = 'preference', $empty_label = null) {
1188
  $lists = $this->get_list_options($empty_label);
1434
  * Attributes:
1435
  * weight: [true|false]
1436
  * color: [true|false]
1437
+ *
1438
  * @param string $name
1439
  * @param array $attrs
1440
  */
1484
  function css_font_family($name = 'font_family') {
1485
  $value = $this->get_value($name);
1486
 
1487
+ $fonts = array('Helvetica, Arial, sans-serif'=>'Helvetica, Arial',
1488
+ 'Arial Black, Gadget, sans-serif'=>'Arial Black, Gadget',
1489
+ 'Garamond, serif'=>'Garamond',
1490
+ 'Courier, monospace'=>'Courier',
1491
+ 'Comic Sans MS, cursive'=>'Comic Sans MS',
1492
  'Impact, Charcoal, sans-serif'=>'Impact, Charcoal',
1493
+ 'Tahoma, Geneva, sans-serif'=>'Tahoma, Geneva',
1494
+ 'Times New Roman, Times, serif'=>'Times New Roman',
1495
  'Verdana, Geneva, sans-serif'=>'Verdana, Geneva');
1496
 
1497
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1543
 
1544
  /**
1545
  * Media selector using the media library of WP. Produces a field which values is an array containing 'id' and 'url'.
1546
+ *
1547
  * @param string $name
1548
  */
1549
  function media($name) {
1603
  /**
1604
  * Creates a checkbox group with all active languages. Each checkbox is named
1605
  * $name[] and values with the relative language code.
1606
+ *
1607
  * @param string $name
1608
  */
1609
  function languages($name = 'languages') {
1625
  /**
1626
  * Prints a formatted date using the formats and timezone of WP, including the current date and time and the
1627
  * time left to the passed time.
1628
+ *
1629
  * @param int $time
1630
  * @param int $now
1631
  * @param bool $left
1654
  }
1655
  return $buffer;
1656
  }
1657
+
1658
+ static function delta_time($delta = 0) {
1659
+ $seconds = $delta % 60;
1660
+ $minutes = floor(($delta/60) % 60);
1661
+ $hours = floor(($delta/(60*60)) % 24);
1662
+ $days = floor($delta / (24*60*60));
1663
+
1664
+
1665
+ return $days . ' day(s), ' . $hours . ' hour(s), ' . $minutes . ' minute(s)';
1666
+
1667
+ }
1668
+
1669
  /**
1670
  * Prints the help button near a form field. The label is used as icon title.
1671
+ *
1672
  * @param string $url
1673
  * @param string $label
1674
  */
1686
 
1687
  /**
1688
  * Prints a panel link to the documentation.
1689
+ *
1690
  * @param type $url
1691
  * @param type $text
1692
  */
1732
 
1733
  /**
1734
  * Adds the fields used by the composer (version 1) in the page form.
1735
+ *
1736
  * @param type $name
1737
  */
1738
  function composer_fields($name = 'body') {
1785
  * Adds the fields used by the composer (version 2) in the page form.
1786
  */
1787
  function composer_fields_v2($name = 'message') {
 
 
 
 
 
 
 
 
 
1788
  $this->hidden('subject');
1789
  $this->hidden('message');
 
 
 
 
 
 
 
1790
  }
1791
 
1792
  function composer_load_v2($show_subject = false, $show_test = true, $context_type = '') {
includes/module.php CHANGED
@@ -10,10 +10,18 @@ require_once __DIR__ . '/mailer.php';
10
  require_once __DIR__ . '/themes.php';
11
 
12
  class TNP_Media {
 
13
  var $url;
14
  var $width;
15
  var $height;
16
  var $alt;
 
 
 
 
 
 
 
17
  }
18
 
19
  /**
@@ -421,7 +429,7 @@ class NewsletterModule {
421
  $name = html_entity_decode($name, ENT_QUOTES);
422
  $name = str_replace(';', ' ', $name);
423
  $name = strip_tags($name);
424
-
425
  return $name;
426
  }
427
 
@@ -701,6 +709,7 @@ class NewsletterModule {
701
 
702
  /**
703
  * Save an email and provide serialization, if needed, of $email['options'].
 
704
  */
705
  function save_email($email, $return_format = OBJECT) {
706
  if (is_object($email)) {
@@ -1527,7 +1536,7 @@ class NewsletterModule {
1527
  */
1528
  function replace($text, $user = null, $email = null, $referrer = null) {
1529
  global $wpdb;
1530
-
1531
  if (strpos($text, '<p') !== false) {
1532
  $esc_html = true;
1533
  } else {
10
  require_once __DIR__ . '/themes.php';
11
 
12
  class TNP_Media {
13
+
14
  var $url;
15
  var $width;
16
  var $height;
17
  var $alt;
18
+
19
+ /** Sets the width recalculating the height */
20
+ public function set_width($width) {
21
+ $this->height = floor($width / $this->width * $this->height);
22
+ $this->width = $width;
23
+ }
24
+
25
  }
26
 
27
  /**
429
  $name = html_entity_decode($name, ENT_QUOTES);
430
  $name = str_replace(';', ' ', $name);
431
  $name = strip_tags($name);
432
+
433
  return $name;
434
  }
435
 
709
 
710
  /**
711
  * Save an email and provide serialization, if needed, of $email['options'].
712
+ * @return TNP_Email
713
  */
714
  function save_email($email, $return_format = OBJECT) {
715
  if (is_object($email)) {
1536
  */
1537
  function replace($text, $user = null, $email = null, $referrer = null) {
1538
  global $wpdb;
1539
+
1540
  if (strpos($text, '<p') !== false) {
1541
  $esc_html = true;
1542
  } else {
main/smtp.php CHANGED
@@ -31,6 +31,8 @@ if (!$controls->is_action()) {
31
 
32
  if (is_wp_error($r)) {
33
  $controls->errors = $r->get_error_message();
 
 
34
  } else {
35
  $controls->messages = 'Success.';
36
  }
31
 
32
  if (is_wp_error($r)) {
33
  $controls->errors = $r->get_error_message();
34
+ $controls->errors .= '<br><a href="https://www.thenewsletterplugin.com/documentation/?p=15170" target="_blank"><strong>' . __('Read more', 'newsletter') . '</strong></a>.';
35
+
36
  } else {
37
  $controls->messages = 'Success.';
38
  }
main/status.php CHANGED
@@ -13,7 +13,7 @@ $wp_cron_calls_max = 0;
13
  $wp_cron_calls_min = 0;
14
  $wp_cron_calls_avg = 0;
15
  if (count($wp_cron_calls) > 20) {
16
-
17
  for ($i = 1; $i < count($wp_cron_calls); $i++) {
18
  $diff = $wp_cron_calls[$i] - $wp_cron_calls[$i - 1];
19
  $total += $diff;
@@ -92,23 +92,25 @@ if ($controls->is_action('test')) {
92
  $message->subject = 'Newsletter test email at ' . date(DATE_ISO8601);
93
  $message->from = $module->options['sender_email'];
94
  $message->from_name = $module->options['sender_name'];
95
-
96
  $r = $module->deliver($message);
97
 
98
  if (!is_wp_error($r)) {
99
  $options['mail'] = 1;
100
  $controls->messages .= '<strong>SUCCESS</strong><br>';
 
 
101
  } else {
102
  $options['mail'] = 0;
103
  $options['mail_error'] = $r->get_error_message();
104
 
105
- $controls->errors .= '<strong>FAILED</strong> (' . $r->get_error_message() . ')<br>';
106
 
107
  if (!empty($module->options['return_path'])) {
108
  $controls->errors .= '- Try to remove the return path on main settings.<br>';
109
  }
110
 
111
- $controls->errors .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank"><strong>' . __('Read more', 'newsletter') . '</strong></a>.';
112
 
113
  $parts = explode('@', $module->options['sender_email']);
114
  $sitename = strtolower($_SERVER['SERVER_NAME']);
@@ -134,7 +136,23 @@ foreach ($emails as $email) {
134
  $queued += $email->total - $email->sent;
135
  }
136
  $speed = Newsletter::$instance->options['scheduler_max'];
 
 
 
 
 
 
 
 
 
 
 
137
  ?>
 
 
 
 
 
138
 
139
  <div class="wrap tnp-main-status" id="tnp-wrap">
140
 
@@ -150,7 +168,55 @@ $speed = Newsletter::$instance->options['scheduler_max'];
150
 
151
  <form method="post" action="">
152
  <?php $controls->init(); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  <h3>General checks</h3>
155
  <table class="widefat" id="tnp-status-table">
156
 
@@ -160,6 +226,7 @@ $speed = Newsletter::$instance->options['scheduler_max'];
160
  <th><?php _e('Status', 'newsletter') ?></th>
161
  <th>Action</th>
162
  </tr>
 
163
  </thead>
164
 
165
  <tbody>
@@ -168,24 +235,22 @@ $speed = Newsletter::$instance->options['scheduler_max'];
168
  if (function_exists('get_filesystem_method')) {
169
  $method = get_filesystem_method(array(), WP_PLUGIN_DIR);
170
  }
 
 
 
 
 
 
171
  ?>
172
  <tr>
173
  <td>Add-ons installable</td>
174
  <td>
175
- <?php if (empty($method)) { ?>
176
- <span class="tnp-maybe">MAYBE</span>
177
-
178
- <?php } else if ($method == 'direct') { ?>
179
- <span class="tnp-ok">OK</span>
180
- <?php } else { ?>
181
- <span class="tnp-ko">KO</span>
182
- <?php } ?>
183
-
184
  </td>
185
  <td>
186
- <?php if (empty($method)) { ?>
187
  No able to check, just try the add-ons manager one click install
188
- <?php } else if ($method == 'direct') { ?>
189
  The add-ons manager can install our add-ons
190
  <?php } else { ?>
191
  The plugins dir could be read-only, you can install add-ons uploading the package from the
@@ -221,69 +286,22 @@ $speed = Newsletter::$instance->options['scheduler_max'];
221
  $mailer = Newsletter::instance()->get_mailer();
222
  $name = 'Unknown';
223
  if (is_object($mailer)) {
224
- if (method_exists($mailer, 'get_description')) {
225
- $name = $mailer->get_description();
226
- } else {
227
- $name = get_class($mailer);
228
- }
229
  }
230
  ?>
231
-
232
  <?php echo esc_html($name) ?>
233
  </td>
234
  </tr>
 
235
 
236
- <tr>
237
- <td>Mailing</td>
238
- <td>
239
- <?php if (empty($options['mail'])) { ?>
240
- <span class="tnp-ko">KO</span>
241
- <?php } else { ?>
242
- <span class="tnp-ok">OK</span>
243
- <?php } ?>
244
 
245
- </td>
246
- <td>
247
- <?php if (empty($options['mail'])) { ?>
248
- <?php if (empty($options['mail_error'])) { ?>
249
- A test has never run.
250
- <?php } else { ?>
251
- Last test failed with error "<?php echo esc_html($options['mail_error']) ?>".
252
 
253
- <?php } ?>
254
- <?php } else { ?>
255
- Last test was successful. If you didn't receive the test email:
256
- <ol>
257
- <li>If you set the Newsletter SMTP, do a test from that panel</li>
258
- <li>If you're using a integration extension do a test from its configuration panel</li>
259
- <li>If previous points do not apply to you, ask for support to your provider reporting the emails from your blog are not delivered</li>
260
- </ol>
261
- <?php } ?>
262
- <br>
263
- <a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more to solve your issues, if any</a>.
264
- <br>
265
- Email: <?php $controls->text_email('test_email') ?> <?php $controls->button('test', __('Send a test message')) ?>
266
- </td>
267
 
268
- </tr>
269
-
270
- <?php if (ini_get('opcache.validate_timestamps') === '0') { ?>
271
-
272
- <tr>
273
- <td>
274
- Opcache
275
- </td>
276
-
277
- <td>
278
- <span class="tnp-ko">KO</span>
279
- </td>
280
-
281
- <td>
282
- You have the PHP opcache active with file validation disable so every blog plugins update needs a webserver restart!
283
- </td>
284
- </tr>
285
- <?php } ?>
286
-
287
  <?php
288
  $return_path = $module->options['return_path'];
289
  if (!empty($return_path)) {
@@ -318,766 +336,810 @@ $speed = Newsletter::$instance->options['scheduler_max'];
318
 
319
  </tr>
320
 
321
- <tr>
322
- <td>Blog Charset</td>
323
- <td>
324
- <?php if (get_option('blog_charset') == 'UTF-8') { ?>
325
- <span class="tnp-ok">OK</span>
326
- <?php } else { ?>
327
- <span class="tnp-ko">KO</span>
328
- <?php } ?>
329
- </td>
330
- <td>
331
- Charset: <?php echo esc_html(get_option('blog_charset')) ?>
332
- <br>
333
 
334
- <?php if (get_option('blog_charset') == 'UTF-8') { ?>
335
 
336
- <?php } else { ?>
337
- Your blog charset is <?php echo esc_html(get_option('blog_charset')) ?> but it is recommended to use
338
- the <code>UTF-8</code> charset but the <a href="https://codex.wordpress.org/Converting_Database_Character_Sets" target="_blank">conversion</a>
339
- could be tricky. If you're not experiencing problem, leave things as is.
340
- <?php } ?>
341
- </td>
342
- </tr>
343
 
344
  <tr>
345
- <td>PHP version</td>
 
 
 
346
  <td>
347
- <?php if (version_compare(phpversion(), '5.3', '<')) { ?>
348
- <span class="tnp-ko">KO</span>
349
- <?php } else { ?>
350
- <span class="tnp-ok">OK</span>
351
- <?php } ?>
352
-
353
  </td>
354
  <td>
355
- Your PHP version is <?php echo phpversion() ?><br>
356
- <?php if (version_compare(phpversion(), '5.3', '<')) { ?>
357
- Newsletter plugin works correctly with PHP version 5.3 or greater. Ask your provider to upgrade your PHP. Your version is
358
- unsupported even by the PHP community.
 
359
  <?php } ?>
360
  </td>
361
 
362
  </tr>
363
 
 
 
 
 
 
 
364
  <tr>
365
- <td>Curl version</td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  <td>
367
- <?php if (!function_exists('curl_version')) { ?>
368
- <span class="tnp-ko">KO</span>
369
- <?php } else { ?>
370
- <span class="tnp-ok">OK</span>
371
- <?php } ?>
372
-
373
  </td>
374
  <td>
375
- <?php if (!function_exists('curl_version')) { ?>
376
- cUrl is not available, ask the provider to install it and activate the PHP cUrl library
377
- <?php
378
- } else {
379
- $version = curl_version();
380
- echo 'Version: ' . $version['version'] . '<br>';
381
- echo 'SSL Version: ' . $version['ssl_version'] . '<br>';
382
- }
383
- ?>
384
  </td>
385
-
386
  </tr>
387
-
388
  <?php
389
- $value = (int) ini_get('max_execution_time');
390
- $res = true;
391
- if ($value != 0 && $value < NEWSLETTER_CRON_INTERVAL) {
392
- $res = set_time_limit(NEWSLETTER_CRON_INTERVAL);
 
 
 
 
 
393
  }
394
  ?>
395
 
396
  <tr>
397
- <td>Addons update</td>
398
  <td>
399
- <?php if (NEWSLETTER_EXTENSION_UPDATE) { ?>
400
- <span class="tnp-ok">OK</span>
 
 
 
401
  <?php } else { ?>
402
- <span class="tnp-maybe">MAYBE</span>
403
  <?php } ?>
404
  </td>
405
  <td>
406
- <?php if (!NEWSLETTER_EXTENSION_UPDATE) { ?>
407
- Newsletter Addons update is disabled (probably in your <code>wp-config.php</code> file)
408
  <?php } else { ?>
409
- Newsletter Addons can be updated
410
  <?php } ?>
411
- </td>
412
 
 
 
 
 
 
 
 
 
 
413
  </tr>
414
 
415
 
416
  <?php
417
- $value = (int) ini_get('max_execution_time');
418
  $res = true;
419
- if ($value != 0 && $value < NEWSLETTER_CRON_INTERVAL) {
420
- $res = set_time_limit(NEWSLETTER_CRON_INTERVAL);
 
 
 
 
 
 
 
421
  }
422
  ?>
423
-
424
  <tr>
425
- <td>PHP execution time limit</td>
426
  <td>
427
- <?php if ($res) { ?>
428
- <span class="tnp-ok">OK</span>
429
- <?php } else { ?>
430
- <span class="tnp-ko">KO</span>
431
- <?php } ?>
432
-
433
  </td>
434
  <td>
435
  <?php if (!$res) { ?>
436
- Your PHP execution time limit is <?php echo $value ?> seconds and cannot be changed or
437
- is too lower to grant the maximum delivery rate of Newsletter.
438
- <?php } else { ?>
439
- Your PHP execution time limit is <?php echo $value ?> seconds and can be eventually changed by Newsletter<br>
440
- <?php } ?>
441
-
442
- </td>
443
-
444
- </tr>
445
-
446
- <tr>
447
- <td>Home URL</td>
448
- <td>
449
- <?php if (strpos(home_url('/'), 'http') !== 0) { ?>
450
  <span class="tnp-ko">KO</span>
451
  <?php } else { ?>
452
  <span class="tnp-ok">OK</span>
453
  <?php } ?>
454
-
455
  </td>
456
  <td>
457
- Value: <?php echo home_url('/'); ?>
458
- <br>
459
- <?php if (strpos(home_url('/'), 'http') !== 0) { ?>
460
- Your home URL is not absolute, emails require absolute URLs.
461
- Probably you have a protocol agnostic plugin installed to manage both HTTPS and HTTP in your
462
- blog.
463
  <?php } else { ?>
464
 
465
  <?php } ?>
 
466
  </td>
467
  </tr>
468
 
 
469
  <tr>
470
- <td>WP_CONTENT_URL</td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
471
  <td>
472
- <?php if (strpos(WP_CONTENT_URL, 'http') !== 0) { ?>
473
- <span class="tnp-ko">KO</span>
474
- <?php } else { ?>
475
- <span class="tnp-ok">OK</span>
476
- <?php } ?>
477
-
478
  </td>
479
  <td>
480
- Value: <?php echo WP_CONTENT_URL; ?>
481
- <br>
482
- <?php if (strpos(WP_CONTENT_URL, 'http') !== 0) { ?>
483
- Your content URL is not absolute, emails require absolute URLs when they have images inside.
484
- Newsletter tries to deal with this problem but when a problem with images persists, you should try to remove
485
- from your wp-config.php the WP_CONTENT_URL define and check again.
486
  <?php } else { ?>
487
 
488
  <?php } ?>
489
  </td>
490
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
 
492
  <tr>
493
- <td>Database Charset</td>
 
 
494
  <td>
495
- <?php if ($wpdb->charset != 'utf8mb4') { ?>
496
- <span class="tnp-ko">KO</span>
497
- <?php } else { ?>
498
- <span class="tnp-ok">OK</span>
499
- <?php } ?>
500
-
501
  </td>
502
  <td>
503
- Charset: <?php echo $wpdb->charset; ?>
504
- <br>
505
- <?php if ($wpdb->charset != 'utf8mb4') { ?>
506
- The recommended charset for your database is <code>utf8mb4</code> to avoid possible saving errors when you use emoji.
507
- Read the WordPress Codex <a href="https://codex.wordpress.org/Converting_Database_Character_Sets" target="_blank">conversion
508
- instructions</a> (skilled technicia required).
509
- <?php } else { ?>
510
- If you experience newsletter saving database error
511
- <?php $controls->button('conversion', 'Try tables upgrade')?>
512
- <?php } ?>
513
  </td>
514
- </tr>
515
-
516
-
517
- <?php $wait_timeout = $wpdb->get_var("select @@wait_timeout"); ?>
518
- <tr>
519
- <td>Database wait timeout</td>
520
  <td>
521
- <?php if ($wait_timeout < 30) { ?>
522
- <span class="tnp-ko">KO</span>
523
  <?php } else { ?>
524
- <span class="tnp-ok">OK</span>
525
- <?php } ?>
526
 
527
- </td>
528
- <td>
529
- Your database wait timeout is <?php echo $wait_timeout; ?> seconds<br>
530
- <?php if ($wait_timeout < 30) { ?>
531
- That value is low and could produce database connection errors while sending emails or during long import
532
- sessions. Ask the provider to raise it at least to 60 seconds.
533
  <?php } ?>
534
  </td>
535
  </tr>
536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
537
  <?php
538
- $res = $wpdb->query("drop table if exists {$wpdb->prefix}newsletter_test");
539
- $res = $wpdb->query("create table if not exists {$wpdb->prefix}newsletter_test (id int(20))");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
540
  ?>
541
  <tr>
542
- <td>Database table creation</td>
543
  <td>
544
  <?php if ($res === false) { ?>
545
- <span class="tnp-ko">KO</span>
546
  <?php } else { ?>
547
  <span class="tnp-ok">OK</span>
548
- <?php } ?>
 
 
549
  </td>
550
  <td>
551
  <?php if ($res === false) { ?>
552
- Check the privileges of the user you use to connect to the database, it seems it cannot create tables.<br>
553
- (<?php echo esc_html($wpdb->last_error) ?>)
554
  <?php } else { ?>
 
555
  <?php } ?>
 
 
556
  </td>
557
  </tr>
558
 
559
  <?php
560
- $res = $wpdb->query("alter table {$wpdb->prefix}newsletter_test add column id1 int(20)");
 
 
 
 
 
 
 
 
561
  ?>
562
  <tr>
563
- <td>Database table change</td>
564
  <td>
565
- <?php if ($res === false) { ?>
 
 
 
566
  <span class="tnp-ko">KO</span>
567
  <?php } else { ?>
568
  <span class="tnp-ok">OK</span>
569
  <?php } ?>
570
  </td>
571
  <td>
572
- <?php if ($res === false) { ?>
573
- Check the privileges of the user you use to connect to the database, it seems it cannot change the tables. It's require to update the
574
- plugin.<br>
575
- (<?php echo esc_html($wpdb->last_error) ?>)
576
  <?php } else { ?>
 
577
  <?php } ?>
578
  </td>
579
- </tr>
 
 
580
 
581
- <?php
582
- // Clean up
583
- $res = $wpdb->query("drop table if exists {$wpdb->prefix}newsletter_test");
584
- ?>
585
 
586
- <?php
587
- set_transient('newsletter_transient_test', 1, 300);
588
- delete_transient('newsletter_transient_test');
589
- $res = get_transient('newsletter_transient_test');
590
- ?>
591
  <tr>
592
- <td>WordPress transients</td>
 
 
 
 
 
 
 
 
 
593
  <td>
594
- <?php if ($res !== false) { ?>
595
- <span class="tnp-ko">KO</span>
596
- <?php } else { ?>
597
- <span class="tnp-ok">OK</span>
598
- <?php } ?>
599
  </td>
600
  <td>
601
- <?php if ($res !== false) { ?>
602
- Transients cannot be delete. This can block the delivery engine. Usually it is due to a not well coded plugin installed.
 
 
 
 
603
  <?php } else { ?>
 
604
  <?php } ?>
605
  </td>
606
  </tr>
607
-
608
- <?php
609
- $time = wp_next_scheduled('newsletter');
610
- $res = true;
611
- if ($time === false) {
612
- $res = false;
613
- }
614
- $delta = $time - time();
615
- if ($delta <= -600) {
616
- $res = false;
617
- }
618
- ?>
619
  <tr>
620
- <td>Newsletter schedule timing</td>
621
  <td>
622
- <?php if ($res === false) { ?>
623
- <span class="tnp-ko">KO</span>
624
- <?php } else { ?>
625
- <span class="tnp-ok">OK</span>
626
- <?php } ?>
627
  </td>
628
  <td>
629
- <?php if ($time === false) { ?>
630
- No next execution is planned.
631
- <?php $controls->button('reschedule', 'Reset') ?>
632
- <?php } else if ($delta <= -600) { ?>
633
- The scheduler is very late: <?php echo $delta ?> seconds (<a href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">read more</a>)
634
- <?php $controls->button('trigger', 'Trigger') ?>
635
  <?php } else { ?>
636
- Next execution is planned in <?php echo $delta ?> seconds (negative values are ok).
637
  <?php } ?>
638
  </td>
639
  </tr>
640
 
641
- <?php
642
- $schedules = wp_get_schedules();
643
- $res = false;
644
- if (!empty($schedules)) {
645
- foreach ($schedules as $key => $data) {
646
- if ($key == 'newsletter') {
647
- $res = true;
648
- break;
649
- }
650
- }
651
- }
652
- ?>
653
-
654
  <tr>
 
 
 
655
  <td>
656
- Newsletter schedule
657
  </td>
658
  <td>
659
- <?php if ($res === false) { ?>
660
- <span class="tnp-ko">KO</span>
661
- <?php } else { ?>
662
- <span class="tnp-ok">OK</span>
663
- <?php } ?>
664
  </td>
665
  <td>
666
- <?php if ($res === false) { ?>
667
- The Newsletter schedule is not present probably another plugin is interfering with the starndard WordPress schuling system.<br>
 
668
  <?php } else { ?>
669
- <?php } ?>
670
 
671
- WordPress registered schedules:<br>
672
- <?php
673
- if (!empty($schedules)) {
674
- foreach ($schedules as $key => $data) {
675
- echo esc_html($key . ' - ' . $data['interval']) . ' seconds<br>';
676
- }
677
- }
678
- ?>
679
  </td>
680
  </tr>
681
-
682
  <tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
  <td>
684
- WordPress scheduler auto trigger
685
  </td>
686
  <td>
687
- <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) { ?>
688
- <span class="tnp-maybe">MAYBE</span>
689
- <?php } else { ?>
690
- <span class="tnp-ok">OK</span>
691
- <?php } ?>
692
  </td>
693
  <td>
694
- <?php if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) { ?>
695
- The constant DISABLE_WP_CRON is set to true (probably in wp-config.php). That disables the scheduler auto triggering and it's
696
- good ONLY if you setup an external trigger.
697
  <?php } else { ?>
698
 
699
  <?php } ?>
 
 
 
700
  </td>
701
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
702
  <tr>
 
 
 
703
  <td>
704
- Alternate cron
705
  </td>
706
  <td>
707
- &nbsp;
708
  </td>
709
  <td>
710
- <?php if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) { ?>
711
- Using the alternate cron trigger.
712
  <?php } else { ?>
713
 
714
  <?php } ?>
715
  </td>
716
  </tr>
717
 
 
 
718
  <tr>
 
 
 
 
 
719
  <td>
720
- Cron calls
721
  </td>
722
  <td>
723
- <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL * 1.1) { ?>
724
- <span class="tnp-ko">KO</span>
 
 
 
725
  <?php } else { ?>
726
- <span class="tnp-ok">OK</span>
 
 
727
  <?php } ?>
728
  </td>
729
- <td>
730
- <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL * 1.1) { ?>
731
- The blog cron system is NOT triggered enough often.
732
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
733
  <?php } else { ?>
734
 
735
  <?php } ?>
736
- <br>
737
- Trigger interval: average <?php echo $wp_cron_calls_avg ?>&nbsp;s, max <?php echo $wp_cron_calls_max ?>&nbsp;s, min <?php echo $wp_cron_calls_min ?>&nbsp;s
738
  </td>
739
  </tr>
740
 
741
- <?php
742
- $res = true;
743
- $response = wp_remote_post(home_url('/') . '?na=test');
744
- if (is_wp_error($response)) {
745
- $res = false;
746
- $message = $response->get_error_message();
747
- } else {
748
- if (wp_remote_retrieve_response_code($response) != 200) {
749
- $res = false;
750
- $message = wp_remote_retrieve_response_message($response);
751
- }
752
- }
753
- ?>
754
  <tr>
 
 
 
 
755
  <td>
756
- Action call
757
  </td>
758
  <td>
759
- <?php if (!$res) { ?>
760
- <span class="tnp-ko">KO</span>
 
 
 
 
761
  <?php } else { ?>
762
- <span class="tnp-ok">OK</span>
763
  <?php } ?>
764
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
765
  <td>
766
- <?php if (!$res) { ?>
767
- The blog is not responding to Newsletter URLs: ask the provider or your IT consultant to check this problem. Report the URL and error below<br>
768
- Error: <?php echo esc_html($message) ?><br>
769
  <?php } else { ?>
770
-
771
  <?php } ?>
772
- Url: <?php echo esc_html(home_url('/') . '?na=test') ?><br>
773
  </td>
774
  </tr>
 
 
775
 
776
- <?php
777
- $res = true;
778
- $response = wp_remote_get(site_url('/wp-cron.php') . '?' . time());
779
- if (is_wp_error($response)) {
780
- $res = false;
781
- $message = $response->get_error_message();
782
- } else {
783
- if (wp_remote_retrieve_response_code($response) != 200) {
784
- $res = false;
785
- $message = wp_remote_retrieve_response_message($response);
786
- }
787
- }
788
- ?>
789
  <tr>
 
 
 
 
 
 
 
 
790
  <td>
791
- WordPress scheduler auto trigger call
792
- </td>
793
- <td>
794
- <?php if (!$res) { ?>
795
  <span class="tnp-ko">KO</span>
796
  <?php } else { ?>
797
  <span class="tnp-ok">OK</span>
798
  <?php } ?>
 
799
  </td>
800
  <td>
801
- <?php if (!$res) { ?>
802
- The blog cannot autotrigger the internal scheduler, if an external trigger is used this could not be a real problem.<br>
803
- Error: <?php echo esc_html($message) ?><br>
804
- <?php } else { ?>
805
-
806
  <?php } ?>
807
- Url: <?php echo esc_html(site_url('/wp-cron.php')) ?><br>
808
  </td>
 
809
  </tr>
810
 
811
- <?php
812
- $res = true;
813
- $response = wp_remote_get('http://www.thenewsletterplugin.com/wp-content/versions/all.txt');
814
- if (is_wp_error($response)) {
815
- $res = false;
816
- $message = $response->get_error_message();
817
- } else {
818
- if (wp_remote_retrieve_response_code($response) != 200) {
819
- $res = false;
820
- $message = wp_remote_retrieve_response_message($response);
821
- }
822
- }
823
- ?>
824
  <tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
825
  <td>
826
- Extension version check
827
  </td>
828
  <td>
829
  <?php if (!$res) { ?>
830
- <span class="tnp-ko">KO</span>
 
831
  <?php } else { ?>
832
- <span class="tnp-ok">OK</span>
833
  <?php } ?>
834
- </td>
835
- <td>
836
- <?php if (!$res) { ?>
837
- The blog cannot contact www.thenewsletterplugin.com to check the license or the extension versions.<br>
838
- Error: <?php echo esc_html($message) ?><br>
839
- <?php } else { ?>
840
 
841
- <?php } ?>
842
  </td>
843
- </tr>
844
-
 
 
845
  <tr>
 
 
 
 
846
  <td>
847
- Addons update
848
- </td>
849
- <td>
850
- <?php if (NEWSLETTER_EXTENSION_UPDATE) { ?>
851
- <span class="tnp-ok">OK</span>
852
- <?php } else { ?>
853
  <span class="tnp-ko">KO</span>
 
 
854
  <?php } ?>
 
855
  </td>
856
  <td>
857
- <?php if (!NEWSLETTER_EXTENSION_UPDATE) { ?>
858
- Addons update has been disabled.
859
- <?php } else { ?>
860
-
861
- <?php } ?>
 
 
 
 
862
  </td>
863
- </tr>
864
- <?php
865
- // Send calls stats
866
- $send_calls = get_option('newsletter_diagnostic_send_calls', array());
867
- if (count($send_calls)) {
868
- $send_max = 0;
869
- $send_min = PHP_INT_MAX;
870
- $send_total_time = 0;
871
- $send_total_emails = 0;
872
- $send_completed = 0;
873
- for ($i = 0; $i < count($send_calls); $i++) {
874
- if (empty($send_calls[$i][2]))
875
- continue;
876
 
877
- $delta = $send_calls[$i][1] - $send_calls[$i][0];
878
- $send_total_time += $delta;
879
- $send_total_emails += $send_calls[$i][2];
880
- $send_mean = $delta / $send_calls[$i][2];
881
- if ($send_min > $send_mean) {
882
- $send_min = $send_mean;
883
- }
884
- if ($send_max < $send_mean) {
885
- $send_max = $send_mean;
886
- }
887
- if (isset($send_calls[$i][3])) {
888
- $send_completed++;
889
- }
890
- }
891
- $send_mean = $send_total_time / $send_total_emails;
892
- ?>
893
  <tr>
894
  <td>
895
- Send details
896
  </td>
 
897
  <td>
898
- <?php if ($send_mean > 1) { ?>
899
- <span class="tnp-ko">KO</span>
900
- <?php } else { ?>
901
- <span class="tnp-ok">OK</span>
902
- <?php } ?>
903
  </td>
904
- <td>
905
- <?php if ($send_mean > 1) { ?>
906
- <strong>Sending an email is taking more than 1 second, rather slow.</strong>
907
- <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-performance" target="_blank">Read more</a>.
908
- <?php } ?>
909
- Average time to send an email: <?php echo sprintf("%.2f", $send_mean) ?> seconds<br>
910
- <?php if ($send_mean > 0) { ?>
911
- Max speed: <?php echo sprintf("%.2f", 1.0 / $send_mean * 3600) ?> emails per hour<br>
912
- <?php } ?>
913
 
914
- Max mean time measured: <?php echo sprintf("%.2f", $send_max) ?> seconds<br>
915
- Min mean time measured: <?php echo sprintf("%.2f", $send_min) ?> seconds<br>
916
- Total email in the sample: <?php echo $send_total_emails ?><br>
917
- Runs in the sample: <?php echo count($send_calls); ?><br>
918
- Runs prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls) - $send_completed) * 100.0 / count($send_calls)) ?>%<br>
919
  </td>
920
- </tr>
921
- <?php
922
- }
923
- ?>
924
-
925
 
 
 
 
926
  <tr>
 
 
 
 
 
 
 
 
927
  <td>
928
- Cron warnings
929
- </td>
930
- <td>
931
- <?php if (defined('NEWSLETTER_CRON_WARNINGS') && !NEWSLETTER_CRON_WARNINGS) { ?>
932
- <span class="tnp-maybe">MAYBE</span>
933
  <?php } else { ?>
934
  <span class="tnp-ok">OK</span>
935
  <?php } ?>
 
936
  </td>
937
  <td>
938
- <?php if (defined('NEWSLETTER_CRON_WARNINGS') && !NEWSLETTER_CRON_WARNINGS) { ?>
939
- Scheduler warnings are disabled in your wp-config.php with the constant <code>NEWSLETTER_CRON_WARNINGS</code> set to true.
 
 
 
 
940
  <?php } else { ?>
941
-
 
942
  <?php } ?>
943
  </td>
944
  </tr>
945
-
 
 
 
 
 
946
  <tr>
 
947
  <td>
948
- WordPress debug mode
949
- </td>
950
- <td>
951
- <?php if (defined('WP_DEBUG') && WP_DEBUG) { ?>
952
- <span class="tnp-maybe">MAYBE</span>
953
- <?php } else { ?>
954
- <span class="tnp-ok">OK</span>
955
- <?php } ?>
956
  </td>
957
  <td>
958
- <?php if (defined('WP_DEBUG') && WP_DEBUG) { ?>
959
- WordPress is in debug mode it is not recommended on a production system. See the constant WP_DEBUG inside the wp-config.php.
960
- <?php } else { ?>
961
-
962
  <?php } ?>
963
  </td>
964
  </tr>
965
 
966
-
967
-
968
- <?php /*
969
- $memory = intval(WP_MEMORY_LIMIT);
970
- if (false !== strpos(WP_MEMORY_LIMIT, 'G'))
971
- $memory *= 1024;
972
- ?>
973
- <tr>
974
- <td>
975
- PHP memory limit
976
- </td>
977
- <td>
978
- <?php if ($memory < 64) { ?>
979
- <span class="tnp-ko">MAYBE</span>
980
- <?php } else if ($memory < 128) { ?>
981
- <span class="tnp-maybe">MAYBE</span>
982
- <?php } else { ?>
983
- <span class="tnp-ok">OK</span>
984
- <?php } ?>
985
- </td>
986
- <td>
987
- WordPress WP_MEMORY_LIMIT is set to <?php echo $memory ?> megabyte but your PHP setting could allow more than that.
988
- Anyway we suggest to set the value to at least 64M.
989
- <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
990
- <?php if ($memory < 64) { ?>
991
- This value is too low you should increase it adding <code>define('WP_MEMORY_LIMIT', '64M');</code> to your <code>wp-config.php</code>.
992
- <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
993
- <?php } else if ($memory < 128) { ?>
994
- The value should be fine, it depends on how many plugins you're running and how many resource are required by your theme.
995
- Blank pages may happen with low memory problems. Eventually increase it adding <code>define('WP_MEMORY_LIMIT', '128M');</code>
996
- to your <code>wp-config.php</code>.
997
- <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
998
- <?php } else { ?>
999
-
1000
- <?php } ?>
1001
-
1002
- </td>
1003
- </tr>
1004
- */ ?>
1005
-
1006
  <?php
1007
- $ip = gethostbyname($_SERVER['HTTP_HOST']);
1008
- $name = gethostbyaddr($ip);
1009
- $res = true;
1010
- if (strpos($name, '.secureserver.net') !== false) {
1011
- //$smtp = get_option('newsletter_main_smtp');
1012
- //if (!empty($smtp['enabled']))
1013
- $res = false;
1014
- $message = 'If you\'re hosted with GoDaddy, be sure to set their SMTP (relay-hosting.secureserver.net, without username and password) to send emails
1015
- on Newsletter SMTP panel.
1016
- Remember they limits you to 250 emails per day. Open them a ticket for more details.';
1017
- }
1018
- if (strpos($name, '.aruba.it') !== false) {
1019
- $res = false;
1020
- $message = 'If you\'re hosted with Aruba consider to use an external SMTP (Sendgrid, Mailjet, Mailgun, Amazon SES, Elasticemail, Sparkpost, ...)
1021
- since their mail service is not good. If you have your personal email with them, you can try to use the SMTP of your
1022
- pesonal account. Ask the support for the SMTP parameters and configure them on Newsletter SMTP panel.';
1023
- }
1024
  ?>
1025
  <tr>
1026
- <td>Your Server</td>
1027
  <td>
1028
- <?php if ($res === false) { ?>
1029
- <span class="tnp-maybe">MAYBE</span>
1030
- <?php } else { ?>
1031
- <span class="tnp-ok">OK</span>
1032
- <?php } ?>
1033
-
1034
-
1035
  </td>
1036
  <td>
1037
  <?php if ($res === false) { ?>
1038
- <?php echo $message ?>
 
1039
  <?php } else { ?>
1040
-
1041
  <?php } ?>
1042
- IP: <?php echo $ip ?><br>
1043
- Name: <?php echo $name ?><br>
1044
  </td>
1045
  </tr>
1046
 
1047
  <?php
1048
- wp_mkdir_p(NEWSLETTER_LOG_DIR);
1049
- $res = is_dir(NEWSLETTER_LOG_DIR) && is_writable(NEWSLETTER_LOG_DIR);
1050
- if ($res) {
1051
- @file_put_contents(NEWSLETTER_LOG_DIR . '/test.txt', "");
1052
- $res = is_file(NEWSLETTER_LOG_DIR . '/test.txt');
1053
- if ($res) {
1054
- @unlink(NEWSLETTER_LOG_DIR . '/test.txt');
1055
- }
1056
- }
1057
  ?>
1058
  <tr>
 
1059
  <td>
1060
- Log folder
1061
  </td>
1062
  <td>
1063
- <?php if (!$res) { ?>
1064
- <span class="tnp-ko">KO</span>
 
 
1065
  <?php } else { ?>
1066
- <span class="tnp-ok">OK</span>
1067
  <?php } ?>
1068
  </td>
1069
- <td>
1070
- The log folder is <?php echo esc_html(NEWSLETTER_LOG_DIR) ?><br>
1071
- <?php if (!$res) { ?>
1072
- Cannot create the folder or it is not writable.
1073
- <?php } else { ?>
 
1074
 
1075
- <?php } ?>
1076
- </td>
1077
- </tr>
1078
  </tbody>
1079
  </table>
1080
-
1081
  <h3>General parameters</h3>
1082
  <table class="widefat" id="tnp-parameters-table">
1083
  <thead>
@@ -1113,8 +1175,8 @@ $speed = Newsletter::$instance->options['scheduler_max'];
1113
  <?php echo NEWSLETTER_CRON_INTERVAL . ' (seconds)'; ?>
1114
  </td>
1115
  </tr>
1116
-
1117
-
1118
 
1119
  <?php /*
1120
  <tr>
13
  $wp_cron_calls_min = 0;
14
  $wp_cron_calls_avg = 0;
15
  if (count($wp_cron_calls) > 20) {
16
+
17
  for ($i = 1; $i < count($wp_cron_calls); $i++) {
18
  $diff = $wp_cron_calls[$i] - $wp_cron_calls[$i - 1];
19
  $total += $diff;
92
  $message->subject = 'Newsletter test email at ' . date(DATE_ISO8601);
93
  $message->from = $module->options['sender_email'];
94
  $message->from_name = $module->options['sender_name'];
95
+
96
  $r = $module->deliver($message);
97
 
98
  if (!is_wp_error($r)) {
99
  $options['mail'] = 1;
100
  $controls->messages .= '<strong>SUCCESS</strong><br>';
101
+ $controls->messages .= 'Anyway if the message does not appear the mailbox (check even the spam folder) you can ';
102
+ $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/?p=15170" target="_blank"><strong>read more here</strong></a>.';
103
  } else {
104
  $options['mail'] = 0;
105
  $options['mail_error'] = $r->get_error_message();
106
 
107
+ $controls->errors .= '<strong>FAILED</strong> (' . $r->get_error_message() . ')<br>';
108
 
109
  if (!empty($module->options['return_path'])) {
110
  $controls->errors .= '- Try to remove the return path on main settings.<br>';
111
  }
112
 
113
+ $controls->errors .= '<a href="https://www.thenewsletterplugin.com/documentation/?p=15170" target="_blank"><strong>' . __('Read more', 'newsletter') . '</strong></a>.';
114
 
115
  $parts = explode('@', $module->options['sender_email']);
116
  $sitename = strtolower($_SERVER['SERVER_NAME']);
136
  $queued += $email->total - $email->sent;
137
  }
138
  $speed = Newsletter::$instance->options['scheduler_max'];
139
+
140
+ function tnp_status_print_flag($condition) {
141
+ switch ($condition) {
142
+ case 0: echo ' <span class="tnp-ko">KO</span>';
143
+ break;
144
+ case 1: echo '<span class="tnp-ok">OK</span>';
145
+ break;
146
+ case 2: echo '<span class="tnp-maybe">MAYBE</span>';
147
+ break;
148
+ }
149
+ }
150
  ?>
151
+ <style>
152
+ table.widefat tbody tr>td:first-child {
153
+ width: 150px!important;
154
+ }
155
+ </style>
156
 
157
  <div class="wrap tnp-main-status" id="tnp-wrap">
158
 
168
 
169
  <form method="post" action="">
170
  <?php $controls->init(); ?>
171
+
172
+ <h3>Mailing test</h3>
173
+ <table class="widefat" id="tnp-status-table">
174
+
175
+ <thead>
176
+ <tr>
177
+ <th>Parameter</th>
178
+ <th><?php _e('Status', 'newsletter') ?></th>
179
+ <th>Action</th>
180
+ </tr>
181
+ </thead>
182
+
183
+ <tbody>
184
+ <tr>
185
+ <td>Mailing</td>
186
+ <td>
187
+ <?php if (empty($options['mail'])) { ?>
188
+ <span class="tnp-ko">KO</span>
189
+ <?php } else { ?>
190
+ <span class="tnp-ok">OK</span>
191
+ <?php } ?>
192
+
193
+ </td>
194
+ <td>
195
+ <?php if (empty($options['mail'])) { ?>
196
+ <?php if (empty($options['mail_error'])) { ?>
197
+ A test has never run.
198
+ <?php } else { ?>
199
+ Last test failed with error "<?php echo esc_html($options['mail_error']) ?>".
200
 
201
+ <?php } ?>
202
+ <?php } else { ?>
203
+ Last test was successful. If you didn't receive the test email:
204
+ <ol>
205
+ <li>If you set the Newsletter SMTP, do a test from that panel</li>
206
+ <li>If you're using a integration extension do a test from its configuration panel</li>
207
+ <li>If previous points do not apply to you, ask for support to your provider reporting the emails from your blog are not delivered</li>
208
+ </ol>
209
+ <?php } ?>
210
+ <br>
211
+ <a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more to solve your issues, if any</a>.
212
+ <br>
213
+ Email: <?php $controls->text_email('test_email') ?> <?php $controls->button('test', __('Send a test message')) ?>
214
+ </td>
215
+
216
+ </tr>
217
+ </tbody>
218
+ </table>
219
+
220
  <h3>General checks</h3>
221
  <table class="widefat" id="tnp-status-table">
222
 
226
  <th><?php _e('Status', 'newsletter') ?></th>
227
  <th>Action</th>
228
  </tr>
229
+
230
  </thead>
231
 
232
  <tbody>
235
  if (function_exists('get_filesystem_method')) {
236
  $method = get_filesystem_method(array(), WP_PLUGIN_DIR);
237
  }
238
+ if (empty($method))
239
+ $condition = 2;
240
+ else if ($method == 'direct')
241
+ $condition = 1;
242
+ else
243
+ $condition = 0;
244
  ?>
245
  <tr>
246
  <td>Add-ons installable</td>
247
  <td>
248
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
 
 
 
249
  </td>
250
  <td>
251
+ <?php if ($condition == 2) { ?>
252
  No able to check, just try the add-ons manager one click install
253
+ <?php } else if ($condition == 1) { ?>
254
  The add-ons manager can install our add-ons
255
  <?php } else { ?>
256
  The plugins dir could be read-only, you can install add-ons uploading the package from the
286
  $mailer = Newsletter::instance()->get_mailer();
287
  $name = 'Unknown';
288
  if (is_object($mailer)) {
289
+ if (method_exists($mailer, 'get_description')) {
290
+ $name = $mailer->get_description();
291
+ } else {
292
+ $name = get_class($mailer);
293
+ }
294
  }
295
  ?>
296
+
297
  <?php echo esc_html($name) ?>
298
  </td>
299
  </tr>
300
+
301
 
 
 
 
 
 
 
 
 
302
 
 
 
 
 
 
 
 
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
305
  <?php
306
  $return_path = $module->options['return_path'];
307
  if (!empty($return_path)) {
336
 
337
  </tr>
338
 
 
 
 
 
 
 
 
 
 
 
 
 
339
 
 
340
 
341
+
 
 
 
 
 
 
342
 
343
  <tr>
344
+ <?php
345
+ $condition = NEWSLETTER_EXTENSION_UPDATE ? 1 : 0;
346
+ ?>
347
+ <td>Addons update</td>
348
  <td>
349
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
350
  </td>
351
  <td>
352
+ <?php if ($condition == 0) { ?>
353
+ Newsletter Addons update is disabled (probably in your <code>wp-config.php</code> file the constant
354
+ <code>NEWSLETTER_EXTENSION_UPDATE</code> is set to <code>true</code>)
355
+ <?php } else { ?>
356
+ Newsletter Addons can be updated
357
  <?php } ?>
358
  </td>
359
 
360
  </tr>
361
 
362
+
363
+
364
+
365
+
366
+
367
+
368
  <tr>
369
+ <?php
370
+ $time = wp_next_scheduled('newsletter');
371
+ $res = true;
372
+ $condition = 1;
373
+ if ($time === false) {
374
+ $res = false;
375
+ $condition = 0;
376
+ }
377
+ $delta = $time - time();
378
+ if ($delta <= -600) {
379
+ $res = false;
380
+ $condition = 0;
381
+ }
382
+ ?>
383
+ <td>Newsletter delivery engine job</td>
384
  <td>
385
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
386
  </td>
387
  <td>
388
+ <?php if ($time === false) { ?>
389
+ No next execution is planned.
390
+ <?php $controls->button('reschedule', 'Reset') ?>
391
+ <?php } else if ($delta <= -600) { ?>
392
+ The scheduler is very late: <?php echo $delta ?> seconds (<a href="https://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">read more</a>)
393
+ <?php $controls->button('trigger', 'Trigger') ?>
394
+ <?php } else { ?>
395
+ Next execution is planned in <?php echo $delta ?> seconds (negative values are ok).
396
+ <?php } ?>
397
  </td>
 
398
  </tr>
399
+
400
  <?php
401
+ $schedules = wp_get_schedules();
402
+ $res = false;
403
+ if (!empty($schedules)) {
404
+ foreach ($schedules as $key => $data) {
405
+ if ($key == 'newsletter') {
406
+ $res = true;
407
+ break;
408
+ }
409
+ }
410
  }
411
  ?>
412
 
413
  <tr>
 
414
  <td>
415
+ Newsletter schedule
416
+ </td>
417
+ <td>
418
+ <?php if ($res === false) { ?>
419
+ <span class="tnp-ko">KO</span>
420
  <?php } else { ?>
421
+ <span class="tnp-ok">OK</span>
422
  <?php } ?>
423
  </td>
424
  <td>
425
+ <?php if ($res === false) { ?>
426
+ The Newsletter schedule is not present probably another plugin is interfering with the starndard WordPress schuling system.<br>
427
  <?php } else { ?>
 
428
  <?php } ?>
 
429
 
430
+ WordPress registered schedules:<br>
431
+ <?php
432
+ if (!empty($schedules)) {
433
+ foreach ($schedules as $key => $data) {
434
+ echo esc_html($key . ' - ' . $data['interval']) . ' seconds<br>';
435
+ }
436
+ }
437
+ ?>
438
+ </td>
439
  </tr>
440
 
441
 
442
  <?php
 
443
  $res = true;
444
+ $response = wp_remote_post(home_url('/') . '?na=test');
445
+ if (is_wp_error($response)) {
446
+ $res = false;
447
+ $message = $response->get_error_message();
448
+ } else {
449
+ if (wp_remote_retrieve_response_code($response) != 200) {
450
+ $res = false;
451
+ $message = wp_remote_retrieve_response_message($response);
452
+ }
453
  }
454
  ?>
 
455
  <tr>
 
456
  <td>
457
+ Action call
 
 
 
 
 
458
  </td>
459
  <td>
460
  <?php if (!$res) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
461
  <span class="tnp-ko">KO</span>
462
  <?php } else { ?>
463
  <span class="tnp-ok">OK</span>
464
  <?php } ?>
 
465
  </td>
466
  <td>
467
+ <?php if (!$res) { ?>
468
+ The blog is not responding to Newsletter URLs: ask the provider or your IT consultant to check this problem. Report the URL and error below<br>
469
+ Error: <?php echo esc_html($message) ?><br>
 
 
 
470
  <?php } else { ?>
471
 
472
  <?php } ?>
473
+ Url: <?php echo esc_html(home_url('/') . '?na=test') ?><br>
474
  </td>
475
  </tr>
476
 
477
+
478
  <tr>
479
+ <?php
480
+ $res = true;
481
+ $response = wp_remote_get('http://www.thenewsletterplugin.com/wp-content/extensions.json');
482
+ $condition = 1;
483
+ if (is_wp_error($response)) {
484
+ $res = false;
485
+ $condition = 0;
486
+ $message = $response->get_error_message();
487
+ } else {
488
+ if (wp_remote_retrieve_response_code($response) != 200) {
489
+ $res = false;
490
+ $condition = 0;
491
+ $message = wp_remote_retrieve_response_message($response);
492
+ }
493
+ }
494
+ ?>
495
+
496
  <td>
497
+ Addons version check<br>
498
+ <small>Your blog can check the professional addon updates?</small>
 
 
 
 
499
  </td>
500
  <td>
501
+ <?php tnp_status_print_flag($condition) ?>
502
+ </td>
503
+ <td>
504
+ <?php if ($condition == 0) { ?>
505
+ The blog cannot contact www.thenewsletterplugin.com to check the license or the extension versions.<br>
506
+ Error: <?php echo esc_html($message) ?><br>
507
  <?php } else { ?>
508
 
509
  <?php } ?>
510
  </td>
511
+ </tr>
512
+
513
+
514
+ <?php
515
+ // Send calls stats
516
+ $send_calls = get_option('newsletter_diagnostic_send_calls', array());
517
+ if (count($send_calls)) {
518
+ $send_max = 0;
519
+ $send_min = PHP_INT_MAX;
520
+ $send_total_time = 0;
521
+ $send_total_emails = 0;
522
+ $send_completed = 0;
523
+ for ($i = 0; $i < count($send_calls); $i++) {
524
+ if (empty($send_calls[$i][2]))
525
+ continue;
526
+
527
+ $delta = $send_calls[$i][1] - $send_calls[$i][0];
528
+ $send_total_time += $delta;
529
+ $send_total_emails += $send_calls[$i][2];
530
+ $send_mean = $delta / $send_calls[$i][2];
531
+ if ($send_min > $send_mean) {
532
+ $send_min = $send_mean;
533
+ }
534
+ if ($send_max < $send_mean) {
535
+ $send_max = $send_mean;
536
+ }
537
+ if (isset($send_calls[$i][3])) {
538
+ $send_completed++;
539
+ }
540
+ }
541
+ $send_mean = $send_total_time / $send_total_emails;
542
+ ?>
543
+ <tr>
544
+ <td>
545
+ Send details
546
+ </td>
547
+ <td>
548
+ <?php if ($send_mean > 1) { ?>
549
+ <span class="tnp-ko">KO</span>
550
+ <?php } else { ?>
551
+ <span class="tnp-ok">OK</span>
552
+ <?php } ?>
553
+ </td>
554
+ <td>
555
+ <?php if ($send_mean > 1) { ?>
556
+ <strong>Sending an email is taking more than 1 second, rather slow.</strong>
557
+ <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-performance" target="_blank">Read more</a>.
558
+ <?php } ?>
559
+ Average time to send an email: <?php echo sprintf("%.2f", $send_mean) ?> seconds<br>
560
+ <?php if ($send_mean > 0) { ?>
561
+ Max speed: <?php echo sprintf("%.2f", 1.0 / $send_mean * 3600) ?> emails per hour<br>
562
+ <?php } ?>
563
+
564
+ Max mean time measured: <?php echo sprintf("%.2f", $send_max) ?> seconds<br>
565
+ Min mean time measured: <?php echo sprintf("%.2f", $send_min) ?> seconds<br>
566
+ Total email in the sample: <?php echo $send_total_emails ?><br>
567
+ Runs in the sample: <?php echo count($send_calls); ?><br>
568
+ Runs prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls) - $send_completed) * 100.0 / count($send_calls)) ?>%<br>
569
+ </td>
570
+ </tr>
571
+ <?php
572
+ }
573
+ ?>
574
+
575
 
576
  <tr>
577
+ <?php
578
+ $condition = (defined('NEWSLETTER_CRON_WARNINGS') && !NEWSLETTER_CRON_WARNINGS) ? 2 : 1;
579
+ ?>
580
  <td>
581
+ Cron warnings<br>
582
+ <small>Newsletter can notify of WP scheduler problems?</small>
 
 
 
 
583
  </td>
584
  <td>
585
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
 
 
 
 
586
  </td>
 
 
 
 
 
 
587
  <td>
588
+ <?php if ($condition == 2) { ?>
589
+ Scheduler warnings are disabled in your <code>wp-config.php</code> with the constant <code>NEWSLETTER_CRON_WARNINGS</code> set to true.
590
  <?php } else { ?>
 
 
591
 
 
 
 
 
 
 
592
  <?php } ?>
593
  </td>
594
  </tr>
595
 
596
+
597
+
598
+
599
+ <?php /*
600
+ $memory = intval(WP_MEMORY_LIMIT);
601
+ if (false !== strpos(WP_MEMORY_LIMIT, 'G'))
602
+ $memory *= 1024;
603
+ ?>
604
+ <tr>
605
+ <td>
606
+ PHP memory limit
607
+ </td>
608
+ <td>
609
+ <?php if ($memory < 64) { ?>
610
+ <span class="tnp-ko">MAYBE</span>
611
+ <?php } else if ($memory < 128) { ?>
612
+ <span class="tnp-maybe">MAYBE</span>
613
+ <?php } else { ?>
614
+ <span class="tnp-ok">OK</span>
615
+ <?php } ?>
616
+ </td>
617
+ <td>
618
+ WordPress WP_MEMORY_LIMIT is set to <?php echo $memory ?> megabyte but your PHP setting could allow more than that.
619
+ Anyway we suggest to set the value to at least 64M.
620
+ <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
621
+ <?php if ($memory < 64) { ?>
622
+ This value is too low you should increase it adding <code>define('WP_MEMORY_LIMIT', '64M');</code> to your <code>wp-config.php</code>.
623
+ <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
624
+ <?php } else if ($memory < 128) { ?>
625
+ The value should be fine, it depends on how many plugins you're running and how many resource are required by your theme.
626
+ Blank pages may happen with low memory problems. Eventually increase it adding <code>define('WP_MEMORY_LIMIT', '128M');</code>
627
+ to your <code>wp-config.php</code>.
628
+ <a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
629
+ <?php } else { ?>
630
+
631
+ <?php } ?>
632
+
633
+ </td>
634
+ </tr>
635
+ */ ?>
636
+
637
  <?php
638
+ $ip = gethostbyname($_SERVER['HTTP_HOST']);
639
+ $name = gethostbyaddr($ip);
640
+ $res = true;
641
+ if (strpos($name, '.secureserver.net') !== false) {
642
+ //$smtp = get_option('newsletter_main_smtp');
643
+ //if (!empty($smtp['enabled']))
644
+ $res = false;
645
+ $message = 'If you\'re hosted with GoDaddy, be sure to set their SMTP (relay-hosting.secureserver.net, without username and password) to send emails
646
+ on Newsletter SMTP panel.
647
+ Remember they limits you to 250 emails per day. Open them a ticket for more details.';
648
+ }
649
+ if (strpos($name, '.aruba.it') !== false) {
650
+ $res = false;
651
+ $message = 'If you\'re hosted with Aruba consider to use an external SMTP (Sendgrid, Mailjet, Mailgun, Amazon SES, Elasticemail, Sparkpost, ...)
652
+ since their mail service is not good. If you have your personal email with them, you can try to use the SMTP of your
653
+ pesonal account. Ask the support for the SMTP parameters and configure them on Newsletter SMTP panel.';
654
+ }
655
  ?>
656
  <tr>
657
+ <td>Your Server</td>
658
  <td>
659
  <?php if ($res === false) { ?>
660
+ <span class="tnp-maybe">MAYBE</span>
661
  <?php } else { ?>
662
  <span class="tnp-ok">OK</span>
663
+ <?php } ?>
664
+
665
+
666
  </td>
667
  <td>
668
  <?php if ($res === false) { ?>
669
+ <?php echo $message ?>
 
670
  <?php } else { ?>
671
+
672
  <?php } ?>
673
+ IP: <?php echo $ip ?><br>
674
+ Name: <?php echo $name ?><br>
675
  </td>
676
  </tr>
677
 
678
  <?php
679
+ wp_mkdir_p(NEWSLETTER_LOG_DIR);
680
+ $res = is_dir(NEWSLETTER_LOG_DIR) && is_writable(NEWSLETTER_LOG_DIR);
681
+ if ($res) {
682
+ @file_put_contents(NEWSLETTER_LOG_DIR . '/test.txt', "");
683
+ $res = is_file(NEWSLETTER_LOG_DIR . '/test.txt');
684
+ if ($res) {
685
+ @unlink(NEWSLETTER_LOG_DIR . '/test.txt');
686
+ }
687
+ }
688
  ?>
689
  <tr>
 
690
  <td>
691
+ Log folder
692
+ </td>
693
+ <td>
694
+ <?php if (!$res) { ?>
695
  <span class="tnp-ko">KO</span>
696
  <?php } else { ?>
697
  <span class="tnp-ok">OK</span>
698
  <?php } ?>
699
  </td>
700
  <td>
701
+ The log folder is <?php echo esc_html(NEWSLETTER_LOG_DIR) ?><br>
702
+ <?php if (!$res) { ?>
703
+ Cannot create the folder or it is not writable.
 
704
  <?php } else { ?>
705
+
706
  <?php } ?>
707
  </td>
708
+ </tr>
709
+ </tbody>
710
+ </table>
711
 
712
+ <h3>WordPress Scheduler/Cron</h3>
 
 
 
713
 
714
+ <table class="widefat" id="tnp-status-table">
715
+ <thead>
 
 
 
716
  <tr>
717
+ <th>Parameter</th>
718
+ <th><?php _e('Status', 'newsletter') ?></th>
719
+ <th>Action</th>
720
+ </tr>
721
+ </thead>
722
+ <tbody>
723
+ <tr>
724
+ <?php
725
+ $condition = (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) ? 2 : 1;
726
+ ?>
727
  <td>
728
+ WordPress scheduler auto trigger
 
 
 
 
729
  </td>
730
  <td>
731
+ <?php tnp_status_print_flag($condition) ?>
732
+ </td>
733
+ <td>
734
+ <?php if ($condition == 2) { ?>
735
+ The constant <code>DISABLE_WP_CRON</code> is set to true (probably in <code>wp-config.php</code>). That disables the scheduler auto triggering and it's
736
+ good ONLY if you setup an external trigger.
737
  <?php } else { ?>
738
+
739
  <?php } ?>
740
  </td>
741
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
742
  <tr>
 
743
  <td>
744
+ Alternate cron
 
 
 
 
745
  </td>
746
  <td>
747
+ &nbsp;
748
+ </td>
749
+ <td>
750
+ <?php if (defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON) { ?>
751
+ Using the alternate cron trigger.
 
752
  <?php } else { ?>
753
+
754
  <?php } ?>
755
  </td>
756
  </tr>
757
 
 
 
 
 
 
 
 
 
 
 
 
 
 
758
  <tr>
759
+ <?php
760
+ $condition = ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL * 1.1) ? 0 : 1;
761
+ ?>
762
  <td>
763
+ Cron calls
764
  </td>
765
  <td>
766
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
767
  </td>
768
  <td>
769
+ <?php if ($condition == 0) { ?>
770
+ The blog cron system is NOT triggered enough often.
771
+
772
  <?php } else { ?>
 
773
 
774
+ <?php } ?>
775
+ <br>
776
+ Trigger interval: average <?php echo $wp_cron_calls_avg ?>&nbsp;s, max <?php echo $wp_cron_calls_max ?>&nbsp;s, min <?php echo $wp_cron_calls_min ?>&nbsp;s
777
+ <br>
778
+ <a href="https://www.thenewsletterplugin.com/documentation/delivery-and-spam/newsletter-delivery-engine/" target="_blank">Read more</a>
 
 
 
779
  </td>
780
  </tr>
 
781
  <tr>
782
+ <?php
783
+ $res = true;
784
+ $response = wp_remote_get(site_url('/wp-cron.php') . '?' . time());
785
+ if (is_wp_error($response)) {
786
+ $res = false;
787
+ $message = $response->get_error_message();
788
+ } else {
789
+ if (wp_remote_retrieve_response_code($response) != 200) {
790
+ $res = false;
791
+ $message = wp_remote_retrieve_response_message($response);
792
+ }
793
+ }
794
+ $condition = !$res ? 0 : 1;
795
+ ?>
796
+
797
  <td>
798
+ WordPress scheduler auto trigger call
799
  </td>
800
  <td>
801
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
802
  </td>
803
  <td>
804
+ <?php if ($condition == 0) { ?>
805
+ The blog cannot auto-trigger the internal scheduler, if an external trigger is used this could not be a real problem.<br>
806
+ Error: <?php echo esc_html($message) ?><br>
807
  <?php } else { ?>
808
 
809
  <?php } ?>
810
+ Url: <?php echo esc_html(site_url('/wp-cron.php')) ?><br>
811
+ <br>
812
+ <a href="https://www.thenewsletterplugin.com/documentation/delivery-and-spam/newsletter-delivery-engine/" target="_blank">Read more</a>
813
  </td>
814
  </tr>
815
+ </tbody>
816
+ </table>
817
+
818
+
819
+
820
+ <h3>WordPress</h3>
821
+
822
+ <table class="widefat" id="tnp-status-table">
823
+ <thead>
824
+ <tr>
825
+ <th>Parameter</th>
826
+ <th><?php _e('Status', 'newsletter') ?></th>
827
+ <th>Action</th>
828
+ </tr>
829
+ </thead>
830
+ <tbody>
831
+
832
  <tr>
833
+ <?php
834
+ $condition = (defined('WP_DEBUG') && WP_DEBUG) ? 2 : 1;
835
+ ?>
836
  <td>
837
+ WordPress debug mode
838
  </td>
839
  <td>
840
+ <?php tnp_status_print_flag($condition) ?>
841
  </td>
842
  <td>
843
+ <?php if (defined('WP_DEBUG') && WP_DEBUG) { ?>
844
+ WordPress is in debug mode it is not recommended on a production system. See the constant <code>WP_DEBUG</code> inside the <code>wp-config.php</code>.
845
  <?php } else { ?>
846
 
847
  <?php } ?>
848
  </td>
849
  </tr>
850
 
851
+
852
+
853
  <tr>
854
+ <?php
855
+ $charset = get_option('blog_charset');
856
+ $condition = $charset === 'UTF-8' ? 1 : 0;
857
+ ?>
858
+ <td>Blog Charset</td>
859
  <td>
860
+ <?php tnp_status_print_flag($condition) ?>
861
  </td>
862
  <td>
863
+ Charset: <?php echo esc_html($charset) ?>
864
+ <br>
865
+
866
+ <?php if ($condition == 1) { ?>
867
+
868
  <?php } else { ?>
869
+ It is recommended to use
870
+ the <code>UTF-8</code> charset but the <a href="https://codex.wordpress.org/Converting_Database_Character_Sets" target="_blank">conversion</a>
871
+ could be tricky. If you're not experiencing problem, leave things as is.
872
  <?php } ?>
873
  </td>
874
+ </tr>
 
 
875
 
876
+ <tr>
877
+ <?php
878
+ $condition = (strpos(home_url('/'), 'http') !== 0) ? 0 : 1;
879
+ ?>
880
+ <td>Home URL</td>
881
+ <td>
882
+ <?php tnp_status_print_flag($condition) ?>
883
+ </td>
884
+ <td>
885
+ Value: <?php echo home_url('/'); ?>
886
+ <br>
887
+ <?php if ($condition == 0) { ?>
888
+ Your home URL is not absolute, emails require absolute URLs.
889
+ Probably you have a protocol agnostic plugin installed to manage both HTTPS and HTTP in your
890
+ blog.
891
  <?php } else { ?>
892
 
893
  <?php } ?>
 
 
894
  </td>
895
  </tr>
896
 
 
 
 
 
 
 
 
 
 
 
 
 
 
897
  <tr>
898
+ <?php
899
+ $condition = (strpos(WP_CONTENT_URL, 'http') !== 0) ? 0 : 1;
900
+ ?>
901
+ <td>WP_CONTENT_URL</td>
902
  <td>
903
+ <?php tnp_status_print_flag($condition) ?>
904
  </td>
905
  <td>
906
+ Value: <?php echo esc_html(WP_CONTENT_URL); ?>
907
+ <br>
908
+ <?php if ($condition == 0) { ?>
909
+ Your content URL is not absolute, emails require absolute URLs when they have images inside.
910
+ Newsletter tries to deal with this problem but when a problem with images persists, you should try to remove
911
+ from your <code>wp-config.php</code> the <code>WP_CONTENT_URL</code> define and check again.
912
  <?php } else { ?>
913
+
914
  <?php } ?>
915
  </td>
916
+ </tr>
917
+
918
+ <tr>
919
+ <?php
920
+ set_transient('newsletter_transient_test', 1, 300);
921
+ delete_transient('newsletter_transient_test');
922
+ $res = get_transient('newsletter_transient_test');
923
+ $condition = ($res !== false) ? 0 : 1;
924
+ ?>
925
+ <td>WordPress transients</td>
926
+ <td>
927
+ <?php tnp_status_print_flag($condition) ?>
928
+ </td>
929
  <td>
930
+ <?php if ($res !== false) { ?>
931
+ Transients cannot be delete. This can block the delivery engine. Usually it is due to a not well coded plugin installed.
 
932
  <?php } else { ?>
 
933
  <?php } ?>
 
934
  </td>
935
  </tr>
936
+ </tbody>
937
+ </table>
938
 
939
+
940
+
941
+ <h3>PHP</h3>
942
+ <table class="widefat" id="tnp-status-table">
943
+ <thead>
 
 
 
 
 
 
 
 
944
  <tr>
945
+ <th>Parameter</th>
946
+ <th><?php _e('Status', 'newsletter') ?></th>
947
+ <th>Action</th>
948
+ </tr>
949
+ </thead>
950
+ <tbody>
951
+ <tr>
952
+ <td>PHP version</td>
953
  <td>
954
+ <?php if (version_compare(phpversion(), '5.6', '<')) { ?>
 
 
 
955
  <span class="tnp-ko">KO</span>
956
  <?php } else { ?>
957
  <span class="tnp-ok">OK</span>
958
  <?php } ?>
959
+
960
  </td>
961
  <td>
962
+ Your PHP version is <?php echo phpversion() ?><br>
963
+ <?php if (version_compare(phpversion(), '5.3', '<')) { ?>
964
+ Newsletter plugin works correctly with PHP version 5.6 or greater. Ask your provider to upgrade your PHP. Your version is
965
+ unsupported even by the PHP community.
 
966
  <?php } ?>
 
967
  </td>
968
+
969
  </tr>
970
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
  <tr>
972
+ <?php
973
+ $value = (int) ini_get('max_execution_time');
974
+ $res = true;
975
+ $condition = 1;
976
+ if ($value != 0 && $value < NEWSLETTER_CRON_INTERVAL) {
977
+ $res = set_time_limit(NEWSLETTER_CRON_INTERVAL);
978
+ if ($res)
979
+ $condition = 1;
980
+ else
981
+ $condition = 0;
982
+ }
983
+ ?>
984
+ <td>PHP execution time limit</td>
985
  <td>
986
+ <?php tnp_status_print_flag($condition) ?>
987
  </td>
988
  <td>
989
  <?php if (!$res) { ?>
990
+ Your PHP execution time limit is <?php echo $value ?> seconds and cannot be changed or
991
+ is too lower to grant the maximum delivery rate of Newsletter.
992
  <?php } else { ?>
993
+ Your PHP execution time limit is <?php echo $value ?> seconds and can be eventually changed by Newsletter<br>
994
  <?php } ?>
 
 
 
 
 
 
995
 
 
996
  </td>
997
+
998
+ </tr>
999
+
1000
+
1001
  <tr>
1002
+ <?php
1003
+ $condition = function_exists('curl_version');
1004
+ ?>
1005
+ <td>Curl version</td>
1006
  <td>
1007
+ <?php if (!$condition) { ?>
 
 
 
 
 
1008
  <span class="tnp-ko">KO</span>
1009
+ <?php } else { ?>
1010
+ <span class="tnp-ok">OK</span>
1011
  <?php } ?>
1012
+
1013
  </td>
1014
  <td>
1015
+ <?php
1016
+ if (!$condition) {
1017
+ echo 'cUrl is not available, ask the provider to install it and activate the PHP cUrl library';
1018
+ } else {
1019
+ $version = curl_version();
1020
+ echo 'Version: ' . $version['version'] . '<br>';
1021
+ echo 'SSL Version: ' . $version['ssl_version'] . '<br>';
1022
+ }
1023
+ ?>
1024
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
1025
 
1026
+ </tr>
1027
+ <?php if (ini_get('opcache.validate_timestamps') === '0') { ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1028
  <tr>
1029
  <td>
1030
+ Opcache
1031
  </td>
1032
+
1033
  <td>
1034
+ <span class="tnp-ko">KO</span>
 
 
 
 
1035
  </td>
 
 
 
 
 
 
 
 
 
1036
 
1037
+ <td>
1038
+ You have the PHP opcache active with file validation disable so every blog plugins update needs a webserver restart!
 
 
 
1039
  </td>
1040
+ </tr>
1041
+ <?php } ?>
1042
+ </tbody>
1043
+ </table>
 
1044
 
1045
+ <h3>Database</h3>
1046
+ <table class="widefat" id="tnp-status-table">
1047
+ <thead>
1048
  <tr>
1049
+ <th>Parameter</th>
1050
+ <th><?php _e('Status', 'newsletter') ?></th>
1051
+ <th>Action</th>
1052
+ </tr>
1053
+ </thead>
1054
+ <tbody>
1055
+ <tr>
1056
+ <td>Database Charset</td>
1057
  <td>
1058
+ <?php if ($wpdb->charset != 'utf8mb4') { ?>
1059
+ <span class="tnp-ko">KO</span>
 
 
 
1060
  <?php } else { ?>
1061
  <span class="tnp-ok">OK</span>
1062
  <?php } ?>
1063
+
1064
  </td>
1065
  <td>
1066
+ Charset: <?php echo $wpdb->charset; ?>
1067
+ <br>
1068
+ <?php if ($wpdb->charset != 'utf8mb4') { ?>
1069
+ The recommended charset for your database is <code>utf8mb4</code> to avoid possible saving errors when you use emoji.
1070
+ Read the WordPress Codex <a href="https://codex.wordpress.org/Converting_Database_Character_Sets" target="_blank">conversion
1071
+ instructions</a> (skilled technicia required).
1072
  <?php } else { ?>
1073
+ If you experience newsletter saving database error
1074
+ <?php $controls->button('conversion', 'Try tables upgrade') ?>
1075
  <?php } ?>
1076
  </td>
1077
  </tr>
1078
+
1079
+
1080
+ <?php
1081
+ $wait_timeout = $wpdb->get_var("select @@wait_timeout");
1082
+ $condition = ($wait_timeout < 30) ? 0 : 1;
1083
+ ?>
1084
  <tr>
1085
+ <td>Database wait timeout</td>
1086
  <td>
1087
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
 
 
1088
  </td>
1089
  <td>
1090
+ Your database wait timeout is <?php echo $wait_timeout; ?> seconds<br>
1091
+ <?php if ($wait_timeout < 30) { ?>
1092
+ That value is low and could produce database connection errors while sending emails or during long import
1093
+ sessions. Ask the provider to raise it at least to 60 seconds.
1094
  <?php } ?>
1095
  </td>
1096
  </tr>
1097
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1098
  <?php
1099
+ $res = $wpdb->query("drop table if exists {$wpdb->prefix}newsletter_test");
1100
+ $res = $wpdb->query("create table if not exists {$wpdb->prefix}newsletter_test (id int(20))");
1101
+ $condition = $res === false ? 0 : 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1102
  ?>
1103
  <tr>
1104
+ <td>Database table creation</td>
1105
  <td>
1106
+ <?php tnp_status_print_flag($condition) ?>
 
 
 
 
 
 
1107
  </td>
1108
  <td>
1109
  <?php if ($res === false) { ?>
1110
+ Check the privileges of the user you use to connect to the database, it seems it cannot create tables.<br>
1111
+ (<?php echo esc_html($wpdb->last_error) ?>)
1112
  <?php } else { ?>
 
1113
  <?php } ?>
 
 
1114
  </td>
1115
  </tr>
1116
 
1117
  <?php
1118
+ $res = $wpdb->query("alter table {$wpdb->prefix}newsletter_test add column id1 int(20)");
1119
+ $condition = $res === false ? 0 : 1;
 
 
 
 
 
 
 
1120
  ?>
1121
  <tr>
1122
+ <td>Database table change</td>
1123
  <td>
1124
+ <?php tnp_status_print_flag($condition) ?>
1125
  </td>
1126
  <td>
1127
+ <?php if ($res === false) { ?>
1128
+ Check the privileges of the user you use to connect to the database, it seems it cannot change the tables. It's require to update the
1129
+ plugin.<br>
1130
+ (<?php echo esc_html($wpdb->last_error) ?>)
1131
  <?php } else { ?>
 
1132
  <?php } ?>
1133
  </td>
1134
+ </tr>
1135
+
1136
+ <?php
1137
+ // Clean up
1138
+ $res = $wpdb->query("drop table if exists {$wpdb->prefix}newsletter_test");
1139
+ ?>
1140
 
 
 
 
1141
  </tbody>
1142
  </table>
 
1143
  <h3>General parameters</h3>
1144
  <table class="widefat" id="tnp-parameters-table">
1145
  <thead>
1175
  <?php echo NEWSLETTER_CRON_INTERVAL . ' (seconds)'; ?>
1176
  </td>
1177
  </tr>
1178
+
1179
+
1180
 
1181
  <?php /*
1182
  <tr>
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 6.5.7
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '6.5.7');
39
 
40
  global $newsletter, $wpdb;
41
 
@@ -262,7 +262,8 @@ class Newsletter extends NewsletterModule {
262
  echo 'ok';
263
  die();
264
  }
265
-
 
266
  do_action('newsletter_action', $this->action);
267
  }
268
 
@@ -345,7 +346,7 @@ class Newsletter extends NewsletterModule {
345
  `total` int(11) NOT NULL DEFAULT '0',
346
  `last_id` int(11) NOT NULL DEFAULT '0',
347
  `sent` int(11) NOT NULL DEFAULT '0',
348
- `track` int(11) NOT NULL DEFAULT '0',
349
  `list` int(11) NOT NULL DEFAULT '0',
350
  `type` varchar(50) NOT NULL DEFAULT '',
351
  `query` longtext,
@@ -470,14 +471,6 @@ class Newsletter extends NewsletterModule {
470
  }
471
  }
472
 
473
- /**
474
- * Returns a set of warnings about this installtion the suser should be aware of. Return an empty string
475
- * if there are no warnings.
476
- */
477
- function warnings() {
478
-
479
- }
480
-
481
  function hook_in_admin_header() {
482
  if (!$this->is_admin_page()) {
483
  add_action('admin_notices', array($this, 'hook_admin_notices'));
@@ -499,22 +492,6 @@ class Newsletter extends NewsletterModule {
499
  if (isset($this->options['debug']) && $this->options['debug'] == 1) {
500
  echo '<div class="notice notice-warning"><p>The Newsletter plugin is in <strong>debug mode</strong>. When done change it on Newsletter <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>. Do not keep the debug mode active on production sites.</p></div>';
501
  }
502
-
503
- if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
504
- $x = wp_next_scheduled('newsletter');
505
- if ($x === false) {
506
- echo '<div class="notice notice-error"><p>The Newsletter delivery engine is off (it should never be off). Deactivate and reactivate the Newsletter plugin.</p></div>';
507
- } else if (time() - $x > 900) {
508
- echo '<div class="notice notice-error"><p>The WP scheduler doesn\'t seem to be running correctly for Newsletter. <a href="https://www.thenewsletterplugin.com/documentation/newsletter-delivery-engine#cron" target="_blank"><strong>Read this page to solve the problem</strong></a>.</p></div>';
509
- } else {
510
- // if (empty($this->options['disable_cron_notice'])) {
511
- // $cron_data = get_option('newsletter_diagnostic_cron_data');
512
- // if ($cron_data && $cron_data['mean'] > 500) {
513
- // echo '<div class="notice notice-error"><p>The WP scheduler doesn\'t seem to be triggered enough often for Newsletter. <a href="https://www.thenewsletterplugin.com/documentation/newsletter-delivery-engine#cron" target="_blank"><strong>Read this page to solve the problem</strong></a> or disable this notice on <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>.</p></div>';
514
- // }
515
- // }
516
- }
517
- }
518
  }
519
 
520
  function hook_wp_enqueue_scripts() {
@@ -551,9 +528,9 @@ class Newsletter extends NewsletterModule {
551
 
552
  // https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/
553
  // https://make.wordpress.org/core/2018/05/17/4-9-6-update-guide/
554
- if (function_exists('wp_add_privacy_policy_content')) {
555
  //wp_add_privacy_policy_content('Newsletter', wp_kses_post( wpautop( $content, false )));
556
- }
557
  }
558
 
559
  function hook_admin_head() {
@@ -775,7 +752,8 @@ class Newsletter extends NewsletterModule {
775
  update_option('newsletter_diagnostic_send_calls', $send_calls, false);
776
  }
777
 
778
- if ($supplied_users && $this->limits_exceeded()) {
 
779
  $result = false;
780
  }
781
 
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 6.5.8
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
35
  return;
36
  }
37
 
38
+ define('NEWSLETTER_VERSION', '6.5.8');
39
 
40
  global $newsletter, $wpdb;
41
 
262
  echo 'ok';
263
  die();
264
  }
265
+
266
+ //$user = $this->get_user_from_request();
267
  do_action('newsletter_action', $this->action);
268
  }
269
 
346
  `total` int(11) NOT NULL DEFAULT '0',
347
  `last_id` int(11) NOT NULL DEFAULT '0',
348
  `sent` int(11) NOT NULL DEFAULT '0',
349
+ `track` int(11) NOT NULL DEFAULT '1',
350
  `list` int(11) NOT NULL DEFAULT '0',
351
  `type` varchar(50) NOT NULL DEFAULT '',
352
  `query` longtext,
471
  }
472
  }
473
 
 
 
 
 
 
 
 
 
474
  function hook_in_admin_header() {
475
  if (!$this->is_admin_page()) {
476
  add_action('admin_notices', array($this, 'hook_admin_notices'));
492
  if (isset($this->options['debug']) && $this->options['debug'] == 1) {
493
  echo '<div class="notice notice-warning"><p>The Newsletter plugin is in <strong>debug mode</strong>. When done change it on Newsletter <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>. Do not keep the debug mode active on production sites.</p></div>';
494
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
  }
496
 
497
  function hook_wp_enqueue_scripts() {
528
 
529
  // https://developer.wordpress.org/plugins/privacy/suggesting-text-for-the-site-privacy-policy/
530
  // https://make.wordpress.org/core/2018/05/17/4-9-6-update-guide/
531
+ //if (function_exists('wp_add_privacy_policy_content')) {
532
  //wp_add_privacy_policy_content('Newsletter', wp_kses_post( wpautop( $content, false )));
533
+ //}
534
  }
535
 
536
  function hook_admin_head() {
752
  update_option('newsletter_diagnostic_send_calls', $send_calls, false);
753
  }
754
 
755
+ // We sent to all supplied users, but warning that no more should be processed
756
+ if (!$test && $supplied_users && $this->limits_exceeded()) {
757
  $result = false;
758
  }
759
 
profile/index.php CHANGED
@@ -1,14 +1,15 @@
1
  <?php
2
  defined('ABSPATH') || exit;
3
 
 
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
6
  $controls = new NewsletterControls();
7
- $module = NewsletterProfile::instance();
8
 
9
- $current_language = $module->get_current_language();
10
 
11
- $is_all_languages = $module->is_all_languages();
12
 
13
  if (!$is_all_languages) {
14
  $controls->warnings[] = 'You are configuring the language "<strong>' . $current_language . '</strong>". Switch to "all languages" to see every options.';
@@ -17,16 +18,16 @@ if (!$is_all_languages) {
17
  // Profile options are still inside the main options
18
  if ($controls->is_action()) {
19
  if ($controls->is_action('save')) {
20
- $module->save_options($controls->data, '', null, $current_language);
21
  $controls->add_message_saved();
22
  }
23
  if ($controls->is_action('reset')) {
24
- $module->reset_options();
25
- $controls->data = $module->get_options('', $current_language);
26
  $controls->add_message_reset();
27
  }
28
  } else {
29
- $controls->data = $module->get_options('', $current_language);
30
  }
31
  ?>
32
 
1
  <?php
2
  defined('ABSPATH') || exit;
3
 
4
+ /* @var $this NewsletterProfile */
5
+
6
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
 
8
  $controls = new NewsletterControls();
 
9
 
10
+ $current_language = $this->get_current_language();
11
 
12
+ $is_all_languages = $this->is_all_languages();
13
 
14
  if (!$is_all_languages) {
15
  $controls->warnings[] = 'You are configuring the language "<strong>' . $current_language . '</strong>". Switch to "all languages" to see every options.';
18
  // Profile options are still inside the main options
19
  if ($controls->is_action()) {
20
  if ($controls->is_action('save')) {
21
+ $this->save_options($controls->data, '', null, $current_language);
22
  $controls->add_message_saved();
23
  }
24
  if ($controls->is_action('reset')) {
25
+ $this->reset_options();
26
+ $controls->data = $this->get_options('', $current_language);
27
  $controls->add_message_reset();
28
  }
29
  } else {
30
+ $controls->data = $this->get_options('', $current_language);
31
  }
32
  ?>
33
 
profile/profile.php CHANGED
@@ -436,17 +436,6 @@ class NewsletterProfile extends NewsletterModule {
436
 
437
  parent::upgrade();
438
 
439
- // Migration code
440
- if (empty($this->options) || empty($this->options['email_changed'])) {
441
- // Options of the subscription module (worng name, I know)
442
- $options = get_option('newsletter');
443
- $this->options['saved'] = $options['profile_saved'];
444
- $this->options['text'] = $options['profile_text'];
445
- $this->options['email_changed'] = $options['profile_email_changed'];
446
- $this->options['error'] = $options['profile_error'];
447
- $this->options['url'] = $options['profile_url'];
448
- $this->save_options($this->options);
449
- }
450
  }
451
 
452
  function admin_menu() {
436
 
437
  parent::upgrade();
438
 
 
 
 
 
 
 
 
 
 
 
 
439
  }
440
 
441
  function admin_menu() {
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.3.2
5
- Stable tag: 6.5.7
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
@@ -109,6 +109,18 @@ Thank you, The Newsletter Team
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  = 6.5.7 =
113
 
114
  * Fixed posts block to stop automated by default when there are no new contents
@@ -224,174 +236,3 @@ Thank you, The Newsletter Team
224
  * Fixed extra profile fields management in REST and PHP API
225
  * Removed the "read more" added by themes on posts excerpt
226
  * Core improvements
227
-
228
- = 6.3.9 =
229
-
230
- * Improved antibot and/or spam subscription checks (please review your security configuration)
231
-
232
- = 6.3.8 =
233
-
234
- * Fixed email encoding when sent with wp_mail() and an encoding is selected on main settings
235
- * Optimization on sending process
236
- * Test newsletter stats cleared when real delivery starts
237
- * Improved image resize
238
- * Fixed security page help texts
239
-
240
- = 6.3.7 =
241
-
242
- * Schedules registration fix
243
-
244
- = 6.3.6 =
245
-
246
- * Improved error detection
247
- * Fixed stats collection for Autoresponder
248
- * Changed the init sequence to grant full load of other plugins (newsletter preview problems on some installations)
249
- * Better reporting on tests
250
-
251
- = 6.3.5 =
252
-
253
- * New addons panel
254
-
255
- = 6.3.4 =
256
-
257
- * Fixes
258
-
259
- = 6.3.3 =
260
-
261
- * Fixed the missing admin notification when using the internal SMTP
262
-
263
- = 6.3.2 =
264
-
265
- * Fixed the admin notification email not sent or bot correctly formatted
266
-
267
- = 6.3.1 =
268
-
269
- * Empty subject fix
270
-
271
- = 6.3.0 =
272
-
273
- * New mailer infrastructure: better compatibility and performance
274
- * New [TEST] prefix for newsletter tests
275
- * Fix on composer subject saving
276
- * General performance improvements
277
- * Fixed title display in header composer block
278
-
279
- = 6.2.2 =
280
-
281
- * Fixed custom blocks style.css loading
282
- * Fixed loading sequence for Archive Addon
283
- * Labels translation on profile panel
284
-
285
- = 6.2.1 =
286
-
287
- * Fixed foreach warning
288
- * Added IP on subscription via API
289
- * All addons update logics moved to our free [Addons Manager](https://www.thenewsletterplugin.com/documentation/how-to-install-the-addons-manager) to make Newsletter even lighter
290
-
291
- = 6.2.0 =
292
-
293
- * Fixed integration with addons manager
294
- * Support for new addon format
295
- * Added PHP minimum version declaration
296
-
297
- = 6.1.9 =
298
-
299
- * Fixed a missing default on profile configuration
300
- * Fixed the default message template
301
- * Added image alt on image block
302
- * Improved addons version check and performances
303
- * Post block and image block fixes
304
-
305
- = 6.1.8 =
306
-
307
- * Fixed a version check on main settings
308
-
309
- = 6.1.7 =
310
-
311
- * Fix for Automated
312
-
313
- = 6.1.6 =
314
-
315
- * Fixed roles management
316
-
317
- = 6.1.5 =
318
-
319
- * Improved the Gutenberg block
320
-
321
- = 6.1.4 =
322
-
323
- * Support for Automated theme regeneration
324
- * Fixed link tracking
325
-
326
- = 6.1.3 =
327
-
328
- * Fix to avoid third party plugin notices to interfere with the composer
329
- * NEW! Added subscription block to the Gutenberg editor
330
- * Code cleanup
331
-
332
- = 6.1.2 =
333
-
334
- * Added support for roles
335
-
336
- = 6.1.1 =
337
-
338
- * Added support for custom blocks
339
-
340
- = 6.1.0 =
341
-
342
- * Fixed data cleanup for non utf8mb4 database. Emoji not saved solved.
343
- * Small changes to the addons panel
344
-
345
- = 6.0.9 =
346
-
347
- * Changed the access control for editors
348
- * Added the convert to utf8mb4 on status panel
349
- * Small loading improvements
350
- * API Subscribe activation message fix
351
- * Fixed debug notice on composer
352
- * Fixed alt attribute on social block
353
-
354
- = 6.0.8 =
355
-
356
- * Specific link tracking patch for ElasticEmail
357
- * Compatibility code for WP 4.7
358
- * Fixed minimal widget subscribe button
359
-
360
- = 6.0.7 =
361
-
362
- * Fixed the wrong edit mode of duplicated newsletters
363
- * Fixed the alignment of small images on composer
364
- * Added addons update notice on status panel
365
-
366
- = 6.0.6 =
367
-
368
- * Fixed the textual part saving
369
- * Fixed required check on extra field of type "select"
370
- * Fixed old CTA theme text part
371
-
372
- = 6.0.5 =
373
-
374
- * Fixed repated CSS inclusion in emails
375
- * Email body weight optimization
376
- * Fix warning on posts block
377
-
378
- = 6.0.4 =
379
-
380
- * Fixed the hero block
381
-
382
- = 6.0.3 =
383
-
384
- * Fixed link and color picker on text block
385
-
386
- = 6.0.2 =
387
-
388
- * Fixed posts block (link missing)
389
-
390
- = 6.0.1 =
391
-
392
- * Fixed new newsletter creating panel "proceed" button
393
-
394
- = 6.0.0 =
395
-
396
- * The Newsletter Plugin Composer - A new revamped drag & drop composer
397
- * Several improvements and fixes
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.3.2
5
+ Stable tag: 6.5.8
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
109
 
110
  == Changelog ==
111
 
112
+ = 6.5.8 =
113
+
114
+ * Improvements on controls
115
+ * Delivery test mode fix for Autoresponder
116
+ * Fixed link to documentation on status panel
117
+ * Added link to documentation on SMTP page
118
+ * Reorganized status page with more links to the documentation
119
+ * Improved image block dimensions management for Outlook
120
+ * Fixed the mobile preview in the composer
121
+ * Added "image to the right" in the hero block
122
+ * Fixed dark color schema in hero block
123
+
124
  = 6.5.7 =
125
 
126
  * Fixed posts block to stop automated by default when there are no new contents
236
  * Fixed extra profile fields management in REST and PHP API
237
  * Removed the "read more" added by themes on posts excerpt
238
  * Core improvements
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
statistics/statistics.php CHANGED
@@ -248,6 +248,11 @@ class NewsletterStatistics extends NewsletterModule {
248
  $page = apply_filters('newsletter_statistics_view', 'newsletter_statistics_view');
249
  return 'admin.php?page=' . $page . '&amp;id=' . $email_id;
250
  }
 
 
 
 
 
251
 
252
  function get_index_url() {
253
  $page = apply_filters('newsletter_statistics_index', 'newsletter_statistics_index');
248
  $page = apply_filters('newsletter_statistics_view', 'newsletter_statistics_view');
249
  return 'admin.php?page=' . $page . '&amp;id=' . $email_id;
250
  }
251
+
252
+ function echo_statistics_button($email_id) {
253
+ echo '<a class="button-primary" href="', $this->get_statistics_url($email_id), '"><i class="fas fa-chart-bar"></i></a>';
254
+
255
+ }
256
 
257
  function get_index_url() {
258
  $page = apply_filters('newsletter_statistics_index', 'newsletter_statistics_index');
tnp-header.php CHANGED
@@ -239,6 +239,23 @@ $warning |= empty($status_options['mail']);
239
  </div>
240
  <?php } ?>
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  <div id="tnp-notification">
243
  <?php
244
  if (isset($controls)) {
239
  </div>
240
  <?php } ?>
241
 
242
+ <?php if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
243
+ $x = wp_next_scheduled('newsletter');
244
+ if ($x === false) {
245
+ echo '<div class="tnp-warning">The Newsletter delivery engine is off (it should never be off). Deactivate and reactivate the Newsletter plugin.</div>';
246
+ } else if (time() - $x > 900) {
247
+ echo '<div class="tnp-warning">The WP scheduler doesn\'t seem to be running correctly for Newsletter. <a href="https://www.thenewsletterplugin.com/documentation/?p=6128" target="_blank"><strong>Read this page to solve the problem</strong></a>.</div>';
248
+ } else {
249
+ // if (empty($this->options['disable_cron_notice'])) {
250
+ // $cron_data = get_option('newsletter_diagnostic_cron_data');
251
+ // if ($cron_data && $cron_data['mean'] > 500) {
252
+ // echo '<div class="notice notice-error"><p>The WP scheduler doesn\'t seem to be triggered enough often for Newsletter. <a href="https://www.thenewsletterplugin.com/documentation/newsletter-delivery-engine#cron" target="_blank"><strong>Read this page to solve the problem</strong></a> or disable this notice on <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>.</p></div>';
253
+ // }
254
+ // }
255
+ }
256
+ }
257
+ ?>
258
+
259
  <div id="tnp-notification">
260
  <?php
261
  if (isset($controls)) {