Newsletter - Version 6.0.5

Version Description

  • Fixed repated CSS inclusion in emails
  • Email body weight optimization
  • Fix warning on posts block
Download this release

Release Info

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

Code changes from version 6.0.4 to 6.0.5

emails/blocks/posts/block.php CHANGED
@@ -72,7 +72,6 @@ if (empty($posts) && $options['block_context'] == 'automated') {
72
  return;
73
  }
74
 
75
- $button_color = $options['button_color'];
76
  $button_background = $options['button_background'];
77
  $button_label = $options['button_label'];
78
  $button_font_family = $options['button_font_family'];
72
  return;
73
  }
74
 
 
75
  $button_background = $options['button_background'];
76
  $button_label = $options['button_label'];
77
  $button_font_family = $options['button_font_family'];
emails/composer.php CHANGED
@@ -7,7 +7,6 @@ $module = NewsletterEmails::instance();
7
 
8
  //wp_enqueue_style('wp-color-picker');
9
  //wp_enqueue_script('wp-color-picker');
10
-
11
  // TNP Composer style
12
  wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builder.css', __FILE__), array(), time());
13
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
@@ -16,85 +15,78 @@ include NEWSLETTER_INCLUDES_DIR . '/codemirror.php';
16
 
17
  if ($controls->is_action()) {
18
 
19
- /*** Save or create ***/
20
 
21
- if (empty($_GET['id'])) {
22
 
23
- $email = array();
24
- $email['status'] = 'new';
25
- $email['track'] = Newsletter::instance()->options['track'];
26
- $email['token'] = $module->get_token();
27
 
28
- $email['message'] = $controls->data['body'];
29
- $email['subject'] = $controls->data['subject'];
30
 
31
- $email['message_text'] = 'This email requires a modern e-mail reader but you can view the email online here:
32
  {email_url}.
33
 
34
- Thank you, ' . wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ) . '
35
 
36
  To change your subscription follow: {profile_url}.';
37
 
38
 
39
- $email['editor'] = NewsletterEmails::EDITOR_COMPOSER;
40
- $email['type'] = 'message';
41
- $email['send_on'] = time();
42
- $email['query'] = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
43
-
44
- $email = Newsletter::instance()->save_email( $email, ARRAY_A );
45
-
46
- } else {
47
 
48
- $email['id'] = $_GET['id'];
49
- $email['message'] = $controls->data['body'];
50
- $email['subject'] = $controls->data['subject'];
51
- $email = Newsletter::instance()->save_email( $email, ARRAY_A );
52
 
53
- }
54
-
55
- $controls->add_message_saved();
 
 
56
 
 
57
 
58
- /*** Post save tasks ***/
59
 
60
- if ($controls->is_action('test')) {
61
- $module->send_test_email($module->get_email($email['id']), $controls);
62
- }
63
 
64
- if ( $controls->is_action( 'preview' ) ) {
65
- $redirect = $module->get_admin_page_url( 'edit' );
66
- } else {
67
- $redirect = $module->get_admin_page_url( 'composer' );
68
- }
69
 
70
- $controls->js_redirect($redirect . '&id=' . $email['id']);
 
 
 
 
71
 
72
- return;
73
 
 
74
  } else {
75
 
76
  if (!empty($_GET['id'])) {
77
- $email = Newsletter::instance()->get_email( (int) $_GET['id'], ARRAY_A );
78
- $controls->data = $email;
79
  }
80
-
81
  }
82
 
83
  if (isset($email)) {
84
  $controls->data['body'] = $email['message'];
85
- $controls->data['subject'] = $email['subject'];
86
  }
87
-
88
  ?>
89
 
90
  <div id="tnp-notification">
91
- <?php
92
- if (isset($controls)) {
93
- $controls->show();
94
- $controls->messages = '';
95
- $controls->errors = '';
96
- }
97
- ?>
98
  </div>
99
 
100
  <div class="wrap tnp-emails-composer" id="tnp-wrap">
7
 
8
  //wp_enqueue_style('wp-color-picker');
9
  //wp_enqueue_script('wp-color-picker');
 
10
  // TNP Composer style
11
  wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builder.css', __FILE__), array(), time());
12
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
15
 
16
  if ($controls->is_action()) {
17
 
18
+ /* * * Save or create ** */
19
 
20
+ if (empty($_GET['id'])) {
21
 
22
+ $email = array();
23
+ $email['status'] = 'new';
24
+ $email['track'] = Newsletter::instance()->options['track'];
25
+ $email['token'] = $module->get_token();
26
 
27
+ $email['message'] = $controls->data['body'];
28
+ $email['subject'] = $controls->data['subject'];
29
 
30
+ $email['message_text'] = 'This email requires a modern e-mail reader but you can view the email online here:
31
  {email_url}.
32
 
33
+ Thank you, ' . wp_specialchars_decode(get_option('blogname'), ENT_QUOTES) . '
34
 
35
  To change your subscription follow: {profile_url}.';
36
 
37
 
38
+ $email['editor'] = NewsletterEmails::EDITOR_COMPOSER;
39
+ $email['type'] = 'message';
40
+ $email['send_on'] = time();
41
+ $email['query'] = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
 
 
 
 
42
 
43
+ $email = Newsletter::instance()->save_email($email, ARRAY_A);
44
+ } else {
 
 
45
 
46
+ $email['id'] = $_GET['id'];
47
+ $email['message'] = $controls->data['body'];
48
+ $email['subject'] = $controls->data['subject'];
49
+ $email = Newsletter::instance()->save_email($email, ARRAY_A);
50
+ }
51
 
52
+ $controls->add_message_saved();
53
 
 
54
 
55
+ /* * * Post save tasks ** */
 
 
56
 
57
+ if ($controls->is_action('test')) {
58
+ $module->send_test_email($module->get_email($email['id']), $controls);
59
+ }
 
 
60
 
61
+ if ($controls->is_action('preview')) {
62
+ $redirect = $module->get_admin_page_url('edit');
63
+ } else {
64
+ $redirect = $module->get_admin_page_url('composer');
65
+ }
66
 
67
+ $controls->js_redirect($redirect . '&id=' . $email['id']);
68
 
69
+ return;
70
  } else {
71
 
72
  if (!empty($_GET['id'])) {
73
+ $email = Newsletter::instance()->get_email((int) $_GET['id'], ARRAY_A);
74
+ $controls->data = $email;
75
  }
 
76
  }
77
 
78
  if (isset($email)) {
79
  $controls->data['body'] = $email['message'];
80
+ $controls->data['subject'] = $email['subject'];
81
  }
 
82
  ?>
83
 
84
  <div id="tnp-notification">
85
+ <?php
86
+ $controls->show();
87
+ $controls->messages = '';
88
+ $controls->errors = '';
89
+ ?>
 
 
90
  </div>
91
 
92
  <div class="wrap tnp-emails-composer" id="tnp-wrap">
emails/emails.php CHANGED
@@ -187,7 +187,7 @@ class NewsletterEmails extends NewsletterModule {
187
  ob_start();
188
  $this->render_block($options['block_id'], true, $options, true);
189
  $block_html = ob_get_clean();
190
- $result .= $block_html;
191
  // If a dynamic blocks return something, we need to return a regenerated template
192
  if ($last_run && $block['content'] == 'dynamic' && !empty($block_html))
193
  $all_empty = false;
@@ -317,15 +317,15 @@ class NewsletterEmails extends NewsletterModule {
317
 
318
  echo $content;
319
 
320
- echo "</td>\n</tr>\n</table>";
321
  echo '<!--[if mso]></td></tr></table><![endif]-->';
322
- echo "\n</td>\n</tr></table>\n\n";
323
  } else {
324
 
325
  $data = $this->options_encode($options);
326
  // First time block creation wrapper
327
  if ($wrapper) {
328
- echo "\n", '<table type="block" border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="border-collapse: collapse; width: 100%;" class="tnpc-row tnpc-row-block" data-id="', esc_attr($block_id), '">', "\n";
329
  echo "<tr>\n";
330
  echo '<td align="center" style="padding: 0;" class="edit-block">', "\n";
331
  }
@@ -334,20 +334,21 @@ class NewsletterEmails extends NewsletterModule {
334
  echo '<!--[if mso]><table border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '"><![endif]-->';
335
  echo "\n";
336
  echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
337
- echo "<tr>\n";
338
  echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
339
 
340
- echo "<!-- block generated content -->\n";
341
  echo $content;
342
- echo "\n<!-- /block generated content -->\n";
343
 
344
- echo "</td>\n</tr>\n</table>\n";
345
- echo '<!--[if mso]></td></tr></table><![endif]-->', "\n";
346
 
347
  // First time block creation wrapper
348
  if ($wrapper) {
349
- echo "</td>\n</tr>\n</table>\n";
350
  }
 
351
  }
352
  }
353
 
187
  ob_start();
188
  $this->render_block($options['block_id'], true, $options, true);
189
  $block_html = ob_get_clean();
190
+ $result .= trim($block_html);
191
  // If a dynamic blocks return something, we need to return a regenerated template
192
  if ($last_run && $block['content'] == 'dynamic' && !empty($block_html))
193
  $all_empty = false;
317
 
318
  echo $content;
319
 
320
+ echo "\n</td></tr></table>";
321
  echo '<!--[if mso]></td></tr></table><![endif]-->';
322
+ echo "</td></tr></table>\n";
323
  } else {
324
 
325
  $data = $this->options_encode($options);
326
  // First time block creation wrapper
327
  if ($wrapper) {
328
+ echo '<table type="block" border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="border-collapse: collapse; width: 100%;" class="tnpc-row tnpc-row-block" data-id="', esc_attr($block_id), '">', "\n";
329
  echo "<tr>\n";
330
  echo '<td align="center" style="padding: 0;" class="edit-block">', "\n";
331
  }
334
  echo '<!--[if mso]><table border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '"><![endif]-->';
335
  echo "\n";
336
  echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
337
+ echo "<tr>";
338
  echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
339
 
340
+ //echo "<!-- block generated content -->\n";
341
  echo $content;
342
+ //echo "\n<!-- /block generated content -->\n";
343
 
344
+ echo "\n</td></tr></table>";
345
+ echo '<!--[if mso]></td></tr></table><![endif]-->';
346
 
347
  // First time block creation wrapper
348
  if ($wrapper) {
349
+ echo "</td></tr></table>";
350
  }
351
+ echo "\n";
352
  }
353
  }
354
 
emails/tnp-composer/_scripts/newsletter-builder.js CHANGED
@@ -28,6 +28,7 @@ jQuery.fn.add_block_clone = function () {
28
  }
29
 
30
  let start_options = null;
 
31
 
32
  jQuery.fn.perform_block_edit = function () {
33
 
@@ -47,7 +48,7 @@ jQuery.fn.perform_block_edit = function () {
47
  jQuery('.bgcolor').wpColorPicker().iris('color', target.css("background-color"));
48
 
49
  // The row container which is a global variable and used later after the options save
50
- let container = jQuery(this).closest("table");
51
 
52
  if (container.hasClass('tnpc-row-block')) {
53
 
@@ -287,11 +288,12 @@ function tnpc_save(form) {
287
  jQuery("#newsletter-preloaded-export .tnpc-row").removeClass("ui-draggable");
288
 
289
  let preload_export_html = jQuery("#newsletter-preloaded-export").html();
 
290
 
291
- let data = form.elements["options[css]"].value;
292
 
293
  let export_content = '<!DOCTYPE html>\n<html>\n<head>\n<title>Newsletter</title>\n<meta charset="utf-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<meta http-equiv="X-UA-Compatible" content="IE=edge">\n';
294
- export_content += '<style type="text/css">' + data + '</style>';
295
  export_content += '</head>\n<body style="margin: 0; padding: 0;">\n';
296
  export_content += preload_export_html;
297
  export_content += '\n</body>\n</html>';
28
  }
29
 
30
  let start_options = null;
31
+ let container = null;
32
 
33
  jQuery.fn.perform_block_edit = function () {
34
 
48
  jQuery('.bgcolor').wpColorPicker().iris('color', target.css("background-color"));
49
 
50
  // The row container which is a global variable and used later after the options save
51
+ container = jQuery(this).closest("table");
52
 
53
  if (container.hasClass('tnpc-row-block')) {
54
 
288
  jQuery("#newsletter-preloaded-export .tnpc-row").removeClass("ui-draggable");
289
 
290
  let preload_export_html = jQuery("#newsletter-preloaded-export").html();
291
+ preload_export_html = jQuery.trim(preload_export_html);
292
 
293
+ let css = jQuery.trim(form.elements["options[css]"].value);
294
 
295
  let export_content = '<!DOCTYPE html>\n<html>\n<head>\n<title>Newsletter</title>\n<meta charset="utf-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n<meta http-equiv="X-UA-Compatible" content="IE=edge">\n';
296
+ export_content += '<style type="text/css">' + css + '</style>';
297
  export_content += '</head>\n<body style="margin: 0; padding: 0;">\n';
298
  export_content += preload_export_html;
299
  export_content += '\n</body>\n</html>';
emails/tnp-composer/index.php CHANGED
@@ -35,6 +35,10 @@ $block_options = get_option('newsletter_main');
35
  }
36
  </style>
37
 
 
 
 
 
38
  <div id="newsletter-builder">
39
 
40
  <div id="newsletter-builder-area" class="tnp-builder-column">
35
  }
36
  </style>
37
 
38
+ <style>
39
+ <?php echo NewsletterEmails::instance()->get_composer_css(); ?>
40
+ </style>
41
+
42
  <div id="newsletter-builder">
43
 
44
  <div id="newsletter-builder-area" class="tnp-builder-column">
includes/controls.php CHANGED
@@ -739,9 +739,9 @@ class NewsletterControls {
739
  $value = $this->get_value($name);
740
  echo '<input id="options-', esc_attr($name), '" placeholder="' . esc_attr($placeholder) . '" name="options[' . $name . ']" type="text" ';
741
  if (!empty($size)) {
742
- echo 'size="' . $size . '"';
743
  }
744
- echo 'value="' , esc_attr($value), '">';
745
  }
746
 
747
  function text_email($name, $size = 40) {
@@ -985,7 +985,7 @@ class NewsletterControls {
985
 
986
  $value = $this->get_value($name);
987
  //echo '<input id="options-', esc_attr($name), '" class="tnp-controls-color" name="options[' . $name . ']" type="text" value="';
988
- echo '<input id="options-', esc_attr($name), '" name="options[' . $name . ']" type="color" value="';
989
  echo esc_attr($value);
990
  echo '">';
991
  }
@@ -1347,7 +1347,7 @@ class NewsletterControls {
1347
  * @param array $attrs
1348
  */
1349
  function css_font($name = 'font', $attrs = array()) {
1350
- $default = array('color' => true, 'weight'=>true);
1351
  $attrs = array_merge($default, $attrs);
1352
  $this->css_font_family($name . '_family');
1353
  $this->css_font_size($name . '_size');
@@ -1376,10 +1376,10 @@ class NewsletterControls {
1376
  function css_font_weight($name = 'font_weight') {
1377
  $value = $this->get_value($name);
1378
 
1379
- $fonts = array('normal'=>'Normal', 'bold'=>'Bold');
1380
 
1381
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1382
- foreach ($fonts as $key=>$font) {
1383
  echo '<option value="', esc_attr($key), '"';
1384
  if ($value == $font) {
1385
  echo ' selected';
@@ -1483,7 +1483,7 @@ class NewsletterControls {
1483
  echo $output;
1484
  }
1485
 
1486
- function language($name = 'language', $empty_label='All') {
1487
  if (!class_exists('SitePress') && !function_exists('pll_default_language') && !class_exists('TRP_Translate_Press')) {
1488
  echo __('Install a multilanguage plugin.', 'newsletter');
1489
  echo ' <a href="https://www.thenewsletterplugin.com/documentation/multilanguage" target="_blank">', __('Read more', 'newsletter'), '</a>';
@@ -1622,31 +1622,46 @@ class NewsletterControls {
1622
  echo '</div>';
1623
  }
1624
 
1625
- function composer_fields($name='body') {
1626
 
1627
- // body
1628
  $value = $this->get_value($name);
1629
- // Required since esc_html DOES NOT escape the HTML entities (apparently)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1630
  $value = str_replace('&', '&amp;', $value);
1631
  $value = str_replace('"', '&quot;', $value);
1632
  $value = str_replace('<', '&lt;', $value);
1633
  $value = str_replace('>', '&gt;', $value);
1634
  echo '<input type="hidden" name="options[', esc_attr($name), ']" id="options-', esc_attr($name), '" value="', $value, '">';
1635
 
 
1636
  $css = NewsletterEmails::instance()->get_composer_css();
1637
- echo '<input type="hidden" name="options[css]" id="options-css" value="', esc_attr($css), '">';
1638
 
1639
  // subject
1640
  $value = $this->get_value('subject');
1641
  echo '<input type="hidden" name="options[subject]" id="options-subject" value="', $value, '">';
1642
-
1643
  }
1644
-
1645
- function composer_load($name='body', $show_subject = false) {
1646
 
1647
- global $controls;
1648
- global $tnpc_show_subject;
1649
- $tnpc_show_subject = $show_subject;
 
 
1650
 
1651
  wp_enqueue_style('tnpc-style', plugins_url('newsletter') . '/emails/tnp-composer/_css/newsletter-builder.css', array(), time());
1652
 
739
  $value = $this->get_value($name);
740
  echo '<input id="options-', esc_attr($name), '" placeholder="' . esc_attr($placeholder) . '" name="options[' . $name . ']" type="text" ';
741
  if (!empty($size)) {
742
+ echo 'size="' . $size . '"';
743
  }
744
+ echo 'value="', esc_attr($value), '">';
745
  }
746
 
747
  function text_email($name, $size = 40) {
985
 
986
  $value = $this->get_value($name);
987
  //echo '<input id="options-', esc_attr($name), '" class="tnp-controls-color" name="options[' . $name . ']" type="text" value="';
988
+ echo '<input id="options-', esc_attr($name), '" name="options[' . $name . ']" type="color" value="';
989
  echo esc_attr($value);
990
  echo '">';
991
  }
1347
  * @param array $attrs
1348
  */
1349
  function css_font($name = 'font', $attrs = array()) {
1350
+ $default = array('color' => true, 'weight' => true);
1351
  $attrs = array_merge($default, $attrs);
1352
  $this->css_font_family($name . '_family');
1353
  $this->css_font_size($name . '_size');
1376
  function css_font_weight($name = 'font_weight') {
1377
  $value = $this->get_value($name);
1378
 
1379
+ $fonts = array('normal' => 'Normal', 'bold' => 'Bold');
1380
 
1381
  echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1382
+ foreach ($fonts as $key => $font) {
1383
  echo '<option value="', esc_attr($key), '"';
1384
  if ($value == $font) {
1385
  echo ' selected';
1483
  echo $output;
1484
  }
1485
 
1486
+ function language($name = 'language', $empty_label = 'All') {
1487
  if (!class_exists('SitePress') && !function_exists('pll_default_language') && !class_exists('TRP_Translate_Press')) {
1488
  echo __('Install a multilanguage plugin.', 'newsletter');
1489
  echo ' <a href="https://www.thenewsletterplugin.com/documentation/multilanguage" target="_blank">', __('Read more', 'newsletter'), '</a>';
1622
  echo '</div>';
1623
  }
1624
 
1625
+ function composer_fields($name = 'body') {
1626
 
1627
+ // body
1628
  $value = $this->get_value($name);
1629
+
1630
+ // Extracts only the body part
1631
+ $x = strpos($value, '<body');
1632
+ if ($x) {
1633
+ $x = strpos($value, '>', $x);
1634
+ $y = strpos($value, '</body>');
1635
+ $value = substr($value, $x + 1, $y - $x - 1);
1636
+ }
1637
+
1638
+ /* Cleans up uncorrectly stored newsletter bodies */
1639
+ $value = preg_replace('/<style\s+.*?>.*?<\\/style>/is', '', $value);
1640
+ $value = preg_replace('/<meta.*?>/', '', $value);
1641
+ $value = preg_replace('/<title\s+.*?>.*?<\\/title>/i', '', $value);
1642
+ $value = trim($value);
1643
+
1644
+ // Required since esc_html DOES NOT escape the HTML entities (apparently)
1645
  $value = str_replace('&', '&amp;', $value);
1646
  $value = str_replace('"', '&quot;', $value);
1647
  $value = str_replace('<', '&lt;', $value);
1648
  $value = str_replace('>', '&gt;', $value);
1649
  echo '<input type="hidden" name="options[', esc_attr($name), ']" id="options-', esc_attr($name), '" value="', $value, '">';
1650
 
1651
+ // Used by composer to rebuild the full HTML
1652
  $css = NewsletterEmails::instance()->get_composer_css();
1653
+ echo '<input type="hidden" name="options[css]" id="options-css" value="', esc_attr($css), '">';
1654
 
1655
  // subject
1656
  $value = $this->get_value('subject');
1657
  echo '<input type="hidden" name="options[subject]" id="options-subject" value="', $value, '">';
 
1658
  }
 
 
1659
 
1660
+ function composer_load($name = 'body', $show_subject = false) {
1661
+
1662
+ global $controls;
1663
+ global $tnpc_show_subject;
1664
+ $tnpc_show_subject = $show_subject;
1665
 
1666
  wp_enqueue_style('tnpc-style', plugins_url('newsletter') . '/emails/tnp-composer/_css/newsletter-builder.css', array(), time());
1667
 
includes/module.php CHANGED
@@ -1602,7 +1602,7 @@ class NewsletterModule {
1602
  $text = $this->replace_url($text, 'BLOG_URL', $home_url);
1603
  $text = $this->replace_url($text, 'HOME_URL', $home_url);
1604
 
1605
- $text = str_replace('{blog_title}', get_option('blogname'), $text);
1606
  $text = str_replace('{blog_description}', get_option('blogdescription'), $text);
1607
 
1608
  $text = $this->replace_date($text);
1602
  $text = $this->replace_url($text, 'BLOG_URL', $home_url);
1603
  $text = $this->replace_url($text, 'HOME_URL', $home_url);
1604
 
1605
+ $text = str_replace('{blog_title}', html_entity_decode(get_bloginfo('name')), $text);
1606
  $text = str_replace('{blog_description}', get_option('blogdescription'), $text);
1607
 
1608
  $text = $this->replace_date($text);
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.0.4
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.
@@ -29,7 +29,7 @@
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
- define('NEWSLETTER_VERSION', '6.0.4');
33
 
34
  global $newsletter, $wpdb;
35
 
@@ -412,7 +412,7 @@ class Newsletter extends NewsletterModule {
412
  }
413
 
414
  //add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
415
-
416
  do_action('newsletter_init');
417
 
418
  if (empty($this->action)) {
@@ -453,19 +453,19 @@ class Newsletter extends NewsletterModule {
453
  }
454
 
455
  if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
456
- $x = wp_next_scheduled('newsletter');
457
- if ($x === false) {
458
- 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>';
459
- } else if (time() - $x > 900) {
460
- 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>';
461
- } else {
462
  // if (empty($this->options['disable_cron_notice'])) {
463
  // $cron_data = get_option('newsletter_diagnostic_cron_data');
464
  // if ($cron_data && $cron_data['mean'] > 500) {
465
  // 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>';
466
  // }
467
  // }
468
- }
469
  }
470
  }
471
 
@@ -645,7 +645,9 @@ class Newsletter extends NewsletterModule {
645
 
646
  $user = apply_filters('newsletter_send_user', $user);
647
 
648
- $m = $this->replace($email->message, $user, $email);
 
 
649
  $mt = $this->replace($email->message_text, $user, $email);
650
 
651
  $m = apply_filters('newsletter_message_html', $m, $email, $user);
@@ -1189,9 +1191,9 @@ class Newsletter extends NewsletterModule {
1189
  * @since 1.0.0
1190
  */
1191
  function hook_plugins_loaded() {
1192
-
1193
  //do_action('newsletter_loaded', NEWSLETTER_VERSION);
1194
-
1195
  if (function_exists('load_plugin_textdomain')) {
1196
  load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
1197
  }
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.0.5
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.
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
+ define('NEWSLETTER_VERSION', '6.0.5');
33
 
34
  global $newsletter, $wpdb;
35
 
412
  }
413
 
414
  //add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
415
+
416
  do_action('newsletter_init');
417
 
418
  if (empty($this->action)) {
453
  }
454
 
455
  if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
456
+ $x = wp_next_scheduled('newsletter');
457
+ if ($x === false) {
458
+ 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>';
459
+ } else if (time() - $x > 900) {
460
+ 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>';
461
+ } else {
462
  // if (empty($this->options['disable_cron_notice'])) {
463
  // $cron_data = get_option('newsletter_diagnostic_cron_data');
464
  // if ($cron_data && $cron_data['mean'] > 500) {
465
  // 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>';
466
  // }
467
  // }
468
+ }
469
  }
470
  }
471
 
645
 
646
  $user = apply_filters('newsletter_send_user', $user);
647
 
648
+ $m = preg_replace('/data-json=".*?"/is', '', $email->message);
649
+ $m = preg_replace('/ +/s', ' ', $m);
650
+ $m = $this->replace($m, $user, $email);
651
  $mt = $this->replace($email->message_text, $user, $email);
652
 
653
  $m = apply_filters('newsletter_message_html', $m, $email, $user);
1191
  * @since 1.0.0
1192
  */
1193
  function hook_plugins_loaded() {
1194
+
1195
  //do_action('newsletter_loaded', NEWSLETTER_VERSION);
1196
+
1197
  if (function_exists('load_plugin_textdomain')) {
1198
  load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
1199
  }
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
3
  Requires at least: 3.4.0
4
  Tested up to: 5.2.1
5
- Stable tag: 6.0.4
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -122,6 +122,12 @@ Thank you, The Newsletter Team
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
 
125
  = 6.0.4 =
126
 
127
  * Fixed the hero block
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
3
  Requires at least: 3.4.0
4
  Tested up to: 5.2.1
5
+ Stable tag: 6.0.5
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
122
 
123
  == Changelog ==
124
 
125
+ = 6.0.5 =
126
+
127
+ * Fixed repated CSS inclusion in emails
128
+ * Email body weight optimization
129
+ * Fix warning on posts block
130
+
131
  = 6.0.4 =
132
 
133
  * Fixed the hero block
subscription/subscription.php CHANGED
@@ -1059,7 +1059,7 @@ class NewsletterSubscription extends NewsletterModule {
1059
  $buffer .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1060
 
1061
  if (isset($attrs['referrer'])) {
1062
- $buffer .= '<input type="hidden" name="nr" value="' . esc_attr($referrer) . '">' . "\n";
1063
  }
1064
 
1065
  if (isset($attrs['confirmation_url'])) {
1059
  $buffer .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1060
 
1061
  if (isset($attrs['referrer'])) {
1062
+ $buffer .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">' . "\n";
1063
  }
1064
 
1065
  if (isset($attrs['confirmation_url'])) {