Newsletter - Version 5.7.3

Version Description

  • Fixed block padding warning
  • Fixed lists display on import panel
  • Fixed lists display on targeting panel when in multilanguage mode
Download this release

Release Info

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

Code changes from version 5.7.1 to 5.7.3

emails/blocks/cta/block.php CHANGED
@@ -15,16 +15,21 @@ $default_options = array(
15
  'url' => home_url(),
16
  'font_family' => $font_family,
17
  'font_size' => 16,
 
18
  'block_background'=>'#ffffff',
19
- 'width'=>'200'
 
 
20
  );
21
 
22
  $options = array_merge($default_options, $options);
23
- $options['block_padding_top'] = '15px';
24
- $options['block_padding_bottom'] = '15px';
 
 
25
  ?>
26
 
27
- <a href="<?php echo $options['url'] ?>" target="_blank" rel="noopener" style="line-height: normal; font-size: <?php echo $options['font_size'] ?>px; font-family: <?php echo $options['font_family'] ?>; font-weight: normal; color: <?php echo $options['color'] ?>; text-decoration: none; background-color: <?php echo $options['background'] ?>; border-top: 15px solid <?php echo $options['background'] ?>; border-bottom: 15px solid <?php echo $options['background'] ?>; border-left: 25px solid <?php echo $options['background'] ?>; border-right: 25px solid <?php echo $options['background'] ?>; width: <?php echo $options['width'] ?>px; max-width: 100%; box-sizing: border-box; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; display: inline-block;"><?php echo $options['text'] ?></a>
28
 
29
  <div itemscope="" itemtype="http://schema.org/EmailMessage">
30
  <div itemprop="potentialAction" itemscope="" itemtype="http://schema.org/ViewAction">
15
  'url' => home_url(),
16
  'font_family' => $font_family,
17
  'font_size' => 16,
18
+ 'font_weight' => 'normal',
19
  'block_background'=>'#ffffff',
20
+ 'width'=>'200',
21
+ 'block_padding_top' => 20,
22
+ 'block_padding_bottom' => 20,
23
  );
24
 
25
  $options = array_merge($default_options, $options);
26
+ //$options['block_padding_top'] = '15px';
27
+ //$options['block_padding_bottom'] = '15px';
28
+ $options['block_padding_left'] = '0px';
29
+ $options['block_padding_right'] = '0px';
30
  ?>
31
 
32
+ <a href="<?php echo $options['url'] ?>" target="_blank" rel="noopener" style="line-height: normal; font-size: <?php echo $options['font_size'] ?>px; font-family: <?php echo $options['font_family'] ?>; font-weight: <?php echo $options['font_weight'] ?>; color: <?php echo $options['color'] ?>; text-decoration: none; background-color: <?php echo $options['background'] ?>; border-top: 15px solid <?php echo $options['background'] ?>; border-bottom: 15px solid <?php echo $options['background'] ?>; border-left: 25px solid <?php echo $options['background'] ?>; border-right: 25px solid <?php echo $options['background'] ?>; width: <?php echo $options['width'] ?>px; max-width: 100%; box-sizing: border-box; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; display: inline-block;"><?php echo $options['text'] ?></a>
33
 
34
  <div itemscope="" itemtype="http://schema.org/EmailMessage">
35
  <div itemprop="potentialAction" itemscope="" itemtype="http://schema.org/ViewAction">
emails/blocks/cta/options.php CHANGED
@@ -7,53 +7,60 @@
7
 
8
  <table class="form-table">
9
  <tr>
10
- <th>Text</th>
11
  <td>
12
- <?php $controls->text('text') ?>
 
 
13
  </td>
14
  </tr>
15
  <tr>
16
- <th>Button color</th>
17
  <td>
18
- <?php $controls->color('background') ?>
19
- </td>
20
- </tr>
21
- <tr>
22
- <th><?php _e('Color', 'newsletter') ?></th>
23
- <td>
24
- <?php $controls->color('color') ?>
25
- </td>
26
- </tr>
27
- <tr>
28
- <th>Link to</th>
29
- <td>
30
- <?php $controls->text('url', 50, 'https://...') ?>
31
- </td>
32
- </tr>
33
- <tr>
34
- <th>Font size</th>
35
- <td>
36
- <?php $controls->css_font_size('font_size') ?>
37
  </td>
38
  </tr>
 
39
  <tr>
40
- <th>Font family</th>
41
  <td>
42
- <?php $controls->css_font_family('font_family') ?>
43
  </td>
44
  </tr>
45
-
46
  <tr>
47
- <th>Width</th>
48
  <td>
49
- <?php $controls->text('width') ?>px
50
  </td>
51
  </tr>
52
-
53
  <tr>
54
- <th><?php _e('Background', 'newsletter') ?></th>
55
  <td>
56
- <?php $controls->color('block_background') ?>
 
 
 
 
 
 
 
 
 
 
 
57
  </td>
58
  </tr>
59
  </table>
7
 
8
  <table class="form-table">
9
  <tr>
10
+ <th><?php _e('Label and link', 'newsletter') ?></th>
11
  <td>
12
+ <?php $controls->text('text', 70) ?>
13
+ <br>
14
+ <?php $controls->text('url', 70, 'https://...') ?>
15
  </td>
16
  </tr>
17
  <tr>
18
+ <th></th>
19
  <td>
20
+ <table class="tnp-button-colors">
21
+ <tr>
22
+ <td>
23
+ <?php _e('Background', 'newsletter') ?><br>
24
+ <?php $controls->color('background') ?>
25
+ </td>
26
+ <td>
27
+ <?php _e('Label', 'newsletter') ?><br>
28
+ <?php $controls->color('color') ?>
29
+ </td>
30
+ </tr>
31
+ </table>
32
+ <?php $controls->css_font('font') ?>
 
 
 
 
 
 
33
  </td>
34
  </tr>
35
+
36
  <tr>
37
+ <th><?php _e('Width', 'newsletter') ?></th>
38
  <td>
39
+ <?php $controls->text('width') ?>px
40
  </td>
41
  </tr>
42
+
43
  <tr>
44
+ <th><?php _e('Block background', 'newsletter') ?></th>
45
  <td>
46
+ <?php $controls->color('block_background') ?>
47
  </td>
48
  </tr>
 
49
  <tr>
50
+ <th><?php _e('Block padding', 'newsletter') ?></th>
51
  <td>
52
+ <table class="tnp-button-colors">
53
+ <tr>
54
+ <td>
55
+ Top<br>
56
+ <?php $controls->text('block_padding_top', 4) ?>
57
+ </td>
58
+ <td>
59
+ Bottom<br>
60
+ <?php $controls->text('block_padding_bottom', 4) ?>
61
+ </td>
62
+ </tr>
63
+ </table>
64
  </td>
65
  </tr>
66
  </table>
emails/blocks/giphy/block.php CHANGED
@@ -16,8 +16,8 @@ $default_options = array(
16
  'font_family'=>$font_family,
17
  'font_size'=>13,
18
  'color'=>'#999999',
19
- 'block_padding_top'=>'15px',
20
- 'block_padding_bottom'=>'15px',
21
  'block_padding_left'=>0,
22
  'block_padding_right'=>0
23
  );
16
  'font_family'=>$font_family,
17
  'font_size'=>13,
18
  'color'=>'#999999',
19
+ 'block_padding_top'=>15,
20
+ 'block_padding_bottom'=>15,
21
  'block_padding_left'=>0,
22
  'block_padding_right'=>0
23
  );
emails/blocks/hero/block.php ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Last posts
4
+ * Section: content
5
+ * Description: Last opsts list with different layouts
6
+ */
7
+
8
+ /* @var $options array */
9
+ /* @var $wpdb wpdb */
10
+ include NEWSLETTER_INCLUDES_DIR . '/helper.php';
11
+
12
+ $defaults = array(
13
+ 'url' => '',
14
+ 'title' => 'An Awesome Title',
15
+ 'text' => 'This is just a simple text you should change',
16
+ 'font_family' => 'Helvetica, Arial, sans-serif',
17
+ 'font_size' => '14',
18
+ 'font_weight' => 'normal',
19
+ 'title_font_family' => 'Helvetica, Arial, sans-serif',
20
+ 'title_font_size' => '20',
21
+ 'title_font_weight' => 'normal',
22
+ 'block_background' => '#ffffff',
23
+ 'layout' => 'full',
24
+ 'button_label' => 'Click Here',
25
+ 'button_color' => '#ffffff',
26
+ 'button_background' => '#256F9C',
27
+ 'layout' => 'full'
28
+ );
29
+
30
+ $options = array_merge($defaults, $options);
31
+
32
+ $url = $options['url'];
33
+
34
+ $font_family = $options['font_family'];
35
+ $font_size = $options['font_size'];
36
+ $font_weight = $options['font_weight'];
37
+
38
+ $title_font_family = $options['title_font_family'];
39
+ $title_font_size = $options['title_font_size'];
40
+ $title_font_weight = $options['title_font_weight'];
41
+
42
+ $button_color = $options['button_color'];
43
+ $button_background = $options['button_background'];
44
+ $button_label = $options['button_label'];
45
+ $layout = $options['layout'];
46
+
47
+ $options['block_padding_top'] = 20;
48
+ $options['block_padding_bottom'] = 20;
49
+ $options['block_padding_left'] = 0;
50
+ $options['block_padding_right'] = 0;
51
+
52
+ if (!empty($options['image'])) {
53
+ if ($layout == 'full') {
54
+ $image = tnp_media_resize($options['image']['id'], array(600, 0));
55
+ } else {
56
+ $image = tnp_media_resize($options['image']['id'], array(300, 200, true));
57
+ }
58
+ } else {
59
+ $image = false;
60
+ }
61
+ ?>
62
+
63
+ <?php if ($layout == 'full') { ?>
64
+
65
+ <style>
66
+ .hero-title {
67
+ font-size: <?php echo $title_font_size ?>px;
68
+ color: #333333;
69
+ padding-top: 30px;
70
+ font-family: <?php echo $title_font_family ?>;
71
+ font-weight: <?php echo $title_font_weight ?>;
72
+ }
73
+ .hero-text {
74
+ padding: 20px 0 0 0;
75
+ font-size: <?php echo $font_size ?>px;
76
+ line-height: 150%;
77
+ color: #666666;
78
+ font-family: <?php echo $font_family ?>;
79
+ }
80
+ .hero-button-table {
81
+ background-color: <?php echo $button_background ?>;
82
+ /*border:1px solid #353535;*/
83
+ border-radius:5px;
84
+ }
85
+ .hero-button-td {
86
+ color: <?php echo $button_color ?>;
87
+ font-family:<?php echo $font_family ?>;
88
+ font-size:16px;
89
+ font-weight:bold;
90
+ letter-spacing:-.5px;
91
+ line-height:150%;
92
+ padding-top:15px;
93
+ padding-right:30px;
94
+ padding-bottom:15px;
95
+ padding-left:30px;
96
+ }
97
+ .hero-button-a {
98
+ color:<?php echo $button_color ?>;
99
+ text-decoration:none;
100
+ }
101
+ .hero-image {
102
+ max-width: 100%!important;
103
+ display: block;
104
+ }
105
+ </style>
106
+
107
+
108
+ <!-- HERO IMAGE -->
109
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
110
+ <tr>
111
+ <td class="padding-copy tnpc-row-edit">
112
+ <a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
113
+ <img src="<?php echo $image ?>" border="0" alt="" inline-class="hero-image">
114
+ </a>
115
+ </td>
116
+ </tr>
117
+ <tr>
118
+ <td>
119
+ <!-- COPY -->
120
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
121
+ <tr>
122
+ <td align="center" inline-class="hero-title">
123
+ <span><?php echo $options['title'] ?></span>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td align="center" inline-class="hero-text">
128
+ <span><?php echo $options['text'] ?></span>
129
+ </td>
130
+ </tr>
131
+
132
+ <tr>
133
+ <td align="center">
134
+ <br>
135
+ <table border="0" cellpadding="0" cellspacing="0" inline-class="hero-button-table" align="center">
136
+ <tr>
137
+ <td align="center" valign="middle" inline-class="hero-button-td">
138
+ <a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="hero-button-a"><?php echo $button_label ?></a>
139
+ </td>
140
+ </tr>
141
+ </table>
142
+
143
+ </td>
144
+ </tr>
145
+ </table>
146
+ </td>
147
+ </tr>
148
+ </table>
149
+
150
+ <?php } ?>
151
+
152
+ <?php if ($layout == 'left') { ?>
153
+
154
+ <style>
155
+ .hero-title {
156
+ font-size: <?php echo $title_font_size ?>px;
157
+ color: #333333;
158
+ padding-top: 0;
159
+ font-family: <?php echo $title_font_family ?>;
160
+ font-weight: <?php echo $title_font_weight ?>;
161
+ }
162
+ .hero-text {
163
+ padding: 20px 0 0 0;
164
+ font-size: <?php echo $font_size ?>px;
165
+ line-height: 150%;
166
+ color: #666666;
167
+ font-family: <?php echo $font_family ?>;
168
+ font-weight: <?php echo $font_weight ?>;
169
+ }
170
+ .hero-button-table {
171
+ background-color: <?php echo $button_background ?>;
172
+ /*border:1px solid #353535;*/
173
+ border-radius:5px;
174
+ }
175
+ .hero-button-td {
176
+ color: <?php echo $button_color ?>;
177
+ font-family:<?php echo $font_family ?>;
178
+ font-size:<?php echo $font_size ?>px;
179
+ font-weight:bold;
180
+ letter-spacing:-.5px;
181
+ line-height:150%;
182
+ padding-top:10px;
183
+ padding-right:30px;
184
+ padding-bottom:10px;
185
+ padding-left:30px;
186
+ }
187
+ .hero-button-a {
188
+ color:<?php echo $button_color ?>;
189
+ text-decoration:none;
190
+ }
191
+ </style>
192
+
193
+ <table width="290" align="left" class="hero-table">
194
+ <tr>
195
+ <td align="center" valign="top">
196
+ <img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: block;" class="img-max">
197
+ </td>
198
+ </tr>
199
+ </table>
200
+
201
+ <table width="290" align="right" class="hero-table hero-table-right">
202
+ <tr>
203
+ <td>
204
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
205
+ <tr>
206
+ <td align="center" inline-class="hero-title">
207
+ <span><?php echo $options['title'] ?></span>
208
+ </td>
209
+ </tr>
210
+ <tr>
211
+ <td align="center" inline-class="hero-text">
212
+ <span><?php echo $options['text'] ?></span>
213
+ </td>
214
+ </tr>
215
+ </table>
216
+ <br>
217
+ <table border="0" cellpadding="0" cellspacing="0" align="center" inline-class="hero-button-table">
218
+ <tr>
219
+ <td align="center" valign="middle" inline-class="hero-button-td">
220
+ <a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="hero-button-a"><?php echo $button_label ?></a>
221
+ </td>
222
+ </tr>
223
+ </table>
224
+
225
+ </td>
226
+ </tr>
227
+ </table>
228
+
229
+
230
+ <?php } ?>
231
+
emails/{tnp-composer/blocks/content-01-hero.block.png → blocks/hero/icon.png} RENAMED
File without changes
emails/blocks/hero/options.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * @var $options array contains all the options the current block we're ediging contains
4
+ * @var $controls NewsletterControls
5
+ */
6
+ ?>
7
+
8
+ <table class="form-table">
9
+ <tr>
10
+ <th><?php _e('Layout', 'newsletter') ?></th>
11
+ <td>
12
+ <?php $controls->select('layout', array('full' => 'Full', 'left' => 'Left')) ?>
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <th><?php _e('Image', 'newsletter') ?></th>
17
+ <td>
18
+ <?php $controls->media('image') ?>
19
+ </td>
20
+ </tr>
21
+
22
+ <tr>
23
+ <th>Title and Text</th>
24
+ <td>
25
+ <?php $controls->text('title', 70) ?>
26
+ <?php $controls->css_font('title_font') ?>
27
+ <br><br>
28
+ <?php $controls->textarea('text') ?>
29
+ <?php $controls->css_font('font') ?>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <th><?php _e('Button', 'newsletter') ?></th>
34
+ <td>
35
+
36
+
37
+ <?php $controls->text('button_label', 70) ?>
38
+ <br>
39
+ <?php $controls->text('url', 70, 'https://...') ?>
40
+
41
+ <table class="tnp-button-colors">
42
+ <tr>
43
+ <td>
44
+ <?php _e('Background', 'newsletter') ?><br>
45
+ <?php $controls->color('button_background') ?>
46
+ </td>
47
+ <td>
48
+ <?php _e('Label', 'newsletter')?><br>
49
+ <?php $controls->color('button_color') ?>
50
+ </td>
51
+ </tr>
52
+ </table>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <th><?php _e('Block background', 'newsletter') ?></th>
57
+ <td>
58
+ <?php $controls->color('block_background') ?>
59
+ </td>
60
+ </tr>
61
+ </table>
62
+
emails/blocks/hero/style.css ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ @media all and (max-width: 525px) {
2
+ .hero-table {
3
+ width: 100%!important;
4
+ max-width: 100%!important;
5
+ }
6
+
7
+ .hero-table-right {
8
+ margin-top: 20px;
9
+ }
10
+ }
emails/blocks/preheader/block.php CHANGED
@@ -10,20 +10,24 @@
10
  /* @var $wpdb wpdb */
11
 
12
  $default_options = array(
13
- 'view'=>'View online',
14
- 'text'=>'Few words summary',
15
- 'block_background'=>'#ffffff',
16
- 'font_family'=>$font_family,
17
- 'font_size'=>13,
18
- 'color'=>'#999999'
19
  );
20
 
21
  $options = array_merge($default_options, $options);
22
-
23
  ?>
24
  <style>
 
 
 
 
 
25
  .preheader-link {
26
- padding: 20px;
27
  text-align: center;
28
  font-size: <?php echo $options['font_size'] ?>px;
29
  font-family: <?php echo $options['font_family'] ?>;
@@ -31,7 +35,7 @@ $options = array_merge($default_options, $options);
31
  }
32
  </style>
33
 
34
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
35
  <tr>
36
  <td class="preheader-link" width="50%" valign="top" align="center">
37
  <?php echo $options['text'] ?>
10
  /* @var $wpdb wpdb */
11
 
12
  $default_options = array(
13
+ 'view' => 'View online',
14
+ 'text' => 'Few words summary',
15
+ 'block_background' => '#ffffff',
16
+ 'font_family' => $font_family,
17
+ 'font_size' => 13,
18
+ 'color' => '#999999'
19
  );
20
 
21
  $options = array_merge($default_options, $options);
 
22
  ?>
23
  <style>
24
+ .preheader-table {
25
+ width: 100%!important
26
+ border: 0;
27
+ border-collapse: collapse;
28
+ }
29
  .preheader-link {
30
+ padding: 10px;
31
  text-align: center;
32
  font-size: <?php echo $options['font_size'] ?>px;
33
  font-family: <?php echo $options['font_family'] ?>;
35
  }
36
  </style>
37
 
38
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" inline-class="preheader-table">
39
  <tr>
40
  <td class="preheader-link" width="50%" valign="top" align="center">
41
  <?php echo $options['text'] ?>
emails/blocks/separator/block.php CHANGED
@@ -12,8 +12,8 @@
12
  $default_options = array(
13
  'color'=>'#dddddd',
14
  'height'=>1,
15
- 'block_padding_top'=>'20px',
16
- 'block_padding_bottom'=>'20px'
17
 
18
  );
19
 
12
  $default_options = array(
13
  'color'=>'#dddddd',
14
  'height'=>1,
15
+ 'block_padding_top'=>20,
16
+ 'block_padding_bottom'=>20
17
 
18
  );
19
 
emails/emails.php CHANGED
@@ -66,7 +66,22 @@ class NewsletterEmails extends NewsletterModule {
66
  */
67
  function render_block($block_id = null, $wrapper = false, $options = array()) {
68
  $width = 600;
69
- $font_family = 'Helvetica, Arial, sans-serif';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  $block_options = get_option('newsletter_main');
72
 
@@ -91,7 +106,7 @@ class NewsletterEmails extends NewsletterModule {
91
  return;
92
  }
93
  $is_old_block = isset($block['filename']) && strpos($block['filename'], '.block');
94
-
95
  if ($is_old_block) {
96
  ob_start();
97
  include NEWSLETTER_DIR . '/emails/tnp-composer/blocks/' . $block['filename'] . '.php';
@@ -101,24 +116,30 @@ class NewsletterEmails extends NewsletterModule {
101
  include $block['dir'] . '/block.php';
102
  $content = ob_get_clean();
103
  }
104
-
105
  // Obsolete
106
  $content = str_replace('{width}', $width, $content);
 
107
  $content = $this->inline_css($content, true);
108
 
109
  // CSS driven by the block
110
- if (!isset($options['block_background'])) {
111
- $options['block_background'] = '';
112
- }
113
- $style = '';
114
- if (isset($options['block_padding_top'])) $style .= 'padding-top: ' . $options['block_padding_top'] . '; ';
115
- if (isset($options['block_padding_left'])) $style .= 'padding-left: ' . $options['block_padding_left'] . '; ';
116
- if (isset($options['block_padding_right'])) $style .= 'padding-right: ' . $options['block_padding_right'] . '; ';
117
- if (isset($options['block_padding_bottom'])) $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . '; ';
118
-
 
 
 
 
 
119
  // Old block type
120
  if ($is_old_block) {
121
-
122
  echo '<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="border-collapse: collapse; width: 100%;" class="tnpc-row" data-id="', esc_attr($block_id), "\">\n";
123
  echo "<tr>\n";
124
  echo '<td align="center" style="padding: 0;">', "\n";
@@ -126,14 +147,13 @@ class NewsletterEmails extends NewsletterModule {
126
 
127
  echo '<table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
128
  echo "<tr>\n";
129
- echo '<td class="edit-block" align="center" style="', $style, 'text-align: center;" bgcolor="', $options['block_background'], '" width="100%">', "\n";
130
 
131
  echo $content;
132
-
133
  echo "</td>\n</tr>\n</table>";
134
  echo '<!--[if mso]></td></tr></table><![endif]-->';
135
  echo "\n</td>\n</tr></table>\n\n";
136
-
137
  } else {
138
 
139
  $data = '';
@@ -146,22 +166,22 @@ class NewsletterEmails extends NewsletterModule {
146
  }
147
  }
148
  }
149
-
150
  if ($wrapper) {
151
  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), '">';
152
  echo '<tr>';
153
  echo '<td data-options="', esc_attr($data), '" align="center" style="padding: 0; font-family: Helvetica, Arial, sans-serif;" class="edit-block">';
154
  }
155
-
156
  // Container that fixes the width and makes the block responsive
157
  echo '<!--[if mso]><table border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '"><![endif]-->';
158
  echo "\n";
159
  echo '<table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
160
  echo "<tr>\n";
161
- echo '<td align="center" style="', $style, 'text-align: center;" bgcolor="', $options['block_background'], '" width="100%">', "\n";
162
 
163
  echo $content;
164
-
165
  echo "</td>\n</tr>\n</table>";
166
  echo '<!--[if mso]></td></tr></table><![endif]-->';
167
  if ($wrapper) {
@@ -277,6 +297,7 @@ class NewsletterEmails extends NewsletterModule {
277
  header('Content-Type: text/css');
278
  echo file_get_contents(__DIR__ . '/tnp-composer/css/newsletter.css');
279
  $dirs = apply_filters('newsletter_blocks_dir', array());
 
280
  foreach ($dirs as $dir) {
281
  $dir = str_replace('\\', '/', $dir);
282
  $list = NewsletterEmails::instance()->scan_blocks_dir($dir);
@@ -504,8 +525,9 @@ class NewsletterEmails extends NewsletterModule {
504
  $relative_dir = substr($dir, strlen(WP_CONTENT_DIR));
505
  while ($file = readdir($handle)) {
506
 
507
- if ($file == '.' || $file == '..') continue;
508
-
 
509
  // The block unique key, we should find out how to biuld it, maybe an hash of the (relative) dir?
510
  $block_id = sanitize_key($file);
511
 
@@ -544,9 +566,10 @@ class NewsletterEmails extends NewsletterModule {
544
  function get_blocks() {
545
 
546
  static $blocks = null;
547
-
548
- if (!is_null($blocks)) return $blocks;
549
-
 
550
  $blocks = array();
551
 
552
  // Legacy blocks
@@ -595,16 +618,18 @@ class NewsletterEmails extends NewsletterModule {
595
  */
596
  function get_block($id) {
597
  switch ($id) {
598
- case 'content-07-twocols.block':
599
- case 'content-06-posts.block':
600
  $id = 'posts';
601
  break;
602
  case 'content-04-cta.block': $id = 'cta';
603
  break;
 
 
604
  // case 'content-02-heading.block': $id = '/plugins/newsletter/emails/blocks/heading';
605
  // break;
606
  }
607
-
608
  // Conversion for old full path ID
609
  $id = sanitize_key(basename($id));
610
 
66
  */
67
  function render_block($block_id = null, $wrapper = false, $options = array()) {
68
  $width = 600;
69
+ $font_family = 'Helvetica, Arial, sans-serif';
70
+
71
+ $defaults = array(
72
+ 'block_padding_top' => 15,
73
+ 'block_padding_bottom' => 15,
74
+ 'block_padding_right' => 0,
75
+ 'block_padding_left' => 0,
76
+ 'block_background' => '#ffffff'
77
+ );
78
+
79
+ // Just in case...
80
+ if (!is_array($options)) {
81
+ $options = array();
82
+ }
83
+
84
+ $options = array_merge($defaults, $options);
85
 
86
  $block_options = get_option('newsletter_main');
87
 
106
  return;
107
  }
108
  $is_old_block = isset($block['filename']) && strpos($block['filename'], '.block');
109
+
110
  if ($is_old_block) {
111
  ob_start();
112
  include NEWSLETTER_DIR . '/emails/tnp-composer/blocks/' . $block['filename'] . '.php';
116
  include $block['dir'] . '/block.php';
117
  $content = ob_get_clean();
118
  }
119
+
120
  // Obsolete
121
  $content = str_replace('{width}', $width, $content);
122
+
123
  $content = $this->inline_css($content, true);
124
 
125
  // CSS driven by the block
126
+
127
+ $style = 'text-align: center; ';
128
+
129
+ $options['block_padding_top'] = (int) str_replace('px', '', $options['block_padding_top']);
130
+ $options['block_padding_bottom'] = (int) str_replace('px', '', $options['block_padding_bottom']);
131
+ $options['block_padding_right'] = (int) str_replace('px', '', $options['block_padding_right']);
132
+ $options['block_padding_left'] = (int) str_replace('px', '', $options['block_padding_left']);
133
+
134
+ $style .= 'padding-top: ' . $options['block_padding_top'] . 'px; ';
135
+ $style .= 'padding-left: ' . $options['block_padding_left'] . 'px; ';
136
+ $style .= 'padding-right: ' . $options['block_padding_right'] . 'px; ';
137
+ $style .= 'padding-bottom: ' . $options['block_padding_bottom'] . 'px; ';
138
+ $style .= 'background-color: ' . $options['block_background'] . ';';
139
+
140
  // Old block type
141
  if ($is_old_block) {
142
+
143
  echo '<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="border-collapse: collapse; width: 100%;" class="tnpc-row" data-id="', esc_attr($block_id), "\">\n";
144
  echo "<tr>\n";
145
  echo '<td align="center" style="padding: 0;">', "\n";
147
 
148
  echo '<table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
149
  echo "<tr>\n";
150
+ echo '<td class="edit-block" align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
151
 
152
  echo $content;
153
+
154
  echo "</td>\n</tr>\n</table>";
155
  echo '<!--[if mso]></td></tr></table><![endif]-->';
156
  echo "\n</td>\n</tr></table>\n\n";
 
157
  } else {
158
 
159
  $data = '';
166
  }
167
  }
168
  }
169
+
170
  if ($wrapper) {
171
  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), '">';
172
  echo '<tr>';
173
  echo '<td data-options="', esc_attr($data), '" align="center" style="padding: 0; font-family: Helvetica, Arial, sans-serif;" class="edit-block">';
174
  }
175
+
176
  // Container that fixes the width and makes the block responsive
177
  echo '<!--[if mso]><table border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '"><![endif]-->';
178
  echo "\n";
179
  echo '<table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
180
  echo "<tr>\n";
181
+ echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
182
 
183
  echo $content;
184
+
185
  echo "</td>\n</tr>\n</table>";
186
  echo '<!--[if mso]></td></tr></table><![endif]-->';
187
  if ($wrapper) {
297
  header('Content-Type: text/css');
298
  echo file_get_contents(__DIR__ . '/tnp-composer/css/newsletter.css');
299
  $dirs = apply_filters('newsletter_blocks_dir', array());
300
+ array_push($dirs, __DIR__ . '/blocks');
301
  foreach ($dirs as $dir) {
302
  $dir = str_replace('\\', '/', $dir);
303
  $list = NewsletterEmails::instance()->scan_blocks_dir($dir);
525
  $relative_dir = substr($dir, strlen(WP_CONTENT_DIR));
526
  while ($file = readdir($handle)) {
527
 
528
+ if ($file == '.' || $file == '..')
529
+ continue;
530
+
531
  // The block unique key, we should find out how to biuld it, maybe an hash of the (relative) dir?
532
  $block_id = sanitize_key($file);
533
 
566
  function get_blocks() {
567
 
568
  static $blocks = null;
569
+
570
+ if (!is_null($blocks))
571
+ return $blocks;
572
+
573
  $blocks = array();
574
 
575
  // Legacy blocks
618
  */
619
  function get_block($id) {
620
  switch ($id) {
621
+ case 'content-07-twocols.block':
622
+ case 'content-06-posts.block':
623
  $id = 'posts';
624
  break;
625
  case 'content-04-cta.block': $id = 'cta';
626
  break;
627
+ case 'content-01-hero.block': $id = 'hero';
628
+ break;
629
  // case 'content-02-heading.block': $id = '/plugins/newsletter/emails/blocks/heading';
630
  // break;
631
  }
632
+
633
  // Conversion for old full path ID
634
  $id = sanitize_key(basename($id));
635
 
emails/tnp-composer/_css/newsletter-builder.css CHANGED
@@ -114,7 +114,7 @@
114
 
115
  #newsletter-builder-area {
116
  xbackground-color: #EDF1F4;
117
- width: 860px;
118
  margin-left: 30px;
119
  box-sizing: border-box;
120
  padding-left: 50px;
@@ -122,18 +122,19 @@
122
  margin-top: 30px;
123
  padding-top: 10px;
124
  border-radius: 10px;
125
- border: 1px solid #eee;
126
  margin-bottom: 30px;
127
  }
128
 
129
 
 
130
  #newsletter-builder-area-center-frame-content {
131
  /*float: left;*/
132
- width: 750px;
133
  /*background-color: rgba(153,153,153,1);*/
134
  min-height: 50px;
135
  padding-bottom: 75px;
136
- border: 1px dashed #eee;
137
  }
138
 
139
  #newsletter-mobile-preview-area {
@@ -141,22 +142,23 @@
141
  box-sizing: border-box;
142
  margin-top: 30px;
143
  text-align: center;
144
- border: 1px solid #eee;
145
  border-radius: 10px;
146
  padding-left: 10px;
147
  padding-right: 10px;
 
148
  }
149
  #newsletter-mobile-preview-area input {
150
  width: 100px;
151
  }
152
 
153
- #tnp-mobile-preview {
154
  width: 340px!important;
155
  height: 95%;
156
- padding-top: 10px;
157
- padding-bottom: 10px;
158
  box-sizing: border-box;
159
  }
 
160
  .tnpc-row {
161
  -webkit-transition: box-shadow 0.5s;
162
  -moz-transition: box-shadow 0.5s;
@@ -596,12 +598,33 @@
596
  padding: 10px;
597
  }
598
 
599
- #tnpc-block-options-form th, #tnpc-block-options-form td {
 
 
 
 
 
 
 
 
 
 
600
  padding: 5px;
 
 
601
  }
602
 
603
  #tnpc-block-options-form table.form-table {
604
  margin: 0px;
605
  border-collapse: separate!important;
606
- border-spacing: 3px!important;
607
  }
 
 
 
 
 
 
 
 
 
114
 
115
  #newsletter-builder-area {
116
  xbackground-color: #EDF1F4;
117
+ width: 750px;
118
  margin-left: 30px;
119
  box-sizing: border-box;
120
  padding-left: 50px;
122
  margin-top: 30px;
123
  padding-top: 10px;
124
  border-radius: 10px;
125
+ border: 1px solid #ddd;
126
  margin-bottom: 30px;
127
  }
128
 
129
 
130
+
131
  #newsletter-builder-area-center-frame-content {
132
  /*float: left;*/
133
+ /*width: 730px;*/
134
  /*background-color: rgba(153,153,153,1);*/
135
  min-height: 50px;
136
  padding-bottom: 75px;
137
+ /*border: 1px dashed #eee;*/
138
  }
139
 
140
  #newsletter-mobile-preview-area {
142
  box-sizing: border-box;
143
  margin-top: 30px;
144
  text-align: center;
145
+ border: 1px solid #ddd;
146
  border-radius: 10px;
147
  padding-left: 10px;
148
  padding-right: 10px;
149
+ padding-top: 10px;
150
  }
151
  #newsletter-mobile-preview-area input {
152
  width: 100px;
153
  }
154
 
155
+ iframe#tnp-mobile-preview {
156
  width: 340px!important;
157
  height: 95%;
158
+ padding: 0;
 
159
  box-sizing: border-box;
160
  }
161
+
162
  .tnpc-row {
163
  -webkit-transition: box-shadow 0.5s;
164
  -moz-transition: box-shadow 0.5s;
598
  padding: 10px;
599
  }
600
 
601
+ #tnpc-block-options-form h3 {
602
+ color: #000;
603
+ }
604
+
605
+ #tnpc-block-options-form table.form-table th {
606
+ background-color: #f4f4f4;
607
+ width: 150px;
608
+ vertical-align: top;
609
+ }
610
+
611
+ #tnpc-block-options-form table.form-table th, #tnpc-block-options-form table.form-table td {
612
  padding: 5px;
613
+ padding-right: 15px;
614
+ padding-top: 15px;
615
  }
616
 
617
  #tnpc-block-options-form table.form-table {
618
  margin: 0px;
619
  border-collapse: separate!important;
620
+ border-spacing: 1px!important;
621
  }
622
+
623
+ #tnpc-block-options-form table.form-table table.tnp-button-colors {
624
+ border: 0;
625
+ border-collapse: collapse;
626
+ }
627
+ #tnpc-block-options-form table.form-table table.tnp-button-colors td {
628
+ border: 0;
629
+ padding-top: 0;
630
+ }
emails/tnp-composer/blocks/{content-01-hero.block.php → _/content-01-hero.block.php} RENAMED
File without changes
emails/tnp-composer/blocks/_/content-01-hero.block.png ADDED
Binary file
emails/tnp-composer/blocks/content-05-image.block.php CHANGED
@@ -5,7 +5,7 @@
5
 
6
  <div class="tnpc-row-edit" data-type="image">
7
  <a href="#" target="_blank">
8
- <img src="https://unsplash.it/800/300?image=998" border="0" alt="Insert alt text here" width="<?php echo $width ?>" style="width: <?php echo $width ?>px; max-width: 100%!important; height: auto!important;display: block; color: #666666;" class="img-max">
9
  </a>
10
  </div>
11
 
5
 
6
  <div class="tnpc-row-edit" data-type="image">
7
  <a href="#" target="_blank">
8
+ <img src="https://unsplash.it/800/300?image=998" border="0" alt="Insert alt text here" style="max-width: 100%!important; height: auto!important;display: block;" class="img-max">
9
  </a>
10
  </div>
11
 
emails/tnp-composer/css/newsletter.css CHANGED
@@ -40,7 +40,7 @@ table{border-collapse:collapse !important;}
40
 
41
  img[class="img-max"]{
42
  max-width: 100% !important;
43
- width: 100% !important;
44
  height:auto !important;
45
  }
46
 
40
 
41
  img[class="img-max"]{
42
  max-width: 100% !important;
43
+ /*width: 100% !important;*/
44
  height:auto !important;
45
  }
46
 
includes/controls.php CHANGED
@@ -1023,15 +1023,14 @@ class NewsletterControls {
1023
  * Empty preferences are skipped.
1024
  */
1025
  function preferences($name = 'preferences') {
1026
- $lists = NewsletterSubscription::instance()->options_lists;
 
1027
  echo '<div class="newsletter-preferences-group">';
1028
 
1029
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1030
- if (empty($lists['list_' . $i])) {
1031
- continue;
1032
- }
1033
  echo '<div class="newsletter-preferences-item">';
1034
- $this->checkbox2($name . '_' . $i, esc_html($lists['list_' . $i]));
1035
  echo '</div>';
1036
  }
1037
  }
@@ -1042,15 +1041,14 @@ class NewsletterControls {
1042
  * will be an array if at east one preference is checked).
1043
  */
1044
  function preferences_group($name = 'preferences') {
1045
- $lists = NewsletterSubscription::instance()->options_lists;
 
1046
 
1047
  echo '<div class="newsletter-preferences-group">';
1048
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1049
- if (empty($lists['list_' . $i])) {
1050
- continue;
1051
- }
1052
  echo '<div class="newsletter-preferences-item">';
1053
- $this->checkbox_group($name, $i, '(' . $i . ') ' . esc_html($lists['list_' . $i]));
1054
  echo '</div>';
1055
  }
1056
  echo '<div style="clear: both"></div>';
@@ -1064,18 +1062,15 @@ class NewsletterControls {
1064
  * 'any', 'yes', 'no' corresponding to the values 0, 1, 2.
1065
  */
1066
  function preferences_selects($name = 'preferences', $skip_empty = false) {
1067
- $lists = NewsletterSubscription::instance()->options_lists;
1068
 
1069
  echo '<div class="newsletter-preferences-group">';
1070
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1071
- if (empty($lists['list_' . $i])) {
1072
- continue;
1073
- }
1074
 
1075
  echo '<div class="newsletter-preferences-item">';
1076
 
1077
- $this->select($name . '_' . $i, array(0 => 'Any', 1 => 'Yes', 2 => 'No'));
1078
- echo '(' . $i . ') ' . esc_html($lists['list_' . $i]);
1079
 
1080
  echo '</div>';
1081
  }
@@ -1088,28 +1083,13 @@ class NewsletterControls {
1088
  * Creates a single select with the active preferences.
1089
  */
1090
  function preferences_select($name = 'preference', $empty_label = null) {
1091
- $options = NewsletterSubscription::instance()->options_lists;
1092
-
1093
- $lists = array();
1094
- if ($empty_label) {
1095
- $lists[''] = $empty_label;
1096
- }
1097
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1098
- $lists['' . $i] = '(' . $i . ') ' . $options['list_' . $i];
1099
- }
1100
  $this->select($name, $lists);
1101
  echo ' <a href="admin.php?page=newsletter_subscription_lists" target="_blank"><i class="fa fa-edit"></i></a>';
1102
  }
1103
 
1104
  function lists_select($name = 'list', $empty_label = null) {
1105
- $objs = Newsletter::instance()->get_lists();
1106
- $lists = array();
1107
- if ($empty_label) {
1108
- $lists[''] = $empty_label;
1109
- }
1110
- foreach ($objs as $list) {
1111
- $lists['' . $list->id] = '[' . $list->id . '] ' . $list->name;
1112
- }
1113
  $this->select($name, $lists);
1114
  }
1115
 
@@ -1119,13 +1099,13 @@ class NewsletterControls {
1119
  * @return array
1120
  */
1121
  function get_list_options($empty_label = null) {
1122
- $options_profile = NewsletterSubscription::instance()->options_lists;
1123
  $lists = array();
1124
  if ($empty_label) {
1125
  $lists[''] = $empty_label;
1126
  }
1127
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1128
- $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
1129
  }
1130
  return $lists;
1131
  }
@@ -1347,6 +1327,12 @@ class NewsletterControls {
1347
  return NewsletterUsers::instance()->get_test_users();
1348
  }
1349
 
 
 
 
 
 
 
1350
  function css_font_size($name = 'font_size') {
1351
  $value = $this->get_value($name);
1352
 
@@ -1358,7 +1344,23 @@ class NewsletterControls {
1358
  }
1359
  echo '>' . $i . '</option>';
1360
  }
1361
- echo '</select>&nbsp;px';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1362
  }
1363
 
1364
  function css_font_family($name = 'font_family') {
@@ -1456,19 +1458,16 @@ class NewsletterControls {
1456
  }
1457
 
1458
  function language($name = 'language') {
1459
- if (!class_exists('SitePress')) {
1460
- echo __('Install WPML or Polylang for multilanguage support', 'newsletter');
 
1461
  return;
1462
  }
1463
 
1464
- $languages = apply_filters('wpml_active_languages', null);
1465
- $language_options = array('' => 'All');
1466
- foreach ($languages as $language) {
1467
- $language_options[$language['language_code']] = $language['translated_name'];
1468
- }
1469
-
1470
-
1471
- $this->select($name, $language_options);
1472
  }
1473
 
1474
  function is_multilanguage() {
1023
  * Empty preferences are skipped.
1024
  */
1025
  function preferences($name = 'preferences') {
1026
+ $lists = Newsletter::instance()->get_lists();
1027
+
1028
  echo '<div class="newsletter-preferences-group">';
1029
 
1030
+ foreach ($lists as $list) {
1031
+
 
 
1032
  echo '<div class="newsletter-preferences-item">';
1033
+ $this->checkbox2($name . '_' . $list->id, esc_html($list->name));
1034
  echo '</div>';
1035
  }
1036
  }
1041
  * will be an array if at east one preference is checked).
1042
  */
1043
  function preferences_group($name = 'preferences') {
1044
+
1045
+ $lists = Newsletter::instance()->get_lists();
1046
 
1047
  echo '<div class="newsletter-preferences-group">';
1048
+ foreach ($lists as $list) {
1049
+
 
 
1050
  echo '<div class="newsletter-preferences-item">';
1051
+ $this->checkbox_group($name, $list->id, '(' . $list->id . ') ' . esc_html($list->name));
1052
  echo '</div>';
1053
  }
1054
  echo '<div style="clear: both"></div>';
1062
  * 'any', 'yes', 'no' corresponding to the values 0, 1, 2.
1063
  */
1064
  function preferences_selects($name = 'preferences', $skip_empty = false) {
1065
+ $lists = Newsletter::instance()->get_lists();
1066
 
1067
  echo '<div class="newsletter-preferences-group">';
1068
+ foreach ($lists as $list) {
 
 
 
1069
 
1070
  echo '<div class="newsletter-preferences-item">';
1071
 
1072
+ $this->select($name . '_' . $list->id, array(0 => 'Any', 1 => 'Yes', 2 => 'No'));
1073
+ echo '(' . $list->id . ') ' . esc_html($list->name);
1074
 
1075
  echo '</div>';
1076
  }
1083
  * Creates a single select with the active preferences.
1084
  */
1085
  function preferences_select($name = 'preference', $empty_label = null) {
1086
+ $lists = $this->get_list_options($empty_label);
 
 
 
 
 
 
 
 
1087
  $this->select($name, $lists);
1088
  echo ' <a href="admin.php?page=newsletter_subscription_lists" target="_blank"><i class="fa fa-edit"></i></a>';
1089
  }
1090
 
1091
  function lists_select($name = 'list', $empty_label = null) {
1092
+ $lists = $this->get_list_options($empty_label);
 
 
 
 
 
 
 
1093
  $this->select($name, $lists);
1094
  }
1095
 
1099
  * @return array
1100
  */
1101
  function get_list_options($empty_label = null) {
1102
+ $objs = Newsletter::instance()->get_lists();
1103
  $lists = array();
1104
  if ($empty_label) {
1105
  $lists[''] = $empty_label;
1106
  }
1107
+ foreach ($objs as $list) {
1108
+ $lists['' . $list->id] = '(' . $list->id . ') ' . esc_html($list->name);
1109
  }
1110
  return $lists;
1111
  }
1327
  return NewsletterUsers::instance()->get_test_users();
1328
  }
1329
 
1330
+ function css_font($name = 'font', $attrs = array()) {
1331
+ $this->css_font_family($name . '_family');
1332
+ $this->css_font_size($name . '_size');
1333
+ $this->css_font_weight($name . '_weight');
1334
+ }
1335
+
1336
  function css_font_size($name = 'font_size') {
1337
  $value = $this->get_value($name);
1338
 
1344
  }
1345
  echo '>' . $i . '</option>';
1346
  }
1347
+ echo '</select>';
1348
+ }
1349
+
1350
+ function css_font_weight($name = 'font_weight') {
1351
+ $value = $this->get_value($name);
1352
+
1353
+ $fonts = array('Normal', 'Bold');
1354
+
1355
+ echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
1356
+ foreach ($fonts as $font) {
1357
+ echo '<option value="', esc_attr($font), '"';
1358
+ if ($value == $font) {
1359
+ echo ' selected';
1360
+ }
1361
+ echo '>', esc_html($font), '</option>';
1362
+ }
1363
+ echo '</select>';
1364
  }
1365
 
1366
  function css_font_family($name = 'font_family') {
1458
  }
1459
 
1460
  function language($name = 'language') {
1461
+ if (!class_exists('SitePress') && !function_exists('pll_default_language') && !class_exists('TRP_Translate_Press')) {
1462
+ echo __('Install a multilanguage plugin.', 'newsletter');
1463
+ echo ' <a href="https://www.thenewsletterplugin.com/documentation/multilanguage" target="_blank">', __('Read more', 'newsletter'), '</a>';
1464
  return;
1465
  }
1466
 
1467
+ $languages = Newsletter::instance()->get_languages();
1468
+ $languages = array_merge(array('' => 'All'), $languages);
1469
+
1470
+ $this->select($name, $languages);
 
 
 
 
1471
  }
1472
 
1473
  function is_multilanguage() {
includes/helper.php CHANGED
@@ -76,8 +76,12 @@ function tnp_media_resize($media_id, $size) {
76
 
77
  // Thumbnail generation if needed.
78
  if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
79
- wp_mkdir_p(WP_CONTENT_DIR . '/newsletter/thumbnails/' . $pathinfo['dirname']);
80
-
 
 
 
 
81
  $editor = wp_get_image_editor($absolute_file);
82
  if (is_wp_error($editor)) {
83
  return $editor;
76
 
77
  // Thumbnail generation if needed.
78
  if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
79
+ $r = wp_mkdir_p(WP_CONTENT_DIR . '/newsletter/thumbnails/' . $pathinfo['dirname']);
80
+
81
+ if (!$r) {
82
+ return $uploads['baseurl'] . '/' . $relative_file;
83
+ }
84
+
85
  $editor = wp_get_image_editor($absolute_file);
86
  if (is_wp_error($editor)) {
87
  return $editor;
includes/module.php CHANGED
@@ -47,6 +47,22 @@ abstract class TNP_Email {
47
 
48
  }
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  class NewsletterModule {
51
 
52
  /**
@@ -1155,8 +1171,8 @@ class NewsletterModule {
1155
  }
1156
 
1157
  /**
1158
- * Add to a destination url the parameters to identify the user, the email and to show
1159
- * an alert message, if required. The parameters and them managed by the [newsletter] shortcode.
1160
  *
1161
  * @param string $url If empty the standard newsletter page URL is used (usually it is empty, but sometime a custom URL has been specified)
1162
  * @param string $message_key The message identifier
@@ -1212,7 +1228,7 @@ class NewsletterModule {
1212
  }
1213
  return $url;
1214
  }
1215
-
1216
  function get_subscribe_url() {
1217
  return $this->build_action_url('s');
1218
  }
@@ -1302,7 +1318,7 @@ class NewsletterModule {
1302
 
1303
  return $this->get_user($user);
1304
  }
1305
-
1306
  /**
1307
  *
1308
  * @global wpdb $wpdb
@@ -1313,11 +1329,11 @@ class NewsletterModule {
1313
  global $wpdb;
1314
 
1315
  $token = $this->get_token();
1316
-
1317
  $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set token=%s where id=%d limit 1", $token, $user->id));
1318
 
1319
  return $this->get_user($user);
1320
- }
1321
 
1322
  /**
1323
  * Create a log entry with the meaningful user data.
@@ -1373,7 +1389,7 @@ class NewsletterModule {
1373
  function get_user_by_wp_user_id($wp_user_id, $format = OBJECT) {
1374
  return $this->store->get_single_by_field(NEWSLETTER_USERS_TABLE, 'wp_user_id', $wp_user_id, $format);
1375
  }
1376
-
1377
  /**
1378
  * Returns the user language IF there is a supported mutilanguage plugin installed.
1379
  * @param TNP_User $user
@@ -1734,12 +1750,13 @@ class NewsletterModule {
1734
  * @return string The language code
1735
  */
1736
  function get_current_language($user = null) {
 
1737
  // TODO: Check if the blog is multilanguage?
1738
-
1739
  if ($user && $user->language) {
1740
  return $user->language;
1741
  }
1742
-
1743
  if (class_exists('SitePress')) {
1744
  $current_language = apply_filters('wpml_current_language', '');
1745
  if ($current_language == 'all') {
@@ -1750,15 +1767,19 @@ class NewsletterModule {
1750
  if (function_exists('pll_current_language')) {
1751
  return pll_current_language();
1752
  }
1753
- return '';
 
 
 
1754
  }
1755
 
1756
  function get_default_language() {
1757
  if (class_exists('SitePress')) {
1758
  return $current_language = apply_filters('wpml_current_language', '');
1759
- }
1760
- if (function_exists('pll_default_language')) {
1761
  return pll_default_language();
 
 
1762
  }
1763
  return '';
1764
  }
@@ -1770,45 +1791,49 @@ class NewsletterModule {
1770
  function is_default_language() {
1771
  return $this->get_current_language() == $this->get_default_language();
1772
  }
1773
-
1774
  /**
1775
- * Returns an array od languages with key the language code and value the language name.
1776
  * An empty array is returned if no language is available.
1777
  */
1778
  function get_languages() {
1779
  $language_options = array();
 
1780
  if (class_exists('SitePress')) {
1781
  $languages = apply_filters('wpml_active_languages', null);
1782
  foreach ($languages as $language) {
1783
  $language_options[$language['language_code']] = $language['translated_name'];
1784
  }
 
1785
  } else if (function_exists('icl_get_languages')) {
1786
  $languages = icl_get_languages();
1787
- foreach ($languages as $code=>$language) {
1788
  $language_options[$code] = $language['native_name'];
1789
  }
1790
- }
1791
-
1792
- return $language_options;
 
1793
  }
1794
-
1795
  function get_language_label($language) {
1796
  $languages = $this->get_languages();
1797
- if (isset($languages[$language])) return $languages[$language];
 
1798
  return '';
1799
-
1800
  }
1801
 
1802
  function switch_language($language) {
1803
  if (class_exists('SitePress')) {
1804
- if (empty($language)) $language = 'all';
 
1805
  do_action('wpml_switch_language', $language);
1806
  return;
1807
  }
1808
  }
1809
 
1810
  function is_multilanguage() {
1811
- return class_exists('SitePress') || function_exists('pll_default_language');
1812
  }
1813
 
1814
  function get_posts($filters = array(), $language = '') {
47
 
48
  }
49
 
50
+ /**
51
+ * @property string $id Theme identifier
52
+ * @property string $dir Absolute path to the theme folder
53
+ * @property string $name Theme name
54
+ **/
55
+ class TNP_Theme {
56
+ var $dir;
57
+ var $name;
58
+
59
+ public function get_defaults() {
60
+ @include $this->dir . '/theme-defaults.php';
61
+ if (!isset($theme_defaults) || !is_array($theme_defaults)) return array();
62
+ return $theme_defaults;
63
+ }
64
+ }
65
+
66
  class NewsletterModule {
67
 
68
  /**
1171
  }
1172
 
1173
  /**
1174
+ * Add to a destination URL the parameters to identify the user, the email and to show
1175
+ * an alert message, if required. The parameters are then managed by the [newsletter] shortcode.
1176
  *
1177
  * @param string $url If empty the standard newsletter page URL is used (usually it is empty, but sometime a custom URL has been specified)
1178
  * @param string $message_key The message identifier
1228
  }
1229
  return $url;
1230
  }
1231
+
1232
  function get_subscribe_url() {
1233
  return $this->build_action_url('s');
1234
  }
1318
 
1319
  return $this->get_user($user);
1320
  }
1321
+
1322
  /**
1323
  *
1324
  * @global wpdb $wpdb
1329
  global $wpdb;
1330
 
1331
  $token = $this->get_token();
1332
+
1333
  $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set token=%s where id=%d limit 1", $token, $user->id));
1334
 
1335
  return $this->get_user($user);
1336
+ }
1337
 
1338
  /**
1339
  * Create a log entry with the meaningful user data.
1389
  function get_user_by_wp_user_id($wp_user_id, $format = OBJECT) {
1390
  return $this->store->get_single_by_field(NEWSLETTER_USERS_TABLE, 'wp_user_id', $wp_user_id, $format);
1391
  }
1392
+
1393
  /**
1394
  * Returns the user language IF there is a supported mutilanguage plugin installed.
1395
  * @param TNP_User $user
1750
  * @return string The language code
1751
  */
1752
  function get_current_language($user = null) {
1753
+ global $TRP_LANGUAGE, $current_user;
1754
  // TODO: Check if the blog is multilanguage?
1755
+
1756
  if ($user && $user->language) {
1757
  return $user->language;
1758
  }
1759
+
1760
  if (class_exists('SitePress')) {
1761
  $current_language = apply_filters('wpml_current_language', '');
1762
  if ($current_language == 'all') {
1767
  if (function_exists('pll_current_language')) {
1768
  return pll_current_language();
1769
  }
1770
+
1771
+ $current_language = apply_filters('newsletter_current_language', '');
1772
+
1773
+ return $current_language;
1774
  }
1775
 
1776
  function get_default_language() {
1777
  if (class_exists('SitePress')) {
1778
  return $current_language = apply_filters('wpml_current_language', '');
1779
+ } else if (function_exists('pll_default_language')) {
 
1780
  return pll_default_language();
1781
+ } else if (class_exists('TRP_Translate_Press')) {
1782
+ // TODO: Find the default language
1783
  }
1784
  return '';
1785
  }
1791
  function is_default_language() {
1792
  return $this->get_current_language() == $this->get_default_language();
1793
  }
1794
+
1795
  /**
1796
+ * Returns an array of languages with key the language code and value the language name.
1797
  * An empty array is returned if no language is available.
1798
  */
1799
  function get_languages() {
1800
  $language_options = array();
1801
+
1802
  if (class_exists('SitePress')) {
1803
  $languages = apply_filters('wpml_active_languages', null);
1804
  foreach ($languages as $language) {
1805
  $language_options[$language['language_code']] = $language['translated_name'];
1806
  }
1807
+ return $language_options;
1808
  } else if (function_exists('icl_get_languages')) {
1809
  $languages = icl_get_languages();
1810
+ foreach ($languages as $code => $language) {
1811
  $language_options[$code] = $language['native_name'];
1812
  }
1813
+ return $language_options;
1814
+ }
1815
+
1816
+ return apply_filters('newsletter_languages', $language_options);
1817
  }
1818
+
1819
  function get_language_label($language) {
1820
  $languages = $this->get_languages();
1821
+ if (isset($languages[$language]))
1822
+ return $languages[$language];
1823
  return '';
 
1824
  }
1825
 
1826
  function switch_language($language) {
1827
  if (class_exists('SitePress')) {
1828
+ if (empty($language))
1829
+ $language = 'all';
1830
  do_action('wpml_switch_language', $language);
1831
  return;
1832
  }
1833
  }
1834
 
1835
  function is_multilanguage() {
1836
+ return class_exists('SitePress') || function_exists('pll_default_language') || class_exists('TRP_Translate_Press');
1837
  }
1838
 
1839
  function get_posts($filters = array(), $language = '') {
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: 5.7.1
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', '5.7.1');
18
 
19
  global $newsletter, $wpdb;
20
 
@@ -377,7 +377,7 @@ class Newsletter extends NewsletterModule {
377
  wp_enqueue_script('tnp-jquery-vmap-world', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/maps/jquery.vmap.world.js', array('tnp-jquery-vmap'));
378
  wp_enqueue_style('tnp-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jqvmap.min.css');
379
 
380
- wp_register_script('tnp-chart', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js', array('jquery'));
381
 
382
  $dismissed = get_option('newsletter_dismissed', array());
383
 
@@ -418,30 +418,6 @@ class Newsletter extends NewsletterModule {
418
  die();
419
  }
420
  }
421
-
422
- // function hook_site_transient_update_plugins($value) {
423
- // //return null;
424
- // //var_dump($value);
425
- // //die('xxx');
426
- // if (!isset($value->response['newsletter/plugin.php'])) {
427
- // $value->response['newsletter/plugin.php'] = $value->no_update['newsletter/plugin.php'];
428
- // }
429
- //
430
- // // Add caching
431
- // $response = wp_remote_get('http://plugins.svn.wordpress.org/newsletter/');
432
- // $body = wp_remote_retrieve_body($response);
433
- //
434
- // $x = strpos($body, 'Revision');
435
- // $x += 9;
436
- // $y = strpos($body, ':', $x);
437
- // $version = substr($body, $x, $y-$x);
438
- // $value->checked['newsletter/plugin.php'] = $version;
439
- // $value->response['newsletter/plugin.php']->new_version = $version;
440
- // $value->response['newsletter/plugin.php']->package = 'https://downloads.wordpress.org/plugin/newsletter.zip';
441
- //
442
- // return $value;
443
- //
444
- // }
445
 
446
  function hook_admin_notices() {
447
  // Check of Newsletter dedicated page
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: 5.7.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.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '5.7.3');
18
 
19
  global $newsletter, $wpdb;
20
 
377
  wp_enqueue_script('tnp-jquery-vmap-world', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/maps/jquery.vmap.world.js', array('tnp-jquery-vmap'));
378
  wp_enqueue_style('tnp-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jqvmap.min.css');
379
 
380
+ wp_register_script('tnp-chart', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.2/Chart.min.js', array('jquery'));
381
 
382
  $dismissed = get_option('newsletter_dismissed', array());
383
 
418
  die();
419
  }
420
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
421
 
422
  function hook_admin_notices() {
423
  // Check of Newsletter dedicated page
profile/index.php CHANGED
@@ -142,7 +142,7 @@ if ($controls->is_action()) {
142
  </table>
143
  <?php } else { ?>
144
 
145
- <p>Switch to your main language to manage these options.</p>
146
 
147
 
148
 
142
  </table>
143
  <?php } else { ?>
144
 
145
+ <p>Switch to "All languages" to manage these options.</p>
146
 
147
 
148
 
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: 4.9.8
5
- Stable tag: 5.7.1
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -12,16 +12,23 @@ Add a real newsletter system to your blog. For free. With unlimited newsletters
12
  Newsletter is a **real newsletter system** for your WordPress blog: perfect for list building, you can easily create,
13
  send and track e-mails, headache-free. It just works out of box!
14
 
 
 
 
 
 
15
  = Main Features =
16
 
17
  * **Unlimited subscribers** with statistics
18
- * **Unlimited newsletter** with tracking
19
  * **Subscription spam check** with domain/ip black lists, Akismet, captcha
20
  * **Delivery speed** fine control (from 12 emails per hour to as much as your blog can manage)
 
21
  * [WPML ready](https://www.thenewsletterplugin.com/documentation/multilanguage)
 
 
22
  * [GDPR ready](https://www.thenewsletterplugin.com/documentation/gdpr-compliancy)
23
  * **Multi-list targeting** with list combinations like all in, at least one, not in and so on
24
- * **Drag and drop composer** with responsive email layout
25
  * Customizable **subscription widget**, **page** or **custom form**
26
  * Wordpress User Registration **seamless integration**
27
  * **Single** And **Double Opt-In** plus privacy checkbox for EU laws compliance
@@ -108,6 +115,18 @@ Thank you, The Newsletter Team
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  = 5.7.1 =
112
 
113
  * Improvements on posts 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: 4.9.8
5
+ Stable tag: 5.7.3
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
12
  Newsletter is a **real newsletter system** for your WordPress blog: perfect for list building, you can easily create,
13
  send and track e-mails, headache-free. It just works out of box!
14
 
15
+ = Find Us =
16
+
17
+ Newsletter is a continuously evolving plugin. Stay tuned following us on
18
+ [Facebook](https://www.facebook.com/thenewsletterplugin/) or [Twitter](https://twitter.com/newsletterwp).
19
+
20
  = Main Features =
21
 
22
  * **Unlimited subscribers** with statistics
23
+ * **Unlimited newsletters** with tracking
24
  * **Subscription spam check** with domain/ip black lists, Akismet, captcha
25
  * **Delivery speed** fine control (from 12 emails per hour to as much as your blog can manage)
26
+ * **Drag and drop composer** with responsive email layout
27
  * [WPML ready](https://www.thenewsletterplugin.com/documentation/multilanguage)
28
+ * [Polylang ready](https://www.thenewsletterplugin.com/documentation/multilanguage)
29
+ * [Translatepress ready](https://www.thenewsletterplugin.com/documentation/multilanguage)
30
  * [GDPR ready](https://www.thenewsletterplugin.com/documentation/gdpr-compliancy)
31
  * **Multi-list targeting** with list combinations like all in, at least one, not in and so on
 
32
  * Customizable **subscription widget**, **page** or **custom form**
33
  * Wordpress User Registration **seamless integration**
34
  * **Single** And **Double Opt-In** plus privacy checkbox for EU laws compliance
115
 
116
  == Changelog ==
117
 
118
+ = 5.7.3 =
119
+
120
+ * Fixed block padding warning
121
+ * Fixed lists display on import panel
122
+ * Fixed lists display on targeting panel when in multilanguage mode
123
+
124
+ = 5.7.2 =
125
+
126
+ * Improvements on posts block
127
+ * New hero block layout
128
+ * Transaltepress extension compatibility pack
129
+
130
  = 5.7.1 =
131
 
132
  * Improvements on posts block
subscription/options.php CHANGED
@@ -169,7 +169,7 @@ if ($controls->is_action()) {
169
  </tr>
170
  </table>
171
  <?php } else { ?>
172
- <p>Switch to your main language to manage these options.</p>
173
  <?php } ?>
174
 
175
  </div>
169
  </tr>
170
  </table>
171
  <?php } else { ?>
172
+ <p>Switch to "All languages" to manage these options.</p>
173
  <?php } ?>
174
 
175
  </div>