Newsletter - Version 4.8.7

Version Description

  • Empty excerpt fix
  • Fixed the list of blocks not appearing on few PHP installations
  • Fixed the composer editor
Download this release

Release Info

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

Code changes from version 4.8.6 to 4.8.7

admin.css CHANGED
@@ -1494,8 +1494,96 @@ table.widefat {
1494
  padding: 5px 8px;
1495
  text-decoration: none;
1496
  cursor: pointer;
 
 
 
 
 
 
 
 
 
1497
  }
1498
 
1499
  .tnp-extensions-image img {
1500
  margin: 25px 0px -10px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1501
  }
1494
  padding: 5px 8px;
1495
  text-decoration: none;
1496
  cursor: pointer;
1497
+ position: relative;
1498
+ }
1499
+
1500
+ img.tnp-extensions-free-badge {
1501
+ position: absolute;
1502
+ display: block;
1503
+ right: 0;
1504
+ top: 0;
1505
+ width: 70px;
1506
  }
1507
 
1508
  .tnp-extensions-image img {
1509
  margin: 25px 0px -10px;
1510
+ }
1511
+
1512
+ /* Subscription modal for free extensions */
1513
+ #tnp-subscribe-overlay {
1514
+ height: 100vh;
1515
+ width: 100vw;
1516
+ z-index: 10000;
1517
+ display: none;
1518
+ background-image: url(images/modal-background.png);
1519
+ background-repeat: repeat;
1520
+ position: fixed;
1521
+ top: 0;
1522
+ left: -20px;
1523
+ }
1524
+
1525
+ #tnp-subscribe-modal {
1526
+ width: 600px;
1527
+ background-color: rgba(255,255,255,1);
1528
+ margin-right: auto;
1529
+ margin-left: auto;
1530
+ margin-top: 100px;
1531
+ -webkit-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5);
1532
+ -moz-box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5);
1533
+ box-shadow: 0px 0px 20px 0px rgba(0,0,0,0.5);
1534
+ padding: 25px;
1535
+ background-color: #1D2B38;
1536
+
1537
+ text-align: center;
1538
+ }
1539
+
1540
+ #tnp-subscribe-modal img {
1541
+ width: 30%;
1542
+ }
1543
+
1544
+ #tnp-subscribe-title {
1545
+ font-size: 20px;
1546
+ margin-top: 30px;
1547
+ margin-bottom: 30px;
1548
+ line-height: 30px;
1549
+ color: white;
1550
+ font-weight: 200;
1551
+ }
1552
+
1553
+ #tnp-subscribe-email-wrapper {
1554
+ margin: 20px;
1555
+ }
1556
+
1557
+ #tnp-subscribe-email-wrapper input {
1558
+ border: none;
1559
+ background-color: #223242;
1560
+ color: white;
1561
+ }
1562
+
1563
+ #tnp-subscribe-email {
1564
+ font-size: 24px;
1565
+ box-sizing: border-box;
1566
+ width: 100%;
1567
+ padding: 10px;
1568
+ text-align: center;
1569
+ }
1570
+
1571
+ #tnp-subscribe-submit-wrapper {
1572
+ margin-bottom: 20px;
1573
+ }
1574
+
1575
+ #tnp-subscribe-submit {
1576
+ font-size: 24px;
1577
+ background-color: #219050;
1578
+ color: #fff;
1579
+ padding: 10px 35px;
1580
+ border: 0;
1581
+ font-size: 17px;
1582
+ letter-spacing: 2px;
1583
+ }
1584
+
1585
+ #tnp-subscribe-no-thanks {
1586
+ color: #666;
1587
+ margin-top: 20px;
1588
+ margin-bottom: 20px;
1589
  }
emails/emails.php CHANGED
@@ -95,9 +95,7 @@ class NewsletterEmails extends NewsletterModule {
95
  }
96
 
97
  function tnpc_preview_callback() {
98
-
99
- $id = (int) ($_POST['id'] ? $_POST['id'] : $_GET['id']);
100
- $email = Newsletter::instance()->get_email($id, ARRAY_A);
101
 
102
  if (empty($email)) {
103
  echo 'Wrong email identifier';
95
  }
96
 
97
  function tnpc_preview_callback() {
98
+ $email = Newsletter::instance()->get_email($_REQUEST['id'], ARRAY_A);
 
 
99
 
100
  if (empty($email)) {
101
  echo 'Wrong email identifier';
emails/themes/simple/theme.php CHANGED
@@ -13,9 +13,11 @@ global $newsletter, $post;
13
  if (!defined('ABSPATH'))
14
  exit;
15
 
16
- $color = $theme_options['theme_color'];
17
- if (empty($color))
18
  $color = '#0088cc';
 
 
19
 
20
  if (isset($theme_options['theme_posts'])) {
21
  $filters = array();
@@ -66,7 +68,7 @@ if (isset($theme_options['theme_posts'])) {
66
  <tbody>
67
  <tr>
68
  <td valign="top" style="background-color: #333; color: #f4f4f4; font-size: 20px; padding: 7px">
69
- <?php echo get_option('blogname') ?>
70
  </td>
71
  </tr>
72
  <!-- main content here -->
@@ -124,7 +126,7 @@ if (isset($theme_options['theme_posts'])) {
124
  <tbody>
125
  <tr>
126
  <td align="center" style="font-size: 14px; font-family: Arial;">
127
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
128
  </td>
129
  </tr>
130
  </tbody>
13
  if (!defined('ABSPATH'))
14
  exit;
15
 
16
+
17
+ if (empty($theme_options['theme_color']))
18
  $color = '#0088cc';
19
+ else
20
+ $color = $theme_options['theme_color'];
21
 
22
  if (isset($theme_options['theme_posts'])) {
23
  $filters = array();
68
  <tbody>
69
  <tr>
70
  <td valign="top" style="background-color: #333; color: #f4f4f4; font-size: 20px; padding: 7px">
71
+ <?php echo get_option('blogname') ?>
72
  </td>
73
  </tr>
74
  <!-- main content here -->
126
  <tbody>
127
  <tr>
128
  <td align="center" style="font-size: 14px; font-family: Arial;">
129
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
130
  </td>
131
  </tr>
132
  </tbody>
emails/tnp-composer/_scripts/newsletter-builder.js CHANGED
@@ -95,57 +95,9 @@ jQuery.fn.hover_edit = function () {
95
  //edit text
96
  if (target.attr("data-type") == 'text') {
97
  jQuery("#tnpc-edit-text .text").val(target.text());
98
- tinymce.init({
99
- selector: '#tnpc-edit-text .text',
100
- menubar: false,
101
- relative_urls: false,
102
- remove_script_host: false,
103
- toolbar: [
104
- 'fontselect fontsizeselect forecolor | bold italic underline | link | bullist numlist | emoticons | alignleft aligncenter alignright alignjustify tnp'
105
- ],
106
- plugins: "textcolor,link,emoticons",
107
- init_instance_callback: function (editor) {
108
- editor.setContent(target.html());
109
- },
110
- elementpath: false,
111
- statusbar: false,
112
- forced_root_block: false,
113
- font_formats: "Arial=arial,helvetica,sans-serif" +
114
- "Arial Black=arial black,avant garde;" +
115
- "Tahoma=tahoma,arial,helvetica,sans-serif;" +
116
- "Trebuchet MS=trebuchet ms,geneva;" +
117
- "Verdana=verdana,geneva;" +
118
- "Georgia=georgia,palatino;" +
119
- "Times=times,times new roman;" +
120
- "Times New Roman=times new roman,times;" +
121
- "Courier=courier,courier new;" +
122
- "Courier New=courier new,courier",
123
- setup: function (editor) {
124
- editor.addButton('tnp', {
125
- type: 'menubutton',
126
- //image: tinymce.baseURL + '/skins/tnp.png',
127
- menu: [
128
- {text: '{blog_url}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{blog_url}&nbsp;');}},
129
- {text: '{blog_title}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{blog_title}&nbsp;');}},
130
- {text: '{blog_description}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{blog_description}&nbsp;');}},
131
- {text: '{date}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{date}&nbsp;');}},
132
- {text: '{date_NNN}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{date_NNN}&nbsp;');}},
133
- {text: '{email_url}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{email_url}&nbsp;');}},
134
- {text: '{name}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{name}&nbsp;');}},
135
- {text: '{surname}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{surname}&nbsp;');}},
136
- {text: '{title}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{title}&nbsp;');}},
137
- {text: '{email}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{email}&nbsp;');}},
138
- {text: '{profile_N}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{profile_N}&nbsp;');}},
139
- {text: '{ip}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{ip}&nbsp;');}},
140
- {text: '{subscription_confirm_url}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{subscription_confirm_url}&nbsp;');}},
141
- {text: '{unsubscription_confirm_url}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{unsubscription_confirm_url}&nbsp;');}},
142
- {text: '{profile_url}', onclick: function () {console.log(this.text); editor.insertContent('&nbsp;{profile_url}&nbsp;');}},
143
- ],
144
- });
145
- },
146
- });
147
- //if (tinymce.activeEditor != null)
148
- // tinymce.activeEditor.setContent(target.html());
149
  jQuery("#tnpc-edit-text").fadeIn(500);
150
  jQuery("#tnpc-edit-text .tnpc-edit-box").slideDown(500);
151
  jQuery("#tnpc-edit-text .tnpc-edit-box-buttons-save").click(function () {
@@ -184,7 +136,7 @@ jQuery.fn.perform_delete = function () {
184
  jQuery(this).parent().remove();
185
  tnp_mobile_preview();
186
  });
187
-
188
  }
189
 
190
  jQuery.fn.add_block_edit = function () {
@@ -197,8 +149,8 @@ jQuery.fn.perform_block_edit = function () {
197
  jQuery(".tnpc-row-edit-block").click(function (e) {
198
  e.preventDefault()
199
  });
200
-
201
-
202
 
203
  this.click(function (e) {
204
 
@@ -228,7 +180,7 @@ jQuery.fn.perform_block_edit = function () {
228
  jQuery("#tnpc-block-options .tnpc-edit-box").slideDown(500);
229
  // Qua bisogna mandare anche le opzioni
230
  jQuery("#tnpc-block-options-form").load(ajaxurl, "action=tnpc_options&id=" + $container.data("id") + "&" + target.attr("data-options"), function (data) {
231
-
232
  });
233
  } else {
234
 
@@ -245,8 +197,8 @@ jQuery.fn.perform_block_edit = function () {
245
  target.css("font-family", jQuery("#tnpc-edit-block .font").val());
246
 
247
  });
248
-
249
-
250
 
251
  jQuery("#tnpc-edit-posts .tnpc-edit-box-buttons-save").click(function () {
252
 
@@ -270,7 +222,7 @@ jQuery.fn.perform_block_edit = function () {
270
  target.parent().before(new_row).remove();
271
  new_row.add_delete();
272
  new_row.add_block_edit();
273
-
274
  new_row.find(".tnpc-row-edit").hover_edit();
275
  });
276
  });
@@ -283,6 +235,100 @@ jQuery(function () {
283
 
284
  // collapse wp menu
285
  jQuery('body').addClass('folded');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
 
287
  //Drag & Drop
288
  jQuery("#newsletter-builder-area-center-frame-content").sortable({
@@ -331,15 +377,15 @@ jQuery(function () {
331
  start: function () {
332
  if (jQuery('.tnpc-row').length) {
333
  jQuery('.tnpc-row').append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>');
334
- } else {
335
  jQuery('#newsletter-builder-area-center-frame-content').append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>');
336
  }
337
  },
338
  stop: function (event, ui) {
339
  //debugger;
340
  jQuery('.tnpc-drop-here').remove();
341
-
342
-
343
  }
344
  });
345
 
@@ -348,7 +394,7 @@ jQuery(function () {
348
  jQuery(this).parent().parent().parent().fadeOut(500)
349
  jQuery(this).parent().parent().slideUp(500)
350
  });
351
-
352
  jQuery("#tnpc-block-options .tnpc-edit-box-buttons-save").click(function () {
353
  //alert(target.data('options'));
354
  jQuery(this).parent().parent().parent().fadeOut(500)
@@ -369,7 +415,7 @@ jQuery(function () {
369
  tnp_mobile_preview();
370
  //alert(data);
371
  });
372
- });
373
 
374
  // initialize controls
375
  jQuery(".tnpc-row").add_delete();
@@ -381,14 +427,14 @@ jQuery(function () {
381
  function tnp_mobile_preview() {
382
  var d = document.getElementById("tnp-mobile-preview").contentWindow.document;
383
  d.open();
384
-
385
  d.write("<!DOCTYPE html><html><head>");
386
  d.write("<link rel='stylesheet' href='" + TNP_HOME_URL + "?na=emails-composer-css&ver=" + Math.random() + "' type='text/css'");
387
  d.write("</head><body style='margin: 0; padding: 0;'>");
388
  d.write(jQuery("#newsletter-builder-area-center-frame-content").html());
389
  d.write("</body></html>");
390
  d.close();
391
- }
392
 
393
  function create() {
394
 
95
  //edit text
96
  if (target.attr("data-type") == 'text') {
97
  jQuery("#tnpc-edit-text .text").val(target.text());
98
+
99
+ if (tinymce.activeEditor != null)
100
+ tinymce.activeEditor.setContent(target.html());
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  jQuery("#tnpc-edit-text").fadeIn(500);
102
  jQuery("#tnpc-edit-text .tnpc-edit-box").slideDown(500);
103
  jQuery("#tnpc-edit-text .tnpc-edit-box-buttons-save").click(function () {
136
  jQuery(this).parent().remove();
137
  tnp_mobile_preview();
138
  });
139
+
140
  }
141
 
142
  jQuery.fn.add_block_edit = function () {
149
  jQuery(".tnpc-row-edit-block").click(function (e) {
150
  e.preventDefault()
151
  });
152
+
153
+
154
 
155
  this.click(function (e) {
156
 
180
  jQuery("#tnpc-block-options .tnpc-edit-box").slideDown(500);
181
  // Qua bisogna mandare anche le opzioni
182
  jQuery("#tnpc-block-options-form").load(ajaxurl, "action=tnpc_options&id=" + $container.data("id") + "&" + target.attr("data-options"), function (data) {
183
+
184
  });
185
  } else {
186
 
197
  target.css("font-family", jQuery("#tnpc-edit-block .font").val());
198
 
199
  });
200
+
201
+
202
 
203
  jQuery("#tnpc-edit-posts .tnpc-edit-box-buttons-save").click(function () {
204
 
222
  target.parent().before(new_row).remove();
223
  new_row.add_delete();
224
  new_row.add_block_edit();
225
+
226
  new_row.find(".tnpc-row-edit").hover_edit();
227
  });
228
  });
235
 
236
  // collapse wp menu
237
  jQuery('body').addClass('folded');
238
+ tinymce.init({
239
+ selector: '#tnpc-edit-text .text',
240
+ menubar: false,
241
+ relative_urls: false,
242
+ remove_script_host: false,
243
+ toolbar: [
244
+ 'fontselect fontsizeselect forecolor | bold italic underline | link | bullist numlist | emoticons | alignleft aligncenter alignright alignjustify tnp'
245
+ ],
246
+ plugins: "textcolor,link,emoticons",
247
+ init_instance_callback: function (editor) {
248
+ //editor.setContent(target.html());
249
+ },
250
+ elementpath: false,
251
+ statusbar: false,
252
+ forced_root_block: false,
253
+ font_formats: "Arial=arial,helvetica,sans-serif" +
254
+ "Arial Black=arial black,avant garde;" +
255
+ "Tahoma=tahoma,arial,helvetica,sans-serif;" +
256
+ "Trebuchet MS=trebuchet ms,geneva;" +
257
+ "Verdana=verdana,geneva;" +
258
+ "Georgia=georgia,palatino;" +
259
+ "Times=times,times new roman;" +
260
+ "Times New Roman=times new roman,times;" +
261
+ "Courier=courier,courier new;" +
262
+ "Courier New=courier new,courier",
263
+ setup: function (editor) {
264
+ editor.addButton('tnp', {
265
+ type: 'menubutton',
266
+ //image: tinymce.baseURL + '/skins/tnp.png',
267
+ menu: [
268
+ {text: '{blog_url}', onclick: function () {
269
+ console.log(this.text);
270
+ editor.insertContent('&nbsp;{blog_url}&nbsp;');
271
+ }},
272
+ {text: '{blog_title}', onclick: function () {
273
+ console.log(this.text);
274
+ editor.insertContent('&nbsp;{blog_title}&nbsp;');
275
+ }},
276
+ {text: '{blog_description}', onclick: function () {
277
+ console.log(this.text);
278
+ editor.insertContent('&nbsp;{blog_description}&nbsp;');
279
+ }},
280
+ {text: '{date}', onclick: function () {
281
+ console.log(this.text);
282
+ editor.insertContent('&nbsp;{date}&nbsp;');
283
+ }},
284
+ {text: '{date_NNN}', onclick: function () {
285
+ console.log(this.text);
286
+ editor.insertContent('&nbsp;{date_NNN}&nbsp;');
287
+ }},
288
+ {text: '{email_url}', onclick: function () {
289
+ console.log(this.text);
290
+ editor.insertContent('&nbsp;{email_url}&nbsp;');
291
+ }},
292
+ {text: '{name}', onclick: function () {
293
+ console.log(this.text);
294
+ editor.insertContent('&nbsp;{name}&nbsp;');
295
+ }},
296
+ {text: '{surname}', onclick: function () {
297
+ console.log(this.text);
298
+ editor.insertContent('&nbsp;{surname}&nbsp;');
299
+ }},
300
+ {text: '{title}', onclick: function () {
301
+ console.log(this.text);
302
+ editor.insertContent('&nbsp;{title}&nbsp;');
303
+ }},
304
+ {text: '{email}', onclick: function () {
305
+ console.log(this.text);
306
+ editor.insertContent('&nbsp;{email}&nbsp;');
307
+ }},
308
+ {text: '{profile_N}', onclick: function () {
309
+ console.log(this.text);
310
+ editor.insertContent('&nbsp;{profile_N}&nbsp;');
311
+ }},
312
+ {text: '{ip}', onclick: function () {
313
+ console.log(this.text);
314
+ editor.insertContent('&nbsp;{ip}&nbsp;');
315
+ }},
316
+ {text: '{subscription_confirm_url}', onclick: function () {
317
+ console.log(this.text);
318
+ editor.insertContent('&nbsp;{subscription_confirm_url}&nbsp;');
319
+ }},
320
+ {text: '{unsubscription_confirm_url}', onclick: function () {
321
+ console.log(this.text);
322
+ editor.insertContent('&nbsp;{unsubscription_confirm_url}&nbsp;');
323
+ }},
324
+ {text: '{profile_url}', onclick: function () {
325
+ console.log(this.text);
326
+ editor.insertContent('&nbsp;{profile_url}&nbsp;');
327
+ }},
328
+ ],
329
+ });
330
+ },
331
+ });
332
 
333
  //Drag & Drop
334
  jQuery("#newsletter-builder-area-center-frame-content").sortable({
377
  start: function () {
378
  if (jQuery('.tnpc-row').length) {
379
  jQuery('.tnpc-row').append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>');
380
+ } else {
381
  jQuery('#newsletter-builder-area-center-frame-content').append('<div class="tnpc-drop-here">Drag&Drop blocks here!</div>');
382
  }
383
  },
384
  stop: function (event, ui) {
385
  //debugger;
386
  jQuery('.tnpc-drop-here').remove();
387
+
388
+
389
  }
390
  });
391
 
394
  jQuery(this).parent().parent().parent().fadeOut(500)
395
  jQuery(this).parent().parent().slideUp(500)
396
  });
397
+
398
  jQuery("#tnpc-block-options .tnpc-edit-box-buttons-save").click(function () {
399
  //alert(target.data('options'));
400
  jQuery(this).parent().parent().parent().fadeOut(500)
415
  tnp_mobile_preview();
416
  //alert(data);
417
  });
418
+ });
419
 
420
  // initialize controls
421
  jQuery(".tnpc-row").add_delete();
427
  function tnp_mobile_preview() {
428
  var d = document.getElementById("tnp-mobile-preview").contentWindow.document;
429
  d.open();
430
+
431
  d.write("<!DOCTYPE html><html><head>");
432
  d.write("<link rel='stylesheet' href='" + TNP_HOME_URL + "?na=emails-composer-css&ver=" + Math.random() + "' type='text/css'");
433
  d.write("</head><body style='margin: 0; padding: 0;'>");
434
  d.write(jQuery("#newsletter-builder-area-center-frame-content").html());
435
  d.write("</body></html>");
436
  d.close();
437
+ }
438
 
439
  function create() {
440
 
emails/tnp-composer/index.php CHANGED
@@ -4,7 +4,7 @@ if (!defined('ABSPATH'))
4
 
5
  /* READ THE BLOCKS */
6
  $blocks_dir = NEWSLETTER_DIR . '/emails/tnp-composer/blocks/';
7
- $files = glob($blocks_dir . '*.block.php', GLOB_BRACE);
8
  foreach ($files as $file) {
9
  $path_parts = pathinfo($file);
10
  $filename = $path_parts['filename'];
4
 
5
  /* READ THE BLOCKS */
6
  $blocks_dir = NEWSLETTER_DIR . '/emails/tnp-composer/blocks/';
7
+ $files = glob($blocks_dir . '*.block.php');
8
  foreach ($files as $file) {
9
  $path_parts = pathinfo($file);
10
  $filename = $path_parts['filename'];
images/extension-free.png ADDED
Binary file
images/modal-background.png ADDED
Binary file
includes/controls.php CHANGED
@@ -988,15 +988,21 @@ class NewsletterControls {
988
  }
989
 
990
  function media($name) {
991
- $media_id = $this->data[$name]['id'];
992
- $media = wp_get_attachment_image_src($media_id, 'medium');
993
- $media_full = wp_get_attachment_image_src($media_id, 'full');
 
 
 
 
994
 
995
  if ($media === false) {
996
  $media = array('', '', '');
 
 
997
  echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
998
  } else {
999
- echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . $media[0] . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1000
  echo '<br>';
1001
  echo '<a href="#" onclick="newsletter_media_remove(\'' . esc_attr($name) . '\'); return false">Remove</a>';
1002
  }
988
  }
989
 
990
  function media($name) {
991
+ if (isset($this->data[$name])) {
992
+ $media_id = (int)$this->data[$name]['id'];
993
+ $media = wp_get_attachment_image_src($media_id, 'medium');
994
+ $media_full = wp_get_attachment_image_src($media_id, 'full');
995
+ } else {
996
+ $media = false;
997
+ }
998
 
999
  if ($media === false) {
1000
  $media = array('', '', '');
1001
+ $media_full = array('', '', '');
1002
+ $media_id = 0;
1003
  echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1004
  } else {
1005
+ echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . esc_attr($media[0]) . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1006
  echo '<br>';
1007
  echo '<a href="#" onclick="newsletter_media_remove(\'' . esc_attr($name) . '\'); return false">Remove</a>';
1008
  }
includes/helper.php CHANGED
@@ -8,10 +8,10 @@ function tnp_post_thumbnail_src($post, $size = 'thumbnail') {
8
  return $media[0];
9
  }
10
 
11
- function tnp_post_excerpt($post, $lenght = 30) {
12
  if (empty($post->post_excerpt)) {
13
  $excerpt = wp_strip_all_tags(strip_shortcodes($post->post_content));
14
- $excerpt = wp_trim_words($excerpt, $lenght);
15
  } else {
16
  $excerpt = wp_trim_words($post->post_excerpt, $length);
17
  }
8
  return $media[0];
9
  }
10
 
11
+ function tnp_post_excerpt($post, $length = 30) {
12
  if (empty($post->post_excerpt)) {
13
  $excerpt = wp_strip_all_tags(strip_shortcodes($post->post_content));
14
+ $excerpt = wp_trim_words($excerpt, $length);
15
  } else {
16
  $excerpt = wp_trim_words($post->post_excerpt, $length);
17
  }
includes/module.php CHANGED
@@ -592,7 +592,7 @@ class NewsletterModule {
592
  }
593
 
594
  function get_email($id, $format = OBJECT) {
595
- return $this->store->get_single(NEWSLETTER_EMAILS_TABLE, $id, $format);
596
  }
597
 
598
  function get_email_status_label($email) {
592
  }
593
 
594
  function get_email($id, $format = OBJECT) {
595
+ return $this->store->get_single(NEWSLETTER_EMAILS_TABLE, (int)$id, $format);
596
  }
597
 
598
  function get_email_status_label($email) {
main/extensions.php CHANGED
@@ -30,19 +30,21 @@ if ($controls->is_action('install')) {
30
 
31
  $result = $upgrader->install($source);
32
  if (!$result || is_wp_error($result)) {
33
- $controls->errors = __('Error while installing','newsletter');
34
  if (is_wp_error($result)) {
35
  $controls->errors .= ': ' . $result->get_error_message();
36
  }
37
  } else {
38
  $result = activate_plugin($extension->wp_slug);
39
  if (is_wp_error($result)) {
40
- $controls->errors .= __('Error while activating:','newsletter') . " " . $result->get_error_message();
41
  } else {
42
- $controls->messages .= __('Installed and activated','newsletter');
43
  }
44
  }
45
  wp_clean_plugins_cache(false);
 
 
46
  }
47
 
48
  if ($controls->is_action('activate')) {
@@ -60,7 +62,29 @@ if ($controls->is_action('activate')) {
60
  $controls->messages .= __('Activated', 'newsletter');
61
  }
62
  wp_clean_plugins_cache(false);
 
 
63
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  ?>
65
 
66
  <div class="wrap" id="tnp-wrap">
@@ -77,6 +101,7 @@ if ($controls->is_action('activate')) {
77
 
78
  <?php if (is_array($extensions)) { ?>
79
 
 
80
  <?php foreach ($extensions AS $e) { ?>
81
 
82
  <?php
@@ -109,11 +134,23 @@ if ($controls->is_action('activate')) {
109
  </div>
110
  </div>
111
  <?php } ?>
 
112
 
113
- <!--FREE EXTENSIONS-->
 
 
 
 
 
 
 
 
 
 
114
  <?php if ($e->type == "free") { ?>
115
  <div class="tnp-extension-free-box <?php echo $e->slug ?>">
116
- <div class="tnp-extensions-image"><img src="<?php echo $e->image ?>" alt="" /></div>
 
117
  <h3><?php echo $e->title ?></h3>
118
  <p><?php echo $e->description ?></p>
119
  <div class="tnp-extension-free-action">
@@ -123,19 +160,24 @@ if ($controls->is_action('activate')) {
123
  <a href="<?php echo $e->activate_url ?>" class="tnp-extension-activate">
124
  <i class="fa fa-power-off" aria-hidden="true"></i> <?php _e('Activate', 'newsletter') ?>
125
  </a>
126
- <?php } elseif ($e->downloadable) { ?>
127
  <a href="<?php echo $e->install_url ?>" class="tnp-extension-install">
128
  <i class="fa fa-download" aria-hidden="true"></i> Install Now
129
  </a>
130
- <?php } else { ?>
131
- <a href="https://www.thenewsletterplugin.com/account?utm_source=plugin&utm_medium=link&utm_campaign=extpanel" class="tnp-extension-free" target="_blank">
132
- <i class="fa fa-gift" aria-hidden="true"></i> Free Download
133
- </a>
134
  <?php } ?>
135
  </div>
136
  </div>
137
  <?php } ?>
138
 
 
 
 
 
 
 
 
 
 
139
  <!--INTEGRATIONS-->
140
  <?php if ($e->type == "integration") { ?>
141
  <div class="tnp-integration-box <?php echo $e->slug ?>">
@@ -164,6 +206,7 @@ if ($controls->is_action('activate')) {
164
 
165
  <?php } ?>
166
 
 
167
  <?php } else { ?>
168
 
169
  <p style="color: white;">No extensions available.</p>
@@ -178,3 +221,30 @@ if ($controls->is_action('activate')) {
178
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
179
 
180
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  $result = $upgrader->install($source);
32
  if (!$result || is_wp_error($result)) {
33
+ $controls->errors = __('Error while installing', 'newsletter');
34
  if (is_wp_error($result)) {
35
  $controls->errors .= ': ' . $result->get_error_message();
36
  }
37
  } else {
38
  $result = activate_plugin($extension->wp_slug);
39
  if (is_wp_error($result)) {
40
+ $controls->errors .= __('Error while activating:', 'newsletter') . " " . $result->get_error_message();
41
  } else {
42
+ $controls->messages .= __('Installed and activated', 'newsletter');
43
  }
44
  }
45
  wp_clean_plugins_cache(false);
46
+ //wp_redirect(admin_url('admin.php') . '?page=newsletter_main_extensions');
47
+ //die();
48
  }
49
 
50
  if ($controls->is_action('activate')) {
62
  $controls->messages .= __('Activated', 'newsletter');
63
  }
64
  wp_clean_plugins_cache(false);
65
+ wp_redirect(admin_url('admin.php') . '?page=newsletter_main_extensions');
66
+ die();
67
  }
68
+
69
+ if (isset($_POST['email']) && check_admin_referer('subscribe')) {
70
+ $body = array();
71
+ $body['ne'] = $_POST['email'];
72
+ $body['nr'] = 'extensions';
73
+ $body['nl[]'] = '3';
74
+ $body['nl[]'] = '4';
75
+ $body['nl[]'] = '1';
76
+ $body['optin'] = 'single';
77
+
78
+ wp_remote_post('https://www.thenewsletterplugin.com/?na=ajaxsub', array('body'=>$body));
79
+
80
+ update_option('newsletter_subscribed', time(), false);
81
+
82
+ $id = (int)$_POST['id'];
83
+ wp_redirect(wp_nonce_url(admin_url('admin.php'), 'save') . '&page=newsletter_main_extensions&act=install&id=' . $id);
84
+ die();
85
+ }
86
+
87
+ $subscribed = get_option('newsletter_subscribed', false);
88
  ?>
89
 
90
  <div class="wrap" id="tnp-wrap">
101
 
102
  <?php if (is_array($extensions)) { ?>
103
 
104
+ <!--PREMIUM EXTENSIONS-->
105
  <?php foreach ($extensions AS $e) { ?>
106
 
107
  <?php
134
  </div>
135
  </div>
136
  <?php } ?>
137
+ <?php } ?>
138
 
139
+ <!--FREE EXTENSIONS-->
140
+ <?php foreach ($extensions AS $e) { ?>
141
+
142
+ <?php
143
+ $e->activate_url = wp_nonce_url(admin_url('admin.php') . '?page=newsletter_main_extensions&act=activate&id=' . $e->id, 'save');
144
+ if ($subscribed) {
145
+ $e->install_url = wp_nonce_url(admin_url('admin.php') . '?page=newsletter_main_extensions&act=install&id=' . $e->id, 'save');
146
+ } else {
147
+ $e->install_url = 'javascript:newsletter_subscribe(' . $e->id . ')';
148
+ }
149
+ ?>
150
  <?php if ($e->type == "free") { ?>
151
  <div class="tnp-extension-free-box <?php echo $e->slug ?>">
152
+ <img class="tnp-extensions-free-badge" src="<?php echo plugins_url('newsletter')?>/images/extension-free.png">
153
+ <div class="tnp-extensions-image"><img src="<?php echo $e->image ?>"></div>
154
  <h3><?php echo $e->title ?></h3>
155
  <p><?php echo $e->description ?></p>
156
  <div class="tnp-extension-free-action">
160
  <a href="<?php echo $e->activate_url ?>" class="tnp-extension-activate">
161
  <i class="fa fa-power-off" aria-hidden="true"></i> <?php _e('Activate', 'newsletter') ?>
162
  </a>
163
+ <?php } else { ?>
164
  <a href="<?php echo $e->install_url ?>" class="tnp-extension-install">
165
  <i class="fa fa-download" aria-hidden="true"></i> Install Now
166
  </a>
 
 
 
 
167
  <?php } ?>
168
  </div>
169
  </div>
170
  <?php } ?>
171
 
172
+ <?php } ?>
173
+
174
+ <!--FREE EXTENSIONS-->
175
+ <?php foreach ($extensions AS $e) { ?>
176
+
177
+ <?php
178
+ $e->activate_url = wp_nonce_url(admin_url('admin.php') . '?page=newsletter_main_extensions&act=activate&id=' . $e->id, 'save');
179
+ $e->install_url = wp_nonce_url(admin_url('admin.php') . '?page=newsletter_main_extensions&act=install&id=' . $e->id, 'save');
180
+ ?>
181
  <!--INTEGRATIONS-->
182
  <?php if ($e->type == "integration") { ?>
183
  <div class="tnp-integration-box <?php echo $e->slug ?>">
206
 
207
  <?php } ?>
208
 
209
+
210
  <?php } else { ?>
211
 
212
  <p style="color: white;">No extensions available.</p>
221
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
222
 
223
  </div>
224
+
225
+ <script>
226
+ function newsletter_subscribe(id) {
227
+ document.getElementById("tnp-extension-id").value = id;
228
+ jQuery("#tnp-subscribe-overlay").fadeIn(500);
229
+ }
230
+ </script>
231
+
232
+ <div id="tnp-subscribe-overlay">
233
+ <div id="tnp-subscribe-modal">
234
+ <div>
235
+ <img src="http://cdn.thenewsletterplugin.com/newsletters-img/tnp-logo-colore-text-white@2x.png">
236
+ </div>
237
+ <div id="tnp-subscribe-title">
238
+ Subscribe our newsletter to get this extension<br>
239
+ and be informed about updates and best practices.</div>
240
+ <form method="post" action="?page=newsletter_main_extensions&noheader=true">
241
+ <?php wp_nonce_field('subscribe'); ?>
242
+ <input type="hidden" value="id" name="id" id="tnp-extension-id">
243
+ <div id="tnp-subscribe-email-wrapper"><input type="email" id="tnp-subscribe-email" name="email" value="<?php echo esc_attr(get_option('admin_email')) ?>"></div>
244
+ <div id="tnp-subscribe-submit-wrapper"><input type="submit" id="tnp-subscribe-submit" value="<?php esc_attr_e('Subscribe', 'newsletter') ?>"></div>
245
+ </form>
246
+ <div class="tnp-subscribe-no-thanks">
247
+ <a href="javascript:jQuery('#tnp-subscribe-overlay').hide()">No thanks, I don't want to install the free extension</a>
248
+ </div>
249
+ </div>
250
+ </div>
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: 4.8.6
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.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '4.8.6');
18
 
19
  global $wpdb, $newsletter;
20
 
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: 4.8.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.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '4.8.7');
18
 
19
  global $wpdb, $newsletter;
20
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.7.3
5
- Stable tag: 4.8.6
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -77,6 +77,12 @@ Thank you, The Newsletter Team
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
80
  = 4.8.6 =
81
 
82
  * Warnings on SMTP panel when configured but not yet activated
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.7.3
5
+ Stable tag: 4.8.7
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
77
 
78
  == Changelog ==
79
 
80
+ = 4.8.7 =
81
+
82
+ * Empty excerpt fix
83
+ * Fixed the list of blocks not appearing on few PHP installations
84
+ * Fixed the composer editor
85
+
86
  = 4.8.6 =
87
 
88
  * Warnings on SMTP panel when configured but not yet activated
subscription/options.php CHANGED
@@ -136,7 +136,7 @@ if (empty($controls->data['page'])) {
136
  if (!$post || $post->post_status != 'publish') {
137
  $controls->errors .= '<p>The dedicated page selected below does not exist anymore or has been unpublished. Please, select a different one.</p>';
138
  } else {
139
- if (strpos($post->post_content, '[newsletter]') === false) {
140
  $controls->errors .= '<p>The dedicated page selected DOES NOT contain the [newsletter] shortcode. Please fix it. It should contain ONLY the [newsletter] shortcode.</p>';
141
  }
142
  }
136
  if (!$post || $post->post_status != 'publish') {
137
  $controls->errors .= '<p>The dedicated page selected below does not exist anymore or has been unpublished. Please, select a different one.</p>';
138
  } else {
139
+ if (strpos($post->post_content, '[newsletter') === false) {
140
  $controls->errors .= '<p>The dedicated page selected DOES NOT contain the [newsletter] shortcode. Please fix it. It should contain ONLY the [newsletter] shortcode.</p>';
141
  }
142
  }
subscription/style.css CHANGED
@@ -263,6 +263,7 @@ tnp-profile form .tnp-field label {
263
  border-radius: 0px;
264
  }
265
 
 
266
  .tnp-comments {
267
  clear: both;
268
  margin-top: 15px;
@@ -277,3 +278,16 @@ tnp-profile form .tnp-field label {
277
  display: inline;
278
  width: auto!important;
279
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  border-radius: 0px;
264
  }
265
 
266
+ /* Comments Extension */
267
  .tnp-comments {
268
  clear: both;
269
  margin-top: 15px;
278
  display: inline;
279
  width: auto!important;
280
  }
281
+
282
+
283
+ /* Locked Content Extension */
284
+ .tnp-lock {
285
+ clear: both;
286
+ display: block;
287
+ box-sizing: border-box;
288
+ box-shadow: none;
289
+ margin: 20px;
290
+ padding: 15px;
291
+ background-color: #fff;
292
+ border: 1px solid #ddd;
293
+ }
subscription/subscription.php CHANGED
@@ -313,6 +313,14 @@ class NewsletterSubscription extends NewsletterModule {
313
  $options_profile = get_option('newsletter_profile', array());
314
 
315
  $opt_in = (int) $this->options['noconfirmation']; // 0 - double, 1 - single
 
 
 
 
 
 
 
 
316
 
317
  $email = $newsletter->normalize_email(stripslashes($_REQUEST['ne']));
318
 
@@ -627,6 +635,7 @@ class NewsletterSubscription extends NewsletterModule {
627
 
628
  if ($user->status == 'C') {
629
  $newsletter->set_user_status($user->id, 'U');
 
630
 
631
  global $wpdb;
632
  if (isset($_REQUEST['nek'])) {
313
  $options_profile = get_option('newsletter_profile', array());
314
 
315
  $opt_in = (int) $this->options['noconfirmation']; // 0 - double, 1 - single
316
+ if (isset($_REQUEST['optin'])) {
317
+ switch ($_REQUEST['optin']) {
318
+ case 'single': $opt_in = 1;
319
+ break;
320
+ case 'double': $opt_in = 0;
321
+ break;
322
+ }
323
+ }
324
 
325
  $email = $newsletter->normalize_email(stripslashes($_REQUEST['ne']));
326
 
635
 
636
  if ($user->status == 'C') {
637
  $newsletter->set_user_status($user->id, 'U');
638
+ do_action('newsletter_unsubscribed', $user);
639
 
640
  global $wpdb;
641
  if (isset($_REQUEST['nek'])) {
tnp-header.php CHANGED
@@ -59,8 +59,10 @@ function newsletter_print_entries($group) {
59
  <small><?php _e('Profile the subscribers for a better targeting', 'newsletter') ?></small></a></li>
60
  <li><a href="?page=newsletter_subscription_unsubscription"><i class="fa fa-sign-out"></i> <?php _e('Unsubscription', 'newsletter') ?>
61
  <small><?php _e('How to give the last goodbye (or avoid it!)', 'newsletter') ?></small></a></li>
 
62
  <li><a href="?page=newsletter_lock_index"><i class="fa fa-lock"></i> <?php _e('Locked Content', 'newsletter') ?>
63
  <small><?php _e('Make your best content available only upon subscription', 'newsletter') ?></small></a></li>
 
64
  <li><a href="?page=newsletter_subscription_forms"><i class="fa fa-pencil"></i> <?php _e('Custom Forms', 'newsletter') ?>
65
  <small><?php _e('Hand coded form storage', 'newsletter') ?></small></a></li>
66
  <li><a href="?page=newsletter_subscription_template"><i class="fa fa-file-text-o"></i> <?php _e('Messages Template', 'newsletter') ?>
@@ -150,6 +152,16 @@ function newsletter_print_entries($group) {
150
  </div>
151
  <?php } ?>
152
 
 
 
 
 
 
 
 
 
 
 
153
 
154
  <?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-subscribe']) && get_option('newsletter_install_time') && get_option('newsletter_install_time') < time() - 86400 * 15) { ?>
155
  <div class="tnp-notice">
59
  <small><?php _e('Profile the subscribers for a better targeting', 'newsletter') ?></small></a></li>
60
  <li><a href="?page=newsletter_subscription_unsubscription"><i class="fa fa-sign-out"></i> <?php _e('Unsubscription', 'newsletter') ?>
61
  <small><?php _e('How to give the last goodbye (or avoid it!)', 'newsletter') ?></small></a></li>
62
+ <?php if (!file_exists(WP_PLUGIN_DIR . '/newsletter-lock')) { ?>
63
  <li><a href="?page=newsletter_lock_index"><i class="fa fa-lock"></i> <?php _e('Locked Content', 'newsletter') ?>
64
  <small><?php _e('Make your best content available only upon subscription', 'newsletter') ?></small></a></li>
65
+ <?php } ?>
66
  <li><a href="?page=newsletter_subscription_forms"><i class="fa fa-pencil"></i> <?php _e('Custom Forms', 'newsletter') ?>
67
  <small><?php _e('Hand coded form storage', 'newsletter') ?></small></a></li>
68
  <li><a href="?page=newsletter_subscription_template"><i class="fa fa-file-text-o"></i> <?php _e('Messages Template', 'newsletter') ?>
152
  </div>
153
  <?php } ?>
154
 
155
+ <?php /*
156
+ $newsletter_lock_options = get_option('newsletter_lock');
157
+ if (isset($_GET['debug']) || !isset($dismissed['newsletter-lock']) && !file_exists(WP_PLUGIN_DIR . '/newsletter-lock') && !empty($newsletter_lock_options['enabled'])) { ?>
158
+ <div class="tnp-notice">
159
+ <a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-lock' ?>" class="tnp-dismiss">&times;</a>
160
+ The <strong>Locked Content</strong> feature is now managed with a free extension. Please install it from the
161
+ <a href="?page=newsletter_main_extensions">Extensions panel</a>. Thank you.
162
+ </div>
163
+ <?php } */ ?>
164
+
165
 
166
  <?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-subscribe']) && get_option('newsletter_install_time') && get_option('newsletter_install_time') < time() - 86400 * 15) { ?>
167
  <div class="tnp-notice">