Newsletter - Version 6.5.3

Version Description

  • Removed a background wrapper for outlook otherwise outlook cut down long emails
  • Added background gradient (experimental, no supported by all mail clients)
  • Added dark color schema to cta and hero blocks
  • Fixed a debug notice
Download this release

Release Info

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

Code changes from version 6.5.2 to 6.5.3

css/fields.css CHANGED
@@ -56,25 +56,12 @@
56
 
57
  }
58
 
59
- /* Labels */
60
-
61
- .tnp-label {
62
- /* margin: 5px; */
63
- /* text-align: center; */
64
- color: #868686;
65
- /* margin-bottom: 20px; */
66
- font-family: Circular Std, sans-serif;
67
- font-weight: 300;
68
- border-bottom: 1px solid #fff;
69
- padding-bottom: 10px;
70
- }
71
-
72
  .tnp-field.tnp-separator {
73
  border-top: 1px solid #ddd;
74
  line-height: 0;
75
  }
76
 
77
- /* Single field/row container */
78
  .tnp-field {
79
  display: block;
80
  width: 100%;
@@ -84,11 +71,13 @@
84
  .tnp-field label.tnp-label {
85
  display: block;
86
  font-size: 12px;
87
- color: #868686;
88
- font-family: "Circular Std", sans-serif;
89
  font-weight: 300;
90
  border-bottom: 1px solid #fff;
91
- margin: 30px 0px 10px 0px;
 
 
 
 
92
  }
93
 
94
  .tnp-field.tnp-checkbox label {
@@ -150,3 +139,10 @@ tnp-field.tnp-font {
150
  .tnp-field.tnp-categories label {
151
 
152
  }
 
 
 
 
 
 
 
56
 
57
  }
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  .tnp-field.tnp-separator {
60
  border-top: 1px solid #ddd;
61
  line-height: 0;
62
  }
63
 
64
+ /* Single field container */
65
  .tnp-field {
66
  display: block;
67
  width: 100%;
71
  .tnp-field label.tnp-label {
72
  display: block;
73
  font-size: 12px;
 
 
74
  font-weight: 300;
75
  border-bottom: 1px solid #fff;
76
+ margin: 25px 0px 10px 0px;
77
+ font-family: Circular Std, sans-serif;
78
+ font-weight: 300;
79
+ padding-bottom: 5px;
80
+ color: #868686;
81
  }
82
 
83
  .tnp-field.tnp-checkbox label {
139
  .tnp-field.tnp-categories label {
140
 
141
  }
142
+
143
+ .tnp-description {
144
+ margin-top: 7px;
145
+ font-style: italic;
146
+ font-weight: normal;
147
+ color: #999999;
148
+ }
emails/blocks/cta/block.php CHANGED
@@ -11,8 +11,8 @@ $default_options = array(
11
  'font_color' => '#ffffff',
12
  'url' => home_url(),
13
  'font_family' => $font_family,
14
- 'font_size' => 16,
15
- 'font_weight' => 'normal',
16
  'block_background' => '#ffffff',
17
  'width' => '200',
18
  'block_padding_top' => 20,
@@ -20,6 +20,20 @@ $default_options = array(
20
  );
21
 
22
  $options = array_merge($default_options, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  ?>
24
  <style>
25
  .cta-button {
11
  'font_color' => '#ffffff',
12
  'url' => home_url(),
13
  'font_family' => $font_family,
14
+ 'font_size' => 20,
15
+ 'font_weight' => 'bold',
16
  'block_background' => '#ffffff',
17
  'width' => '200',
18
  'block_padding_top' => 20,
20
  );
21
 
22
  $options = array_merge($default_options, $options);
23
+
24
+ if (!empty($options['schema'])) {
25
+ if ($options['schema'] === 'dark') {
26
+ $options['block_background'] = '#000000';
27
+ $options['font_color'] = '#ffffff';
28
+ $options['background'] = '#96969C';
29
+ }
30
+
31
+ if ($options['schema'] === 'bright') {
32
+ $options['block_background'] = '#ffffff';
33
+ $options['font_color'] = '#ffffff';
34
+ $options['background'] = '#256F9C';
35
+ }
36
+ }
37
  ?>
38
  <style>
39
  .cta-button {
emails/blocks/cta/options.php CHANGED
@@ -1,11 +1,20 @@
1
  <?php
2
-
3
  /* @var $fields NewsletterFields */
 
 
4
  ?>
5
 
6
- <?php $fields->text('text', 'Button label') ?>
7
- <?php $fields->url('url', 'Button URL') ?>
8
- <?php $fields->font('font', __('Font', 'newsletter')) ?>
 
 
 
 
 
 
 
 
9
  <?php $fields->color('background', 'Button background') ?>
10
  <?php $fields->size('width', __('Width', 'newsletter')) ?>
11
 
1
  <?php
 
2
  /* @var $fields NewsletterFields */
3
+
4
+ $fields->controls->data['schema'] = '';
5
  ?>
6
 
7
+ <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark'), ['after-rendering' => 'reload']) ?>
8
+
9
+ <div class="tnp-field-row">
10
+ <div class="tnp-field-col-2">
11
+ <?php $fields->text('text', 'Button label') ?>
12
+ </div>
13
+ <div class="tnp-field-col-2">
14
+ <?php $fields->url('url', 'Button URL') ?>
15
+ </div>
16
+ </div>
17
+ <?php $fields->font('font', '') ?>
18
  <?php $fields->color('background', 'Button background') ?>
19
  <?php $fields->size('width', __('Width', 'newsletter')) ?>
20
 
emails/blocks/heading/block.php CHANGED
@@ -19,6 +19,23 @@ $default_options = array(
19
  'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  ?>
23
 
24
  <style>
19
  'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
22
+
23
+ if (!empty($options['schema'])) {
24
+ if ($options['schema'] === 'dark') {
25
+ $options['block_background'] = '#000000';
26
+ $options['font_color'] = '#ffffff';
27
+ }
28
+
29
+ if ($options['schema'] === 'bright') {
30
+ $options['block_background'] = '#ffffff';
31
+ $options['font_color'] = '#444444';
32
+ }
33
+
34
+ if ($options['schema'] === 'red') {
35
+ $options['block_background'] = '#c00000';
36
+ $options['font_color'] = '#ffffff';
37
+ }
38
+ }
39
  ?>
40
 
41
  <style>
emails/blocks/heading/options.php CHANGED
@@ -1,9 +1,13 @@
1
  <?php
2
 
3
  /* @var $fields NewsletterFields */
 
 
4
  ?>
 
 
5
  <?php $fields->text('text', __('Text', 'newsletter')) ?>
6
- <?php $fields->font() ?>
7
  <?php $fields->select('align', 'Alignment', array('center'=>'Center', 'left'=>'Left', 'right'=>'Right')) ?>
8
 
9
 
1
  <?php
2
 
3
  /* @var $fields NewsletterFields */
4
+
5
+ $fields->controls->data['schema'] = '';
6
  ?>
7
+ <?php $fields->select('schema', __('Schema', 'newsletter'), array('' => 'Custom', 'bright' => 'Bright', 'dark' => 'Dark', 'red' => 'Red'), ['after-rendering' => 'reload']) ?>
8
+
9
  <?php $fields->text('text', __('Text', 'newsletter')) ?>
10
+ <?php $fields->font('font', false) ?>
11
  <?php $fields->select('align', 'Alignment', array('center'=>'Center', 'left'=>'Left', 'right'=>'Right')) ?>
12
 
13
 
emails/blocks/hero/block.php CHANGED
@@ -12,26 +12,48 @@ $defaults = array(
12
  'title' => 'An Awesome Title',
13
  'text' => 'This is just a simple text you should change',
14
  'font_family' => 'Helvetica, Arial, sans-serif',
15
- 'font_size' => '14',
16
  'font_weight' => 'normal',
17
  'font_color' => '#000000',
18
  'title_font_family' => 'Helvetica, Arial, sans-serif',
19
- 'title_font_size' => '20',
20
- 'title_font_weight' => 'normal',
21
  'title_font_color' => '#000000',
22
  'block_background' => '#ffffff',
23
  'layout' => 'full',
24
  'button_url' => '',
25
  'button_label' => 'Click Here',
26
  'button_font_color' => '#ffffff',
27
- 'button_font_weight' => 'normal',
28
  'button_font_size' => 20,
29
  'button_background' => '#256F9C',
30
- 'block_padding_top'=>20,
31
- 'block_padding_bottom'=>20
 
 
 
32
  );
33
 
34
  $options = array_merge($defaults, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  $layout = $options['layout'];
36
 
37
  if ($layout == 'full') {
@@ -51,9 +73,6 @@ $title_font_size = $options['title_font_size'];
51
  $title_font_weight = $options['title_font_weight'];
52
  $title_font_color = $options['title_font_color'];
53
 
54
- $button_color = $options['button_color'];
55
- $button_background = $options['button_background'];
56
- $button_label = $options['button_label'];
57
  $layout = $options['layout'];
58
 
59
  if (!empty($options['image']['id'])) {
@@ -74,7 +93,6 @@ if (!empty($options['image']['id'])) {
74
  .hero-title {
75
  font-size: <?php echo $title_font_size ?>px;
76
  color: <?php echo $title_font_color ?>;
77
- padding-top: 30px;
78
  font-family: <?php echo $title_font_family ?>;
79
  font-weight: <?php echo $title_font_weight ?>;
80
  }
12
  'title' => 'An Awesome Title',
13
  'text' => 'This is just a simple text you should change',
14
  'font_family' => 'Helvetica, Arial, sans-serif',
15
+ 'font_size' => 18,
16
  'font_weight' => 'normal',
17
  'font_color' => '#000000',
18
  'title_font_family' => 'Helvetica, Arial, sans-serif',
19
+ 'title_font_size' => '32',
20
+ 'title_font_weight' => 'bold',
21
  'title_font_color' => '#000000',
22
  'block_background' => '#ffffff',
23
  'layout' => 'full',
24
  'button_url' => '',
25
  'button_label' => 'Click Here',
26
  'button_font_color' => '#ffffff',
27
+ 'button_font_weight' => 'bold',
28
  'button_font_size' => 20,
29
  'button_background' => '#256F9C',
30
+ 'layout' => 'full',
31
+ 'block_padding_top'=>30,
32
+ 'block_padding_bottom'=>30,
33
+ 'block_padding_left'=>15,
34
+ 'block_padding_right'=>15
35
  );
36
 
37
  $options = array_merge($defaults, $options);
38
+
39
+ if (!empty($options['schema'])) {
40
+ if ($options['schema'] === 'dark') {
41
+ $options['block_background'] = '#000000';
42
+ $options['title_font_color'] = '#ffffff';
43
+ $options['font_color'] = '#ffffff';
44
+ $options['button_font_color'] = '#ffffff';
45
+ $options['button_background'] = '#96969C';
46
+ }
47
+
48
+ if ($options['schema'] === 'bright') {
49
+ $options['block_background'] = '#ffffff';
50
+ $options['title_font_color'] = '#000000';
51
+ $options['font_color'] = '#000000';
52
+ $options['button_font_color'] = '#ffffff';
53
+ $options['button_background'] = '#256F9C';
54
+ }
55
+ }
56
+
57
  $layout = $options['layout'];
58
 
59
  if ($layout == 'full') {
73
  $title_font_weight = $options['title_font_weight'];
74
  $title_font_color = $options['title_font_color'];
75
 
 
 
 
76
  $layout = $options['layout'];
77
 
78
  if (!empty($options['image']['id'])) {
93
  .hero-title {
94
  font-size: <?php echo $title_font_size ?>px;
95
  color: <?php echo $title_font_color ?>;
 
96
  font-family: <?php echo $title_font_family ?>;
97
  font-weight: <?php echo $title_font_weight ?>;
98
  }
emails/blocks/hero/options.php CHANGED
@@ -4,18 +4,20 @@
4
  * @var $controls NewsletterControls
5
  */
6
  /* @var $fields NewsletterFields */
 
 
7
  ?>
8
 
9
  <div class="tnp-field-row">
10
- <div class="tnp-field-col-20">
11
  <?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Left'))?>
12
  </div>
13
- <div class="tnp-field-col-80">
 
 
 
14
 
15
  <?php $fields->text('title', __('Title', 'newsletter')) ?>
16
- </div>
17
-
18
- </div>
19
 
20
  <?php $fields->font('title_font', '')?>
21
 
@@ -26,7 +28,7 @@
26
  <?php $fields->textarea('text', __('Text', 'newsletter')) ?>
27
  <?php $fields->font('font', '')?>
28
 
29
- <?php $fields->button('button', __('Button', 'newsletter'))?>
30
 
31
  <?php $fields->block_commons() ?>
32
 
4
  * @var $controls NewsletterControls
5
  */
6
  /* @var $fields NewsletterFields */
7
+
8
+ $fields->controls->data['schema'] = '';
9
  ?>
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'])?>
17
+ </div>
18
+ </div>
19
 
20
  <?php $fields->text('title', __('Title', 'newsletter')) ?>
 
 
 
21
 
22
  <?php $fields->font('title_font', '')?>
23
 
28
  <?php $fields->textarea('text', __('Text', 'newsletter')) ?>
29
  <?php $fields->font('font', '')?>
30
 
31
+ <?php $fields->button('button', __('Button', 'newsletter'), ['weight'=>true])?>
32
 
33
  <?php $fields->block_commons() ?>
34
 
emails/blocks/image/block.php CHANGED
@@ -11,6 +11,7 @@
11
  $defaults = array(
12
  'image' => '',
13
  'url' => '',
 
14
  'block_background' => '#ffffff',
15
  'block_padding_left' => 0,
16
  'block_padding_right' => 0,
@@ -40,9 +41,18 @@ if (empty($options['image']['id'])) {
40
 
41
  $url = $options['url'];
42
  ?>
43
-
 
 
 
 
 
 
 
 
 
44
  <?php if (!empty($url)) { ?>
45
- <a href="<?php echo $url ?>" target="_blank"><img src="<?php echo $media->url ?>" width="<?php echo $media->width ?>" height="<?php echo $media->height ?>" border="0" alt="<?php echo esc_attr($media->alt) ?>" style="max-width: 100%!important; height: auto!important; display: inline-block;"></a>
46
  <?php } else { ?>
47
- <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 ?>" style="max-width: 100%!important; height: auto!important; display: inline-block;">
48
  <?php } ?>
11
  $defaults = array(
12
  'image' => '',
13
  'url' => '',
14
+ 'width'=>0,
15
  'block_background' => '#ffffff',
16
  'block_padding_left' => 0,
17
  'block_padding_right' => 0,
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)) { ?>
55
+ <a href="<?php echo $url ?>" target="_blank"><img src="<?php echo $media->url ?>" width="<?php echo $media->width ?>" height="<?php echo $media->height ?>" border="0" alt="<?php echo esc_attr($media->alt) ?>" inline-class="image"></a>
56
  <?php } else { ?>
57
+ <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">
58
  <?php } ?>
emails/blocks/image/options.php CHANGED
@@ -9,6 +9,6 @@
9
  <?php $fields->media('image', null, array('alt'=>true)) ?>
10
 
11
  <?php $fields->url('url', 'URL') ?>
12
-
13
  <?php $fields->block_commons() ?>
14
 
9
  <?php $fields->media('image', null, array('alt'=>true)) ?>
10
 
11
  <?php $fields->url('url', 'URL') ?>
12
+ <?php $fields->size('width', 'Width') ?>
13
  <?php $fields->block_commons() ?>
14
 
emails/emails.php CHANGED
@@ -110,7 +110,11 @@ class NewsletterEmails extends NewsletterModule {
110
  $controls->init();
111
  echo '<input type="hidden" name="action" value="tnpc_render">';
112
  echo '<input type="hidden" name="b" value="' . esc_attr($_REQUEST['id']) . '">';
113
- echo '<input type="hidden" name="options[inline_edits]" value="' . esc_attr( serialize( $controls->data['inline_edits'] ) ) . '">';
 
 
 
 
114
 
115
  ob_start();
116
  include $block['dir'] . '/options.php';
@@ -275,11 +279,11 @@ class NewsletterEmails extends NewsletterModule {
275
  }
276
 
277
  static function get_outlook_wrapper_open($width = 600) {
278
- return '<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '" style="vertical-align:top;width:' . $width . 'px;"><![endif]-->' . "\n";
279
  }
280
 
281
  static function get_outlook_wrapper_close() {
282
- echo "<!--[if mso | IE]></td></tr></table><![endif]-->\n";
283
  }
284
 
285
  /**
@@ -370,12 +374,16 @@ class NewsletterEmails extends NewsletterModule {
370
  $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . 'px; ';
371
  $style .= 'background-color: ' . $options['block_background'] . ';';
372
 
 
 
 
 
373
 
374
 
375
  $data = $this->options_encode($options);
376
  // First time block creation wrapper
377
  if ($wrapper) {
378
- 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";
379
  echo "<tr>";
380
  echo '<td align="center" style="padding: 0;" class="edit-block">', "\n";
381
  }
@@ -385,20 +393,19 @@ class NewsletterEmails extends NewsletterModule {
385
 
386
  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";
387
  echo "<tr>";
388
- echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
389
 
390
  //echo "<!-- block generated content -->\n";
391
- echo $content;
392
  //echo "\n<!-- /block generated content -->\n";
393
 
394
- echo "\n</td></tr></table>";
395
  echo $this->get_outlook_wrapper_close();
396
 
397
  // First time block creation wrapper
398
  if ($wrapper) {
399
  echo "</td></tr></table>";
400
  }
401
- echo "\n";
402
 
403
  return $out;
404
  }
@@ -610,7 +617,7 @@ class NewsletterEmails extends NewsletterModule {
610
  break;
611
 
612
 
613
-
614
  case 'emails-create':
615
  // Newsletter from themes are created on frontend context because sometime WP themes change the way the content,
616
  // excerpt, thumbnail are extracted.
@@ -624,14 +631,14 @@ class NewsletterEmails extends NewsletterModule {
624
  if (!$controls->is_action('create')) {
625
  die('Wrong call');
626
  }
627
-
628
  $theme_id = $controls->data['id'];
629
  $theme = $this->themes->get_theme($theme_id);
630
 
631
  if (!$theme) {
632
  die('invalid theme');
633
  }
634
-
635
  $this->themes->save_options($theme_id, $controls->data);
636
 
637
  $email = array();
110
  $controls->init();
111
  echo '<input type="hidden" name="action" value="tnpc_render">';
112
  echo '<input type="hidden" name="b" value="' . esc_attr($_REQUEST['id']) . '">';
113
+ $inline_edits = '';
114
+ if (isset($controls->data['inline_edits'])) {
115
+ $inline_edits = $controls->data['inline_edits'];
116
+ }
117
+ echo '<input type="hidden" name="options[inline_edits]" value="' . esc_attr( serialize( $inline_edits ) ) . '">';
118
 
119
  ob_start();
120
  include $block['dir'] . '/options.php';
279
  }
280
 
281
  static function get_outlook_wrapper_open($width = 600) {
282
+ return '<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '" style="vertical-align:top;width:' . $width . 'px;"><![endif]-->';
283
  }
284
 
285
  static function get_outlook_wrapper_close() {
286
+ echo "<!--[if mso | IE]></td></tr></table><![endif]-->";
287
  }
288
 
289
  /**
374
  $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . 'px; ';
375
  $style .= 'background-color: ' . $options['block_background'] . ';';
376
 
377
+ if (isset($options['block_background_gradient'])) {
378
+ $style .= 'background: linear-gradient(180deg, ' . $options['block_background'] . ' 0%, ' . $options['block_background_2'] . ' 100%);';
379
+ }
380
+
381
 
382
 
383
  $data = $this->options_encode($options);
384
  // First time block creation wrapper
385
  if ($wrapper) {
386
+ echo '<table 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";
387
  echo "<tr>";
388
  echo '<td align="center" style="padding: 0;" class="edit-block">', "\n";
389
  }
393
 
394
  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";
395
  echo "<tr>";
396
+ echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">';
397
 
398
  //echo "<!-- block generated content -->\n";
399
+ echo trim($content);
400
  //echo "\n<!-- /block generated content -->\n";
401
 
402
+ echo "</td></tr></table>";
403
  echo $this->get_outlook_wrapper_close();
404
 
405
  // First time block creation wrapper
406
  if ($wrapper) {
407
  echo "</td></tr></table>";
408
  }
 
409
 
410
  return $out;
411
  }
617
  break;
618
 
619
 
620
+
621
  case 'emails-create':
622
  // Newsletter from themes are created on frontend context because sometime WP themes change the way the content,
623
  // excerpt, thumbnail are extracted.
631
  if (!$controls->is_action('create')) {
632
  die('Wrong call');
633
  }
634
+
635
  $theme_id = $controls->data['id'];
636
  $theme = $this->themes->get_theme($theme_id);
637
 
638
  if (!$theme) {
639
  die('invalid theme');
640
  }
641
+
642
  $this->themes->save_options($theme_id, $controls->data);
643
 
644
  $email = array();
emails/tnp-composer/_scripts/newsletter-builder-v2.js CHANGED
@@ -259,20 +259,26 @@ function start_composer() {
259
  });
260
 
261
  // live preview from block options *** EXPERIMENTAL ***
262
- jQuery('#tnpc-block-options-form').change(function () {
263
  var data = jQuery("#tnpc-block-options-form").serialize();
264
  jQuery.post(ajaxurl, data, function (response) {
265
  target.html(response);
 
 
 
266
  }).fail(function () {
267
  alert("Block rendering failed");
268
  });
269
 
 
 
270
  });
271
 
272
  jQuery(".tnpc-row").add_delete();
273
  jQuery(".tnpc-row").add_block_edit();
274
  jQuery(".tnpc-row").add_block_clone();
275
 
 
276
  tnpc_mobile_preview();
277
 
278
  }
259
  });
260
 
261
  // live preview from block options *** EXPERIMENTAL ***
262
+ jQuery('#tnpc-block-options-form').change(function (event) {
263
  var data = jQuery("#tnpc-block-options-form").serialize();
264
  jQuery.post(ajaxurl, data, function (response) {
265
  target.html(response);
266
+ if (event.target.dataset.afterRendering === 'reload') {
267
+ container.find(".tnpc-row-edit-block").click();
268
+ }
269
  }).fail(function () {
270
  alert("Block rendering failed");
271
  });
272
 
273
+
274
+
275
  });
276
 
277
  jQuery(".tnpc-row").add_delete();
278
  jQuery(".tnpc-row").add_block_edit();
279
  jQuery(".tnpc-row").add_block_clone();
280
 
281
+
282
  tnpc_mobile_preview();
283
 
284
  }
emails/tnp-composer/_scripts/newsletter-builder.js CHANGED
@@ -247,13 +247,18 @@ function start_composer() {
247
  });
248
 
249
  // live preview from block options *** EXPERIMENTAL ***
250
- jQuery('#tnpc-block-options-form').change(function () {
251
  var data = jQuery("#tnpc-block-options-form").serialize();
252
  jQuery.post(ajaxurl, data, function (response) {
253
  target.html(response);
 
 
 
254
  }).fail(function () {
255
  alert("Block rendering failed");
256
  });
 
 
257
 
258
  });
259
 
@@ -261,6 +266,7 @@ function start_composer() {
261
  jQuery(".tnpc-row").add_block_edit();
262
  jQuery(".tnpc-row").add_block_clone();
263
 
 
264
  tnpc_mobile_preview();
265
 
266
  }
247
  });
248
 
249
  // live preview from block options *** EXPERIMENTAL ***
250
+ jQuery('#tnpc-block-options-form').change(function (event) {
251
  var data = jQuery("#tnpc-block-options-form").serialize();
252
  jQuery.post(ajaxurl, data, function (response) {
253
  target.html(response);
254
+ if (event.target.dataset.afterRendering === 'reload') {
255
+ container.find(".tnpc-row-edit-block").click();
256
+ }
257
  }).fail(function () {
258
  alert("Block rendering failed");
259
  });
260
+
261
+
262
 
263
  });
264
 
266
  jQuery(".tnpc-row").add_block_edit();
267
  jQuery(".tnpc-row").add_block_clone();
268
 
269
+
270
  tnpc_mobile_preview();
271
 
272
  }
includes/composer.php CHANGED
@@ -33,26 +33,6 @@ class TNP_Composer {
33
  return true;
34
  }
35
 
36
- /**
37
- * Return normalized array from json encoded global style options
38
- *
39
- * @param $raw
40
- *
41
- * @return array
42
- */
43
- static function normalize_global_style_options($raw) {
44
- $global_styles = json_decode($raw);
45
- $regex_rule = "/^options\[([\w-]*)\]$/";
46
- $global_styles_formatted = array();
47
- foreach ($global_styles as $input) {
48
- preg_match($regex_rule, $input->name, $match);
49
-
50
- $global_styles_formatted["$match[1]"] = $input->value;
51
- }
52
-
53
- return $global_styles_formatted;
54
- }
55
-
56
  /**
57
  * @param string $open
58
  * @param string $inner
@@ -123,18 +103,15 @@ class TNP_Composer {
123
  * @return string
124
  */
125
  static function get_main_wrapper_open($email) {
126
- if (!isset($email->options['composer_background']))
127
- return '';
 
 
 
128
 
129
- $bgcolor = $email->options['composer_background'];
130
- return "\n\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n" .
131
  "<tr>\n" .
132
- "<td bgcolor='$bgcolor' valign='top'>\n" .
133
- "<!--[if gte mso 9]>\n" .
134
- "<v:rect xmlns:v='urn:schemas-microsoft-com:vml' fill='true' stroke='false' style='mso-width-percent:1000;'>\n" .
135
- "<v:fill type='tile' color='$bgcolor' />\n" .
136
- "<v:textbox style='mso-fit-shape-to-text:true' inset='0,0,0,0'>\n" .
137
- "<![endif]-->\n\n<!-- tnp -->\n\n";
138
  }
139
 
140
  /**
@@ -143,59 +120,12 @@ class TNP_Composer {
143
  * @return string
144
  */
145
  static function get_main_wrapper_close($email) {
146
- if (!isset($email->options['composer_background']))
147
- return '';
148
-
149
- return "\n\n<!-- /tnp -->\n\n<!--[if gte mso 9]>\n" .
150
- "</v:textbox>\n" .
151
- "</v:rect>\n" .
152
- "<![endif]-->\n" .
153
  "</td>\n" .
154
  "</tr>\n" .
155
  "</table>\n\n";
156
  }
157
 
158
- /**
159
- * Wrap email coming from composer block with <doctype>, <body> and other stuff
160
- *
161
- * @param array $email
162
- * @param string $body
163
- *
164
- * @return string
165
- */
166
- static function wrap_email($email, $body) {
167
-
168
- $open = '<!DOCTYPE html><html><head><title>' . $email['subject'] . '</title><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta http-equiv="X-UA-Compatible" content="IE=edge">';
169
- $open .= '<style type="text/css">' . NewsletterEmails::instance()->get_composer_css() . '</style>';
170
- $open .= '</head><body style="margin: 0; padding: 0;">';
171
-
172
- $close = '';
173
-
174
- if (isset($email['options']['global-styles']['global-styles-bgcolor'])) {
175
- $bgcolor = $email['options']['global-styles']['global-styles-bgcolor'];
176
- $open .= "<table cellpadding='0' cellspacing='0' border='0' width='100%'>
177
- <tr>
178
- <td bgcolor='$bgcolor' valign='top'>
179
- <!--[if gte mso 9]>
180
- <v:rect xmlns:v='urn:schemas-microsoft-com:vml' fill='true' stroke='false' style='mso-width-percent:1000;'>
181
- <v:fill type='tile' color='$bgcolor' />
182
- <v:textbox style='mso-fit-shape-to-text:true' inset='0,0,0,0'>
183
- <![endif]-->";
184
-
185
- $close .= "<!--[if gte mso 9]>
186
- </v:textbox>
187
- </v:rect>
188
- <![endif]-->
189
- </td>
190
- </tr>
191
- </table>";
192
- }
193
-
194
- $close .= '</body></html>';
195
-
196
- return self::wrap_html_element($open, $body, $close);
197
- }
198
-
199
  /**
200
  * Remove <doctype>, <body> and unnecessary envelopes for editing with composer
201
  *
@@ -258,14 +188,8 @@ class TNP_Composer {
258
  }
259
  }
260
 
261
- //var_dump($email->options);
262
- //die();
263
-
264
  $email->editor = NewsletterEmails::EDITOR_COMPOSER;
265
 
266
- $email->options['global-styles'] = TNP_Composer::normalize_global_style_options($controls->data['global-styles']);
267
-
268
- // TODO: align the field name, please!
269
  $email->message = self::get_html_open($email) . self::get_main_wrapper_open($email) .
270
  $controls->data['message'] . self::get_main_wrapper_close($email) . self::get_html_close($email);
271
  }
33
  return true;
34
  }
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  /**
37
  * @param string $open
38
  * @param string $inner
103
  * @return string
104
  */
105
  static function get_main_wrapper_open($email) {
106
+ if (!isset($email->options['composer_background'])) {
107
+ $bgcolor = '#ffffff';
108
+ } else {
109
+ $bgcolor = $email->options['composer_background'];
110
+ }
111
 
112
+ return "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>\n" .
 
113
  "<tr>\n" .
114
+ "<td bgcolor='$bgcolor' valign='top'><!-- tnp -->";
 
 
 
 
 
115
  }
116
 
117
  /**
120
  * @return string
121
  */
122
  static function get_main_wrapper_close($email) {
123
+ return "\n<!-- /tnp -->\n" .
 
 
 
 
 
 
124
  "</td>\n" .
125
  "</tr>\n" .
126
  "</table>\n\n";
127
  }
128
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  /**
130
  * Remove <doctype>, <body> and unnecessary envelopes for editing with composer
131
  *
188
  }
189
  }
190
 
 
 
 
191
  $email->editor = NewsletterEmails::EDITOR_COMPOSER;
192
 
 
 
 
193
  $email->message = self::get_html_open($email) . self::get_main_wrapper_open($email) .
194
  $controls->data['message'] . self::get_main_wrapper_close($email) . self::get_html_close($email);
195
  }
includes/controls.php CHANGED
@@ -1493,9 +1493,9 @@ class NewsletterControls {
1493
  $media = array('', '', '');
1494
  $media_full = array('', '', '');
1495
  $media_id = 0;
1496
- echo '<img style="max-width: 200px; max-height: 200px; width: 100px;" id="' . esc_attr($name) . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1497
  } else {
1498
- echo '<img style="max-width: 200px; max-height: 200px;" id="' . esc_attr($name) . '_img" src="' . esc_attr($media[0]) . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1499
  }
1500
 
1501
  echo '</div>';
1493
  $media = array('', '', '');
1494
  $media_full = array('', '', '');
1495
  $media_id = 0;
1496
+ echo '<img style="max-width: 200px; max-height: 150px; width: 100px;" id="' . esc_attr($name) . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1497
  } else {
1498
+ echo '<img style="max-width: 200px; max-height: 150px;" id="' . esc_attr($name) . '_img" src="' . esc_attr($media[0]) . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1499
  }
1500
 
1501
  echo '</div>';
includes/fields.php CHANGED
@@ -19,7 +19,8 @@ class NewsletterFields {
19
  }
20
 
21
  public function _label($text, $for = '') {
22
- if (empty($text)) return;
 
23
  echo '<label class="tnp-label">', $text, '</label>';
24
  }
25
 
@@ -124,7 +125,7 @@ class NewsletterFields {
124
  $attrs = $this->_merge_attrs($attrs);
125
  $this->_open();
126
  $this->_label($label);
127
- $this->controls->textarea_fixed($name);
128
  $this->_description($attrs);
129
  $this->_close();
130
  }
@@ -148,17 +149,38 @@ class NewsletterFields {
148
 
149
  if (version_compare($wp_version, '4.8', '>=')) {
150
  echo '<script>wp.editor.remove("options-', $name, '");';
151
- echo 'wp.editor.initialize("options-', $name, '", { tinymce: {toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker", default_link_target: "_blank", relative_urls : false, convert_urls: false}});</script>';
152
  }
153
  $this->_description($attrs);
154
  $this->_close();
155
  }
156
 
157
  public function select($name, $label = '', $options = array(), $attrs = array()) {
158
- $attrs = $this->_merge_attrs($attrs);
159
  $this->_open();
160
  $this->_label($label);
161
- $this->controls->select($name, $options);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  $this->_description($attrs);
163
  $this->_close();
164
  }
@@ -210,7 +232,7 @@ class NewsletterFields {
210
 
211
  /** Configuration for a simple button with label and color */
212
  public function button($name, $label = '', $attrs = array()) {
213
- $attrs = $this->_merge_attrs($attrs, array('placeholder' => 'Label...', 'url_placeholder' => 'https://...', 'url' => true));
214
  $this->_open('tnp-cta');
215
  $this->_label($label);
216
  $value = $this->controls->get_value($name . '_label');
@@ -229,8 +251,9 @@ class NewsletterFields {
229
  echo ' value="', esc_attr($value), '">';
230
  echo '</div>';
231
  }
 
232
  echo '</div>';
233
- $this->controls->css_font($name . '_font', array('weight' => false));
234
  $this->controls->color($name . '_background');
235
  $this->_close();
236
  }
@@ -469,8 +492,14 @@ class NewsletterFields {
469
  $this->_open('tnp-block-commons');
470
  $this->_label('Padding and background');
471
  $this->controls->color('block_background');
 
 
 
 
 
472
  echo '&nbsp;&nbsp;&nbsp;';
473
  $this->padding('block_padding', '', $attrs = array('field_only' => true));
 
474
  $this->_close();
475
  }
476
 
19
  }
20
 
21
  public function _label($text, $for = '') {
22
+ if (empty($text))
23
+ return;
24
  echo '<label class="tnp-label">', $text, '</label>';
25
  }
26
 
125
  $attrs = $this->_merge_attrs($attrs);
126
  $this->_open();
127
  $this->_label($label);
128
+ $this->controls->textarea_fixed($name, '100%', '150');
129
  $this->_description($attrs);
130
  $this->_close();
131
  }
149
 
150
  if (version_compare($wp_version, '4.8', '>=')) {
151
  echo '<script>wp.editor.remove("options-', $name, '");';
152
+ echo 'wp.editor.initialize("options-', $name, '", { tinymce: {content_style: "body {background-color: #f4f4f4;}", toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | help", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker", default_link_target: "_blank", relative_urls : false, convert_urls: false}});</script>';
153
  }
154
  $this->_description($attrs);
155
  $this->_close();
156
  }
157
 
158
  public function select($name, $label = '', $options = array(), $attrs = array()) {
159
+ $attrs = $this->_merge_attrs($attrs, ['reload' => false, 'after-rendering' => '']);
160
  $this->_open();
161
  $this->_label($label);
162
+ $value = $this->controls->get_value($name);
163
+
164
+ echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']"';
165
+ if ($attrs['reload']) {
166
+ echo ' onchange="tnpc_reload_options(event)"';
167
+ }
168
+ if (!empty($attrs['after-rendering'])) {
169
+ echo ' data-after-rendering="' . $attrs['after-rendering'] . '"';
170
+ }
171
+ echo '>';
172
+ if (!empty($first)) {
173
+ echo '<option value="">' . esc_html($first) . '</option>';
174
+ }
175
+ foreach ($options as $key => $label) {
176
+ echo '<option value="' . esc_attr($key) . '"';
177
+ if ($value == $key)
178
+ echo ' selected';
179
+ echo '>' . esc_html($label) . '</option>';
180
+ }
181
+ echo '</select>';
182
+
183
+ //$this->controls->select($name, $options);
184
  $this->_description($attrs);
185
  $this->_close();
186
  }
232
 
233
  /** Configuration for a simple button with label and color */
234
  public function button($name, $label = '', $attrs = array()) {
235
+ $attrs = $this->_merge_attrs($attrs, array('placeholder' => 'Label...', 'url_placeholder' => 'https://...', 'url' => true, 'weight' => true));
236
  $this->_open('tnp-cta');
237
  $this->_label($label);
238
  $value = $this->controls->get_value($name . '_label');
251
  echo ' value="', esc_attr($value), '">';
252
  echo '</div>';
253
  }
254
+ echo '<div style="clear: both"></div>';
255
  echo '</div>';
256
+ $this->controls->css_font($name . '_font', array('weight' => $attrs['weight']));
257
  $this->controls->color($name . '_background');
258
  $this->_close();
259
  }
492
  $this->_open('tnp-block-commons');
493
  $this->_label('Padding and background');
494
  $this->controls->color('block_background');
495
+
496
+ echo '&nbsp;&rarr;&nbsp;';
497
+ $this->controls->checkbox('block_background_gradient');
498
+ $this->controls->color('block_background_2');
499
+
500
  echo '&nbsp;&nbsp;&nbsp;';
501
  $this->padding('block_padding', '', $attrs = array('field_only' => true));
502
+ echo '<div class="tnp-description">Gradients are displayed only by few clients</div>';
503
  $this->_close();
504
  }
505
 
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.2
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.
@@ -28,10 +28,13 @@
28
 
29
  */
30
 
31
- define('NEWSLETTER_VERSION', '6.5.2');
32
 
33
  global $newsletter, $wpdb;
34
 
 
 
 
35
  if (!defined('NEWSLETTER_EXTENSION_UPDATE'))
36
  define('NEWSLETTER_EXTENSION_UPDATE', true);
37
 
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.3
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.
28
 
29
  */
30
 
31
+ define('NEWSLETTER_VERSION', '6.5.3');
32
 
33
  global $newsletter, $wpdb;
34
 
35
+ if (!defined('NEWSLETTER_BETA'))
36
+ define('NEWSLETTER_BETA', false);
37
+
38
  if (!defined('NEWSLETTER_EXTENSION_UPDATE'))
39
  define('NEWSLETTER_EXTENSION_UPDATE', true);
40
 
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.2
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
@@ -109,6 +109,13 @@ Thank you, The Newsletter Team
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
 
 
112
  = 6.5.2 =
113
 
114
  * Fixed image block
@@ -139,6 +146,10 @@ Thank you, The Newsletter Team
139
  = 6.4.8 =
140
 
141
  * Antispam on PHP API
 
 
 
 
142
 
143
  = 6.4.7 =
144
 
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.3
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
109
 
110
  == Changelog ==
111
 
112
+ = 6.5.3 =
113
+
114
+ * Removed a background wrapper for outlook otherwise outlook cut down long emails
115
+ * Added background gradient (experimental, no supported by all mail clients)
116
+ * Added dark color schema to cta and hero blocks
117
+ * Fixed a debug notice
118
+
119
  = 6.5.2 =
120
 
121
  * Fixed image block
146
  = 6.4.8 =
147
 
148
  * Antispam on PHP API
149
+ * Improved hero block layout
150
+ * Added color schema to some blocks
151
+ * Added background gradient (experimental)
152
+ * Added image width control on image block
153
 
154
  = 6.4.7 =
155