Newsletter - Version 7.1.3

Version Description

  • [COMPOSER] Improvements on blocks layout compatibility
  • [COMPOSER] Fixed preset global options saving
  • [COMPOSER] Content regeneration on preset selection
  • [GENERAL] Added to System menu the Site Health link, a not well known native page of WordPress with system information
  • [GENERAL] Added sending statistics reset button on status panel
Download this release

Release Info

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

Code changes from version 7.1.2 to 7.1.3

changelog.txt CHANGED
@@ -1,3 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  = 6.7.9 =
2
 
3
  * Fixed posts block
1
+ = 6.9.9 =
2
+
3
+ * Not specified gender fix
4
+ * Labels translation
5
+ * Added "newsletter_message" filter to act on the whole message before sending
6
+ * Removed X-Mailer when sending with the internal SMTP
7
+ * Added referrer field on subscriber editing page
8
+ * Fixed button label control on composer
9
+
10
+ = 6.9.8 =
11
+
12
+ * New color picker
13
+ * Extended the IP field on stats table
14
+ * Removed filter for temporary email services (can be added in the security page)
15
+ * Added support to show the last regular newsletter (not private) adding to the home url ?na=view&id=last
16
+ * Hero and image blocks now use high res images
17
+
18
+ = 6.9.7 =
19
+
20
+ * Fixed country filter
21
+ * Fixed tag replacements for server with TR-tr locale
22
+
23
+ = 6.9.6 =
24
+
25
+ * Added 3 months option for inactive subscriber selection
26
+ * Improved the add-ons classes
27
+ * Improved admin messages for multilanguage blogs
28
+ * Updated link to documentation on main settings
29
+ * Added VK and Telegram socials
30
+ * Removed the old bounce import on subscribe maintenance panel
31
+ * Added Telegram and VK icon on social block component
32
+
33
+ = 6.9.5 =
34
+ * Added new posts block layout
35
+ * Improved the mobile version of hero block
36
+ * Added title and text global fonts
37
+
38
+ = NEXT =
39
+
40
+ * Added pagination on newsletters page table
41
+ * Changed label text for empty language in edit user page
42
+ * Added preheader text on email
43
+ * If email is paused but scheduled in the future it is now possible to change the sending date
44
+ * Fixed font weight selection for titles on posts block
45
+
46
+ = 6.9.4 =
47
+
48
+ * Fixed the profile save
49
+ * Improved the email change management from the subscriber data page
50
+ * Removed custom javascript and opted for HTML5 validation (you can use a polyfill plugin like parsely)
51
+ * Removed custom error messages (see above)
52
+ * Check on delivery speed to be minimum 10 emails per hour
53
+
54
+ = 6.9.3 =
55
+
56
+ * Fixed profile saving spam check
57
+
58
+ = 6.9.2 =
59
+
60
+ * Fixed error on TNP::subscribe()
61
+
62
+ = 6.9.1 =
63
+
64
+ * Fix of administrator notice on form about worng list
65
+
66
+ = 6.9.0 =
67
+
68
+ * Improved and optimized the lists field shortcode
69
+ * Added the dropdown option to the lists field shortcode
70
+ * Optimized the standard generated form aligned with the structure of the form generated by shortcodes
71
+ * Added notices **only for the administrator** on online forms to better discover wrong or unwanted configurations
72
+ * Added support for the next to come API version 2
73
+ * Internally revised the subscription process
74
+ * Fixed empty tag {profile_20}
75
+ * Fix CSS class on mininmal form privacy field
76
+ * Improved error message with notes for administrator on form submission errors
77
+ * Improved error repoting on invalid tracking links (very rare anyway)
78
+
79
+ = 6.8.9 =
80
+
81
+ * Welcome and activation messages test sent using the admin language
82
+ * Added RTL/LTR button on composer text block
83
+
84
+ = 6.8.8 =
85
+
86
+ * Fixed cancellation notification for admins
87
+
88
+ = 6.8.7 =
89
+
90
+ * Fix of confirmation_url attribute on minimal subscription form
91
+
92
+ = 6.8.6 =
93
+
94
+ * Disabled the default WordPress emoji to image replacer on admin pages of Newsletter
95
+
96
+ = 6.8.5 =
97
+
98
+ * Updated Controls class to support the new Reports Addon
99
+
100
+ = 6.8.4 =
101
+
102
+ * Code update for WordPress 5.5 compatibility (PHPMailer)
103
+ * Added dummy user-related-links on newsletter preview
104
+ * Fixed optin form option for the minimal subsbscription form
105
+
106
+ = 6.8.3 =
107
+
108
+ * Changed the administrative notification of subscription removing the lists and linking the user profile
109
+ * Fixed missing user token on data from some external sources
110
+ * Extra profiles fix and optmization
111
+ * Improved notificatons for usage of private fields on custom forms
112
+ * Better management of opt-in override on forms and notices for administration when used in wrong ways
113
+ * Fixed the posts block with odd numbers of posts on Automated context
114
+ * Added administrative notices on custom form for invalid list usage
115
+ * Added multilanguage support on lists on custom forms
116
+ * Added multilanguage support on extra profiles on custom forms
117
+ * Fixed CSS for extra profile fields
118
+ * Improved antibot/antispam performances
119
+ * Multilanguage on validation JS (but will be removed in favor of pure HTML validation)
120
+ * Fixed label "for" attribute for extra fields on custom forms
121
+ * Better test message from status panel
122
+ * Fixed vulnerability reported by WordFence
123
+
124
+ = 6.8.2 =
125
+
126
+ * Added HTML filtering on block rendering
127
+
128
+ = 6.8.1 =
129
+
130
+ * Fixed welcome message not being displayed (on 6.8.0)
131
+
132
+ = 6.8.0 =
133
+
134
+ * Improved license checking (only for who set a license code - it is not required)
135
+ * Imporved extra field configuration with multilanguage blogs
136
+ * Improved subscription form with extra fields for multilanguage blogs
137
+ * Minor code improvements
138
+ * Improved HTTP responses for invalid profile links (good for users and acceptance tests)
139
+ * Fixed newsletter page url generation with Polylang
140
+
141
  = 6.7.9 =
142
 
143
  * Fixed posts block
css/fields.css CHANGED
@@ -70,7 +70,7 @@
70
  font-size: 12px;
71
  font-weight: 300;
72
  border-bottom: 1px solid #fff;
73
- margin: 25px 0px 10px 0px;
74
  font-family: soleil, sans-serif;
75
  font-weight: 300;
76
  padding-bottom: 5px;
70
  font-size: 12px;
71
  font-weight: 300;
72
  border-bottom: 1px solid #fff;
73
+ margin: 10px 0px 10px 0px;
74
  font-family: soleil, sans-serif;
75
  font-weight: 300;
76
  padding-bottom: 5px;
emails/blocks/giphy/block.php CHANGED
@@ -9,12 +9,7 @@
9
  /* @var $options array */
10
  /* @var $wpdb wpdb */
11
 
12
- $default_options = array(
13
- 'view'=>'View online',
14
- 'text'=>'Few words summary',
15
- 'font_family'=>$font_family,
16
- 'font_size'=>13,
17
- 'color'=>'#999999',
18
  'block_padding_top'=>15,
19
  'block_padding_bottom'=>15,
20
  'block_padding_left'=>0,
@@ -23,14 +18,14 @@ $default_options = array(
23
  'giphy_url' => ''
24
  );
25
 
26
- $options = array_merge($default_options, $options);
27
 
28
  ?>
29
 
30
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
31
  <tr>
32
  <td width="100%" valign="top" align="center">
33
- <img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;" />
34
  </td>
35
  </tr>
36
  </table>
9
  /* @var $options array */
10
  /* @var $wpdb wpdb */
11
 
12
+ $defaults = array(
 
 
 
 
 
13
  'block_padding_top'=>15,
14
  'block_padding_bottom'=>15,
15
  'block_padding_left'=>0,
18
  'giphy_url' => ''
19
  );
20
 
21
+ $options = array_merge($defaults, $options);
22
 
23
  ?>
24
 
25
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" class="responsive">
26
  <tr>
27
  <td width="100%" valign="top" align="center">
28
+ <img src="<?php echo $options['giphy_url'] ?>" style="max-width: 100%!important; height: auto!important;">
29
  </td>
30
  </tr>
31
  </table>
emails/blocks/heading/block.php CHANGED
@@ -6,47 +6,46 @@
6
  */
7
 
8
  $default_options = array(
9
- 'text' => 'An Awesome Title',
10
- 'align' => 'center',
11
- 'block_background' => '',
12
- 'font_family' => '',
13
- 'font_size' => '',
14
- 'font_color' => '',
15
- 'font_weight' => '',
16
- 'block_padding_left' => 15,
17
- 'block_padding_right' => 15,
18
- 'block_padding_bottom' => 15,
19
- 'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
22
 
23
- $title_font_family = empty( $options['font_family'] ) ? $global_title_font_family : $options['font_family'];
24
- $title_font_size = empty( $options['font_size'] ) ? $global_title_font_size : $options['font_size'];
25
- $title_font_color = empty( $options['font_color'] ) ? $global_title_font_color : $options['font_color'];
26
- $title_font_weight = empty( $options['font_weight'] ) ? $global_title_font_weight : $options['font_weight'];
27
 
28
- if (!empty($options['schema'])) {
29
- if ($options['schema'] === 'dark') {
30
- $options['block_background'] = '#000000';
31
- $options['font_color'] = '#ffffff';
32
- }
33
-
34
- if ($options['schema'] === 'bright') {
35
- $options['block_background'] = '#ffffff';
36
- $options['font_color'] = '#444444';
37
- }
38
-
39
- if ($options['schema'] === 'red') {
40
- $options['block_background'] = '#c00000';
41
- $options['font_color'] = '#ffffff';
42
- }
43
- }
44
  ?>
45
 
46
  <style>
47
  .title {
48
  padding: 0;
49
- text-align: <?php echo $options['align'] ?>;
50
  font-size: <?php echo $title_font_size ?>px;
51
  font-family: <?php echo $title_font_family ?>;
52
  font-weight: <?php echo $title_font_weight ?>;
@@ -56,6 +55,10 @@ if (!empty($options['schema'])) {
56
  }
57
  </style>
58
 
59
- <div inline-class="title">
60
- <?php echo $options['text'] ?>
61
- </div>
 
 
 
 
6
  */
7
 
8
  $default_options = array(
9
+ 'text' => 'An Awesome Title',
10
+ 'align' => 'center',
11
+ 'block_background' => '',
12
+ 'font_family' => '',
13
+ 'font_size' => '',
14
+ 'font_color' => '',
15
+ 'font_weight' => '',
16
+ 'block_padding_left' => 15,
17
+ 'block_padding_right' => 15,
18
+ 'block_padding_bottom' => 15,
19
+ 'block_padding_top' => 15
20
  );
21
  $options = array_merge($default_options, $options);
22
 
23
+ $title_font_family = empty($options['font_family']) ? $global_title_font_family : $options['font_family'];
24
+ $title_font_size = empty($options['font_size']) ? $global_title_font_size : $options['font_size'];
25
+ $title_font_color = empty($options['font_color']) ? $global_title_font_color : $options['font_color'];
26
+ $title_font_weight = empty($options['font_weight']) ? $global_title_font_weight : $options['font_weight'];
27
 
28
+ //if (!empty($options['schema'])) {
29
+ // if ($options['schema'] === 'dark') {
30
+ // $options['block_background'] = '#000000';
31
+ // $options['font_color'] = '#ffffff';
32
+ // }
33
+ //
34
+ // if ($options['schema'] === 'bright') {
35
+ // $options['block_background'] = '#ffffff';
36
+ // $options['font_color'] = '#444444';
37
+ // }
38
+ //
39
+ // if ($options['schema'] === 'red') {
40
+ // $options['block_background'] = '#c00000';
41
+ // $options['font_color'] = '#ffffff';
42
+ // }
43
+ //}
44
  ?>
45
 
46
  <style>
47
  .title {
48
  padding: 0;
 
49
  font-size: <?php echo $title_font_size ?>px;
50
  font-family: <?php echo $title_font_family ?>;
51
  font-weight: <?php echo $title_font_weight ?>;
55
  }
56
  </style>
57
 
58
+ <table border="0" cellspacing="0" cellpadding="0" width="100%" class="responsive">
59
+ <tr>
60
+ <td align="<?php echo esc_attr($options['align']) ?>" valign="middle" width="100%" inline-class="title">
61
+ <?php echo $options['text'] ?>
62
+ </td>
63
+ </tr>
64
+ </table>
emails/blocks/heading/options.php CHANGED
@@ -2,13 +2,13 @@
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, ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true]) ?>
11
- <?php $fields->select('align', 'Alignment', array('center'=>__('Center'), 'left'=>__('Left'), 'right'=>__('Right'))) ?>
12
 
13
 
14
  <?php $fields->block_commons() ?>
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, ['family_default'=>true, 'size_default'=>true, 'weight_default'=>true]) ?>
11
+ <?php $fields->align() ?>
12
 
13
 
14
  <?php $fields->block_commons() ?>
emails/blocks/hero/block-full.php CHANGED
@@ -44,12 +44,12 @@
44
 
45
  <tr>
46
  <td align="center" inline-class="title">
47
- <span><?php echo $options['title'] ?></span>
48
  </td>
49
  </tr>
50
  <tr>
51
  <td align="center" inline-class="text">
52
- <span><?php echo $options['text'] ?></span>
53
  </td>
54
  </tr>
55
 
44
 
45
  <tr>
46
  <td align="center" inline-class="title">
47
+ <?php echo $options['title'] ?>
48
  </td>
49
  </tr>
50
  <tr>
51
  <td align="center" inline-class="text">
52
+ <?php echo $options['text'] ?>
53
  </td>
54
  </tr>
55
 
emails/blocks/hero/style.min.css DELETED
@@ -1 +0,0 @@
1
- @media all and (max-width:525px){.hero-title{padding-top:15px}}
 
emails/blocks/image/block.php CHANGED
@@ -12,6 +12,7 @@ $defaults = array(
12
  'image' => '',
13
  'url' => '',
14
  'width' => 0,
 
15
  'block_background' => '',
16
  'block_padding_left' => 0,
17
  'block_padding_right' => 0,
@@ -39,7 +40,7 @@ if (empty($options['image']['id'])) {
39
  }
40
  }
41
  } else {
42
- $media = tnp_resize_2x($options['image']['id'], array(600, 0));
43
  // Should never happen but... it happens
44
  if (!$media) {
45
  echo 'The selected media file cannot be processed';
@@ -54,25 +55,24 @@ $media->link = $options['url'];
54
  if (!empty($options['image-alt'])) {
55
  $media->alt = $options['image-alt'];
56
  }
57
- $image_class_name = 'image';
58
-
59
- $img_align = '';
60
- if (isset($options['img_align']) && in_array($options['img_align'], array('left', 'right'))) {
61
- $img_align = 'float: ' . $options['img_align'] .';';
62
- }
63
 
64
  ?>
65
  <style>
66
- .<?php echo $image_class_name ?> {
67
  max-width: 100% !important;
68
  height: auto !important;
69
- display: block;
70
  width: <?php echo $media->width ?>px;
71
  line-height: 0;
72
  margin: 0 auto;
73
- <?php echo $img_align ?>
74
  }
75
  </style>
76
 
77
- <?php echo TNP_Composer::image( $media, [ 'class' => $image_class_name ] ); ?>
 
 
 
 
 
 
78
 
12
  'image' => '',
13
  'url' => '',
14
  'width' => 0,
15
+ 'align' => 'center',
16
  'block_background' => '',
17
  'block_padding_left' => 0,
18
  'block_padding_right' => 0,
40
  }
41
  }
42
  } else {
43
+ $media = tnp_resize_2x($options['image']['id'], [600, 0]);
44
  // Should never happen but... it happens
45
  if (!$media) {
46
  echo 'The selected media file cannot be processed';
55
  if (!empty($options['image-alt'])) {
56
  $media->alt = $options['image-alt'];
57
  }
 
 
 
 
 
 
58
 
59
  ?>
60
  <style>
61
+ .image {
62
  max-width: 100% !important;
63
  height: auto !important;
64
+ display: inline-block;
65
  width: <?php echo $media->width ?>px;
66
  line-height: 0;
67
  margin: 0 auto;
 
68
  }
69
  </style>
70
 
71
+ <table border="0" cellspacing="0" cellpadding="0" width="100%" class="responsive">
72
+ <tr>
73
+ <td align="<?php echo esc_attr($options['align']) ?>" valign="middle" width="100%" style="line-height: 0">
74
+ <?php echo TNP_Composer::image($media, ['class' => $image_class_name]); ?>
75
+ </td>
76
+ </tr>
77
+ </table>
78
 
emails/blocks/image/options.php CHANGED
@@ -16,7 +16,7 @@
16
  <?php $fields->size('width', __('Width', 'newsletter')) ?>
17
  </div>
18
  <div class="tnp-field-col-2">
19
- <?php $fields->select('img_align', __('Image align', 'newsletter'), ['center' => __('Center', 'newsletter'), 'left' => __('Left', 'newsletter'), 'right' => __('Right')]) ?>
20
  </div>
21
  </div>
22
 
16
  <?php $fields->size('width', __('Width', 'newsletter')) ?>
17
  </div>
18
  <div class="tnp-field-col-2">
19
+ <?php $fields->align() ?>
20
  </div>
21
  </div>
22
 
emails/blocks/posts/block.php CHANGED
@@ -125,12 +125,12 @@ $show_date = ! empty( $options['show_date'] );
125
  $show_author = ! empty( $options['show_author'] );
126
 
127
  $title_font_family = empty( $options['title_font_family'] ) ? $global_title_font_family : $options['title_font_family'];
128
- $title_font_size = empty( $options['title_font_size'] ) ? $global_title_font_size : $options['title_font_size'];
129
  $title_font_color = empty( $options['title_font_color'] ) ? $global_title_font_color : $options['title_font_color'];
130
  $title_font_weight = empty( $options['title_font_weight'] ) ? $global_title_font_weight : $options['title_font_weight'];
131
 
132
  $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
133
- $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
134
  $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
135
  $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
136
 
125
  $show_author = ! empty( $options['show_author'] );
126
 
127
  $title_font_family = empty( $options['title_font_family'] ) ? $global_title_font_family : $options['title_font_family'];
128
+ $title_font_size = empty( $options['title_font_size'] ) ? round($global_title_font_size*0.8) : $options['title_font_size'];
129
  $title_font_color = empty( $options['title_font_color'] ) ? $global_title_font_color : $options['title_font_color'];
130
  $title_font_weight = empty( $options['title_font_weight'] ) ? $global_title_font_weight : $options['title_font_weight'];
131
 
132
  $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
133
+ $text_font_size = empty( $options['font_size'] ) ? round($global_text_font_size*0.9) : $options['font_size'];
134
  $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
135
  $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
136
 
emails/blocks/posts/layout-full-post.php CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  <style>
2
  .title {
3
  font-family: <?php echo $title_font_family ?>;
@@ -18,9 +22,9 @@
18
  text-align: left;
19
  }
20
 
21
- .post-date {
22
  font-family: <?php echo $text_font_family ?>;
23
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
24
  font-weight: <?php echo $text_font_weight ?>;
25
  color: <?php echo $text_font_color ?>;
26
  line-height: normal;
@@ -28,98 +32,79 @@
28
  text-align: center;
29
  }
30
 
31
- .post-author {
32
- font-family: <?php echo $text_font_family ?>;
33
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
34
- font-weight: <?php echo $text_font_weight ?>;
35
- color: <?php echo $text_font_color ?>;
36
- line-height: normal;
37
- padding-bottom: 10px;
38
- text-align: center;
39
- }
40
-
41
- .post-button {
42
  padding: 15px 0;
43
  }
44
 
45
  </style>
46
 
47
- <?php foreach ( $posts as $post ) : ?>
48
 
49
- <?php
50
- $size = [ 'width' => 600, 'height' => 0 ];
51
- $url = tnp_post_permalink( $post );
52
 
53
- $media = null;
54
- if ( $show_image ) {
55
- $media = tnp_composer_block_posts_get_media( $post, $size );
56
- if ( $media ) {
57
- $media->link = $url;
58
- }
59
- }
60
 
61
- $author = '';
62
- if ( $show_author ) {
63
- $author_object = get_user_by( 'id', $post->post_author );
64
- if ( $author_object ) {
65
- $author = $author_object->display_name;
66
- }
67
- }
68
 
69
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
 
72
- <table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" class="responsive-table">
73
  <tr>
74
  <td inline-class="title">
75
- <?php echo $post->post_title ?>
76
  </td>
77
  </tr>
78
 
79
- <?php if ( $show_date ) { ?>
80
  <tr>
81
- <td inline-class="post-date">
82
- <?php echo tnp_post_date( $post ) ?>
83
  </td>
84
  </tr>
85
- <?php } ?>
86
 
87
- <?php if ( $show_author ) { ?>
88
  <tr>
89
- <td inline-class="post-author">
90
- <?php echo $author ?>
91
  </td>
92
  </tr>
93
- <?php } ?>
94
-
95
- <tr>
96
- <td>
97
-
98
- <?php if ( $media ) { ?>
99
- <table width="100%" cellpadding="0" cellspacing="0" border="0" style="margin-bottom: 20px">
100
- <tr>
101
- <td align="center">
102
- <?php echo TNP_Composer::image( $media ) ?>
103
- </td>
104
- </tr>
105
- </table>
106
- <?php } ?>
107
 
108
- </td>
109
- </tr>
110
  <tr>
111
  <td>
112
- <?php echo TNP_Composer::post_content( $post ) ?>
113
  </td>
114
  </tr>
115
- <?php if ($show_read_more_button) { ?>
 
116
  <tr>
117
- <td align="center" inline-class="post-button">
118
- <?php $button_options['button_url'] = $url; ?>
119
- <?php echo TNP_Composer::button( $button_options ) ?>
120
  </td>
121
  </tr>
122
- <?php } ?>
123
  </table>
 
124
 
125
- <?php endforeach; ?>
1
+ <?php
2
+ $size = ['width' => 600, 'height' => 0];
3
+ ?>
4
+
5
  <style>
6
  .title {
7
  font-family: <?php echo $title_font_family ?>;
22
  text-align: left;
23
  }
24
 
25
+ .meta {
26
  font-family: <?php echo $text_font_family ?>;
27
+ font-size: <?php echo round($text_font_size * 0.9) ?>px;
28
  font-weight: <?php echo $text_font_weight ?>;
29
  color: <?php echo $text_font_color ?>;
30
  line-height: normal;
32
  text-align: center;
33
  }
34
 
35
+ .button {
 
 
 
 
 
 
 
 
 
 
36
  padding: 15px 0;
37
  }
38
 
39
  </style>
40
 
41
+ <?php foreach ($posts as $post) { ?>
42
 
43
+ <?php
44
+ $url = tnp_post_permalink($post);
 
45
 
46
+ $media = null;
47
+ if ($show_image) {
48
+ $media = tnp_composer_block_posts_get_media($post, $size);
49
+ if ($media) {
50
+ $media->link = $url;
51
+ }
52
+ }
53
 
54
+ $meta = [];
 
 
 
 
 
 
55
 
56
+ if ($show_date) {
57
+ $meta[] = tnp_post_date($post);
58
+ }
59
+
60
+ if ($show_author) {
61
+ $author_object = get_user_by('id', $post->post_author);
62
+ if ($author_object) {
63
+ $meta[] = $author_object->display_name;
64
+ }
65
+ }
66
+
67
+ $button_options['button_url'] = $url;
68
+ ?>
69
 
70
 
71
+ <table border="0" cellpadding="0" align="center" cellspacing="0" width="100%" class="responsive">
72
  <tr>
73
  <td inline-class="title">
74
+ <?php echo $post->post_title ?>
75
  </td>
76
  </tr>
77
 
78
+ <?php if ($meta) { ?>
79
  <tr>
80
+ <td inline-class="meta">
81
+ <?php echo esc_html(implode(' - ', $meta)) ?>
82
  </td>
83
  </tr>
84
+ <?php } ?>
85
 
86
+ <?php if ($media) { ?>
87
  <tr>
88
+ <td align="center">
89
+ <?php echo TNP_Composer::image($media) ?>
90
  </td>
91
  </tr>
92
+ <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
93
 
 
 
94
  <tr>
95
  <td>
96
+ <?php echo TNP_Composer::post_content($post) ?>
97
  </td>
98
  </tr>
99
+
100
+ <?php if ($show_read_more_button) { ?>
101
  <tr>
102
+ <td align="center" inline-class="button">
103
+ <?php echo TNP_Composer::button($button_options) ?>
 
104
  </td>
105
  </tr>
106
+ <?php } ?>
107
  </table>
108
+ <br><br>
109
 
110
+ <?php } ?>
emails/blocks/posts/layout-one-2.php CHANGED
@@ -23,20 +23,13 @@ $column_width = $total_width / 2 - 10;
23
  text-decoration: none;
24
  }
25
 
26
- .date {
27
  font-family: <?php echo $text_font_family ?>;
28
  color: <?php echo $text_font_color ?>;
29
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
30
- font-weight: normal;
31
- padding: 0 0 5px 0;
32
- }
33
-
34
- .author {
35
- font-family: <?php echo $text_font_family ?>;
36
- color: <?php echo $text_font_color ?>;
37
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
38
  font-weight: normal;
39
  padding: 0 0 5px 0;
 
40
  }
41
  </style>
42
 
@@ -46,7 +39,6 @@ $column_width = $total_width / 2 - 10;
46
  <?php foreach ($posts as $post) { ?>
47
  <?php
48
  $url = tnp_post_permalink($post);
49
- $options['button_url'] = $url;
50
 
51
  $media = null;
52
  if ($show_image) {
@@ -56,14 +48,21 @@ $column_width = $total_width / 2 - 10;
56
  $media->set_width($column_width);
57
  }
58
  }
 
 
 
 
 
 
59
 
60
- $author = '';
61
  if ($show_author) {
62
  $author_object = get_user_by('id', $post->post_author);
63
  if ($author_object) {
64
- $author = $author_object->display_name;
65
  }
66
  }
 
 
67
  ?>
68
 
69
  <tr>
@@ -94,27 +93,16 @@ $column_width = $total_width / 2 - 10;
94
  <tr>
95
  <td>
96
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
97
- <?php if ($show_date) { ?>
98
  <tr>
99
- <td align="<?php echo $align_left ?>" inline-class="date">
100
- <?php echo tnp_post_date($post) ?>
101
- </td>
102
- </tr>
103
- <?php } ?>
104
-
105
- <?php if ($show_author) { ?>
106
- <tr>
107
- <td align="<?php echo $align_left ?>" inline-class="author">
108
- <?php echo $author ?>
109
  </td>
110
  </tr>
111
  <?php } ?>
112
 
113
  <tr>
114
- <td align="<?php echo $align_left ?>"
115
- inline-class="post-excerpt"
116
-
117
- data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
118
  <a href="<?php $url ?>" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text">
119
  <?php
120
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $post->ID) ?
@@ -129,7 +117,6 @@ $column_width = $total_width / 2 - 10;
129
  <tr>
130
  <td align="<?php echo $align_left ?>">
131
  <br>
132
- <?php $button_options['button_url'] = $url; ?>
133
  <?php echo TNP_Composer::button($button_options) ?>
134
  </td>
135
  </tr>
23
  text-decoration: none;
24
  }
25
 
26
+ .meta {
27
  font-family: <?php echo $text_font_family ?>;
28
  color: <?php echo $text_font_color ?>;
29
+ font-size: <?php echo round($text_font_size * 0.9) ?>px;
 
 
 
 
 
 
 
 
30
  font-weight: normal;
31
  padding: 0 0 5px 0;
32
+ line-height: normal !important;
33
  }
34
  </style>
35
 
39
  <?php foreach ($posts as $post) { ?>
40
  <?php
41
  $url = tnp_post_permalink($post);
 
42
 
43
  $media = null;
44
  if ($show_image) {
48
  $media->set_width($column_width);
49
  }
50
  }
51
+
52
+ $meta = [];
53
+
54
+ if ($show_date) {
55
+ $meta[] = tnp_post_date($post);
56
+ }
57
 
 
58
  if ($show_author) {
59
  $author_object = get_user_by('id', $post->post_author);
60
  if ($author_object) {
61
+ $meta[] = $author_object->display_name;
62
  }
63
  }
64
+
65
+ $button_options['button_url'] = $url;
66
  ?>
67
 
68
  <tr>
93
  <tr>
94
  <td>
95
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
96
+ <?php if ($meta) { ?>
97
  <tr>
98
+ <td inline-class="meta" dir="<?php echo $dir ?>" align="<?php echo $align_left ?>">
99
+ <?php echo esc_html(implode(' - ', $meta)) ?>
 
 
 
 
 
 
 
 
100
  </td>
101
  </tr>
102
  <?php } ?>
103
 
104
  <tr>
105
+ <td align="<?php echo $align_left ?>" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
 
 
 
106
  <a href="<?php $url ?>" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text">
107
  <?php
108
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $post->ID) ?
117
  <tr>
118
  <td align="<?php echo $align_left ?>">
119
  <br>
 
120
  <?php echo TNP_Composer::button($button_options) ?>
121
  </td>
122
  </tr>
emails/blocks/posts/layout-one.php CHANGED
@@ -4,16 +4,16 @@ $total_width = 600 - $options['block_padding_left'] - $options['block_padding_ri
4
  $column_width = $total_width / 2 - 10;
5
  ?>
6
  <style>
7
- .post-title {
8
  font-family: <?php echo $title_font_family ?>;
9
- font-size: <?php echo $title_font_size ?>px;
10
  font-weight: <?php echo $title_font_weight ?>;
11
  color: <?php echo $title_font_color ?>;
12
- line-height: normal;
13
  padding: 0 0 5px 0;
14
  }
15
 
16
- .post-excerpt {
17
  font-family: <?php echo $text_font_family ?>;
18
  font-size: <?php echo $text_font_size ?>px;
19
  font-weight: <?php echo $text_font_weight ?>;
@@ -22,20 +22,13 @@ $column_width = $total_width / 2 - 10;
22
  padding: 10px 0 15px 0;
23
  }
24
 
25
- .post-date {
26
  font-family: <?php echo $text_font_family ?>;
27
  color: <?php echo $text_font_color ?>;
28
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
29
  font-weight: normal;
30
- padding: 0 0 5px 0;
31
- }
32
-
33
- .post-author {
34
- font-family: <?php echo $text_font_family ?>;
35
- color: <?php echo $text_font_color ?>;
36
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
37
- font-weight: normal;
38
- padding: 0 0 5px 0;
39
  }
40
  </style>
41
 
@@ -45,7 +38,6 @@ $column_width = $total_width / 2 - 10;
45
  <?php foreach ($posts as $post) { ?>
46
  <?php
47
  $url = tnp_post_permalink($post);
48
- $options['button_url'] = $url;
49
 
50
  $media = null;
51
  if ($show_image) {
@@ -56,22 +48,27 @@ $column_width = $total_width / 2 - 10;
56
  }
57
  }
58
 
59
- $author = '';
60
- if ($show_author) {
61
- $author_object = get_user_by('id', $post->post_author);
62
- if ($author_object) {
63
- $author = $author_object->display_name;
64
- }
65
- }
66
 
 
 
 
 
 
 
 
 
67
  ?>
68
 
69
  <tr>
70
-
71
  <td valign="top" style="padding: 20px 0 0 0;" class="td-1">
72
 
73
  <?php if ($media) { ?>
74
- <table width="<?php echo $column_width?>" cellpadding="0" cellspacing="0" border="0" align="left" class="responsive">
75
  <tr>
76
  <td>
77
  <?php echo TNP_Composer::image($media) ?>
@@ -80,32 +77,19 @@ $column_width = $total_width / 2 - 10;
80
  </table>
81
  <?php } ?>
82
 
83
- <table width="<?php echo $media ? $column_width : '100%' ?>" cellpadding="0" cellspacing="0" border="0" class="responsive" align="right">
84
- <tr>
85
- <td>
86
 
87
- <!-- ARTICLE -->
88
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
89
- <?php if ($show_date) { ?>
90
  <tr>
91
- <td align="<?php echo $align_left ?>" inline-class="post-date">
92
- <?php echo tnp_post_date($post) ?>
93
  </td>
94
  </tr>
95
  <?php } ?>
96
 
97
- <?php if ($show_author) { ?>
98
- <tr>
99
- <td align="<?php echo $align_left ?>" inline-class="post-author">
100
- <?php echo $author ?>
101
- </td>
102
- </tr>
103
- <?php } ?>
104
-
105
  <tr>
106
- <td align="<?php echo $align_left ?>"
107
- inline-class="post-title"
108
- class="tnpc-row-edit tnpc-inline-editable"
109
  data-type="title" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
110
  <?php
111
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $post->ID) ?
@@ -114,10 +98,9 @@ $column_width = $total_width / 2 - 10;
114
  ?>
115
  </td>
116
  </tr>
 
117
  <tr>
118
- <td align="<?php echo $align_left ?>"
119
- inline-class="post-excerpt"
120
- class="padding-copy tnpc-row-edit tnpc-inline-editable"
121
  data-type="text" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
122
  <?php
123
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $post->ID) ?
@@ -126,20 +109,19 @@ $column_width = $total_width / 2 - 10;
126
  ?>
127
  </td>
128
  </tr>
129
- <?php if ($show_read_more_button) { ?>
 
130
  <tr>
131
- <td align="<?php echo $align_left ?>" class="padding">
132
- <?php $button_options['button_url'] = $url; ?>
133
- <?php echo TNP_Composer::button( $button_options ) ?>
134
  <br><br>
135
  </td>
136
  </tr>
137
- <?php } ?>
138
  </table>
139
 
140
- </td>
141
- </tr>
142
- </table>
143
 
144
  </td>
145
  </tr>
4
  $column_width = $total_width / 2 - 10;
5
  ?>
6
  <style>
7
+ .title {
8
  font-family: <?php echo $title_font_family ?>;
9
+ font-size: <?php echo round($title_font_size*0.9) ?>px;
10
  font-weight: <?php echo $title_font_weight ?>;
11
  color: <?php echo $title_font_color ?>;
12
+ line-height: normal !important;
13
  padding: 0 0 5px 0;
14
  }
15
 
16
+ .excerpt {
17
  font-family: <?php echo $text_font_family ?>;
18
  font-size: <?php echo $text_font_size ?>px;
19
  font-weight: <?php echo $text_font_weight ?>;
22
  padding: 10px 0 15px 0;
23
  }
24
 
25
+ .meta {
26
  font-family: <?php echo $text_font_family ?>;
27
  color: <?php echo $text_font_color ?>;
28
+ font-size: <?php echo round($text_font_size * 0.9) ?>px;
29
  font-weight: normal;
30
+ padding: 0 0 10px 0;
31
+ line-height: normal !important;
 
 
 
 
 
 
 
32
  }
33
  </style>
34
 
38
  <?php foreach ($posts as $post) { ?>
39
  <?php
40
  $url = tnp_post_permalink($post);
 
41
 
42
  $media = null;
43
  if ($show_image) {
48
  }
49
  }
50
 
51
+ $meta = [];
52
+
53
+ if ($show_date) {
54
+ $meta[] = tnp_post_date($post);
55
+ }
 
 
56
 
57
+ if ($show_author) {
58
+ $author_object = get_user_by('id', $post->post_author);
59
+ if ($author_object) {
60
+ $meta[] = $author_object->display_name;
61
+ }
62
+ }
63
+
64
+ $button_options['button_url'] = $url;
65
  ?>
66
 
67
  <tr>
 
68
  <td valign="top" style="padding: 20px 0 0 0;" class="td-1">
69
 
70
  <?php if ($media) { ?>
71
+ <table width="<?php echo $column_width ?>" cellpadding="0" cellspacing="0" border="0" align="left" class="responsive">
72
  <tr>
73
  <td>
74
  <?php echo TNP_Composer::image($media) ?>
77
  </table>
78
  <?php } ?>
79
 
80
+ <table width="<?php echo $media ? $column_width : '100%' ?>" cellpadding="0" cellspacing="0" border="0" class="responsive" align="right"><tr><td>
 
 
81
 
 
82
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
83
+ <?php if ($meta) { ?>
84
  <tr>
85
+ <td inline-class="meta" dir="<?php echo $dir ?>" align="<?php echo $align_left ?>">
86
+ <?php echo esc_html(implode(' - ', $meta)) ?>
87
  </td>
88
  </tr>
89
  <?php } ?>
90
 
 
 
 
 
 
 
 
 
91
  <tr>
92
+ <td align="<?php echo $align_left ?>" inline-class="title" class="tnpc-row-edit tnpc-inline-editable"
 
 
93
  data-type="title" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
94
  <?php
95
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $post->ID) ?
98
  ?>
99
  </td>
100
  </tr>
101
+
102
  <tr>
103
+ <td align="<?php echo $align_left ?>" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable"
 
 
104
  data-type="text" data-id="<?php echo $post->ID ?>" dir="<?php echo $dir ?>">
105
  <?php
106
  echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $post->ID) ?
109
  ?>
110
  </td>
111
  </tr>
112
+
113
+ <?php if ($show_read_more_button) { ?>
114
  <tr>
115
+ <td align="<?php echo $align_left ?>">
116
+ <br>
117
+ <?php echo TNP_Composer::button($button_options) ?>
118
  <br><br>
119
  </td>
120
  </tr>
121
+ <?php } ?>
122
  </table>
123
 
124
+ </td></tr></table>
 
 
125
 
126
  </td>
127
  </tr>
emails/blocks/posts/layout-two.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
  $size = array('width' => 240, 'height' => 160, "crop" => true);
 
 
3
  ?>
4
  <style>
5
  .title {
@@ -20,21 +22,15 @@ $size = array('width' => 240, 'height' => 160, "crop" => true);
20
  padding: 5px 0 0 0;
21
  }
22
 
23
- .date {
24
  font-family: <?php echo $text_font_family ?>;
25
  color: <?php echo $text_font_color ?>;
26
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
27
  font-weight: normal;
28
  padding: 10px 0 0 0;
 
29
  }
30
 
31
- .author {
32
- font-family: <?php echo $text_font_family ?>;
33
- color: <?php echo $text_font_color ?>;
34
- font-size: <?php echo round($text_font_size * 0.8) ?>px;
35
- font-weight: normal;
36
- padding: 10px 0 0 0;
37
- }
38
  </style>
39
 
40
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
@@ -45,155 +41,145 @@ $size = array('width' => 240, 'height' => 160, "crop" => true);
45
  if ($show_image) {
46
  $media = tnp_composer_block_posts_get_media($row[0], $size, $image_placeholder_url);
47
  $media->link = tnp_post_permalink($row[0]);
 
 
 
 
 
 
 
48
  }
49
 
50
- $author = '';
51
  if ($show_author) {
52
  $author_object = get_user_by('id', $row[0]->post_author);
53
  if ($author_object) {
54
- $author = $author_object->display_name;
55
  }
56
  }
57
 
58
  $button_options['button_url'] = tnp_post_permalink($row[0]);
59
  ?>
60
  <tr>
61
- <td style="padding: 10px;" class="mobile-wrapper two-columns">
62
 
63
 
64
- <table cellpadding="0" cellspacing="0" border="0" width="47%" align="left" class="responsive">
 
 
 
 
 
 
 
65
  <tr>
66
- <td style="padding: 20px 0 40px 0;">
67
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
68
- <?php if ($media) { ?>
69
- <tr>
70
- <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
71
- <?php echo TNP_Composer::image($media) ?>
72
- </td>
73
- </tr>
74
- <?php } ?>
75
- <tr>
76
- <td align="center" inline-class="title" class="tnpc-row-edit tnpc-inline-editable" data-type="title" data-id="<?php echo $row[0]->ID ?>">
77
- <?php
78
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[0]->ID) ?
79
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[0]->ID) :
80
- tnp_post_title($row[0])
81
- ?>
82
- </td>
83
- </tr>
84
- <?php if ($show_date) { ?>
85
- <tr>
86
- <td align="center" inline-class="date">
87
- <?php echo tnp_post_date($row[0]) ?>
88
- </td>
89
- </tr>
90
- <?php } ?>
91
-
92
- <?php if ($author) { ?>
93
- <tr>
94
- <td align="center" inline-class="author">
95
- <?php echo esc_html($author) ?>
96
- </td>
97
- </tr>
98
- <?php } ?>
99
-
100
- <tr>
101
- <td align="center" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text" data-id="<?php echo $row[0]->ID ?>">
102
- <?php
103
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[0]->ID) ?
104
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[0]->ID) :
105
- tnp_post_excerpt($row[0], $excerpt_length)
106
- ?>
107
- </td>
108
- </tr>
109
- <?php if ($show_read_more_button) { ?>
110
- <tr>
111
- <td align="center">
112
- <br><?php echo TNP_Composer::button($button_options) ?><br><br>
113
- </td>
114
- </tr>
115
- <?php } ?>
116
- </table>
117
  </td>
118
  </tr>
119
- </table>
 
 
 
 
 
 
 
120
 
121
- <?php
122
- if (!isset($row[1])) {
123
- continue;
124
- }
125
- $media = null;
126
- if ($show_image) {
127
- $media = tnp_composer_block_posts_get_media($row[1], $size, $image_placeholder_url);
128
- $media->link = tnp_post_permalink($row[1]);
129
- }
130
-
131
- $author = '';
132
- if ($show_author) {
133
- $author_object = get_user_by('id', $row[1]->post_author);
134
- if ($author_object) {
135
- $author = $author_object->display_name;
136
- }
137
- }
138
 
139
- $button_options['button_url'] = tnp_post_permalink($row[1]);
140
- ?>
141
- <table cellpadding="0" cellspacing="0" border="0" width="47%" align="right" class="responsive">
142
  <tr>
143
- <td style="padding: 20px 0 40px 0;">
144
- <table cellpadding="0" cellspacing="0" border="0" width="100%">
145
- <?php if ($media) { ?>
146
- <tr>
147
- <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
148
- <?php echo TNP_Composer::image($media) ?>
149
- </td>
150
- </tr>
151
- <?php } ?>
152
- <tr>
153
- <td align="center" inline-class="title" class="tnpc-row-edit tnpc-inline-editable" data-type="title" data-id="<?php echo $row[1]->ID ?>">
154
- <?php
155
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[1]->ID) ?
156
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[1]->ID) :
157
- tnp_post_title($row[1])
158
- ?>
159
- </td>
160
- </tr>
161
- <?php if ($show_date) { ?>
162
- <tr>
163
- <td align="center" inline-class="date">
164
- <?php echo tnp_post_date($row[1]) ?>
165
- </td>
166
- </tr>
167
- <?php } ?>
168
-
169
- <?php if ($author) { ?>
170
- <tr>
171
- <td align="center" inline-class="author">
172
- <?php echo esc_html($author) ?>
173
- </td>
174
- </tr>
175
- <?php } ?>
176
-
177
- <tr>
178
- <td align="center" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text" data-id="<?php echo $row[1]->ID ?>">
179
- <?php
180
- echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[1]->ID) ?
181
- TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[1]->ID) :
182
- tnp_post_excerpt($row[1], $excerpt_length)
183
- ?>
184
- </td>
185
- </tr>
186
- <?php if ($show_read_more_button) { ?>
187
- <tr>
188
- <td align="center">
189
- <br><?php echo TNP_Composer::button($button_options) ?><br><br>
190
- </td>
191
- </tr>
192
- <?php } ?>
193
- </table>
194
  </td>
195
  </tr>
 
 
 
 
 
 
 
196
  </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
 
198
 
199
  </td>
1
  <?php
2
  $size = array('width' => 240, 'height' => 160, "crop" => true);
3
+ $total_width = 600 - $options['block_padding_left'] - $options['block_padding_right'];
4
+ $column_width = $total_width / 2 - 20;
5
  ?>
6
  <style>
7
  .title {
22
  padding: 5px 0 0 0;
23
  }
24
 
25
+ .meta {
26
  font-family: <?php echo $text_font_family ?>;
27
  color: <?php echo $text_font_color ?>;
28
+ font-size: <?php echo round($text_font_size * 0.9) ?>px;
29
  font-weight: normal;
30
  padding: 10px 0 0 0;
31
+ font-style: italic;
32
  }
33
 
 
 
 
 
 
 
 
34
  </style>
35
 
36
  <table cellspacing="0" cellpadding="0" border="0" width="100%">
41
  if ($show_image) {
42
  $media = tnp_composer_block_posts_get_media($row[0], $size, $image_placeholder_url);
43
  $media->link = tnp_post_permalink($row[0]);
44
+ $media->set_width($column_width);
45
+ }
46
+
47
+ $meta = [];
48
+
49
+ if ($show_date) {
50
+ $meta[] = tnp_post_date($row[0]);
51
  }
52
 
 
53
  if ($show_author) {
54
  $author_object = get_user_by('id', $row[0]->post_author);
55
  if ($author_object) {
56
+ $meta[] = $author_object->display_name;
57
  }
58
  }
59
 
60
  $button_options['button_url'] = tnp_post_permalink($row[0]);
61
  ?>
62
  <tr>
63
+ <td style="padding-right: 10px" width="50%" valign="top" class="responsive">
64
 
65
 
66
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
67
+ <?php if ($media) { ?>
68
+ <tr>
69
+ <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
70
+ <?php echo TNP_Composer::image($media) ?>
71
+ </td>
72
+ </tr>
73
+ <?php } ?>
74
  <tr>
75
+ <td align="center" inline-class="title" class="tnpc-row-edit tnpc-inline-editable" data-type="title" data-id="<?php echo $row[0]->ID ?>">
76
+ <?php
77
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[0]->ID) ?
78
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[0]->ID) :
79
+ tnp_post_title($row[0])
80
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  </td>
82
  </tr>
83
+ <?php if ($meta) { ?>
84
+ <tr>
85
+ <td inline-class="meta">
86
+ <?php echo esc_html(implode(' - ', $meta)) ?>
87
+ </td>
88
+ </tr>
89
+ <?php } ?>
90
+
91
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
 
 
 
 
93
  <tr>
94
+ <td align="center" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text" data-id="<?php echo $row[0]->ID ?>">
95
+ <?php
96
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[0]->ID) ?
97
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[0]->ID) :
98
+ tnp_post_excerpt($row[0], $excerpt_length)
99
+ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  </td>
101
  </tr>
102
+ <?php if ($show_read_more_button) { ?>
103
+ <tr>
104
+ <td align="center">
105
+ <br><?php echo TNP_Composer::button($button_options) ?><br><br>
106
+ </td>
107
+ </tr>
108
+ <?php } ?>
109
  </table>
110
+ </td>
111
+
112
+ <td style="padding-left: 10px" width="50%" valign="top" class="responsive">
113
+ <?php
114
+ if (isset($row[1])) {
115
+
116
+ $media = null;
117
+ if ($show_image) {
118
+ $media = tnp_composer_block_posts_get_media($row[1], $size, $image_placeholder_url);
119
+ $media->link = tnp_post_permalink($row[1]);
120
+ $media->set_width($column_width);
121
+ }
122
+
123
+ $meta = [];
124
+
125
+ if ($show_date) {
126
+ $meta[] = tnp_post_date($row[1]);
127
+ }
128
+
129
+ if ($show_author) {
130
+ $author_object = get_user_by('id', $row[1]->post_author);
131
+ if ($author_object) {
132
+ $meta[] = $author_object->display_name;
133
+ }
134
+ }
135
+
136
+ $button_options['button_url'] = tnp_post_permalink($row[1]);
137
+ ?>
138
+
139
+
140
+ <table cellpadding="0" cellspacing="0" border="0" width="100%">
141
+ <?php if ($media) { ?>
142
+ <tr>
143
+ <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
144
+ <?php echo TNP_Composer::image($media) ?>
145
+ </td>
146
+ </tr>
147
+ <?php } ?>
148
+ <tr>
149
+ <td align="center" inline-class="title" class="tnpc-row-edit tnpc-inline-editable" data-type="title" data-id="<?php echo $row[1]->ID ?>">
150
+ <?php
151
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'title', $row[1]->ID) ?
152
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'title', $row[1]->ID) :
153
+ tnp_post_title($row[1])
154
+ ?>
155
+ </td>
156
+ </tr>
157
+ <?php if ($meta) { ?>
158
+ <tr>
159
+ <td inline-class="meta">
160
+ <?php echo esc_html(implode(' - ', $meta)) ?>
161
+ </td>
162
+ </tr>
163
+ <?php } ?>
164
+
165
+ <tr>
166
+ <td align="center" inline-class="excerpt" class="tnpc-row-edit tnpc-inline-editable" data-type="text" data-id="<?php echo $row[1]->ID ?>">
167
+ <?php
168
+ echo TNP_Composer::is_post_field_edited_inline($options['inline_edits'], 'text', $row[1]->ID) ?
169
+ TNP_Composer::get_edited_inline_post_field($options['inline_edits'], 'text', $row[1]->ID) :
170
+ tnp_post_excerpt($row[1], $excerpt_length)
171
+ ?>
172
+ </td>
173
+ </tr>
174
+ <?php if ($show_read_more_button) { ?>
175
+ <tr>
176
+ <td align="center">
177
+ <br><?php echo TNP_Composer::button($button_options) ?><br><br>
178
+ </td>
179
+ </tr>
180
+ <?php } ?>
181
+ </table>
182
+ <?php } ?>
183
 
184
 
185
  </td>
emails/blocks/posts/options.php CHANGED
@@ -43,10 +43,8 @@ if (class_exists('NewsletterExtensions')) {
43
 
44
  <?php } ?>
45
 
46
- <div class="tnp-field-row">
47
- <label class="tnp-row-label"><?php _e( 'Layout', 'newsletter' ) ?></label>
48
- <div class="tnp-field-col-2">
49
- <?php $fields->select( 'layout', '',
50
  array(
51
  'one' => __( 'One column', 'newsletter' ),
52
  'one-2' => __( 'One column variant', 'newsletter' ),
@@ -55,20 +53,19 @@ if (class_exists('NewsletterExtensions')) {
55
  'full-post' => __( 'Full post', 'newsletter' )
56
  ) )
57
  ?>
58
- </div>
59
- <div class="tnp-field-col-2">
60
- <?php $fields->checkbox( 'show_image', __( 'Show image', 'newsletter' ) ) ?>
61
- </div>
62
- </div>
63
 
64
  <div class="tnp-field-row">
65
  <label class="tnp-row-label"><?php _e('Post info', 'newsletter') ?></label>
66
- <div class="tnp-field-col-2">
67
  <?php $fields->checkbox('show_date', __('Show date', 'newsletter')) ?>
68
  </div>
69
- <div class="tnp-field-col-2">
70
  <?php $fields->checkbox('show_author', __('Show author', 'newsletter')) ?>
71
  </div>
 
 
 
72
  <div style="clear: both"></div>
73
  </div>
74
 
43
 
44
  <?php } ?>
45
 
46
+
47
+ <?php $fields->select( 'layout', __( 'Layout', 'newsletter' ),
 
 
48
  array(
49
  'one' => __( 'One column', 'newsletter' ),
50
  'one-2' => __( 'One column variant', 'newsletter' ),
53
  'full-post' => __( 'Full post', 'newsletter' )
54
  ) )
55
  ?>
56
+
 
 
 
 
57
 
58
  <div class="tnp-field-row">
59
  <label class="tnp-row-label"><?php _e('Post info', 'newsletter') ?></label>
60
+ <div class="tnp-field-col-3">
61
  <?php $fields->checkbox('show_date', __('Show date', 'newsletter')) ?>
62
  </div>
63
+ <div class="tnp-field-col-3">
64
  <?php $fields->checkbox('show_author', __('Show author', 'newsletter')) ?>
65
  </div>
66
+ <div class="tnp-field-col-3">
67
+ <?php $fields->checkbox( 'show_image', __( 'Show image', 'newsletter' ) ) ?>
68
+ </div>
69
  <div style="clear: both"></div>
70
  </div>
71
 
emails/blocks/posts/style.min.css DELETED
@@ -1 +0,0 @@
1
- @media(max-width:525px){.posts-1-column{width:100%!important}.posts-1-image{width:100%!important;display:block}}
 
emails/blocks/preheader/block.php CHANGED
@@ -9,11 +9,11 @@
9
  /* @var $options array */
10
  /* @var $wpdb wpdb */
11
 
12
- $default_options = array(
13
  'view' => 'View online',
14
  'text' => 'Few words summary',
15
  'font_family' => '',
16
- 'font_size' => 14,
17
  'font_color' => '',
18
  'font_weight' => '',
19
  'block_padding_left'=>15,
@@ -23,28 +23,23 @@ $default_options = array(
23
  'block_background' => '',
24
  );
25
 
26
- $options = array_merge($default_options, $options);
27
 
28
  $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
29
- $text_font_size = empty( $options['font_size'] ) ? $global_text_font_size : $options['font_size'];
30
  $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
31
  $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
32
 
33
  ?>
34
  <style>
35
- .preheader-table {
36
- width: 100%!important
37
- border: 0;
38
- border-collapse: collapse;
39
- }
40
- .preheader-link {
41
  font-family: <?php echo $text_font_family ?>;
42
  font-size: <?php echo $text_font_size ?>px;
43
  font-weight: <?php echo $text_font_weight ?>;
44
  color: <?php echo $text_font_color ?>;
45
- padding: 10px;
46
  }
47
- .preheader-view-link {
48
  font-family: <?php echo $text_font_family ?>;
49
  font-size: <?php echo $text_font_size ?>px;
50
  font-weight: <?php echo $text_font_weight ?>;
@@ -53,13 +48,13 @@ $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight
53
  }
54
  </style>
55
 
56
- <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0" inline-class="preheader-table">
57
  <tr>
58
- <td class="preheader-link" width="50%" valign="top" align="left">
59
  <?php echo $options['text'] ?>
60
  </td>
61
- <td class="preheader-link" width="50%" valign="top" align="right">
62
- <a href="{email_url}" target="_blank" rel="noopener" class="preheader-view-link"><?php echo $options['view'] ?></a>
63
  </td>
64
  </tr>
65
  </table>
9
  /* @var $options array */
10
  /* @var $wpdb wpdb */
11
 
12
+ $defaults = array(
13
  'view' => 'View online',
14
  'text' => 'Few words summary',
15
  'font_family' => '',
16
+ 'font_size' => '',
17
  'font_color' => '',
18
  'font_weight' => '',
19
  'block_padding_left'=>15,
23
  'block_background' => '',
24
  );
25
 
26
+ $options = array_merge($defaults, $options);
27
 
28
  $text_font_family = empty( $options['font_family'] ) ? $global_text_font_family : $options['font_family'];
29
+ $text_font_size = empty( $options['font_size'] ) ? round($global_text_font_size*0.9) : $options['font_size'];
30
  $text_font_color = empty( $options['font_color'] ) ? $global_text_font_color : $options['font_color'];
31
  $text_font_weight = empty( $options['font_weight'] ) ? $global_text_font_weight : $options['font_weight'];
32
 
33
  ?>
34
  <style>
35
+ .td {
 
 
 
 
 
36
  font-family: <?php echo $text_font_family ?>;
37
  font-size: <?php echo $text_font_size ?>px;
38
  font-weight: <?php echo $text_font_weight ?>;
39
  color: <?php echo $text_font_color ?>;
40
+ line-height: normal !important;
41
  }
42
+ .link {
43
  font-family: <?php echo $text_font_family ?>;
44
  font-size: <?php echo $text_font_size ?>px;
45
  font-weight: <?php echo $text_font_weight ?>;
48
  }
49
  </style>
50
 
51
+ <table width="100%" border="0" cellpadding="0" cellspacing="0" class="responsive">
52
  <tr>
53
+ <td inline-class="td" width="50%" valign="top" align="left">
54
  <?php echo $options['text'] ?>
55
  </td>
56
+ <td inline-class="td" width="50%" valign="top" align="right">
57
+ <a href="{email_url}" target="_blank" rel="noopener" inline-class="link"><?php echo $options['view'] ?></a>
58
  </td>
59
  </tr>
60
  </table>
emails/blocks/social/block.php CHANGED
@@ -7,116 +7,38 @@
7
  */
8
 
9
  /* @var $options array */
10
- /* @var $wpdb wpdb */
11
 
12
- $default_options = array(
13
  'block_padding_left' => 15,
14
  'block_padding_right' => 15,
15
  'block_padding_bottom' => 15,
16
  'block_padding_top' => 15,
17
- 'block_background'=> ''
18
  );
19
- $options = array_merge($default_options, $options);
20
 
21
  $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
22
- $configured = false;
23
- ?>
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
- <table border="0" cellspacing="0" cellpadding="0" align="center" class="responsive-table">
27
  <tr>
28
- <td align="center">
29
- <?php
30
- if (!empty($block_options['facebook_url'])) {
31
- $configured = true;
32
- ?>
33
- <span class="tnpc-row-edit" data-type="image">
34
- <a href="<?php echo esc_url($block_options['facebook_url']) ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
35
- </span>
36
- <?php } ?>
37
- <?php
38
- if (!empty($block_options['twitter_url'])) {
39
- $configured = true;
40
- ?>
41
- <span class="tnpc-row-edit" data-type="image">
42
- <a href="<?php echo esc_url($block_options['twitter_url']) ?>"><img src="<?php echo $social_icon_url ?>/twitter.png" alt="Twitter"></a>
43
- </span>
44
- <?php } ?>
45
- <?php
46
- if (!empty($block_options['pinterest_url'])) {
47
- $configured = true;
48
- ?>
49
- <span class="tnpc-row-edit" data-type="image">
50
- <a href="<?php echo esc_url($block_options['pinterest_url']) ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png" alt="Pinterest"></a>
51
- </span>
52
- <?php } ?>
53
- <?php
54
- if (!empty($block_options['linkedin_url'])) {
55
- $configured = true;
56
- ?>
57
- <span class="tnpc-row-edit" data-type="image">
58
- <a href="<?php echo esc_url($block_options['linkedin_url']) ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png" alt="LinkedIn"></a>
59
- </span>
60
- <?php } ?>
61
- <?php
62
- if (!empty($block_options['tumblr_url'])) {
63
- $configured = true;
64
- ?>
65
- <span class="tnpc-row-edit" data-type="image">
66
- <a href="<?php echo esc_url($block_options['tumblr_url']) ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png" alt="Tumblr"></a>
67
- </span>
68
- <?php } ?>
69
- <?php
70
- if (!empty($block_options['youtube_url'])) {
71
- $configured = true;
72
- ?>
73
- <span class="tnpc-row-edit" data-type="image">
74
- <a href="<?php echo esc_url($block_options['youtube_url']) ?>"><img src="<?php echo $social_icon_url ?>/youtube.png" alt="Youtube"></a>
75
- </span>
76
- <?php } ?>
77
- <?php
78
- if (!empty($block_options['soundcloud_url'])) {
79
- $configured = true;
80
- ?>
81
- <span class="tnpc-row-edit" data-type="image">
82
- <a href="<?php echo esc_url($block_options['soundcloud_url']) ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
83
- </span>
84
- <?php } ?>
85
- <?php
86
- if (!empty($block_options['instagram_url'])) {
87
- $configured = true;
88
- ?>
89
- <span class="tnpc-row-edit" data-type="image">
90
- <a href="<?php echo esc_url($block_options['instagram_url']) ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
91
- </span>
92
- <?php } ?>
93
- <?php
94
- if (!empty($block_options['vimeo_url'])) {
95
- $configured = true;
96
- ?>
97
- <span class="tnpc-row-edit" data-type="image">
98
- <a href="<?php echo esc_url($block_options['vimeo_url']) ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
99
- </span>
100
- <?php } ?>
101
- <?php
102
- if (!empty($block_options['telegram_url'])) {
103
- $configured = true;
104
- ?>
105
- <span class="tnpc-row-edit" data-type="image">
106
- <a href="<?php echo esc_url($block_options['telegram_url']) ?>"><img src="<?php echo $social_icon_url ?>/telegram.png" alt="Telegram"></a>
107
- </span>
108
- <?php } ?>
109
- <?php
110
- if (!empty($block_options['vk_url'])) {
111
- $configured = true;
112
- ?>
113
- <span class="tnpc-row-edit" data-type="image">
114
- <a href="<?php echo esc_url($block_options['vk_url']) ?>"><img src="<?php echo $social_icon_url ?>/vk.png" alt="VK"></a>
115
- </span>
116
- <?php } ?>
117
- <?php if (!$configured) { ?>
118
- <p>Configure your social links in the <a href="?page=newsletter_main_info">Social configuration section</a>.<br/>
119
- Then remove and add again this block.</p>
120
  <?php } ?>
121
  </td>
122
  </tr>
7
  */
8
 
9
  /* @var $options array */
 
10
 
11
+ $defaults = array(
12
  'block_padding_left' => 15,
13
  'block_padding_right' => 15,
14
  'block_padding_bottom' => 15,
15
  'block_padding_top' => 15,
16
+ 'block_background' => ''
17
  );
18
+ $options = array_merge($defaults, $options);
19
 
20
  $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
 
 
21
 
22
+ $socials = ['facebook', 'twitter', 'pinterest', 'linkedin', 'tumblr', 'youtube', 'soundcloud', 'instagram', 'vimeo', 'telegram', 'vk'];
23
+
24
+ $valid_socials = [];
25
+ foreach ($socials as &$social) {
26
+ if (!empty($block_options[$social . '_url'])) {
27
+ $valid_socials[] = $social;
28
+ }
29
+ }
30
+
31
+ if (!$valid_socials) {
32
+ echo '<p>Configure your social links in the <a href="?page=newsletter_main_info" target="_blank">social configuration section</a></p>';
33
+ return;
34
+ }
35
+ ?>
36
 
37
+ <table border="0" cellspacing="0" cellpadding="0" width="100%" class="responsive">
38
  <tr>
39
+ <td align="center" valign="middle" width="100%" style="line-height: 0">
40
+ <?php foreach ($valid_socials as &$social) { ?>
41
+ <a href="<?php echo esc_url($block_options[$social . '_url']) ?>"><img src="<?php echo $social_icon_url ?>/<?php echo $social ?>.png" alt="<?php echo $social ?>"></a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  <?php } ?>
43
  </td>
44
  </tr>
emails/composer.php CHANGED
@@ -24,6 +24,13 @@ if ($controls->is_action()) {
24
  $email->subject = $module->sanitize_preset_name($controls->data['subject']);
25
  $email->message = $controls->data['message'];
26
 
 
 
 
 
 
 
 
27
  $email = Newsletter::instance()->save_email($email);
28
 
29
  $redirect = $module->get_admin_page_url('composer');
@@ -45,6 +52,13 @@ if ($controls->is_action()) {
45
 
46
  $email = Newsletter::instance()->save_email($email);
47
 
 
 
 
 
 
 
 
48
  $redirect = $module->get_admin_page_url('composer');
49
  $controls->js_redirect($redirect);
50
 
24
  $email->subject = $module->sanitize_preset_name($controls->data['subject']);
25
  $email->message = $controls->data['message'];
26
 
27
+ //Save Global Style options
28
+ foreach ($controls->data as $name => $value) {
29
+ if (strpos($name, 'options_composer_') === 0) {
30
+ $email->options[substr($name, 8)] = $value;
31
+ }
32
+ }
33
+
34
  $email = Newsletter::instance()->save_email($email);
35
 
36
  $redirect = $module->get_admin_page_url('composer');
52
 
53
  $email = Newsletter::instance()->save_email($email);
54
 
55
+ //Save Global Style options
56
+ foreach ($controls->data as $name => $value) {
57
+ if (strpos($name, 'options_composer_') === 0) {
58
+ $email->options[substr($name, 8)] = $value;
59
+ }
60
+ }
61
+
62
  $redirect = $module->get_admin_page_url('composer');
63
  $controls->js_redirect($redirect);
64
 
emails/emails.php CHANGED
@@ -5,186 +5,207 @@ defined('ABSPATH') || exit;
5
  class NewsletterEmails extends NewsletterModule
6
  {
7
 
8
- static $instance;
9
 
10
- const EDITOR_COMPOSER = 2;
11
- const EDITOR_HTML = 1;
12
- const EDITOR_TINYMCE = 0;
13
 
14
- static $PRESETS_LIST;
15
- const PRESET_EMAIL_TYPE = 'composer_template';
16
 
17
- // Cache
18
- var $blocks = null;
19
 
20
- /**
21
- * @return NewsletterEmails
22
- */
23
- static function instance()
24
- {
25
- if (self::$instance == null) {
26
- self::$instance = new NewsletterEmails();
27
- }
28
- return self::$instance;
29
- }
30
 
31
- function __construct()
32
- {
33
- self::$PRESETS_LIST = array("cta", "invite", "announcement", "posts", "sales", "product", "tour", "simple");
34
- $this->themes = new NewsletterThemes('emails');
35
- parent::__construct('emails', '1.1.5');
36
- add_action('newsletter_action', array($this, 'hook_newsletter_action'), 13, 3);
37
-
38
- if (is_admin()) {
39
- add_action('wp_ajax_tnpc_render', array($this, 'tnpc_render_callback'));
40
- add_action('wp_ajax_tnpc_preview', array($this, 'tnpc_preview_callback'));
41
- add_action('wp_ajax_tnpc_css', array($this, 'tnpc_css_callback'));
42
- add_action('wp_ajax_tnpc_options', array($this, 'hook_wp_ajax_tnpc_options'));
43
- add_action('wp_ajax_tnpc_presets', array($this, 'hook_wp_ajax_tnpc_presets'));
44
- add_action('wp_ajax_tnpc_delete_preset', array($this, 'hook_wp_ajax_tnpc_delete_preset'));
45
- add_action('wp_ajax_tnpc_regenerate_email', array($this, 'hook_wp_ajax_tnpc_regenerate_email'));
46
-
47
- // Thank you to plugins which add the WP editor on other admin plugin pages...
48
- if (isset($_GET['page']) && $_GET['page'] == 'newsletter_emails_edit') {
49
- global $wp_actions;
50
- $wp_actions['wp_enqueue_editor'] = 1;
51
- }
52
- }
53
- }
54
 
55
- function options_decode($options)
56
- {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
 
58
- // Start compatibility
59
- if (is_string($options) && strpos($options, 'options[') !== false) {
60
- $opts = array();
61
- parse_str($options, $opts);
62
- $options = $opts['options'];
63
- }
64
- // End compatibility
65
 
66
- if (is_array($options)) {
67
- return $options;
68
- }
 
 
 
 
69
 
70
- $tmp = json_decode($options, true);
71
- if (is_null($tmp)) {
72
- return json_decode(base64_decode($options), true);
73
- } else {
74
- return $tmp;
75
- }
76
- }
77
 
78
- /**
79
- *
80
- * @param array $options Options array
81
- */
82
- function options_encode($options)
83
- {
84
- return base64_encode(json_encode($options, JSON_HEX_TAG | JSON_HEX_AMP));
85
- }
86
 
87
- function hook_wp_ajax_tnpc_options()
88
- {
89
- global $wpdb;
 
 
 
 
90
 
91
- // TODO: Uniform to use id everywhere
92
- if (!isset($_REQUEST['id']))
93
- $_REQUEST['id'] = $_REQUEST['b'];
94
 
95
- $block = $this->get_block($_REQUEST['id']);
96
- if (!$block) {
97
- die('Block not found with id ' . esc_html($_REQUEST['id']));
98
- }
99
 
100
- if (!class_exists('NewsletterControls')) {
101
- include NEWSLETTER_INCLUDES_DIR . '/controls.php';
102
- }
 
103
 
104
- $options = $this->options_decode(stripslashes_deep($_REQUEST['options']));
105
- $composer = isset($_POST['composer']) ? $_POST['composer'] : [];
 
106
 
107
- $context = array('type' => '');
108
- if (isset($_REQUEST['context_type'])) {
109
- $context['type'] = $_REQUEST['context_type'];
110
- }
111
 
112
- $controls = new NewsletterControls($options);
113
- $fields = new NewsletterFields($controls);
 
 
114
 
115
- $controls->init();
116
- echo '<input type="hidden" name="action" value="tnpc_render">';
117
- echo '<input type="hidden" name="b" value="' . esc_attr($_REQUEST['id']) . '">';
118
- echo '<input type="hidden" name="context_type" value="' . esc_attr($context['type']) . '">';
119
- $inline_edits = '';
120
- if (isset($controls->data['inline_edits'])) {
121
- $inline_edits = $controls->data['inline_edits'];
122
- }
123
- echo '<input type="hidden" name="options[inline_edits]" value="' . $this->options_encode($inline_edits) . '">';
124
 
125
- ob_start();
126
- include $block['dir'] . '/options.php';
127
- $content = ob_get_clean();
128
- echo "<h2>", esc_html($block["name"]), "</h2>";
129
- echo $content;
130
- wp_die();
131
- }
 
 
 
 
 
 
 
 
 
 
132
 
133
- /**
134
- * Retrieves the presets list (no id in GET) or a specific preset id in GET)
135
- *
136
- * @return string
137
- */
138
- public function hook_wp_ajax_tnpc_presets()
139
- {
140
 
141
- if ($this->is_loading_preset_content_request()) {
142
 
143
- $preset_id = $_REQUEST['id'];
144
- $response = $this->get_preset_content($preset_id);
 
 
 
145
 
146
- } else {
 
 
147
 
148
- $response = $this->get_all_preset();
 
 
 
149
 
150
- }
151
 
152
- echo $response;
153
- die();
154
- }
155
 
156
- private function is_loading_preset_content_request()
157
- {
158
- return !empty($_REQUEST['id']);
159
- }
160
 
161
- private function get_preset_content($preset_id)
162
- {
163
 
164
- $content = '';
 
165
 
166
- if ($this->is_a_tnp_default_preset($preset_id)) {
 
 
 
 
167
 
168
- // Get preset from file
169
- $preset = $this->get_preset_from_file($preset_id);
170
 
171
- foreach ($preset->blocks as $item) {
172
- ob_start();
173
- $this->render_block($item->block, true, (array)$item->options);
174
- $content .= trim(ob_get_clean());
175
- }
176
 
177
- } else {
178
 
179
- // Get preset from db
180
- $preset_email = $this->get_email(intval($_REQUEST['id']));
181
- $content = $preset_email->message;
182
 
183
- }
184
 
185
- return $content;
186
 
187
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
  private function is_a_tnp_default_preset($preset_id)
190
  {
@@ -348,7 +369,7 @@ class NewsletterEmails extends NewsletterModule
348
  * @param TNP_Email $email (Rinominare)
349
  * @return string
350
  */
351
- function regenerate($email, $context = array())
352
  {
353
 
354
  // Cannot be removed due to compatibility issues with old Automated versions
@@ -366,7 +387,7 @@ class NewsletterEmails extends NewsletterModule
366
  return array('body' => '', 'subject' => '');
367
  }
368
 
369
- $context = array_merge(array('last_run' => 0, 'type' => ''), $context);
370
 
371
  preg_match_all('/data-json="(.*?)"/m', $theme, $matches, PREG_PATTERN_ORDER);
372
 
@@ -454,10 +475,13 @@ class NewsletterEmails extends NewsletterModule
454
 
455
  /**
456
  * Renders a block identified by its id, using the block options and adding a wrapper
457
- * if required (for the first block rendering.
458
- * @param type $block_id
459
- * @param type $wrapper
460
- * @param type $options
 
 
 
461
  */
462
  function render_block($block_id = null, $wrapper = false, $options = [], $context = [], $composer = [])
463
  {
@@ -471,10 +495,6 @@ class NewsletterEmails extends NewsletterModule
471
  }
472
  $composer = array_merge($composer_defaults, $composer);
473
 
474
- // ========================================================= //
475
- // =============== GLOBAL VARIABLES ================== //
476
- // ========================================================= //
477
-
478
  $width = 600;
479
  $font_family = 'Helvetica, Arial, sans-serif';
480
 
@@ -498,16 +518,13 @@ class NewsletterEmails extends NewsletterModule
498
 
499
  $info = Newsletter::instance()->get_options('info');
500
 
501
- // ============================================================= //
502
- // =============== END GLOBAL VARIABLES ================== //
503
- // ============================================================= //
504
-
505
  // Just in case...
506
  if (!is_array($options)) {
507
  $options = array();
508
  }
509
 
510
-
 
511
  add_filter('safe_style_css', [$this, 'hook_safe_style_css']);
512
  $options = wp_kses_post_deep($options);
513
  remove_filter('safe_style_css', [$this, 'hook_safe_style_css']);
@@ -538,7 +555,7 @@ class NewsletterEmails extends NewsletterModule
538
  return;
539
  }
540
 
541
- $out = array('subject' => '', 'return_empty_message' => false, 'stop' => false, 'skip' => false);
542
 
543
  $dir = is_rtl() ? 'rtl' : 'ltr';
544
  $align_left = is_rtl() ? 'right' : 'left';
5
  class NewsletterEmails extends NewsletterModule
6
  {
7
 
8
+ static $instance;
9
 
10
+ const EDITOR_COMPOSER = 2;
11
+ const EDITOR_HTML = 1;
12
+ const EDITOR_TINYMCE = 0;
13
 
14
+ static $PRESETS_LIST;
15
+ const PRESET_EMAIL_TYPE = 'composer_template';
16
 
17
+ // Cache
18
+ var $blocks = null;
19
 
20
+ /**
21
+ * @return NewsletterEmails
22
+ */
23
+ static function instance() {
24
+ if ( self::$instance == null ) {
25
+ self::$instance = new NewsletterEmails();
26
+ }
 
 
 
27
 
28
+ return self::$instance;
29
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
 
31
+ function __construct() {
32
+ self::$PRESETS_LIST = array( "cta", "invite", "announcement", "posts", "sales", "product", "tour", "simple" );
33
+ $this->themes = new NewsletterThemes( 'emails' );
34
+ parent::__construct( 'emails', '1.1.5' );
35
+ add_action( 'newsletter_action', array( $this, 'hook_newsletter_action' ), 13, 3 );
36
+
37
+ if ( is_admin() ) {
38
+ add_action( 'wp_ajax_tnpc_render', array( $this, 'tnpc_render_callback' ) );
39
+ add_action( 'wp_ajax_tnpc_preview', array( $this, 'tnpc_preview_callback' ) );
40
+ add_action( 'wp_ajax_tnpc_css', array( $this, 'tnpc_css_callback' ) );
41
+ add_action( 'wp_ajax_tnpc_options', array( $this, 'hook_wp_ajax_tnpc_options' ) );
42
+ add_action( 'wp_ajax_tnpc_get_all_presets', array( $this, 'ajax_get_all_presets' ) );
43
+ add_action( 'wp_ajax_tnpc_get_preset', array( $this, 'ajax_get_preset' ) );
44
+ add_action( 'wp_ajax_tnpc_delete_preset', array( $this, 'hook_wp_ajax_tnpc_delete_preset' ) );
45
+ add_action( 'wp_ajax_tnpc_regenerate_email', array( $this, 'hook_wp_ajax_tnpc_regenerate_email' ) );
46
+
47
+ // Thank you to plugins which add the WP editor on other admin plugin pages...
48
+ if ( isset( $_GET['page'] ) && $_GET['page'] == 'newsletter_emails_edit' ) {
49
+ global $wp_actions;
50
+ $wp_actions['wp_enqueue_editor'] = 1;
51
+ }
52
+ }
53
+ }
54
 
55
+ function options_decode( $options ) {
 
 
 
 
 
 
56
 
57
+ // Start compatibility
58
+ if ( is_string( $options ) && strpos( $options, 'options[' ) !== false ) {
59
+ $opts = array();
60
+ parse_str( $options, $opts );
61
+ $options = $opts['options'];
62
+ }
63
+ // End compatibility
64
 
65
+ if ( is_array( $options ) ) {
66
+ return $options;
67
+ }
 
 
 
 
68
 
69
+ $tmp = json_decode( $options, true );
70
+ if ( is_null( $tmp ) ) {
71
+ return json_decode( base64_decode( $options ), true );
72
+ } else {
73
+ return $tmp;
74
+ }
75
+ }
 
76
 
77
+ /**
78
+ *
79
+ * @param array $options Options array
80
+ */
81
+ function options_encode( $options ) {
82
+ return base64_encode( json_encode( $options, JSON_HEX_TAG | JSON_HEX_AMP ) );
83
+ }
84
 
85
+ function hook_wp_ajax_tnpc_options() {
86
+ global $wpdb;
 
87
 
88
+ // TODO: Uniform to use id everywhere
89
+ if ( ! isset( $_REQUEST['id'] ) ) {
90
+ $_REQUEST['id'] = $_REQUEST['b'];
91
+ }
92
 
93
+ $block = $this->get_block( $_REQUEST['id'] );
94
+ if ( ! $block ) {
95
+ die( 'Block not found with id ' . esc_html( $_REQUEST['id'] ) );
96
+ }
97
 
98
+ if ( ! class_exists( 'NewsletterControls' ) ) {
99
+ include NEWSLETTER_INCLUDES_DIR . '/controls.php';
100
+ }
101
 
102
+ $options = $this->options_decode( stripslashes_deep( $_REQUEST['options'] ) );
103
+ $composer = isset( $_POST['composer'] ) ? $_POST['composer'] : [];
 
 
104
 
105
+ $context = array( 'type' => '' );
106
+ if ( isset( $_REQUEST['context_type'] ) ) {
107
+ $context['type'] = $_REQUEST['context_type'];
108
+ }
109
 
110
+ $controls = new NewsletterControls( $options );
111
+ $fields = new NewsletterFields( $controls );
 
 
 
 
 
 
 
112
 
113
+ $controls->init();
114
+ echo '<input type="hidden" name="action" value="tnpc_render">';
115
+ echo '<input type="hidden" name="b" value="' . esc_attr( $_REQUEST['id'] ) . '">';
116
+ echo '<input type="hidden" name="context_type" value="' . esc_attr( $context['type'] ) . '">';
117
+ $inline_edits = '';
118
+ if ( isset( $controls->data['inline_edits'] ) ) {
119
+ $inline_edits = $controls->data['inline_edits'];
120
+ }
121
+ echo '<input type="hidden" name="options[inline_edits]" value="' . $this->options_encode( $inline_edits ) . '">';
122
+
123
+ ob_start();
124
+ include $block['dir'] . '/options.php';
125
+ $content = ob_get_clean();
126
+ echo "<h2>", esc_html( $block["name"] ), "</h2>";
127
+ echo $content;
128
+ wp_die();
129
+ }
130
 
131
+ /**
132
+ * Retrieves the presets list (no id in GET) or a specific preset id in GET)
133
+ */
134
+ public function ajax_get_all_presets() {
135
+ wp_send_json_success( $this->get_all_preset() );
136
+ }
 
137
 
138
+ public function ajax_get_preset() {
139
 
140
+ if ( empty( $_REQUEST['id'] ) ) {
141
+ wp_send_json_error( [
142
+ 'msg' => __( 'Invalid preset ID' )
143
+ ] );
144
+ }
145
 
146
+ $preset_id = $_REQUEST['id'];
147
+ $preset_content = $this->get_preset_content( $preset_id );
148
+ $global_options = $this->get_preset_global_options( $preset_id );
149
 
150
+ wp_send_json_success( [
151
+ 'content' => $preset_content,
152
+ 'globalOptions' => $global_options,
153
+ ] );
154
 
155
+ }
156
 
157
+ private function get_preset_content( $preset_id ) {
 
 
158
 
159
+ $content = '';
 
 
 
160
 
161
+ if ( $this->is_a_tnp_default_preset( $preset_id ) ) {
 
162
 
163
+ // Get preset from file
164
+ $preset = $this->get_preset_from_file( $preset_id );
165
 
166
+ foreach ( $preset->blocks as $item ) {
167
+ ob_start();
168
+ $this->render_block( $item->block, true, (array) $item->options );
169
+ $content .= trim( ob_get_clean() );
170
+ }
171
 
172
+ } else {
 
173
 
174
+ // Get preset from db
175
+ $preset_email = $this->get_email( intval( $preset_id ) );
176
+ $global_options = $this->extract_global_options_from( $preset_email );
177
+ $content = $this->regenerate_email_blocks( $preset_email->message, $global_options );
 
178
 
179
+ }
180
 
181
+ return $content;
 
 
182
 
183
+ }
184
 
185
+ private function get_preset_global_options( $preset_id ) {
186
 
187
+ if ( $this->is_a_tnp_default_preset( $preset_id ) ) {
188
+ return [];
189
+ }
190
+
191
+ // Get preset from db
192
+ $preset_email = $this->get_email( intval( $preset_id ) );
193
+ $global_options = $this->extract_global_options_from( $preset_email );
194
+
195
+ return $global_options;
196
+
197
+ }
198
+
199
+ private function extract_global_options_from( $email ) {
200
+ $global_options = [];
201
+ foreach ( $email->options as $global_option_name => $global_option ) {
202
+ if ( strpos( $global_option_name, 'composer_' ) === 0 ) {
203
+ $global_options[ str_replace( 'composer_', '', $global_option_name ) ] = $global_option;
204
+ }
205
+ }
206
+
207
+ return $global_options;
208
+ }
209
 
210
  private function is_a_tnp_default_preset($preset_id)
211
  {
369
  * @param TNP_Email $email (Rinominare)
370
  * @return string
371
  */
372
+ function regenerate($email, $context = [])
373
  {
374
 
375
  // Cannot be removed due to compatibility issues with old Automated versions
387
  return array('body' => '', 'subject' => '');
388
  }
389
 
390
+ $context = array_merge(['last_run' => 0, 'type' => ''], $context);
391
 
392
  preg_match_all('/data-json="(.*?)"/m', $theme, $matches, PREG_PATTERN_ORDER);
393
 
475
 
476
  /**
477
  * Renders a block identified by its id, using the block options and adding a wrapper
478
+ * if required (for the first block rendering).
479
+ *
480
+ * @param string $block_id
481
+ * @param boolean $wrapper
482
+ * @param array $options
483
+ * @param array $context
484
+ * @param array $composer
485
  */
486
  function render_block($block_id = null, $wrapper = false, $options = [], $context = [], $composer = [])
487
  {
495
  }
496
  $composer = array_merge($composer_defaults, $composer);
497
 
 
 
 
 
498
  $width = 600;
499
  $font_family = 'Helvetica, Arial, sans-serif';
500
 
518
 
519
  $info = Newsletter::instance()->get_options('info');
520
 
 
 
 
 
521
  // Just in case...
522
  if (!is_array($options)) {
523
  $options = array();
524
  }
525
 
526
+ // This code filters the HTML to remove javascript and unsecure attributes and enable the
527
+ // "display" rule for CSS which is needed in blocks to force specific "block" or "inline" or "table".
528
  add_filter('safe_style_css', [$this, 'hook_safe_style_css']);
529
  $options = wp_kses_post_deep($options);
530
  remove_filter('safe_style_css', [$this, 'hook_safe_style_css']);
555
  return;
556
  }
557
 
558
+ $out = ['subject' => '', 'return_empty_message' => false, 'stop' => false, 'skip' => false];
559
 
560
  $dir = is_rtl() ? 'rtl' : 'ltr';
561
  $align_left = is_rtl() ? 'right' : 'left';
emails/tnp-composer/_scripts/newsletter-builder-v2.js CHANGED
@@ -127,7 +127,7 @@ jQuery(function () {
127
  }
128
 
129
  if (!preloadedContent) {
130
- tnpc_show_presets();
131
  } else {
132
  jQuery('#newsletter-builder-area-center-frame-content').html(preloadedContent);
133
  start_composer();
@@ -497,15 +497,22 @@ const presetListModal = new TNPModal({
497
  }
498
  });
499
 
500
- function tnpc_show_presets() {
501
 
502
  jQuery('.tnpc-controls input[type=button]').attr('disabled', true);
503
 
504
  const elModalContent = presetListModal.open();
505
 
506
- jQuery(elModalContent).load(ajaxurl, {
507
- action: "tnpc_presets",
508
- context_type: tnp_context_type,
 
 
 
 
 
 
 
509
  });
510
 
511
  }
@@ -514,22 +521,42 @@ function tnpc_load_preset(id, subject, isEditMode) {
514
 
515
  presetListModal.close();
516
 
517
- jQuery('#newsletter-builder-area-center-frame-content').load(ajaxurl, {
518
- action: "tnpc_presets",
519
- id: id
520
- }, function () {
521
- start_composer();
 
 
 
 
 
522
 
523
- if (!isEditMode) {
524
- //Enable buttons
525
- jQuery('.tnpc-controls input[type=button]').attr('disabled', false);
526
- }
527
 
528
- if (subject && subject.length > 0) {
529
- jQuery('#options-title').val(tnpc_remove_double_quotes_escape_from(subject));
530
- }
 
 
 
 
 
 
531
  });
532
 
 
 
 
 
 
 
 
 
 
 
 
 
533
  }
534
 
535
  function tnpc_save_preset(form) {
127
  }
128
 
129
  if (!preloadedContent) {
130
+ tnpc_show_presets_modal();
131
  } else {
132
  jQuery('#newsletter-builder-area-center-frame-content').html(preloadedContent);
133
  start_composer();
497
  }
498
  });
499
 
500
+ function tnpc_show_presets_modal() {
501
 
502
  jQuery('.tnpc-controls input[type=button]').attr('disabled', true);
503
 
504
  const elModalContent = presetListModal.open();
505
 
506
+ jQuery.ajax({
507
+ type: "POST",
508
+ url: ajaxurl,
509
+ data: {
510
+ action: "tnpc_get_all_presets",
511
+ context_type: tnp_context_type,
512
+ },
513
+ success: function (res) {
514
+ jQuery(elModalContent).html(res.data);
515
+ },
516
  });
517
 
518
  }
521
 
522
  presetListModal.close();
523
 
524
+ jQuery.ajax({
525
+ type: "POST",
526
+ url: ajaxurl,
527
+ data: {
528
+ action: "tnpc_get_preset",
529
+ id: id
530
+ },
531
+ success: function (res) {
532
+ jQuery('#newsletter-builder-area-center-frame-content').html(res.data.content);
533
+ _restore_global_options(res.data.globalOptions);
534
 
535
+ start_composer();
 
 
 
536
 
537
+ if (!isEditMode) {
538
+ //Enable buttons
539
+ jQuery('.tnpc-controls input[type=button]').attr('disabled', false);
540
+ }
541
+
542
+ if (subject && subject.length > 0) {
543
+ jQuery('#options-title').val(tnpc_remove_double_quotes_escape_from(subject));
544
+ }
545
+ },
546
  });
547
 
548
+ function _restore_global_options(options) {
549
+ jQuery.each(options, function (name, value) {
550
+ var el = jQuery(`#tnpc-global-styles-form #options-options_composer_${name}`);
551
+ if (el.length) {
552
+ el.val(value);
553
+ }
554
+ });
555
+
556
+ tnp_controls_init();
557
+ _setBuilderAreaBackgroundColor(document.getElementById('options-options_composer_background').value);
558
+ }
559
+
560
  }
561
 
562
  function tnpc_save_preset(form) {
emails/tnp-composer/css/newsletter.css CHANGED
@@ -10,7 +10,7 @@ img{border:0; height:auto; line-height:100%; outline:none; text-decoration:none;
10
  table{border-collapse:collapse !important;}
11
  img.aligncenter{display:block;margin:0 auto;}
12
 
13
- @media all and (max-width: 525px) {
14
 
15
  /* ALLOWS FOR FLUID TABLES */
16
  table[class="wrapper"]{
@@ -56,15 +56,27 @@ img.aligncenter{display:block;margin:0 auto;}
56
  max-width: 100%!important;
57
  }
58
 
 
 
 
 
 
 
 
 
 
59
  table[class="responsive"]{
60
  width:100%!important;
61
  max-width: 100%!important;
 
 
62
  }
63
 
64
  img.responsive {
65
  width:100%!important;
66
  max-width: 100%!important;
67
- }
 
68
 
69
  .block {
70
  display: block;
@@ -73,6 +85,10 @@ img.aligncenter{display:block;margin:0 auto;}
73
  td[class="responsive"]{
74
  width:100%!important;
75
  max-width: 100%!important;
 
 
 
 
76
  }
77
 
78
  /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
10
  table{border-collapse:collapse !important;}
11
  img.aligncenter{display:block;margin:0 auto;}
12
 
13
+ @media screen and (max-width: 525px) {
14
 
15
  /* ALLOWS FOR FLUID TABLES */
16
  table[class="wrapper"]{
56
  max-width: 100%!important;
57
  }
58
 
59
+ .responsive {
60
+ width:100%!important;
61
+ max-width: 100%!important;
62
+ float: none;
63
+ display: block;
64
+ padding-left: 0;
65
+ padding-right: 0;
66
+ }
67
+
68
  table[class="responsive"]{
69
  width:100%!important;
70
  max-width: 100%!important;
71
+ float: none;
72
+ display: block;
73
  }
74
 
75
  img.responsive {
76
  width:100%!important;
77
  max-width: 100%!important;
78
+ }
79
+
80
 
81
  .block {
82
  display: block;
85
  td[class="responsive"]{
86
  width:100%!important;
87
  max-width: 100%!important;
88
+ display: block;
89
+ padding-left: 0 !important;
90
+ padding-right: 0 !important;
91
+ float: none;
92
  }
93
 
94
  /* UTILITY CLASSES FOR ADJUSTING PADDING ON MOBILE */
emails/tnp-composer/css/newsletter.min.css CHANGED
@@ -1 +1 @@
1
- #outlook a{padding:0}.ReadMsgBody{width:100%}.ExternalClass{width:100%}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:100%}body,table,td,a{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}table,td{mso-table-lspace:0;mso-table-rspace:0}img{-ms-interpolation-mode:bicubic}body{margin:0;padding:0;height:100%!important;margin:0;padding:0;width:100%!important}img{border:0;height:auto;line-height:100%;outline:0;text-decoration:none;max-width:100%!important}table{border-collapse:collapse!important}img.aligncenter{display:block;margin:0 auto}@media all and (max-width:525px){table[class="wrapper"]{width:100%!important}table[class="mobile-full-width"]{width:100%!important}img[class="mobile-full-width"]{width:100%!important;display:block}td[class="logo"]{text-align:left;padding:20px 0 20px 0!important}td[class="logo"] img{margin:0 auto!important}td[class="mobile-hide"]{display:none}img[class="mobile-hide"]{display:none!important}img[class="img-max"]{max-width:100%!important;height:auto!important}table[class="responsive-table"]{width:100%!important;max-width:100%!important}table[class="responsive"]{width:100%!important;max-width:100%!important}img.responsive{width:100%!important;max-width:100%!important}.block{display:block}td[class="responsive"]{width:100%!important;max-width:100%!important}td[class="padding"]{padding:10px 5% 15px 5%!important}td[class="padding-copy"]{padding:10px 5% 10px 5%!important;text-align:center}td[class="padding-meta"]{padding:30px 5% 0 5%!important;text-align:center}td[class="no-pad"]{padding:0 0 20px 0!important}td[class="no-padding"]{padding:0!important}td[class="section-padding"]{padding:50px 15px 50px 15px!important}td[class="section-padding-bottom-image"]{padding:50px 15px 0 15px!important}td[class="mobile-wrapper"]{padding:10px 5% 15px 5%!important}table[class="mobile-button-container"]{margin:0 auto;width:100%!important}a[class="mobile-button"]{width:80%!important;padding:15px!important;border:0!important;font-size:16px!important}}
1
+ #outlook a{padding:0}.ReadMsgBody{width:100%}.ExternalClass{width:100%}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:100%}body,table,td,a{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}table,td{mso-table-lspace:0;mso-table-rspace:0}img{-ms-interpolation-mode:bicubic}body{margin:0;padding:0;height:100%!important;margin:0;padding:0;width:100%!important}img{border:0;height:auto;line-height:100%;outline:0;text-decoration:none;max-width:100%!important}table{border-collapse:collapse!important}img.aligncenter{display:block;margin:0 auto}@media screen and (max-width:525px){table[class="wrapper"]{width:100%!important}table[class="mobile-full-width"]{width:100%!important}img[class="mobile-full-width"]{width:100%!important;display:block}td[class="logo"]{text-align:left;padding:20px 0 20px 0!important}td[class="logo"] img{margin:0 auto!important}td[class="mobile-hide"]{display:none}img[class="mobile-hide"]{display:none!important}img[class="img-max"]{max-width:100%!important;height:auto!important}table[class="responsive-table"]{width:100%!important;max-width:100%!important}.responsive{width:100%!important;max-width:100%!important;float:none;display:block;padding-left:0;padding-right:0}table[class="responsive"]{width:100%!important;max-width:100%!important;float:none;display:block}img.responsive{width:100%!important;max-width:100%!important}.block{display:block}td[class="responsive"]{width:100%!important;max-width:100%!important;display:block;padding-left:0;padding-right:0;float:none}td[class="padding"]{padding:10px 5% 15px 5%!important}td[class="padding-copy"]{padding:10px 5% 10px 5%!important;text-align:center}td[class="padding-meta"]{padding:30px 5% 0 5%!important;text-align:center}td[class="no-pad"]{padding:0 0 20px 0!important}td[class="no-padding"]{padding:0!important}td[class="section-padding"]{padding:50px 15px 50px 15px!important}td[class="section-padding-bottom-image"]{padding:50px 15px 0 15px!important}td[class="mobile-wrapper"]{padding:10px 5% 15px 5%!important}td[class="responsive"]{display:block;width:100%!important}table[class="mobile-button-container"]{margin:0 auto;width:100%!important}a[class="mobile-button"]{width:80%!important;padding:15px!important;border:0!important;font-size:16px!important}}
includes/composer.php CHANGED
@@ -363,27 +363,27 @@ class TNP_Composer {
363
  //Class and style attribute are mutually exclusive.
364
  //Class take priority to style because classes will transform to inline style inside block rendering operation
365
  if (!empty($attr['class'])) {
366
- $styling = ' inline-class="' . $attr['class'] . '" ';
367
  } else {
368
- $styling = ' style="' . $attr['style'] . '" ';
369
  }
370
 
371
  //Class and style attribute are mutually exclusive.
372
  //Class take priority to style because classes will transform to inline style inside block rendering operation
373
  if (!empty($attr['link-class'])) {
374
- $link_styling = ' inline-class="' . $attr['link-class'] . '" ';
375
  } else {
376
- $link_styling = ' style="' . $attr['link-style'] . '" ';
377
  }
378
 
379
  $b = '';
380
  if ($media->link) {
381
- $b .= '<a href="' . $media->link . '" target="_blank" rel="noopener nofollow" ' . $link_styling . '>';
382
  }
383
 
384
  if ($media) {
385
- $b .= '<img src="' . $media->url . '" width="' . $media->width . '"'
386
- . ' height="auto"'
387
  . ' alt="' . esc_attr($media->alt) . '"'
388
  . ' border="0" '
389
  . $styling
@@ -467,8 +467,8 @@ class TNP_Composer {
467
  static function get_global_style_defaults() {
468
  return [
469
  'options_composer_title_font_family' => 'Verdana, Geneva, sans-serif',
470
- 'options_composer_title_font_size' => 36,
471
- 'options_composer_title_font_weight' => 'bold',
472
  'options_composer_title_font_color' => '#222222',
473
  'options_composer_text_font_family' => 'Verdana, Geneva, sans-serif',
474
  'options_composer_text_font_size' => 16,
@@ -476,7 +476,7 @@ class TNP_Composer {
476
  'options_composer_text_font_color' => '#222222',
477
  'options_composer_button_font_family' => 'Verdana, Geneva, sans-serif',
478
  'options_composer_button_font_size' => 16,
479
- 'options_composer_button_font_weight' => 'bold',
480
  'options_composer_button_font_color' => '#FFFFFF',
481
  'options_composer_button_background_color' => '#256F9C',
482
  'options_composer_background' => '#FFFFFF',
363
  //Class and style attribute are mutually exclusive.
364
  //Class take priority to style because classes will transform to inline style inside block rendering operation
365
  if (!empty($attr['class'])) {
366
+ $styling = ' inline-class="' . esc_attr($attr['class']) . '" ';
367
  } else {
368
+ $styling = ' style="' . esc_attr($attr['style']) . '" ';
369
  }
370
 
371
  //Class and style attribute are mutually exclusive.
372
  //Class take priority to style because classes will transform to inline style inside block rendering operation
373
  if (!empty($attr['link-class'])) {
374
+ $link_styling = ' inline-class="' . esc_attr($attr['link-class']) . '" ';
375
  } else {
376
+ $link_styling = ' style="' . esc_attr($attr['link-style']) . '" ';
377
  }
378
 
379
  $b = '';
380
  if ($media->link) {
381
+ $b .= '<a href="' . esc_attr($media->link) . '" target="_blank" rel="noopener nofollow" ' . $link_styling . '>';
382
  }
383
 
384
  if ($media) {
385
+ $b .= '<img src="' . esc_attr($media->url) . '" width="' . esc_attr($media->width) . '"'
386
+ . ' height="' . esc_attr($media->width) . '"'
387
  . ' alt="' . esc_attr($media->alt) . '"'
388
  . ' border="0" '
389
  . $styling
467
  static function get_global_style_defaults() {
468
  return [
469
  'options_composer_title_font_family' => 'Verdana, Geneva, sans-serif',
470
+ 'options_composer_title_font_size' => 32,
471
+ 'options_composer_title_font_weight' => 'normal',
472
  'options_composer_title_font_color' => '#222222',
473
  'options_composer_text_font_family' => 'Verdana, Geneva, sans-serif',
474
  'options_composer_text_font_size' => 16,
476
  'options_composer_text_font_color' => '#222222',
477
  'options_composer_button_font_family' => 'Verdana, Geneva, sans-serif',
478
  'options_composer_button_font_size' => 16,
479
+ 'options_composer_button_font_weight' => 'normal',
480
  'options_composer_button_font_color' => '#FFFFFF',
481
  'options_composer_button_background_color' => '#256F9C',
482
  'options_composer_background' => '#FFFFFF',
includes/controls.php CHANGED
@@ -936,8 +936,8 @@ class NewsletterControls {
936
  $this->btn('save', __('Save', 'newsletter'), ['icon' => 'fa-save']);
937
  }
938
 
939
- function button_reset() {
940
- $this->btn('reset', __('Reset', 'newsletter'), ['icon' => 'fa-reply', 'confirm' => true]);
941
  }
942
 
943
  function button_copy($data = '') {
936
  $this->btn('save', __('Save', 'newsletter'), ['icon' => 'fa-save']);
937
  }
938
 
939
+ function button_reset($action = 'reset') {
940
+ $this->btn($action, __('Reset', 'newsletter'), ['icon' => 'fa-reply', 'confirm' => true]);
941
  }
942
 
943
  function button_copy($data = '') {
includes/fields.php CHANGED
@@ -163,7 +163,7 @@ class NewsletterFields {
163
  }
164
 
165
  public function textarea($name, $label = '', $attrs = []) {
166
- $attrs = $this->_merge_attrs($attrs, ['width'=>'100%', 'height'=>'150']);
167
  $this->_open();
168
  $this->_label($label);
169
  $this->controls->textarea_fixed($name, $attrs['width'], $attrs['height']);
@@ -193,13 +193,13 @@ class NewsletterFields {
193
 
194
  if (version_compare($wp_version, '4.8', '>=')) {
195
 
196
- $paragraph_style = " p { font-family: ${attrs['text_font_family']}; font-size: ${attrs['text_font_size']}px; font-weight: ${attrs['text_font_weight']}; color: ${attrs['text_font_color']}; line-height: 1.5em; }";
197
- $content_style = $paragraph_style;
198
 
199
- echo '<script>';
200
- echo 'wp.editor.remove("options-', $name, '");';
201
- echo 'wp.editor.initialize("options-', $name, '", { tinymce: {content_style: "' . $content_style . '", toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | wp_add_media | charmap | rtl ltr", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker lists wordpress charmap directionality", default_link_target: "_blank", relative_urls : false, convert_urls: false, keep_styles: true }});';
202
- echo '</script>';
203
  }
204
  $this->_description($attrs);
205
  $this->_close();
@@ -245,6 +245,13 @@ class NewsletterFields {
245
  $this->_close();
246
  }
247
 
 
 
 
 
 
 
 
248
  public function yesno($name, $label = '', $attrs = []) {
249
  $attrs = $this->_merge_attrs($attrs);
250
  $this->_open();
@@ -303,16 +310,16 @@ class NewsletterFields {
303
  * - url: if true (default) shows the URL field (sometime the URL is produced elsewhere, for example on post list)
304
  */
305
  public function button($name, $label = '', $attrs = []) {
306
- $attrs = $this->_merge_attrs( $attrs,
307
- [
308
- 'placeholder' => 'Label...',
309
- 'url_placeholder' => 'https://...',
310
- 'url' => true,
311
- 'weight' => true,
312
- 'family_default' => false,
313
- 'size_default' => false,
314
- 'weight_default' => false,
315
- ] );
316
 
317
  $this->_open('tnpf-button');
318
  $this->_label($label);
@@ -334,25 +341,24 @@ class NewsletterFields {
334
  }
335
  echo '<div style="clear: both"></div>';
336
  echo '</div>';
337
- $this->controls->css_font( $name . '_font', [
338
- 'weight' => $attrs['weight'],
339
- 'family_default' => $attrs['family_default'],
340
- 'size_default' => $attrs['size_default'],
341
- 'weight_default' => $attrs['weight_default']
342
- ] );
343
- $this->controls->color( $name . '_background' );
344
  $this->_close();
345
  }
346
 
347
- public function button_style( $name, $label = '' ) {
348
 
349
- $this->_open( 'tnp-font' );
350
- $this->_label( $label );
351
- $this->controls->css_font( $name . '_font' );
352
- $this->controls->color( $name . '_background_color' );
353
- $this->_close();
354
-
355
- }
356
 
357
  /**
358
  * URL input field
@@ -449,7 +455,7 @@ class NewsletterFields {
449
  }
450
 
451
  function lists($name, $label, $attrs = []) {
452
- $attrs = $this->_merge_attrs($attrs, ['empty_label'=>null]);
453
  $this->_open();
454
  $this->_label($label);
455
  $lists = $this->controls->get_list_options($attrs['empty_label']);
@@ -594,16 +600,16 @@ class NewsletterFields {
594
  */
595
  public function font($name = 'font', $label = 'Font', $attrs = []) {
596
  $attrs = $this->_merge_base_attrs($attrs);
597
- $attrs = array_merge( [
598
- 'hide_family' => false,
599
- 'family' => true,
600
- 'color' => true,
601
- 'size' => true,
602
- 'weight' => true,
603
- 'family_default' => false,
604
- 'size_default' => false,
605
- 'weight_default' => false,
606
- ], $attrs );
607
 
608
  $this->_open('tnp-font');
609
  $this->_label($label);
163
  }
164
 
165
  public function textarea($name, $label = '', $attrs = []) {
166
+ $attrs = $this->_merge_attrs($attrs, ['width' => '100%', 'height' => '150']);
167
  $this->_open();
168
  $this->_label($label);
169
  $this->controls->textarea_fixed($name, $attrs['width'], $attrs['height']);
193
 
194
  if (version_compare($wp_version, '4.8', '>=')) {
195
 
196
+ $paragraph_style = " p { font-family: ${attrs['text_font_family']}; font-size: ${attrs['text_font_size']}px; font-weight: ${attrs['text_font_weight']}; color: ${attrs['text_font_color']}; line-height: 1.5em; }";
197
+ $content_style = $paragraph_style;
198
 
199
+ echo '<script>';
200
+ echo 'wp.editor.remove("options-', $name, '");';
201
+ echo 'wp.editor.initialize("options-', $name, '", { tinymce: {content_style: "' . $content_style . '", toolbar1: "undo redo | formatselect fontselect fontsizeselect | bold italic forecolor backcolor | link unlink | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | removeformat | wp_add_media | charmap | rtl ltr", fontsize_formats: "11px 12px 14px 16px 18px 24px 36px 48px", plugins: "link textcolor colorpicker lists wordpress charmap directionality", default_link_target: "_blank", relative_urls : false, convert_urls: false, keep_styles: true }});';
202
+ echo '</script>';
203
  }
204
  $this->_description($attrs);
205
  $this->_close();
245
  $this->_close();
246
  }
247
 
248
+ public function align($name = 'align') {
249
+ $this->select($name,
250
+ __('Align', 'newsletter'),
251
+ ['center' => __('Center', 'newsletter'), 'left' => __('Left', 'newsletter'), 'right' => __('Right')]
252
+ );
253
+ }
254
+
255
  public function yesno($name, $label = '', $attrs = []) {
256
  $attrs = $this->_merge_attrs($attrs);
257
  $this->_open();
310
  * - url: if true (default) shows the URL field (sometime the URL is produced elsewhere, for example on post list)
311
  */
312
  public function button($name, $label = '', $attrs = []) {
313
+ $attrs = $this->_merge_attrs($attrs,
314
+ [
315
+ 'placeholder' => 'Label...',
316
+ 'url_placeholder' => 'https://...',
317
+ 'url' => true,
318
+ 'weight' => true,
319
+ 'family_default' => false,
320
+ 'size_default' => false,
321
+ 'weight_default' => false,
322
+ ]);
323
 
324
  $this->_open('tnpf-button');
325
  $this->_label($label);
341
  }
342
  echo '<div style="clear: both"></div>';
343
  echo '</div>';
344
+ $this->controls->css_font($name . '_font', [
345
+ 'weight' => $attrs['weight'],
346
+ 'family_default' => $attrs['family_default'],
347
+ 'size_default' => $attrs['size_default'],
348
+ 'weight_default' => $attrs['weight_default']
349
+ ]);
350
+ $this->controls->color($name . '_background');
351
  $this->_close();
352
  }
353
 
354
+ public function button_style($name, $label = '') {
355
 
356
+ $this->_open('tnp-font');
357
+ $this->_label($label);
358
+ $this->controls->css_font($name . '_font');
359
+ $this->controls->color($name . '_background_color');
360
+ $this->_close();
361
+ }
 
362
 
363
  /**
364
  * URL input field
455
  }
456
 
457
  function lists($name, $label, $attrs = []) {
458
+ $attrs = $this->_merge_attrs($attrs, ['empty_label' => null]);
459
  $this->_open();
460
  $this->_label($label);
461
  $lists = $this->controls->get_list_options($attrs['empty_label']);
600
  */
601
  public function font($name = 'font', $label = 'Font', $attrs = []) {
602
  $attrs = $this->_merge_base_attrs($attrs);
603
+ $attrs = array_merge([
604
+ 'hide_family' => false,
605
+ 'family' => true,
606
+ 'color' => true,
607
+ 'size' => true,
608
+ 'weight' => true,
609
+ 'family_default' => false,
610
+ 'size_default' => false,
611
+ 'weight_default' => false,
612
+ ], $attrs);
613
 
614
  $this->_open('tnp-font');
615
  $this->_label($label);
includes/module.php CHANGED
@@ -16,6 +16,7 @@ class TNP_Media {
16
  var $height;
17
  var $alt;
18
  var $link;
 
19
 
20
  /** Sets the width recalculating the height */
21
  public function set_width($width) {
16
  var $height;
17
  var $alt;
18
  var $link;
19
+ var $align = 'center';
20
 
21
  /** Sets the width recalculating the height */
22
  public function set_width($width) {
main/main.php CHANGED
@@ -310,9 +310,9 @@ if (!empty($return_path)) {
310
  </tr>
311
 
312
  <tr>
313
- <th><?php _e('Disable standard styles', 'newsletter') ?></th>
314
  <td>
315
- <?php $controls->yesno('css_disabled'); ?>
316
  </td>
317
  </tr>
318
 
310
  </tr>
311
 
312
  <tr>
313
+ <th><?php _e('Standard styles', 'newsletter') ?></th>
314
  <td>
315
+ <?php $controls->disabled('css_disabled'); ?>
316
  </td>
317
  </tr>
318
 
main/status.php CHANGED
@@ -71,6 +71,11 @@ if ($controls->is_action('conversion')) {
71
  $controls->messages = 'Triggered';
72
  }
73
 
 
 
 
 
 
74
  if ($controls->is_action('test')) {
75
 
76
  if (!NewsletterModule::is_email($controls->data['test_email'])) {
@@ -602,7 +607,7 @@ function tnp_status_print_flag($condition) {
602
  if ($send_max < $send_mean) {
603
  $send_max = $send_mean;
604
  }
605
- if (isset($send_calls[$i][3])) {
606
  $send_completed++;
607
  }
608
  }
@@ -634,32 +639,26 @@ function tnp_status_print_flag($condition) {
634
  Total email in the sample: <?php echo $send_total_emails ?><br>
635
  Runs in the sample: <?php echo count($send_calls); ?><br>
636
  Runs prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls) - $send_completed) * 100.0 / count($send_calls)) ?>%<br>
 
 
637
  </td>
638
  </tr>
639
- <?php
640
- }
641
- ?>
642
-
 
 
 
 
 
 
 
 
 
643
 
644
- <tr>
645
- <?php
646
- $condition = (defined('NEWSLETTER_CRON_WARNINGS') && !NEWSLETTER_CRON_WARNINGS) ? 2 : 1;
647
- ?>
648
- <td>
649
- Cron warnings<br>
650
- <small>Newsletter can notify of WP scheduler problems?</small>
651
- </td>
652
- <td>
653
- <?php tnp_status_print_flag($condition) ?>
654
- </td>
655
- <td>
656
- <?php if ($condition == 2) { ?>
657
- Scheduler warnings are disabled in your <code>wp-config.php</code> with the constant <code>NEWSLETTER_CRON_WARNINGS</code> set to true.
658
- <?php } else { ?>
659
 
660
- <?php } ?>
661
- </td>
662
- </tr>
663
 
664
 
665
 
@@ -771,6 +770,7 @@ function tnp_status_print_flag($condition) {
771
  </tbody>
772
  </table>
773
 
 
774
  <h3>WordPress Scheduler/Cron</h3>
775
 
776
  <table class="widefat" id="tnp-status-table">
@@ -782,6 +782,24 @@ function tnp_status_print_flag($condition) {
782
  </tr>
783
  </thead>
784
  <tbody>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  <tr>
786
  <?php
787
  $condition = (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) ? 2 : 1;
71
  $controls->messages = 'Triggered';
72
  }
73
 
74
+ if ($controls->is_action('reset_send_stats')) {
75
+ update_option('newsletter_diagnostic_send_calls', [], false);
76
+ $controls->add_message_done();
77
+ }
78
+
79
  if ($controls->is_action('test')) {
80
 
81
  if (!NewsletterModule::is_email($controls->data['test_email'])) {
607
  if ($send_max < $send_mean) {
608
  $send_max = $send_mean;
609
  }
610
+ if (isset($send_calls[$i][3]) && $send_calls[$i][3]) {
611
  $send_completed++;
612
  }
613
  }
639
  Total email in the sample: <?php echo $send_total_emails ?><br>
640
  Runs in the sample: <?php echo count($send_calls); ?><br>
641
  Runs prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls) - $send_completed) * 100.0 / count($send_calls)) ?>%<br>
642
+ <br>
643
+ <?php $controls->button_reset('reset_send_stats')?>
644
  </td>
645
  </tr>
646
+ <?php } else { ?>
647
+ <tr>
648
+ <td>
649
+ Send details
650
+ </td>
651
+ <td>
652
+ <span class="tnp-maybe">MAYBE</span>
653
+ </td>
654
+ <td>
655
+ No data avaiable. Send a newsletter to collect some sending statistics.
656
+ </td>
657
+ </tr>
658
+ <?php } ?>
659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
660
 
661
+
 
 
662
 
663
 
664
 
770
  </tbody>
771
  </table>
772
 
773
+
774
  <h3>WordPress Scheduler/Cron</h3>
775
 
776
  <table class="widefat" id="tnp-status-table">
782
  </tr>
783
  </thead>
784
  <tbody>
785
+ <tr>
786
+ <?php
787
+ $condition = (defined('NEWSLETTER_CRON_WARNINGS') && !NEWSLETTER_CRON_WARNINGS) ? 2 : 1;
788
+ ?>
789
+ <td>
790
+ Cron warnings<br>
791
+ </td>
792
+ <td>
793
+ <?php tnp_status_print_flag($condition) ?>
794
+ </td>
795
+ <td>
796
+ <?php if ($condition == 2) { ?>
797
+ Scheduler warnings are disabled in your <code>wp-config.php</code> with the constant <code>NEWSLETTER_CRON_WARNINGS</code> set to true.
798
+ <?php } else { ?>
799
+ Scheduler warnings are enabled
800
+ <?php } ?>
801
+ </td>
802
+ </tr>
803
  <tr>
804
  <?php
805
  $condition = (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) ? 2 : 1;
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: 7.1.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.
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '7.1.2');
39
 
40
  global $newsletter, $wpdb;
41
 
@@ -436,6 +436,8 @@ class Newsletter extends NewsletterModule {
436
  $this->save_options($this->options);
437
  }
438
 
 
 
439
  delete_transient("tnp_extensions_json");
440
 
441
  touch(NEWSLETTER_LOG_DIR . '/index.html');
@@ -512,6 +514,12 @@ class Newsletter extends NewsletterModule {
512
  if (!empty($this->options['css'])) {
513
  wp_add_inline_style('newsletter', $this->options['css']);
514
  }
 
 
 
 
 
 
515
  }
516
  }
517
 
@@ -819,13 +827,18 @@ class Newsletter extends NewsletterModule {
819
  }
820
 
821
  $end_time = microtime(true);
 
 
 
 
 
822
 
823
  //Se non sono in test e ho completato con successo delle spedizioni aggiorno i dati di diagnostica
824
  if (!$test && $count > 0) {
825
 
826
  NewsletterStatistics::instance()->reset_stats_time($email->id);
827
 
828
- $send_calls = get_option('newsletter_diagnostic_send_calls', array());
829
  $send_calls[] = array($start_time, $end_time, $count, $result);
830
 
831
  if (count($send_calls) > self::MAX_CRON_SAMPLES)
@@ -834,11 +847,6 @@ class Newsletter extends NewsletterModule {
834
  update_option('newsletter_diagnostic_send_calls', $send_calls, false);
835
  }
836
 
837
- // We sent to all supplied users, but warning that no more should be processed
838
- if (!$test && $supplied_users && $this->limits_exceeded()) {
839
- $result = false;
840
- }
841
-
842
  $this->logger->info(__METHOD__ . '> End run for email ' . $email->id);
843
 
844
  return $result;
@@ -932,7 +940,7 @@ class Newsletter extends NewsletterModule {
932
  return;
933
  }
934
  $status = empty($message->error) ? 0 : 1;
935
-
936
  $error = mb_substr($message->error, 0, 250);
937
 
938
  $this->query($wpdb->prepare("insert into " . $wpdb->prefix . 'newsletter_sent (user_id, email_id, time, status, error) values (%d, %d, %d, %d, %s) on duplicate key update time=%d, status=%d, error=%s', $message->user_id, $message->email_id, time(), $status, $error, time(), $status, $error));
@@ -1269,7 +1277,7 @@ class Newsletter extends NewsletterModule {
1269
  } else {
1270
 
1271
  $extensions_json = wp_remote_retrieve_body($extensions_response);
1272
-
1273
  // Not clear cases
1274
  if (empty($extensions_json) || !json_decode($extensions_json)) {
1275
  $this->logger->error('Invalid json from thenewsletterplugin.com: retrying in 72 hours');
@@ -1378,6 +1386,16 @@ class Newsletter extends NewsletterModule {
1378
  return false;
1379
  }
1380
 
 
 
 
 
 
 
 
 
 
 
1381
  function get_license_data($refresh = false) {
1382
 
1383
  $this->logger->debug('Getting license data');
@@ -1385,6 +1403,7 @@ class Newsletter extends NewsletterModule {
1385
  $license_key = $this->get_license_key();
1386
  if (empty($license_key)) {
1387
  $this->logger->debug('License was empty');
 
1388
  return false;
1389
  }
1390
 
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: 7.1.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.
35
  return;
36
  }
37
 
38
+ define('NEWSLETTER_VERSION', '7.1.3');
39
 
40
  global $newsletter, $wpdb;
41
 
436
  $this->save_options($this->options);
437
  }
438
 
439
+ // Clear the addons and license caches
440
+ delete_transient('newsletter_license_data');
441
  delete_transient("tnp_extensions_json");
442
 
443
  touch(NEWSLETTER_LOG_DIR . '/index.html');
514
  if (!empty($this->options['css'])) {
515
  wp_add_inline_style('newsletter', $this->options['css']);
516
  }
517
+ } else {
518
+ if (!empty($this->options['css'])) {
519
+ add_action('wp_head', function () {
520
+ echo '<style>', $this->options['css'], '</style>';
521
+ });
522
+ }
523
  }
524
  }
525
 
827
  }
828
 
829
  $end_time = microtime(true);
830
+
831
+ // We sent to all supplied users, but warning that no more should be processed
832
+ if (!$test && $supplied_users && $this->limits_exceeded()) {
833
+ $result = false;
834
+ }
835
 
836
  //Se non sono in test e ho completato con successo delle spedizioni aggiorno i dati di diagnostica
837
  if (!$test && $count > 0) {
838
 
839
  NewsletterStatistics::instance()->reset_stats_time($email->id);
840
 
841
+ $send_calls = get_option('newsletter_diagnostic_send_calls', []);
842
  $send_calls[] = array($start_time, $end_time, $count, $result);
843
 
844
  if (count($send_calls) > self::MAX_CRON_SAMPLES)
847
  update_option('newsletter_diagnostic_send_calls', $send_calls, false);
848
  }
849
 
 
 
 
 
 
850
  $this->logger->info(__METHOD__ . '> End run for email ' . $email->id);
851
 
852
  return $result;
940
  return;
941
  }
942
  $status = empty($message->error) ? 0 : 1;
943
+
944
  $error = mb_substr($message->error, 0, 250);
945
 
946
  $this->query($wpdb->prepare("insert into " . $wpdb->prefix . 'newsletter_sent (user_id, email_id, time, status, error) values (%d, %d, %d, %d, %s) on duplicate key update time=%d, status=%d, error=%s', $message->user_id, $message->email_id, time(), $status, $error, time(), $status, $error));
1277
  } else {
1278
 
1279
  $extensions_json = wp_remote_retrieve_body($extensions_response);
1280
+
1281
  // Not clear cases
1282
  if (empty($extensions_json) || !json_decode($extensions_json)) {
1283
  $this->logger->error('Invalid json from thenewsletterplugin.com: retrying in 72 hours');
1386
  return false;
1387
  }
1388
 
1389
+ /**
1390
+ * Get the data connected to the specified license code on man settings.
1391
+ *
1392
+ * - false if no license is present
1393
+ * - WP_Error if something went wrong if getting the license data
1394
+ * - object with expiration and addons list
1395
+ *
1396
+ * @param boolean $refresh
1397
+ * @return \WP_Error|boolean|object
1398
+ */
1399
  function get_license_data($refresh = false) {
1400
 
1401
  $this->logger->debug('Getting license data');
1403
  $license_key = $this->get_license_key();
1404
  if (empty($license_key)) {
1405
  $this->logger->debug('License was empty');
1406
+ delete_transient('newsletter_license_data');
1407
  return false;
1408
  }
1409
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
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.7
5
- Stable tag: 7.1.2
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
@@ -121,6 +121,15 @@ Thank you, The Newsletter Team
121
 
122
  == Changelog ==
123
 
 
 
 
 
 
 
 
 
 
124
  = 7.1.2 =
125
 
126
  * [ADDONS] Fixed the addons list
@@ -218,143 +227,3 @@ Thank you, The Newsletter Team
218
  * Added filter on subscriber saving (from external systems) with wrong list field values
219
  * Added index.html on log folder
220
 
221
- = 6.9.9 =
222
-
223
- * Not specified gender fix
224
- * Labels translation
225
- * Added "newsletter_message" filter to act on the whole message before sending
226
- * Removed X-Mailer when sending with the internal SMTP
227
- * Added referrer field on subscriber editing page
228
- * Fixed button label control on composer
229
-
230
- = 6.9.8 =
231
-
232
- * New color picker
233
- * Extended the IP field on stats table
234
- * Removed filter for temporary email services (can be added in the security page)
235
- * Added support to show the last regular newsletter (not private) adding to the home url ?na=view&id=last
236
- * Hero and image blocks now use high res images
237
-
238
- = 6.9.7 =
239
-
240
- * Fixed country filter
241
- * Fixed tag replacements for server with TR-tr locale
242
-
243
- = 6.9.6 =
244
-
245
- * Added 3 months option for inactive subscriber selection
246
- * Improved the add-ons classes
247
- * Improved admin messages for multilanguage blogs
248
- * Updated link to documentation on main settings
249
- * Added VK and Telegram socials
250
- * Removed the old bounce import on subscribe maintenance panel
251
- * Added Telegram and VK icon on social block component
252
-
253
- = 6.9.5 =
254
- * Added new posts block layout
255
- * Improved the mobile version of hero block
256
- * Added title and text global fonts
257
-
258
- = NEXT =
259
-
260
- * Added pagination on newsletters page table
261
- * Changed label text for empty language in edit user page
262
- * Added preheader text on email
263
- * If email is paused but scheduled in the future it is now possible to change the sending date
264
- * Fixed font weight selection for titles on posts block
265
-
266
- = 6.9.4 =
267
-
268
- * Fixed the profile save
269
- * Improved the email change management from the subscriber data page
270
- * Removed custom javascript and opted for HTML5 validation (you can use a polyfill plugin like parsely)
271
- * Removed custom error messages (see above)
272
- * Check on delivery speed to be minimum 10 emails per hour
273
-
274
- = 6.9.3 =
275
-
276
- * Fixed profile saving spam check
277
-
278
- = 6.9.2 =
279
-
280
- * Fixed error on TNP::subscribe()
281
-
282
- = 6.9.1 =
283
-
284
- * Fix of administrator notice on form about worng list
285
-
286
- = 6.9.0 =
287
-
288
- * Improved and optimized the lists field shortcode
289
- * Added the dropdown option to the lists field shortcode
290
- * Optimized the standard generated form aligned with the structure of the form generated by shortcodes
291
- * Added notices **only for the administrator** on online forms to better discover wrong or unwanted configurations
292
- * Added support for the next to come API version 2
293
- * Internally revised the subscription process
294
- * Fixed empty tag {profile_20}
295
- * Fix CSS class on mininmal form privacy field
296
- * Improved error message with notes for administrator on form submission errors
297
- * Improved error repoting on invalid tracking links (very rare anyway)
298
-
299
- = 6.8.9 =
300
-
301
- * Welcome and activation messages test sent using the admin language
302
- * Added RTL/LTR button on composer text block
303
-
304
- = 6.8.8 =
305
-
306
- * Fixed cancellation notification for admins
307
-
308
- = 6.8.7 =
309
-
310
- * Fix of confirmation_url attribute on minimal subscription form
311
-
312
- = 6.8.6 =
313
-
314
- * Disabled the default WordPress emoji to image replacer on admin pages of Newsletter
315
-
316
- = 6.8.5 =
317
-
318
- * Updated Controls class to support the new Reports Addon
319
-
320
- = 6.8.4 =
321
-
322
- * Code update for WordPress 5.5 compatibility (PHPMailer)
323
- * Added dummy user-related-links on newsletter preview
324
- * Fixed optin form option for the minimal subsbscription form
325
-
326
- = 6.8.3 =
327
-
328
- * Changed the administrative notification of subscription removing the lists and linking the user profile
329
- * Fixed missing user token on data from some external sources
330
- * Extra profiles fix and optmization
331
- * Improved notificatons for usage of private fields on custom forms
332
- * Better management of opt-in override on forms and notices for administration when used in wrong ways
333
- * Fixed the posts block with odd numbers of posts on Automated context
334
- * Added administrative notices on custom form for invalid list usage
335
- * Added multilanguage support on lists on custom forms
336
- * Added multilanguage support on extra profiles on custom forms
337
- * Fixed CSS for extra profile fields
338
- * Improved antibot/antispam performances
339
- * Multilanguage on validation JS (but will be removed in favor of pure HTML validation)
340
- * Fixed label "for" attribute for extra fields on custom forms
341
- * Better test message from status panel
342
- * Fixed vulnerability reported by WordFence
343
-
344
- = 6.8.2 =
345
-
346
- * Added HTML filtering on block rendering
347
-
348
- = 6.8.1 =
349
-
350
- * Fixed welcome message not being displayed (on 6.8.0)
351
-
352
- = 6.8.0 =
353
-
354
- * Improved license checking (only for who set a license code - it is not required)
355
- * Imporved extra field configuration with multilanguage blogs
356
- * Improved subscription form with extra fields for multilanguage blogs
357
- * Minor code improvements
358
- * Improved HTTP responses for invalid profile links (good for users and acceptance tests)
359
- * Fixed newsletter page url generation with Polylang
360
-
1
  === Newsletter ===
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.7.1
5
+ Stable tag: 7.1.3
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
121
 
122
  == Changelog ==
123
 
124
+ = 7.1.3 =
125
+
126
+ * [COMPOSER] Improvements on blocks layout compatibility
127
+ * [COMPOSER] Fixed preset global options saving
128
+ * [COMPOSER] Content regeneration on preset selection
129
+ * [GENERAL] Added to System menu the Site Health link, a not well known native page of WordPress with system information
130
+ * [GENERAL] Added sending statistics reset button on status panel
131
+
132
+
133
  = 7.1.2 =
134
 
135
  * [ADDONS] Fixed the addons list
227
  * Added filter on subscriber saving (from external systems) with wrong list field values
228
  * Added index.html on log folder
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
statistics/statistics.php CHANGED
@@ -142,9 +142,15 @@ class NewsletterStatistics extends NewsletterModule {
142
  }
143
  }
144
 
 
 
 
 
 
 
145
  function reset_stats_time($email_id) {
146
  global $wpdb;
147
- $wpdb->update(NEWSLETTER_EMAILS_TABLE, array('stats_time' => 0), array('id' => $email_id));
148
  }
149
 
150
  function upgrade() {
142
  }
143
  }
144
 
145
+ /**
146
+ * Reset the timestamp which indicates the specific email stats must be recalculated.
147
+ *
148
+ * @global wpdb $wpdb
149
+ * @param int $email_id
150
+ */
151
  function reset_stats_time($email_id) {
152
  global $wpdb;
153
+ $wpdb->update(NEWSLETTER_EMAILS_TABLE, ['stats_time' => 0], ['id' => $email_id]);
154
  }
155
 
156
  function upgrade() {
subscription/subscription.php CHANGED
@@ -547,7 +547,7 @@ class NewsletterSubscription extends NewsletterModule {
547
  }
548
 
549
  // If the existing subscriber esists and is already confirmed, park the data until the new subscription is confirmed itself
550
- if ($user->status == Newsletter::STATUS_CONFIRMED && $subscription->optin == 'double') {
551
 
552
  set_transient('newsletter_subscription_' . $user->id, $subscription->data, 3600 * 48);
553
 
@@ -569,7 +569,7 @@ class NewsletterSubscription extends NewsletterModule {
569
 
570
  $user->token = $this->get_token();
571
 
572
- $user->status = $subscription->optin == 'single' ? Newsletter::STATUS_CONFIRMED : Newsletter::STATUS_NOT_CONFIRMED;
573
  $user->updated = time();
574
  }
575
 
@@ -580,14 +580,14 @@ class NewsletterSubscription extends NewsletterModule {
580
  $this->add_user_log($user, 'subscribe');
581
 
582
  // Notification to admin (only for new confirmed subscriptions)
583
- if ($user->status == Newsletter::STATUS_CONFIRMED) {
584
  do_action('newsletter_user_confirmed', $user);
585
  $this->notify_admin_on_subscription($user);
586
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
587
  }
588
 
589
  if ($subscription->send_emails) {
590
- $this->send_message(($user->status == Newsletter::STATUS_CONFIRMED) ? 'confirmed' : 'confirmation', $user);
591
  }
592
 
593
  // Used by Autoresponder (probably)
@@ -635,7 +635,7 @@ class NewsletterSubscription extends NewsletterModule {
635
  // If a status is forced and it is requested to be "confirmed" is like a single opt in
636
  // $status here can only be confirmed or not confirmed
637
  // TODO: Add a check on status values
638
- if ($status == Newsletter::STATUS_CONFIRMED) {
639
  $opt_in = self::OPTIN_SINGLE;
640
  } else {
641
  $opt_in = self::OPTIN_DOUBLE;
@@ -667,7 +667,7 @@ class NewsletterSubscription extends NewsletterModule {
667
 
668
  // If the subscriber is confirmed, we cannot change his data in double opt in mode, we need to
669
  // temporary store and wait for activation
670
- if ($user->status == Newsletter::STATUS_CONFIRMED && $opt_in == self::OPTIN_DOUBLE) {
671
 
672
  set_transient($this->get_user_key($user), $_REQUEST, 3600 * 48);
673
 
@@ -697,7 +697,7 @@ class NewsletterSubscription extends NewsletterModule {
697
  $ip = $this->process_ip($ip);
698
  $user['ip'] = $ip;
699
  $user['geo'] = 0;
700
- $user['status'] = $opt_in == self::OPTIN_SINGLE ? Newsletter::STATUS_CONFIRMED : Newsletter::STATUS_NOT_CONFIRMED;
701
 
702
  $user['updated'] = time();
703
 
@@ -708,14 +708,14 @@ class NewsletterSubscription extends NewsletterModule {
708
  $this->add_user_log($user, 'subscribe');
709
 
710
  // Notification to admin (only for new confirmed subscriptions)
711
- if ($user->status == Newsletter::STATUS_CONFIRMED) {
712
  do_action('newsletter_user_confirmed', $user);
713
  $this->notify_admin_on_subscription($user);
714
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
715
  }
716
 
717
  if ($emails) {
718
- $this->send_message(($user->status == Newsletter::STATUS_CONFIRMED) ? 'confirmed' : 'confirmation', $user);
719
  }
720
 
721
  $user = apply_filters('newsletter_user_post_subscribe', $user);
@@ -986,7 +986,7 @@ class NewsletterSubscription extends NewsletterModule {
986
  $data->merge_in($user);
987
  //$this->merge($user, $data);
988
  $user = $this->save_user($user);
989
- $user->status = Newsletter::STATUS_NOT_CONFIRMED;
990
  delete_transient('newsletter_subscription_' . $user->id);
991
  } else {
992
  $new_email = get_transient('newsletter_user_' . $user->id . '_email');
@@ -1042,7 +1042,7 @@ class NewsletterSubscription extends NewsletterModule {
1042
  $message = [];
1043
  $message['html'] = do_shortcode($options[$type . '_message']);
1044
  $message['text'] = $this->get_text_message($type);
1045
- if ($user->status == Newsletter::STATUS_NOT_CONFIRMED) {
1046
  $message['html'] = $this->add_microdata($message['html']);
1047
  }
1048
  $subject = $options[$type . '_subject'];
547
  }
548
 
549
  // If the existing subscriber esists and is already confirmed, park the data until the new subscription is confirmed itself
550
+ if ($user->status == TNP_User::STATUS_CONFIRMED && $subscription->optin == 'double') {
551
 
552
  set_transient('newsletter_subscription_' . $user->id, $subscription->data, 3600 * 48);
553
 
569
 
570
  $user->token = $this->get_token();
571
 
572
+ $user->status = $subscription->optin == 'single' ? TNP_User::STATUS_CONFIRMED : TNP_User::STATUS_NOT_CONFIRMED;
573
  $user->updated = time();
574
  }
575
 
580
  $this->add_user_log($user, 'subscribe');
581
 
582
  // Notification to admin (only for new confirmed subscriptions)
583
+ if ($user->status == TNP_User::STATUS_CONFIRMED) {
584
  do_action('newsletter_user_confirmed', $user);
585
  $this->notify_admin_on_subscription($user);
586
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
587
  }
588
 
589
  if ($subscription->send_emails) {
590
+ $this->send_message(($user->status == TNP_User::STATUS_CONFIRMED) ? 'confirmed' : 'confirmation', $user);
591
  }
592
 
593
  // Used by Autoresponder (probably)
635
  // If a status is forced and it is requested to be "confirmed" is like a single opt in
636
  // $status here can only be confirmed or not confirmed
637
  // TODO: Add a check on status values
638
+ if ($status == TNP_User::STATUS_CONFIRMED) {
639
  $opt_in = self::OPTIN_SINGLE;
640
  } else {
641
  $opt_in = self::OPTIN_DOUBLE;
667
 
668
  // If the subscriber is confirmed, we cannot change his data in double opt in mode, we need to
669
  // temporary store and wait for activation
670
+ if ($user->status == TNP_User::STATUS_CONFIRMED && $opt_in == self::OPTIN_DOUBLE) {
671
 
672
  set_transient($this->get_user_key($user), $_REQUEST, 3600 * 48);
673
 
697
  $ip = $this->process_ip($ip);
698
  $user['ip'] = $ip;
699
  $user['geo'] = 0;
700
+ $user['status'] = $opt_in == self::OPTIN_SINGLE ? TNP_User::STATUS_CONFIRMED : TNP_User::STATUS_NOT_CONFIRMED;
701
 
702
  $user['updated'] = time();
703
 
708
  $this->add_user_log($user, 'subscribe');
709
 
710
  // Notification to admin (only for new confirmed subscriptions)
711
+ if ($user->status == TNP_User::STATUS_CONFIRMED) {
712
  do_action('newsletter_user_confirmed', $user);
713
  $this->notify_admin_on_subscription($user);
714
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
715
  }
716
 
717
  if ($emails) {
718
+ $this->send_message(($user->status == TNP_User::STATUS_CONFIRMED) ? 'confirmed' : 'confirmation', $user);
719
  }
720
 
721
  $user = apply_filters('newsletter_user_post_subscribe', $user);
986
  $data->merge_in($user);
987
  //$this->merge($user, $data);
988
  $user = $this->save_user($user);
989
+ $user->status = TNP_User::STATUS_NOT_CONFIRMED;
990
  delete_transient('newsletter_subscription_' . $user->id);
991
  } else {
992
  $new_email = get_transient('newsletter_user_' . $user->id . '_email');
1042
  $message = [];
1043
  $message['html'] = do_shortcode($options[$type . '_message']);
1044
  $message['text'] = $this->get_text_message($type);
1045
+ if ($user->status == TNP_User::STATUS_NOT_CONFIRMED) {
1046
  $message['html'] = $this->add_microdata($message['html']);
1047
  }
1048
  $subject = $options[$type . '_subject'];
tnp-header.php CHANGED
@@ -183,6 +183,10 @@ $warning |= empty($status_options['mail']);
183
  <?php } ?>
184
  </a>
185
  <ul>
 
 
 
 
186
  <li>
187
  <a href="?page=newsletter_main_status"><i class="fas fa-file"></i> <?php _e('Status', 'newsletter') ?>
188
  <small><?php _e('Checks and parameters', 'newsletter') ?></small></a>
183
  <?php } ?>
184
  </a>
185
  <ul>
186
+ <li>
187
+ <a href="<?php echo admin_url('site-health.php')?> "><i class="fas fa-file"></i> <?php _e('Site health') ?>
188
+ <small><?php _e('WP native site health checks', 'newsletter') ?></small></a>
189
+ </li>
190
  <li>
191
  <a href="?page=newsletter_main_status"><i class="fas fa-file"></i> <?php _e('Status', 'newsletter') ?>
192
  <small><?php _e('Checks and parameters', 'newsletter') ?></small></a>