Version Description
- XSS security fix
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.4.6 |
Comparing to | |
See all releases |
Code changes from version 7.4.4 to 7.4.6
- admin/toast.css +131 -131
- includes/composer.php +2 -2
- includes/helper.php +415 -415
- plugin.php +2 -2
- readme.txt +10 -1
- subscription/subscription.php +1 -1
- tnp-header.php +345 -345
admin/toast.css
CHANGED
@@ -1,131 +1,131 @@
|
|
1 |
-
.tnp-toast-main-wrapper {
|
2 |
-
position: fixed;
|
3 |
-
top: 0;
|
4 |
-
left: 0;
|
5 |
-
box-sizing: border-box;
|
6 |
-
height: 100%;
|
7 |
-
width: 100%;
|
8 |
-
z-index: 9991;
|
9 |
-
pointer-events: none;
|
10 |
-
|
11 |
-
display: flex;
|
12 |
-
flex-direction: column;
|
13 |
-
|
14 |
-
}
|
15 |
-
|
16 |
-
.tnp-toast-main-wrapper .notification {
|
17 |
-
display: block;
|
18 |
-
overflow: hidden;
|
19 |
-
pointer-events: auto;
|
20 |
-
box-shadow: 0 3px 7px 0 rgba(0, 0, 0, .25);
|
21 |
-
position: relative;
|
22 |
-
padding: 15px;
|
23 |
-
padding-left: 20px;
|
24 |
-
border-radius: 2px;
|
25 |
-
max-width: 300px;
|
26 |
-
transform: translateY(25%);
|
27 |
-
box-sizing: border-box;
|
28 |
-
flex-shrink: 0;
|
29 |
-
font-weight: bold;
|
30 |
-
animation: .4s ease-in forwards;
|
31 |
-
background-color: #FFF;
|
32 |
-
}
|
33 |
-
|
34 |
-
.tnp-toast-main-wrapper .notification:after {
|
35 |
-
content: ' ';
|
36 |
-
position: absolute;
|
37 |
-
left: 0;
|
38 |
-
top: 0;
|
39 |
-
width: 5px;
|
40 |
-
height: 100%;
|
41 |
-
}
|
42 |
-
|
43 |
-
.tnp-toast-main-wrapper .notification.push-up {
|
44 |
-
animation-name: notification-fadeinup;
|
45 |
-
}
|
46 |
-
|
47 |
-
.tnp-toast-main-wrapper .notification.push-down {
|
48 |
-
animation-name: notification-fadeindown;
|
49 |
-
}
|
50 |
-
|
51 |
-
.tnp-toast-main-wrapper .notification.pop-down {
|
52 |
-
transform: translateY(0);
|
53 |
-
animation: notification-fadeoutdown .4s forwards;
|
54 |
-
animation-delay: .25s;
|
55 |
-
}
|
56 |
-
|
57 |
-
.tnp-toast-main-wrapper .notification.pop-up {
|
58 |
-
transform: translateY(0);
|
59 |
-
animation: notification-fadeoutup .4s forwards;
|
60 |
-
animation-delay: .25s;
|
61 |
-
}
|
62 |
-
|
63 |
-
.tnp-toast-main-wrapper .notification.top-to-bottom {
|
64 |
-
margin-bottom: 20px;
|
65 |
-
}
|
66 |
-
|
67 |
-
.tnp-toast-main-wrapper .notification.bottom-to-top {
|
68 |
-
margin-top: 20px;
|
69 |
-
}
|
70 |
-
|
71 |
-
.tnp-toast-main-wrapper .notification.notification-success:after {
|
72 |
-
background-color: #46b450;
|
73 |
-
}
|
74 |
-
|
75 |
-
.tnp-toast-main-wrapper .notification.notification-error:after {
|
76 |
-
background-color: #dd0000;
|
77 |
-
}
|
78 |
-
|
79 |
-
.tnp-toast-main-wrapper .notification.notification-info:after {
|
80 |
-
background-color: #0073aa;
|
81 |
-
}
|
82 |
-
|
83 |
-
.tnp-toast-main-wrapper .notification.notification-warning:after {
|
84 |
-
background-color: #ffb900;
|
85 |
-
}
|
86 |
-
|
87 |
-
@keyframes notification-fadeinup {
|
88 |
-
0% {
|
89 |
-
opacity: 0;
|
90 |
-
transform: translateY(25%);
|
91 |
-
}
|
92 |
-
|
93 |
-
100% {
|
94 |
-
opacity: 1;
|
95 |
-
transform: translateY(0);
|
96 |
-
}
|
97 |
-
}
|
98 |
-
|
99 |
-
@keyframes notification-fadeoutdown {
|
100 |
-
100% {
|
101 |
-
opacity: 1;
|
102 |
-
transform: translateY(0);
|
103 |
-
}
|
104 |
-
100% {
|
105 |
-
opacity: 0;
|
106 |
-
transform: translateY(25%);
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
@keyframes notification-fadeindown {
|
111 |
-
0% {
|
112 |
-
opacity: 0;
|
113 |
-
transform: translateY(-25%);
|
114 |
-
}
|
115 |
-
|
116 |
-
100% {
|
117 |
-
opacity: 1;
|
118 |
-
transform: translateY(0);
|
119 |
-
}
|
120 |
-
}
|
121 |
-
|
122 |
-
@keyframes notification-fadeoutup {
|
123 |
-
100% {
|
124 |
-
opacity: 1;
|
125 |
-
transform: translateY(0);
|
126 |
-
}
|
127 |
-
100% {
|
128 |
-
opacity: 0;
|
129 |
-
transform: translateY(-25%);
|
130 |
-
}
|
131 |
-
}
|
1 |
+
.tnp-toast-main-wrapper {
|
2 |
+
position: fixed;
|
3 |
+
top: 0;
|
4 |
+
left: 0;
|
5 |
+
box-sizing: border-box;
|
6 |
+
height: 100%;
|
7 |
+
width: 100%;
|
8 |
+
z-index: 9991;
|
9 |
+
pointer-events: none;
|
10 |
+
|
11 |
+
display: flex;
|
12 |
+
flex-direction: column;
|
13 |
+
|
14 |
+
}
|
15 |
+
|
16 |
+
.tnp-toast-main-wrapper .notification {
|
17 |
+
display: block;
|
18 |
+
overflow: hidden;
|
19 |
+
pointer-events: auto;
|
20 |
+
box-shadow: 0 3px 7px 0 rgba(0, 0, 0, .25);
|
21 |
+
position: relative;
|
22 |
+
padding: 15px;
|
23 |
+
padding-left: 20px;
|
24 |
+
border-radius: 2px;
|
25 |
+
max-width: 300px;
|
26 |
+
transform: translateY(25%);
|
27 |
+
box-sizing: border-box;
|
28 |
+
flex-shrink: 0;
|
29 |
+
font-weight: bold;
|
30 |
+
animation: .4s ease-in forwards;
|
31 |
+
background-color: #FFF;
|
32 |
+
}
|
33 |
+
|
34 |
+
.tnp-toast-main-wrapper .notification:after {
|
35 |
+
content: ' ';
|
36 |
+
position: absolute;
|
37 |
+
left: 0;
|
38 |
+
top: 0;
|
39 |
+
width: 5px;
|
40 |
+
height: 100%;
|
41 |
+
}
|
42 |
+
|
43 |
+
.tnp-toast-main-wrapper .notification.push-up {
|
44 |
+
animation-name: notification-fadeinup;
|
45 |
+
}
|
46 |
+
|
47 |
+
.tnp-toast-main-wrapper .notification.push-down {
|
48 |
+
animation-name: notification-fadeindown;
|
49 |
+
}
|
50 |
+
|
51 |
+
.tnp-toast-main-wrapper .notification.pop-down {
|
52 |
+
transform: translateY(0);
|
53 |
+
animation: notification-fadeoutdown .4s forwards;
|
54 |
+
animation-delay: .25s;
|
55 |
+
}
|
56 |
+
|
57 |
+
.tnp-toast-main-wrapper .notification.pop-up {
|
58 |
+
transform: translateY(0);
|
59 |
+
animation: notification-fadeoutup .4s forwards;
|
60 |
+
animation-delay: .25s;
|
61 |
+
}
|
62 |
+
|
63 |
+
.tnp-toast-main-wrapper .notification.top-to-bottom {
|
64 |
+
margin-bottom: 20px;
|
65 |
+
}
|
66 |
+
|
67 |
+
.tnp-toast-main-wrapper .notification.bottom-to-top {
|
68 |
+
margin-top: 20px;
|
69 |
+
}
|
70 |
+
|
71 |
+
.tnp-toast-main-wrapper .notification.notification-success:after {
|
72 |
+
background-color: #46b450;
|
73 |
+
}
|
74 |
+
|
75 |
+
.tnp-toast-main-wrapper .notification.notification-error:after {
|
76 |
+
background-color: #dd0000;
|
77 |
+
}
|
78 |
+
|
79 |
+
.tnp-toast-main-wrapper .notification.notification-info:after {
|
80 |
+
background-color: #0073aa;
|
81 |
+
}
|
82 |
+
|
83 |
+
.tnp-toast-main-wrapper .notification.notification-warning:after {
|
84 |
+
background-color: #ffb900;
|
85 |
+
}
|
86 |
+
|
87 |
+
@keyframes notification-fadeinup {
|
88 |
+
0% {
|
89 |
+
opacity: 0;
|
90 |
+
transform: translateY(25%);
|
91 |
+
}
|
92 |
+
|
93 |
+
100% {
|
94 |
+
opacity: 1;
|
95 |
+
transform: translateY(0);
|
96 |
+
}
|
97 |
+
}
|
98 |
+
|
99 |
+
@keyframes notification-fadeoutdown {
|
100 |
+
100% {
|
101 |
+
opacity: 1;
|
102 |
+
transform: translateY(0);
|
103 |
+
}
|
104 |
+
100% {
|
105 |
+
opacity: 0;
|
106 |
+
transform: translateY(25%);
|
107 |
+
}
|
108 |
+
}
|
109 |
+
|
110 |
+
@keyframes notification-fadeindown {
|
111 |
+
0% {
|
112 |
+
opacity: 0;
|
113 |
+
transform: translateY(-25%);
|
114 |
+
}
|
115 |
+
|
116 |
+
100% {
|
117 |
+
opacity: 1;
|
118 |
+
transform: translateY(0);
|
119 |
+
}
|
120 |
+
}
|
121 |
+
|
122 |
+
@keyframes notification-fadeoutup {
|
123 |
+
100% {
|
124 |
+
opacity: 1;
|
125 |
+
transform: translateY(0);
|
126 |
+
}
|
127 |
+
100% {
|
128 |
+
opacity: 0;
|
129 |
+
transform: translateY(-25%);
|
130 |
+
}
|
131 |
+
}
|
includes/composer.php
CHANGED
@@ -141,7 +141,7 @@ class TNP_Composer {
|
|
141 |
Â
return "";
|
142 |
Â
}
|
143 |
Â
|
144 |
-
$preheader_text = $email->options['preheader'];
|
145 |
Â
$html = "<div style=\"display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;\">$preheader_text</div>";
|
146 |
Â
$html .= "\n";
|
147 |
Â
|
@@ -437,7 +437,7 @@ class TNP_Composer {
|
|
437 |
Â
}
|
438 |
Â
$b .= ' alt="' . esc_attr($media->alt) . '"'
|
439 |
Â
. ' border="0"'
|
440 |
-
. ' style="display: inline-block; max-width: 100%!important; padding: 0; border: 0;"'
|
441 |
Â
. ' class="' . esc_attr($attr['class']) . '" '
|
442 |
Â
. '>';
|
443 |
Â
}
|
141 |
Â
return "";
|
142 |
Â
}
|
143 |
Â
|
144 |
+
$preheader_text = esc_html($email->options['preheader']);
|
145 |
Â
$html = "<div style=\"display:none;font-size:1px;color:#ffffff;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;\">$preheader_text</div>";
|
146 |
Â
$html .= "\n";
|
147 |
Â
|
437 |
Â
}
|
438 |
Â
$b .= ' alt="' . esc_attr($media->alt) . '"'
|
439 |
Â
. ' border="0"'
|
440 |
+
. ' style="display: inline-block; max-width: 100%!important; padding: 0; border: 0; font-size: 12px"'
|
441 |
Â
. ' class="' . esc_attr($attr['class']) . '" '
|
442 |
Â
. '>';
|
443 |
Â
}
|
includes/helper.php
CHANGED
@@ -1,415 +1,415 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
defined('ABSPATH') || exit;
|
4 |
-
|
5 |
-
function tnp_post_thumbnail_src($post, $size = 'thumbnail', $alternative = '') {
|
6 |
-
if (is_object($post)) {
|
7 |
-
$post = $post->ID;
|
8 |
-
}
|
9 |
-
|
10 |
-
// Find a media id to be used as featured image
|
11 |
-
$media_id = get_post_thumbnail_id($post);
|
12 |
-
if (empty($media_id)) {
|
13 |
-
$attachments = get_children(array('numberpost' => 1, 'post_parent' => $post, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order'));
|
14 |
-
if (!empty($attachments)) {
|
15 |
-
foreach ($attachments as $id => &$attachment) {
|
16 |
-
$media_id = $id;
|
17 |
-
break;
|
18 |
-
}
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
if (!$media_id) {
|
23 |
-
return $alternative;
|
24 |
-
}
|
25 |
-
|
26 |
-
if (!defined('NEWSLETTER_MEDIA_RESIZE') || NEWSLETTER_MEDIA_RESIZE) {
|
27 |
-
if (is_array($size)) {
|
28 |
-
$src = tnp_media_resize($media_id, $size);
|
29 |
-
if (is_wp_error($src)) {
|
30 |
-
Newsletter::instance()->logger->error($src);
|
31 |
-
return $alternative;
|
32 |
-
} else {
|
33 |
-
return $src;
|
34 |
-
}
|
35 |
-
}
|
36 |
-
}
|
37 |
-
|
38 |
-
$media = wp_get_attachment_image_src($media_id, $size);
|
39 |
-
if (strpos($media[0], 'http') !== 0) {
|
40 |
-
$media[0] = 'http:' . $media[0];
|
41 |
-
}
|
42 |
-
return $media[0];
|
43 |
-
}
|
44 |
-
|
45 |
-
/**
|
46 |
-
* @param WP_Post $post
|
47 |
-
* @param int $length
|
48 |
-
*
|
49 |
-
* @return string
|
50 |
-
*/
|
51 |
-
function tnp_post_excerpt($post, $length = 30, $characters = false) {
|
52 |
-
if (!$length) return '';
|
53 |
-
|
54 |
-
$excerpt = get_the_excerpt($post->ID);
|
55 |
-
$excerpt = tnp_delete_all_shordcodes_tags($excerpt);
|
56 |
-
$excerpt = trim($excerpt);
|
57 |
-
$excerpt = str_replace(' ', '', $excerpt);
|
58 |
-
|
59 |
-
if ($characters) {
|
60 |
-
if (strlen($excerpt) > $length) {
|
61 |
-
$excerpt = substr($excerpt, 0, $length);
|
62 |
-
$i = strrpos($excerpt, ' ');
|
63 |
-
if ($i) {
|
64 |
-
$excerpt = substr($excerpt, 0, $i);
|
65 |
-
$excerpt .= '…';
|
66 |
-
}
|
67 |
-
}
|
68 |
-
} else {
|
69 |
-
$excerpt = wp_trim_words($excerpt, $length);
|
70 |
-
}
|
71 |
-
|
72 |
-
return $excerpt;
|
73 |
-
}
|
74 |
-
|
75 |
-
function tnp_delete_all_shordcodes_tags($post_content = '') {
|
76 |
-
//Delete open tags
|
77 |
-
$post_content = preg_replace("/\[[a-zA-Z0-9_-]*?(\s.*?)?\]/", '', $post_content);
|
78 |
-
//Delete close tags
|
79 |
-
$post_content = preg_replace("/\[\/[a-zA-Z0-9_-]*?\]/", '', $post_content);
|
80 |
-
|
81 |
-
return $post_content;
|
82 |
-
}
|
83 |
-
|
84 |
-
function tnp_post_permalink($post) {
|
85 |
-
return get_permalink($post->ID);
|
86 |
-
}
|
87 |
-
|
88 |
-
function tnp_post_content($post) {
|
89 |
-
return $post->post_content;
|
90 |
-
}
|
91 |
-
|
92 |
-
function tnp_post_title($post) {
|
93 |
-
//return $post->post_title;
|
94 |
-
return get_the_title($post);
|
95 |
-
}
|
96 |
-
|
97 |
-
function tnp_post_date($post, $format = null) {
|
98 |
-
return get_the_date( $format, $post );
|
99 |
-
}
|
100 |
-
|
101 |
-
/**
|
102 |
-
* Tries to create a resized version of a media uploaded to the media library.
|
103 |
-
* Returns an empty string if the media does not exists or generally if the attached file
|
104 |
-
* cannot be found. If the resize fails for whatever reason, fall backs to the
|
105 |
-
* standard image source returned by WP which is usually not exactly the
|
106 |
-
* requested size.
|
107 |
-
*
|
108 |
-
* @param int $media_id
|
109 |
-
* @param array $size
|
110 |
-
* @return string
|
111 |
-
*/
|
112 |
-
function tnp_media_resize($media_id, $size) {
|
113 |
-
if (empty($media_id)) {
|
114 |
-
return '';
|
115 |
-
}
|
116 |
-
|
117 |
-
$relative_file = get_post_meta($media_id, '_wp_attached_file', true);
|
118 |
-
if (empty($relative_file)) {
|
119 |
-
return '';
|
120 |
-
}
|
121 |
-
|
122 |
-
$width = $size[0];
|
123 |
-
$height = $size[1];
|
124 |
-
$crop = false;
|
125 |
-
if (isset($size[2])) {
|
126 |
-
$crop = (boolean) $size[2];
|
127 |
-
}
|
128 |
-
|
129 |
-
$uploads = wp_upload_dir();
|
130 |
-
|
131 |
-
// Based on _wp_relative_upload_path() function for blog which store the
|
132 |
-
// full patch of media files
|
133 |
-
if (0 === strpos($relative_file, $uploads['basedir'])) {
|
134 |
-
$relative_file = str_replace($uploads['basedir'], '', $relative_file);
|
135 |
-
$relative_file = ltrim($relative_file, '/');
|
136 |
-
}
|
137 |
-
|
138 |
-
$absolute_file = $uploads['basedir'] . '/' . $relative_file;
|
139 |
-
// Relative and absolute name of the thumbnail.
|
140 |
-
$pathinfo = pathinfo($relative_file);
|
141 |
-
|
142 |
-
// We don't know why, but on some systems files with non-ascii characters loose the file name (grrr...)
|
143 |
-
if (empty($pathinfo['filename'])) {
|
144 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
145 |
-
return $src[0];
|
146 |
-
}
|
147 |
-
|
148 |
-
$relative_thumb = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $width . 'x' .
|
149 |
-
$height . ($crop ? '-c' : '') . '.' . $pathinfo['extension'];
|
150 |
-
$absolute_thumb = $uploads['basedir'] . '/newsletter/thumbnails/' . $relative_thumb;
|
151 |
-
|
152 |
-
// Thumbnail generation if needed.
|
153 |
-
if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
|
154 |
-
$r = wp_mkdir_p($uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
155 |
-
|
156 |
-
if (!$r) {
|
157 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
158 |
-
return $src[0];
|
159 |
-
}
|
160 |
-
|
161 |
-
$editor = wp_get_image_editor($absolute_file);
|
162 |
-
if (is_wp_error($editor)) {
|
163 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
164 |
-
return $src[0];
|
165 |
-
//return $editor;
|
166 |
-
//return $uploads['baseurl'] . '/' . $relative_file;
|
167 |
-
}
|
168 |
-
|
169 |
-
$original_size = $editor->get_size();
|
170 |
-
if ($width > $original_size['width'] || $height > $original_size['height']) {
|
171 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
172 |
-
return $src[0];
|
173 |
-
}
|
174 |
-
|
175 |
-
$editor->set_quality(80);
|
176 |
-
$resized = $editor->resize($width, $height, $crop);
|
177 |
-
|
178 |
-
if (is_wp_error($resized)) {
|
179 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
180 |
-
return $src[0];
|
181 |
-
}
|
182 |
-
|
183 |
-
$saved = $editor->save($absolute_thumb);
|
184 |
-
if (is_wp_error($saved)) {
|
185 |
-
$src = wp_get_attachment_image_src($media_id, 'full');
|
186 |
-
return $src[0];
|
187 |
-
//return $saved;
|
188 |
-
//return $uploads['baseurl'] . '/' . $relative_file;
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
return $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
193 |
-
}
|
194 |
-
|
195 |
-
function _tnp_get_default_media($media_id, $size) {
|
196 |
-
|
197 |
-
$src = wp_get_attachment_image_src($media_id, $size);
|
198 |
-
if (!$src) {
|
199 |
-
return null;
|
200 |
-
}
|
201 |
-
$media = new TNP_Media();
|
202 |
-
$media->id = $media_id;
|
203 |
-
$media->url = $src[0];
|
204 |
-
$media->width = $src[1];
|
205 |
-
$media->height = $src[2];
|
206 |
-
return $media;
|
207 |
-
}
|
208 |
-
|
209 |
-
function tnp_get_media($media_id, $size) {
|
210 |
-
$src = wp_get_attachment_image_src($media_id, $size);
|
211 |
-
if (!$src) {
|
212 |
-
return null;
|
213 |
-
}
|
214 |
-
$media = new TNP_Media();
|
215 |
-
$media->id = $media_id;
|
216 |
-
$media->url = $src[0];
|
217 |
-
$media->width = $src[1];
|
218 |
-
$media->height = $src[2];
|
219 |
-
return $media;
|
220 |
-
}
|
221 |
-
|
222 |
-
/**
|
223 |
-
* Create a resized version of the media stored in the WP media library.
|
224 |
-
*
|
225 |
-
* @param int $media_id
|
226 |
-
* @param array $size
|
227 |
-
* @return TNP_Media
|
228 |
-
*/
|
229 |
-
function tnp_resize($media_id, $size) {
|
230 |
-
if (empty($media_id)) {
|
231 |
-
return null;
|
232 |
-
}
|
233 |
-
|
234 |
-
$relative_file = get_post_meta($media_id, '_wp_attached_file', true);
|
235 |
-
|
236 |
-
if (empty($relative_file)) {
|
237 |
-
return null;
|
238 |
-
}
|
239 |
-
|
240 |
-
$uploads = wp_upload_dir();
|
241 |
-
|
242 |
-
// Based on _wp_relative_upload_path() function for blog which store the
|
243 |
-
// full path of media files
|
244 |
-
if (0 === strpos($relative_file, $uploads['basedir'])) {
|
245 |
-
$relative_file = str_replace($uploads['basedir'], '', $relative_file);
|
246 |
-
$relative_file = ltrim($relative_file, '/');
|
247 |
-
}
|
248 |
-
|
249 |
-
$width = $size[0];
|
250 |
-
$height = $size[1];
|
251 |
-
$crop = false;
|
252 |
-
if (isset($size[2])) {
|
253 |
-
$crop = (boolean) $size[2];
|
254 |
-
}
|
255 |
-
|
256 |
-
$absolute_file = $uploads['basedir'] . '/' . $relative_file;
|
257 |
-
|
258 |
-
if (substr($relative_file, -4) === '.gif') {
|
259 |
-
$editor = wp_get_image_editor($absolute_file);
|
260 |
-
if (is_wp_error($editor)) {
|
261 |
-
return _tnp_get_default_media($media_id, $size);
|
262 |
-
}
|
263 |
-
$new_size = $editor->get_size();
|
264 |
-
$media = new TNP_Media();
|
265 |
-
$media->id = $media_id;
|
266 |
-
$media->width = $new_size['width'];
|
267 |
-
$media->height = $new_size['height'];
|
268 |
-
if ($media->width > $width) {
|
269 |
-
$media->set_width($width);
|
270 |
-
}
|
271 |
-
$media->url = $uploads['baseurl'] . '/' . $relative_file;
|
272 |
-
return $media;
|
273 |
-
}
|
274 |
-
|
275 |
-
// Relative and absolute name of the thumbnail.
|
276 |
-
$pathinfo = pathinfo($relative_file);
|
277 |
-
|
278 |
-
// We don't know why, but on some systems files with non-ascii characters loose the file name (grrr...)
|
279 |
-
if (empty($pathinfo['filename'])) {
|
280 |
-
return _tnp_get_default_media($media_id, $size);
|
281 |
-
}
|
282 |
-
|
283 |
-
$relative_thumb = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $width . 'x' . $height . ($crop ? '-c' : '') . '.' . $pathinfo['extension'];
|
284 |
-
$absolute_thumb = $uploads['basedir'] . '/newsletter/thumbnails/' . $relative_thumb;
|
285 |
-
|
286 |
-
// Thumbnail generation if needed.
|
287 |
-
if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
|
288 |
-
$r = wp_mkdir_p($uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
289 |
-
|
290 |
-
if (!$r) {
|
291 |
-
Newsletter::instance()->logger->error('Unable to create dir ' . $uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
292 |
-
return _tnp_get_default_media($media_id, $size);
|
293 |
-
}
|
294 |
-
|
295 |
-
$editor = wp_get_image_editor($absolute_file);
|
296 |
-
if (is_wp_error($editor)) {
|
297 |
-
Newsletter::instance()->logger->error($editor);
|
298 |
-
Newsletter::instance()->logger->error('File: ' . $absolute_file);
|
299 |
-
return _tnp_get_default_media($media_id, $size);
|
300 |
-
}
|
301 |
-
|
302 |
-
$original_size = $editor->get_size();
|
303 |
-
if ($width > $original_size['width'] && ($height > $original_size['height'] || $height == 0)) {
|
304 |
-
Newsletter::instance()->logger->error('Requested size larger than the original one');
|
305 |
-
return _tnp_get_default_media($media_id, $size);
|
306 |
-
}
|
307 |
-
|
308 |
-
if ($height > $original_size['height'] && ($width > $original_size['width'] || $width == 0)) {
|
309 |
-
Newsletter::instance()->logger->error('Requested size larger than the original one');
|
310 |
-
return _tnp_get_default_media($media_id, $size);
|
311 |
-
}
|
312 |
-
|
313 |
-
$editor->set_quality(85);
|
314 |
-
$resized = $editor->resize($width, $height, $crop);
|
315 |
-
|
316 |
-
if (is_wp_error($resized)) {
|
317 |
-
Newsletter::instance()->logger->error($resized);
|
318 |
-
Newsletter::instance()->logger->error('File: ' . $absolute_file);
|
319 |
-
return _tnp_get_default_media($media_id, $size);
|
320 |
-
}
|
321 |
-
|
322 |
-
$saved = $editor->save($absolute_thumb);
|
323 |
-
if (is_wp_error($saved)) {
|
324 |
-
Newsletter::instance()->logger->error($saved);
|
325 |
-
return _tnp_get_default_media($media_id, $size);
|
326 |
-
}
|
327 |
-
$new_size = $editor->get_size();
|
328 |
-
|
329 |
-
$media = new TNP_Media();
|
330 |
-
$media->width = $new_size['width'];
|
331 |
-
$media->height = $new_size['height'];
|
332 |
-
$media->url = $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
333 |
-
} else {
|
334 |
-
$media = new TNP_Media();
|
335 |
-
$new_size = getimagesize($absolute_thumb);
|
336 |
-
$media->width = $new_size[0];
|
337 |
-
$media->height = $new_size[1];
|
338 |
-
$media->url = $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
339 |
-
}
|
340 |
-
|
341 |
-
return $media;
|
342 |
-
}
|
343 |
-
|
344 |
-
function tnp_resize_2x($media_id, $size) {
|
345 |
-
$size[0] = $size[0] * 2;
|
346 |
-
$size[1] = $size[1] * 2;
|
347 |
-
$media = tnp_resize($media_id, $size);
|
348 |
-
if (!$media)
|
349 |
-
return $media;
|
350 |
-
$media->set_width($size[0] / 2);
|
351 |
-
return $media;
|
352 |
-
}
|
353 |
-
|
354 |
-
/**
|
355 |
-
* @param TNP_Media[] $images
|
356 |
-
*
|
357 |
-
* @return int
|
358 |
-
*/
|
359 |
-
function tnp_get_max_height_of($images) {
|
360 |
-
$max_height = 0;
|
361 |
-
foreach ($images as $image) {
|
362 |
-
$max_height = $image->height > $max_height ? $image->height : $max_height;
|
363 |
-
}
|
364 |
-
|
365 |
-
return $max_height;
|
366 |
-
}
|
367 |
-
|
368 |
-
/**
|
369 |
-
* @param WP_Post[] $product_list
|
370 |
-
* @param array $size
|
371 |
-
*
|
372 |
-
* @return TNP_Media[]
|
373 |
-
*/
|
374 |
-
function tnp_resize_product_list_featured_image($product_list, $size) {
|
375 |
-
$images = [];
|
376 |
-
foreach ($product_list as $p) {
|
377 |
-
$images[$p->ID] = tnp_resize_2x(TNP_Composer::get_post_thumbnail_id($p->ID), $size);
|
378 |
-
}
|
379 |
-
|
380 |
-
return $images;
|
381 |
-
}
|
382 |
-
|
383 |
-
/**
|
384 |
-
* Get media for "posts" composer block
|
385 |
-
*
|
386 |
-
* @param WP_Post post
|
387 |
-
* @param array $size
|
388 |
-
* @param string $default_image_url
|
389 |
-
*
|
390 |
-
* @return TNP_Media
|
391 |
-
*/
|
392 |
-
function tnp_composer_block_posts_get_media($post, $size, $default_image_url = null) {
|
393 |
-
$post_thumbnail_id = TNP_Composer::get_post_thumbnail_id($post);
|
394 |
-
|
395 |
-
$media = null;
|
396 |
-
|
397 |
-
if (!empty($post_thumbnail_id)) {
|
398 |
-
$media = tnp_resize($post_thumbnail_id, array_values($size));
|
399 |
-
} else if ($default_image_url) {
|
400 |
-
Newsletter::instance()->logger->error('Thumbnail id not found');
|
401 |
-
$media = new TNP_Media();
|
402 |
-
$media->url = $default_image_url;
|
403 |
-
$media->width = $size['width'];
|
404 |
-
$media->height = $size['height'];
|
405 |
-
}
|
406 |
-
return $media;
|
407 |
-
}
|
408 |
-
|
409 |
-
function tnp_outlook_wrapper_open($width = 600) {
|
410 |
-
return NewsletterEmails::get_outlook_wrapper_open($width);
|
411 |
-
}
|
412 |
-
|
413 |
-
function tnp_outlook_wrapper_close() {
|
414 |
-
return NewsletterEmails::get_outlook_wrapper_close();
|
415 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') || exit;
|
4 |
+
|
5 |
+
function tnp_post_thumbnail_src($post, $size = 'thumbnail', $alternative = '') {
|
6 |
+
if (is_object($post)) {
|
7 |
+
$post = $post->ID;
|
8 |
+
}
|
9 |
+
|
10 |
+
// Find a media id to be used as featured image
|
11 |
+
$media_id = get_post_thumbnail_id($post);
|
12 |
+
if (empty($media_id)) {
|
13 |
+
$attachments = get_children(array('numberpost' => 1, 'post_parent' => $post, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order'));
|
14 |
+
if (!empty($attachments)) {
|
15 |
+
foreach ($attachments as $id => &$attachment) {
|
16 |
+
$media_id = $id;
|
17 |
+
break;
|
18 |
+
}
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
if (!$media_id) {
|
23 |
+
return $alternative;
|
24 |
+
}
|
25 |
+
|
26 |
+
if (!defined('NEWSLETTER_MEDIA_RESIZE') || NEWSLETTER_MEDIA_RESIZE) {
|
27 |
+
if (is_array($size)) {
|
28 |
+
$src = tnp_media_resize($media_id, $size);
|
29 |
+
if (is_wp_error($src)) {
|
30 |
+
Newsletter::instance()->logger->error($src);
|
31 |
+
return $alternative;
|
32 |
+
} else {
|
33 |
+
return $src;
|
34 |
+
}
|
35 |
+
}
|
36 |
+
}
|
37 |
+
|
38 |
+
$media = wp_get_attachment_image_src($media_id, $size);
|
39 |
+
if (strpos($media[0], 'http') !== 0) {
|
40 |
+
$media[0] = 'http:' . $media[0];
|
41 |
+
}
|
42 |
+
return $media[0];
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param WP_Post $post
|
47 |
+
* @param int $length
|
48 |
+
*
|
49 |
+
* @return string
|
50 |
+
*/
|
51 |
+
function tnp_post_excerpt($post, $length = 30, $characters = false) {
|
52 |
+
if (!$length) return '';
|
53 |
+
|
54 |
+
$excerpt = get_the_excerpt($post->ID);
|
55 |
+
$excerpt = tnp_delete_all_shordcodes_tags($excerpt);
|
56 |
+
$excerpt = trim($excerpt);
|
57 |
+
$excerpt = str_replace(' ', '', $excerpt);
|
58 |
+
|
59 |
+
if ($characters) {
|
60 |
+
if (strlen($excerpt) > $length) {
|
61 |
+
$excerpt = substr($excerpt, 0, $length);
|
62 |
+
$i = strrpos($excerpt, ' ');
|
63 |
+
if ($i) {
|
64 |
+
$excerpt = substr($excerpt, 0, $i);
|
65 |
+
$excerpt .= '…';
|
66 |
+
}
|
67 |
+
}
|
68 |
+
} else {
|
69 |
+
$excerpt = wp_trim_words($excerpt, $length);
|
70 |
+
}
|
71 |
+
|
72 |
+
return $excerpt;
|
73 |
+
}
|
74 |
+
|
75 |
+
function tnp_delete_all_shordcodes_tags($post_content = '') {
|
76 |
+
//Delete open tags
|
77 |
+
$post_content = preg_replace("/\[[a-zA-Z0-9_-]*?(\s.*?)?\]/", '', $post_content);
|
78 |
+
//Delete close tags
|
79 |
+
$post_content = preg_replace("/\[\/[a-zA-Z0-9_-]*?\]/", '', $post_content);
|
80 |
+
|
81 |
+
return $post_content;
|
82 |
+
}
|
83 |
+
|
84 |
+
function tnp_post_permalink($post) {
|
85 |
+
return get_permalink($post->ID);
|
86 |
+
}
|
87 |
+
|
88 |
+
function tnp_post_content($post) {
|
89 |
+
return $post->post_content;
|
90 |
+
}
|
91 |
+
|
92 |
+
function tnp_post_title($post) {
|
93 |
+
//return $post->post_title;
|
94 |
+
return get_the_title($post);
|
95 |
+
}
|
96 |
+
|
97 |
+
function tnp_post_date($post, $format = null) {
|
98 |
+
return get_the_date( $format, $post );
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Tries to create a resized version of a media uploaded to the media library.
|
103 |
+
* Returns an empty string if the media does not exists or generally if the attached file
|
104 |
+
* cannot be found. If the resize fails for whatever reason, fall backs to the
|
105 |
+
* standard image source returned by WP which is usually not exactly the
|
106 |
+
* requested size.
|
107 |
+
*
|
108 |
+
* @param int $media_id
|
109 |
+
* @param array $size
|
110 |
+
* @return string
|
111 |
+
*/
|
112 |
+
function tnp_media_resize($media_id, $size) {
|
113 |
+
if (empty($media_id)) {
|
114 |
+
return '';
|
115 |
+
}
|
116 |
+
|
117 |
+
$relative_file = get_post_meta($media_id, '_wp_attached_file', true);
|
118 |
+
if (empty($relative_file)) {
|
119 |
+
return '';
|
120 |
+
}
|
121 |
+
|
122 |
+
$width = $size[0];
|
123 |
+
$height = $size[1];
|
124 |
+
$crop = false;
|
125 |
+
if (isset($size[2])) {
|
126 |
+
$crop = (boolean) $size[2];
|
127 |
+
}
|
128 |
+
|
129 |
+
$uploads = wp_upload_dir();
|
130 |
+
|
131 |
+
// Based on _wp_relative_upload_path() function for blog which store the
|
132 |
+
// full patch of media files
|
133 |
+
if (0 === strpos($relative_file, $uploads['basedir'])) {
|
134 |
+
$relative_file = str_replace($uploads['basedir'], '', $relative_file);
|
135 |
+
$relative_file = ltrim($relative_file, '/');
|
136 |
+
}
|
137 |
+
|
138 |
+
$absolute_file = $uploads['basedir'] . '/' . $relative_file;
|
139 |
+
// Relative and absolute name of the thumbnail.
|
140 |
+
$pathinfo = pathinfo($relative_file);
|
141 |
+
|
142 |
+
// We don't know why, but on some systems files with non-ascii characters loose the file name (grrr...)
|
143 |
+
if (empty($pathinfo['filename'])) {
|
144 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
145 |
+
return $src[0];
|
146 |
+
}
|
147 |
+
|
148 |
+
$relative_thumb = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $width . 'x' .
|
149 |
+
$height . ($crop ? '-c' : '') . '.' . $pathinfo['extension'];
|
150 |
+
$absolute_thumb = $uploads['basedir'] . '/newsletter/thumbnails/' . $relative_thumb;
|
151 |
+
|
152 |
+
// Thumbnail generation if needed.
|
153 |
+
if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
|
154 |
+
$r = wp_mkdir_p($uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
155 |
+
|
156 |
+
if (!$r) {
|
157 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
158 |
+
return $src[0];
|
159 |
+
}
|
160 |
+
|
161 |
+
$editor = wp_get_image_editor($absolute_file);
|
162 |
+
if (is_wp_error($editor)) {
|
163 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
164 |
+
return $src[0];
|
165 |
+
//return $editor;
|
166 |
+
//return $uploads['baseurl'] . '/' . $relative_file;
|
167 |
+
}
|
168 |
+
|
169 |
+
$original_size = $editor->get_size();
|
170 |
+
if ($width > $original_size['width'] || $height > $original_size['height']) {
|
171 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
172 |
+
return $src[0];
|
173 |
+
}
|
174 |
+
|
175 |
+
$editor->set_quality(80);
|
176 |
+
$resized = $editor->resize($width, $height, $crop);
|
177 |
+
|
178 |
+
if (is_wp_error($resized)) {
|
179 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
180 |
+
return $src[0];
|
181 |
+
}
|
182 |
+
|
183 |
+
$saved = $editor->save($absolute_thumb);
|
184 |
+
if (is_wp_error($saved)) {
|
185 |
+
$src = wp_get_attachment_image_src($media_id, 'full');
|
186 |
+
return $src[0];
|
187 |
+
//return $saved;
|
188 |
+
//return $uploads['baseurl'] . '/' . $relative_file;
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
return $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
193 |
+
}
|
194 |
+
|
195 |
+
function _tnp_get_default_media($media_id, $size) {
|
196 |
+
|
197 |
+
$src = wp_get_attachment_image_src($media_id, $size);
|
198 |
+
if (!$src) {
|
199 |
+
return null;
|
200 |
+
}
|
201 |
+
$media = new TNP_Media();
|
202 |
+
$media->id = $media_id;
|
203 |
+
$media->url = $src[0];
|
204 |
+
$media->width = $src[1];
|
205 |
+
$media->height = $src[2];
|
206 |
+
return $media;
|
207 |
+
}
|
208 |
+
|
209 |
+
function tnp_get_media($media_id, $size) {
|
210 |
+
$src = wp_get_attachment_image_src($media_id, $size);
|
211 |
+
if (!$src) {
|
212 |
+
return null;
|
213 |
+
}
|
214 |
+
$media = new TNP_Media();
|
215 |
+
$media->id = $media_id;
|
216 |
+
$media->url = $src[0];
|
217 |
+
$media->width = $src[1];
|
218 |
+
$media->height = $src[2];
|
219 |
+
return $media;
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* Create a resized version of the media stored in the WP media library.
|
224 |
+
*
|
225 |
+
* @param int $media_id
|
226 |
+
* @param array $size
|
227 |
+
* @return TNP_Media
|
228 |
+
*/
|
229 |
+
function tnp_resize($media_id, $size) {
|
230 |
+
if (empty($media_id)) {
|
231 |
+
return null;
|
232 |
+
}
|
233 |
+
|
234 |
+
$relative_file = get_post_meta($media_id, '_wp_attached_file', true);
|
235 |
+
|
236 |
+
if (empty($relative_file)) {
|
237 |
+
return null;
|
238 |
+
}
|
239 |
+
|
240 |
+
$uploads = wp_upload_dir();
|
241 |
+
|
242 |
+
// Based on _wp_relative_upload_path() function for blog which store the
|
243 |
+
// full path of media files
|
244 |
+
if (0 === strpos($relative_file, $uploads['basedir'])) {
|
245 |
+
$relative_file = str_replace($uploads['basedir'], '', $relative_file);
|
246 |
+
$relative_file = ltrim($relative_file, '/');
|
247 |
+
}
|
248 |
+
|
249 |
+
$width = $size[0];
|
250 |
+
$height = $size[1];
|
251 |
+
$crop = false;
|
252 |
+
if (isset($size[2])) {
|
253 |
+
$crop = (boolean) $size[2];
|
254 |
+
}
|
255 |
+
|
256 |
+
$absolute_file = $uploads['basedir'] . '/' . $relative_file;
|
257 |
+
|
258 |
+
if (substr($relative_file, -4) === '.gif') {
|
259 |
+
$editor = wp_get_image_editor($absolute_file);
|
260 |
+
if (is_wp_error($editor)) {
|
261 |
+
return _tnp_get_default_media($media_id, $size);
|
262 |
+
}
|
263 |
+
$new_size = $editor->get_size();
|
264 |
+
$media = new TNP_Media();
|
265 |
+
$media->id = $media_id;
|
266 |
+
$media->width = $new_size['width'];
|
267 |
+
$media->height = $new_size['height'];
|
268 |
+
if ($media->width > $width) {
|
269 |
+
$media->set_width($width);
|
270 |
+
}
|
271 |
+
$media->url = $uploads['baseurl'] . '/' . $relative_file;
|
272 |
+
return $media;
|
273 |
+
}
|
274 |
+
|
275 |
+
// Relative and absolute name of the thumbnail.
|
276 |
+
$pathinfo = pathinfo($relative_file);
|
277 |
+
|
278 |
+
// We don't know why, but on some systems files with non-ascii characters loose the file name (grrr...)
|
279 |
+
if (empty($pathinfo['filename'])) {
|
280 |
+
return _tnp_get_default_media($media_id, $size);
|
281 |
+
}
|
282 |
+
|
283 |
+
$relative_thumb = $pathinfo['dirname'] . '/' . $pathinfo['filename'] . '-' . $width . 'x' . $height . ($crop ? '-c' : '') . '.' . $pathinfo['extension'];
|
284 |
+
$absolute_thumb = $uploads['basedir'] . '/newsletter/thumbnails/' . $relative_thumb;
|
285 |
+
|
286 |
+
// Thumbnail generation if needed.
|
287 |
+
if (!file_exists($absolute_thumb) || filemtime($absolute_thumb) < filemtime($absolute_file)) {
|
288 |
+
$r = wp_mkdir_p($uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
289 |
+
|
290 |
+
if (!$r) {
|
291 |
+
Newsletter::instance()->logger->error('Unable to create dir ' . $uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
|
292 |
+
return _tnp_get_default_media($media_id, $size);
|
293 |
+
}
|
294 |
+
|
295 |
+
$editor = wp_get_image_editor($absolute_file);
|
296 |
+
if (is_wp_error($editor)) {
|
297 |
+
Newsletter::instance()->logger->error($editor);
|
298 |
+
Newsletter::instance()->logger->error('File: ' . $absolute_file);
|
299 |
+
return _tnp_get_default_media($media_id, $size);
|
300 |
+
}
|
301 |
+
|
302 |
+
$original_size = $editor->get_size();
|
303 |
+
if ($width > $original_size['width'] && ($height > $original_size['height'] || $height == 0)) {
|
304 |
+
Newsletter::instance()->logger->error('Requested size larger than the original one');
|
305 |
+
return _tnp_get_default_media($media_id, $size);
|
306 |
+
}
|
307 |
+
|
308 |
+
if ($height > $original_size['height'] && ($width > $original_size['width'] || $width == 0)) {
|
309 |
+
Newsletter::instance()->logger->error('Requested size larger than the original one');
|
310 |
+
return _tnp_get_default_media($media_id, $size);
|
311 |
+
}
|
312 |
+
|
313 |
+
$editor->set_quality(85);
|
314 |
+
$resized = $editor->resize($width, $height, $crop);
|
315 |
+
|
316 |
+
if (is_wp_error($resized)) {
|
317 |
+
Newsletter::instance()->logger->error($resized);
|
318 |
+
Newsletter::instance()->logger->error('File: ' . $absolute_file);
|
319 |
+
return _tnp_get_default_media($media_id, $size);
|
320 |
+
}
|
321 |
+
|
322 |
+
$saved = $editor->save($absolute_thumb);
|
323 |
+
if (is_wp_error($saved)) {
|
324 |
+
Newsletter::instance()->logger->error($saved);
|
325 |
+
return _tnp_get_default_media($media_id, $size);
|
326 |
+
}
|
327 |
+
$new_size = $editor->get_size();
|
328 |
+
|
329 |
+
$media = new TNP_Media();
|
330 |
+
$media->width = $new_size['width'];
|
331 |
+
$media->height = $new_size['height'];
|
332 |
+
$media->url = $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
333 |
+
} else {
|
334 |
+
$media = new TNP_Media();
|
335 |
+
$new_size = getimagesize($absolute_thumb);
|
336 |
+
$media->width = $new_size[0];
|
337 |
+
$media->height = $new_size[1];
|
338 |
+
$media->url = $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $media;
|
342 |
+
}
|
343 |
+
|
344 |
+
function tnp_resize_2x($media_id, $size) {
|
345 |
+
$size[0] = $size[0] * 2;
|
346 |
+
$size[1] = $size[1] * 2;
|
347 |
+
$media = tnp_resize($media_id, $size);
|
348 |
+
if (!$media)
|
349 |
+
return $media;
|
350 |
+
$media->set_width($size[0] / 2);
|
351 |
+
return $media;
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* @param TNP_Media[] $images
|
356 |
+
*
|
357 |
+
* @return int
|
358 |
+
*/
|
359 |
+
function tnp_get_max_height_of($images) {
|
360 |
+
$max_height = 0;
|
361 |
+
foreach ($images as $image) {
|
362 |
+
$max_height = $image->height > $max_height ? $image->height : $max_height;
|
363 |
+
}
|
364 |
+
|
365 |
+
return $max_height;
|
366 |
+
}
|
367 |
+
|
368 |
+
/**
|
369 |
+
* @param WP_Post[] $product_list
|
370 |
+
* @param array $size
|
371 |
+
*
|
372 |
+
* @return TNP_Media[]
|
373 |
+
*/
|
374 |
+
function tnp_resize_product_list_featured_image($product_list, $size) {
|
375 |
+
$images = [];
|
376 |
+
foreach ($product_list as $p) {
|
377 |
+
$images[$p->ID] = tnp_resize_2x(TNP_Composer::get_post_thumbnail_id($p->ID), $size);
|
378 |
+
}
|
379 |
+
|
380 |
+
return $images;
|
381 |
+
}
|
382 |
+
|
383 |
+
/**
|
384 |
+
* Get media for "posts" composer block
|
385 |
+
*
|
386 |
+
* @param WP_Post post
|
387 |
+
* @param array $size
|
388 |
+
* @param string $default_image_url
|
389 |
+
*
|
390 |
+
* @return TNP_Media
|
391 |
+
*/
|
392 |
+
function tnp_composer_block_posts_get_media($post, $size, $default_image_url = null) {
|
393 |
+
$post_thumbnail_id = TNP_Composer::get_post_thumbnail_id($post);
|
394 |
+
|
395 |
+
$media = null;
|
396 |
+
|
397 |
+
if (!empty($post_thumbnail_id)) {
|
398 |
+
$media = tnp_resize($post_thumbnail_id, array_values($size));
|
399 |
+
} else if ($default_image_url) {
|
400 |
+
Newsletter::instance()->logger->error('Thumbnail id not found');
|
401 |
+
$media = new TNP_Media();
|
402 |
+
$media->url = $default_image_url;
|
403 |
+
$media->width = $size['width'];
|
404 |
+
$media->height = $size['height'];
|
405 |
+
}
|
406 |
+
return $media;
|
407 |
+
}
|
408 |
+
|
409 |
+
function tnp_outlook_wrapper_open($width = 600) {
|
410 |
+
return NewsletterEmails::get_outlook_wrapper_open($width);
|
411 |
+
}
|
412 |
+
|
413 |
+
function tnp_outlook_wrapper_close() {
|
414 |
+
return NewsletterEmails::get_outlook_wrapper_close();
|
415 |
+
}
|
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.4.
|
8 |
Â
Author: Stefano Lissa & The Newsletter Team
|
9 |
Â
Author URI: https://www.thenewsletterplugin.com
|
10 |
Â
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -37,7 +37,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
|
|
37 |
Â
return;
|
38 |
Â
}
|
39 |
Â
|
40 |
-
define('NEWSLETTER_VERSION', '7.4.
|
41 |
Â
|
42 |
Â
global $newsletter, $wpdb;
|
43 |
Â
|
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.4.6
|
8 |
Â
Author: Stefano Lissa & The Newsletter Team
|
9 |
Â
Author URI: https://www.thenewsletterplugin.com
|
10 |
Â
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
37 |
Â
return;
|
38 |
Â
}
|
39 |
Â
|
40 |
+
define('NEWSLETTER_VERSION', '7.4.6');
|
41 |
Â
|
42 |
Â
global $newsletter, $wpdb;
|
43 |
Â
|
readme.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
Â
=== Newsletter - Send awesome emails from WordPress ===
|
2 |
Â
Tags: newsletter, email marketing, welcome email, signup forms, lead generation, marketing automation
|
3 |
Â
Tested up to: 6.0
|
4 |
-
Stable tag: 7.4.
|
5 |
Â
Contributors: satollo,webagile,michael-travan
|
6 |
Â
License: GPLv2 or later
|
7 |
Â
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
@@ -126,6 +126,15 @@ Thank you, The Newsletter Team
|
|
126 |
Â
|
127 |
Â
== Changelog ==
|
128 |
Â
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
Â
|
|
129 |
Â
= 7.4.4 =
|
130 |
Â
|
131 |
Â
* Changed the dedicated page retrieval to intercept misconfigurations
|
1 |
Â
=== Newsletter - Send awesome emails from WordPress ===
|
2 |
Â
Tags: newsletter, email marketing, welcome email, signup forms, lead generation, marketing automation
|
3 |
Â
Tested up to: 6.0
|
4 |
+
Stable tag: 7.4.6
|
5 |
Â
Contributors: satollo,webagile,michael-travan
|
6 |
Â
License: GPLv2 or later
|
7 |
Â
License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
126 |
Â
|
127 |
Â
== Changelog ==
|
128 |
Â
|
129 |
+
= 7.4.6 =
|
130 |
+
|
131 |
+
* XSS security fix
|
132 |
+
|
133 |
+
= 7.4.5 =
|
134 |
+
|
135 |
+
* Fixed image block font-size to show the alt text (not for Outlook, it never shows the alt text)
|
136 |
+
* XSS security fix
|
137 |
+
|
138 |
Â
= 7.4.4 =
|
139 |
Â
|
140 |
Â
* Changed the dedicated page retrieval to intercept misconfigurations
|
subscription/subscription.php
CHANGED
@@ -1267,7 +1267,7 @@ class NewsletterSubscription extends NewsletterModule {
|
|
1267 |
Â
|
1268 |
Â
if (isset($attrs['confirmation_url'])) {
|
1269 |
Â
if ($attrs['confirmation_url'] === '#') {
|
1270 |
-
$attrs['confirmation_url'] = $_SERVER['REQUEST_URI'];
|
1271 |
Â
}
|
1272 |
Â
|
1273 |
Â
$b .= '<input type="hidden" name="ncu" value="' . esc_attr($attrs['confirmation_url']) . '">';
|
1267 |
Â
|
1268 |
Â
if (isset($attrs['confirmation_url'])) {
|
1269 |
Â
if ($attrs['confirmation_url'] === '#') {
|
1270 |
+
$attrs['confirmation_url'] = esc_url_raw($_SERVER['REQUEST_URI']);
|
1271 |
Â
}
|
1272 |
Â
|
1273 |
Â
$b .= '<input type="hidden" name="ncu" value="' . esc_attr($attrs['confirmation_url']) . '">';
|
tnp-header.php
CHANGED
@@ -1,345 +1,345 @@
|
|
1 |
-
<?php
|
2 |
-
global $current_user, $wpdb;
|
3 |
-
|
4 |
-
defined('ABSPATH') || exit;
|
5 |
-
|
6 |
-
$dismissed = get_option('newsletter_dismissed', []);
|
7 |
-
|
8 |
-
$user_count = Newsletter::instance()->get_user_count();
|
9 |
-
|
10 |
-
$is_administrator = current_user_can('administrator');
|
11 |
-
|
12 |
-
function newsletter_print_entries($group) {
|
13 |
-
$entries = apply_filters('newsletter_menu_' . $group, array());
|
14 |
-
if (!$entries) {
|
15 |
-
return;
|
16 |
-
}
|
17 |
-
|
18 |
-
foreach ($entries as &$entry) {
|
19 |
-
echo '<li><a href="', $entry['url'], '">', $entry['label'];
|
20 |
-
if (!empty($entry['description'])) {
|
21 |
-
echo '<small>', $entry['description'], '</small>';
|
22 |
-
}
|
23 |
-
echo '</a></li>';
|
24 |
-
}
|
25 |
-
}
|
26 |
-
|
27 |
-
// Check the status to show a warning if needed
|
28 |
-
$status_options = Newsletter::instance()->get_options('status');
|
29 |
-
$warning = false;
|
30 |
-
|
31 |
-
//$warning |= empty($status_options['mail']);
|
32 |
-
|
33 |
-
$current_user_email = ''; //$current_user->user_email;
|
34 |
-
//if (strpos($current_user_email, 'admin@') === 0) {
|
35 |
-
// $current_user_email = '';
|
36 |
-
//}
|
37 |
-
?>
|
38 |
-
|
39 |
-
<div class="tnp-drowpdown" id="tnp-header">
|
40 |
-
<a href="?page=newsletter_main_index"><img src="<?php echo plugins_url('newsletter'); ?>/admin/images/logo-red.png" class="tnp-header-logo" style="vertical-align: bottom;"></a>
|
41 |
-
<ul>
|
42 |
-
<li><a href="#"><i class="fas fa-users"></i> <?php _e('Subscribers', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
43 |
-
<ul>
|
44 |
-
<li>
|
45 |
-
<a href="?page=newsletter_users_index"><i class="fas fa-search"></i> <?php _e('Search And Edit', 'newsletter') ?>
|
46 |
-
<small><?php _e('Add, edit, search', 'newsletter') ?></small></a>
|
47 |
-
</li>
|
48 |
-
|
49 |
-
<li>
|
50 |
-
<a href="?page=newsletter_profile_index"><i class="fas fa-user-circle"></i> <?php _e('Profile page', 'newsletter') ?>
|
51 |
-
<small><?php _e('The subscriber personal profile editing panel', 'newsletter') ?></small></a>
|
52 |
-
</li>
|
53 |
-
|
54 |
-
<?php if (!class_exists('NewsletterImport')) { ?>
|
55 |
-
<li>
|
56 |
-
<a href="?page=newsletter_users_import"><i class="fas fa-upload"></i> <?php _e('Import', 'newsletter') ?>
|
57 |
-
<small><?php _e('Import from external sources', 'newsletter') ?></small></a>
|
58 |
-
</li>
|
59 |
-
<?php } ?>
|
60 |
-
|
61 |
-
<li>
|
62 |
-
<a href="?page=newsletter_users_export"><i class="fas fa-download"></i> <?php _e('Export', 'newsletter') ?>
|
63 |
-
<small><?php _e('Export your subscribers list', 'newsletter') ?></small></a>
|
64 |
-
</li>
|
65 |
-
|
66 |
-
<li>
|
67 |
-
<a href="?page=newsletter_users_massive"><i class="fas fa-wrench"></i> <?php _e('Maintenance', 'newsletter') ?>
|
68 |
-
<small><?php _e('Massive actions: change list, clean up, ...', 'newsletter') ?></small></a>
|
69 |
-
</li>
|
70 |
-
|
71 |
-
<li>
|
72 |
-
<a href="?page=newsletter_users_statistics"><i class="fas fa-chart-bar"></i> <?php _e('Statistics', 'newsletter') ?>
|
73 |
-
<small><?php _e('All about your subscribers', 'newsletter') ?></small></a>
|
74 |
-
</li>
|
75 |
-
|
76 |
-
<?php newsletter_print_entries('subscribers') ?>
|
77 |
-
</ul>
|
78 |
-
</li>
|
79 |
-
<li><a href="#"><i class="fas fa-list"></i> <?php _e('List Building', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
80 |
-
<ul>
|
81 |
-
<li>
|
82 |
-
<a href="?page=newsletter_subscription_profile"><i class="fas fa-check-square"></i> <?php _e('Subscription Form Fields, Buttons, Labels', 'newsletter') ?>
|
83 |
-
<small><?php _e('When and what data to collect', 'newsletter') ?></small></a>
|
84 |
-
</li>
|
85 |
-
|
86 |
-
<li>
|
87 |
-
<a href="?page=newsletter_subscription_options"><i class="fas fa-sign-in-alt"></i> <?php _e('Subscription', 'newsletter') ?>
|
88 |
-
<small><?php _e('The subscription process in detail', 'newsletter') ?></small></a>
|
89 |
-
</li>
|
90 |
-
|
91 |
-
<li>
|
92 |
-
<a href="?page=newsletter_subscription_lists"><i class="fas fa-th-list"></i> <?php _e('Lists', 'newsletter') ?>
|
93 |
-
<small><?php _e('Profile the subscribers for a better targeting', 'newsletter') ?></small></a>
|
94 |
-
</li>
|
95 |
-
|
96 |
-
<li>
|
97 |
-
<a href="?page=newsletter_subscription_antibot"><i class="fas fa-lock"></i> <?php _e('Security', 'newsletter') ?>
|
98 |
-
<small><?php _e('Spam subscriptions control', 'newsletter') ?></small></a>
|
99 |
-
</li>
|
100 |
-
|
101 |
-
<li>
|
102 |
-
<a href="?page=newsletter_unsubscription_index"><i class="fas fa-sign-out-alt"></i> <?php _e('Unsubscription', 'newsletter') ?>
|
103 |
-
<small><?php _e('How to give the last goodbye (or avoid it!)', 'newsletter') ?></small></a>
|
104 |
-
</li>
|
105 |
-
|
106 |
-
<?php
|
107 |
-
newsletter_print_entries('subscription');
|
108 |
-
?>
|
109 |
-
</ul>
|
110 |
-
</li>
|
111 |
-
|
112 |
-
<li>
|
113 |
-
<a href="#"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
114 |
-
<ul>
|
115 |
-
<li>
|
116 |
-
<a href="?page=newsletter_emails_composer"><i class="fas fa-plus"></i> <?php _e('Create newsletter', 'newsletter') ?>
|
117 |
-
<small><?php _e('Start your new campaign', 'newsletter') ?></small></a>
|
118 |
-
</li>
|
119 |
-
|
120 |
-
<li>
|
121 |
-
<a href="?page=newsletter_emails_index"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?>
|
122 |
-
<small><?php _e('The classic "write & send" newsletters', 'newsletter') ?></small></a>
|
123 |
-
</li>
|
124 |
-
|
125 |
-
<li>
|
126 |
-
<a href="<?php echo NewsletterStatistics::instance()->get_index_url() ?>"><i class="fas fa-chart-bar"></i> <?php _e('Statistics', 'newsletter') ?>
|
127 |
-
<small><?php _e('Tracking configuration and basic data', 'newsletter') ?></small></a>
|
128 |
-
</li>
|
129 |
-
<?php
|
130 |
-
newsletter_print_entries('newsletters');
|
131 |
-
?>
|
132 |
-
</ul>
|
133 |
-
</li>
|
134 |
-
|
135 |
-
<li>
|
136 |
-
<a href="#"><i class="fas fa-cog"></i> <?php _e('Settings', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
137 |
-
<ul>
|
138 |
-
<?php if ($is_administrator) { ?>
|
139 |
-
<li>
|
140 |
-
<a href="?page=newsletter_main_main"><i class="fas fa-cogs"></i> <?php _e('General Settings', 'newsletter') ?>
|
141 |
-
<small><?php _e('Delivery speed, sender details, ...', 'newsletter') ?></small></a>
|
142 |
-
</li>
|
143 |
-
<?php if (!class_exists('NewsletterSmtp')) { ?>
|
144 |
-
<li>
|
145 |
-
<a href="?page=newsletter_main_smtp"><i class="fas fa-server"></i> <?php _e('SMTP', 'newsletter') ?>
|
146 |
-
<small><?php _e('External mail server', 'newsletter') ?></small>
|
147 |
-
</a>
|
148 |
-
</li>
|
149 |
-
<?php } ?>
|
150 |
-
<?php } ?>
|
151 |
-
|
152 |
-
<li>
|
153 |
-
<a href="?page=newsletter_main_info"><i class="fas fa-info"></i> <?php _e('Company Info', 'newsletter') ?>
|
154 |
-
<small><?php _e('Social, address, logo and general info', 'newsletter') ?></small></a>
|
155 |
-
</li>
|
156 |
-
|
157 |
-
<li>
|
158 |
-
<a href="?page=newsletter_subscription_template"><i class="fas fa-file-alt"></i> <?php _e('Messages Template', 'newsletter') ?>
|
159 |
-
<small><?php _e('Change the look of your service emails', 'newsletter') ?></small></a>
|
160 |
-
</li>
|
161 |
-
|
162 |
-
<?php
|
163 |
-
newsletter_print_entries('settings');
|
164 |
-
?>
|
165 |
-
</ul>
|
166 |
-
</li>
|
167 |
-
|
168 |
-
<?php if ($is_administrator) { ?>
|
169 |
-
<li>
|
170 |
-
<a href="#"><i class="fas fa-thermometer"></i> <?php _e('System', 'newsletter') ?>
|
171 |
-
<?php if ($warning) { ?>
|
172 |
-
<i class="fas fa-exclamation-triangle" style="color: red;"></i>
|
173 |
-
<?php } ?>
|
174 |
-
</a>
|
175 |
-
<ul>
|
176 |
-
<li>
|
177 |
-
<a href="<?php echo admin_url('site-health.php') ?> "><i class="fas fa-file"></i> <?php _e('Site health') ?>
|
178 |
-
<small><?php _e('WP native site health checks', 'newsletter') ?></small></a>
|
179 |
-
</li>
|
180 |
-
<li>
|
181 |
-
<a href="?page=newsletter_system_delivery"><i class="fas fa-file"></i> <?php _e('Delivery Diagnostic', 'newsletter') ?>
|
182 |
-
<small><?php _e('Delivery analysis and test', 'newsletter') ?></small></a>
|
183 |
-
</li>
|
184 |
-
<li>
|
185 |
-
<a href="?page=newsletter_system_scheduler"><i class="fas fa-robot"></i> <?php _e('Scheduler', 'newsletter') ?>
|
186 |
-
<small><?php _e('WordPress background jobs', 'newsletter') ?></small></a>
|
187 |
-
</li>
|
188 |
-
<li>
|
189 |
-
<a href="?page=newsletter_system_status"><i class="fas fa-file"></i> <?php _e('Status', 'newsletter') ?>
|
190 |
-
<small><?php _e('Checks and parameters', 'newsletter') ?></small></a>
|
191 |
-
</li>
|
192 |
-
|
193 |
-
<li>
|
194 |
-
<a href="?page=newsletter_system_logs"><i class="fas fa-file"></i> <?php _e('Logs', 'newsletter') ?>
|
195 |
-
<small><?php _e('Plugin and addons logs', 'newsletter') ?></small></a>
|
196 |
-
</li>
|
197 |
-
</ul>
|
198 |
-
</li>
|
199 |
-
<?php } ?>
|
200 |
-
|
201 |
-
<?php
|
202 |
-
$license_data = Newsletter::instance()->get_license_data();
|
203 |
-
$premium_url = 'https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=plugin&utm_content=' . urlencode($_GET['page']);
|
204 |
-
?>
|
205 |
-
|
206 |
-
<?php if (empty($license_data)) { ?>
|
207 |
-
<?php if (time() < 1638226799) { ?>
|
208 |
-
<li class="tnp-professional-extensions-button" style="background-color: #000; color: #fff; border-color: #FF5F65!important; border-width: 2px !important;"><a href="https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=black-friday" target="_blank">
|
209 |
-
<i class="fas fa-trophy"></i> BLACK FRIDAY IS LIVE</a>
|
210 |
-
</li>
|
211 |
-
<?php } else { ?>
|
212 |
-
<li class="tnp-professional-extensions-button"><a href="<?php echo $premium_url ?>" target="_blank">
|
213 |
-
<i class="fas fa-trophy"></i> <?php _e('Get Professional Addons', 'newsletter') ?></a>
|
214 |
-
</li>
|
215 |
-
<?php } ?>
|
216 |
-
<?php } elseif (is_wp_error($license_data)) { ?>
|
217 |
-
<li class="tnp-professional-extensions-button-red">
|
218 |
-
<a href="?page=newsletter_main_main"><i class="fas fa-hand-paper" style="color: white"></i> <?php _e('Unable to check', 'newsletter') ?></a>
|
219 |
-
</li>
|
220 |
-
|
221 |
-
<?php } elseif ($license_data->expire == 0) { ?>
|
222 |
-
<?php if (time() < 1638226799) { ?>
|
223 |
-
<li class="tnp-professional-extensions-button" style="background-color: #000; color: #fff; border-color: #FF5F65!important; border-width: 2px !important;"><a href="https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=black-friday" target="_blank">
|
224 |
-
<i class="fas fa-trophy"></i> BLACK FRIDAY IS LIVE</a>
|
225 |
-
</li>
|
226 |
-
<?php } else { ?>
|
227 |
-
<li class="tnp-professional-extensions-button"><a href="<?php echo $premium_url ?>" target="_blank">
|
228 |
-
<i class="fas fa-trophy"></i> <?php _e('Get Professional Addons', 'newsletter') ?></a>
|
229 |
-
</li>
|
230 |
-
<?php } ?>
|
231 |
-
|
232 |
-
<?php } elseif ($license_data->expire < time()) { ?>
|
233 |
-
|
234 |
-
<li class="tnp-professional-extensions-button-red">
|
235 |
-
<a href="?page=newsletter_main_main"><i class="fas fa-hand-paper" style="color: white"></i> <?php _e('License expired', 'newsletter') ?></a>
|
236 |
-
</li>
|
237 |
-
|
238 |
-
<?php } elseif ($license_data->expire >= time()) { ?>
|
239 |
-
|
240 |
-
<?php $p = class_exists('NewsletterExtensions') ? 'newsletter_extensions_index' : 'newsletter_main_extensions'; ?>
|
241 |
-
<li class="tnp-professional-extensions-button">
|
242 |
-
<a href="?page=<?php echo $p ?>"><i class="fas fa-check-square"></i> <?php _e('License active', 'newsletter') ?></a>
|
243 |
-
</li>
|
244 |
-
|
245 |
-
<?php } ?>
|
246 |
-
</ul>
|
247 |
-
</div>
|
248 |
-
|
249 |
-
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-shortcode'])) { ?>
|
250 |
-
<?php
|
251 |
-
// Check of Newsletter dedicated page
|
252 |
-
if (!empty(Newsletter::instance()->options['page'])) {
|
253 |
-
if (get_post_status(Newsletter::instance()->options['page']) === 'publish') {
|
254 |
-
$content = get_post_field('post_content', Newsletter::instance()->options['page']);
|
255 |
-
// With and without attributes
|
256 |
-
if (strpos($content, '[newsletter]') === false && strpos($content, '[newsletter ') === false) {
|
257 |
-
?>
|
258 |
-
<div class="tnp-notice">
|
259 |
-
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-shortcode' ?>" class="tnp-dismiss">×</a>
|
260 |
-
The Newsletter dedicated page does not contain the [newsletter] shortcode. If you're using a visual composer it could be ok.
|
261 |
-
<a href="<?php echo site_url('/wp-admin/post.php') ?>?post=<?php echo esc_attr(Newsletter::instance()->options['page']) ?>&action=edit"><strong>Edit the page</strong></a>.
|
262 |
-
|
263 |
-
</div>
|
264 |
-
<?php
|
265 |
-
}
|
266 |
-
}
|
267 |
-
}
|
268 |
-
?>
|
269 |
-
<?php } ?>
|
270 |
-
|
271 |
-
<?php if (isset($_GET['debug']) || !isset($dismissed['rate']) && $user_count > 300) { ?>
|
272 |
-
<div class="tnp-notice">
|
273 |
-
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=rate' ?>" class="tnp-dismiss">×</a>
|
274 |
-
|
275 |
-
We never asked before and we're curious: <a href="http://wordpress.org/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
|
276 |
-
(few seconds required - account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, The Newsletter Team</strong>.
|
277 |
-
|
278 |
-
</div>
|
279 |
-
<?php } ?>
|
280 |
-
|
281 |
-
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-page']) && empty(Newsletter::instance()->options['page'])) { ?>
|
282 |
-
<div class="tnp-notice">
|
283 |
-
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-page' ?>" class="tnp-dismiss">×</a>
|
284 |
-
|
285 |
-
You should create a blog page to show the subscription form and the subscription messages. Go to the
|
286 |
-
<a href="?page=newsletter_main_main">general settings panel</a> to configure it.
|
287 |
-
|
288 |
-
</div>
|
289 |
-
<?php } ?>
|
290 |
-
|
291 |
-
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-subscribe']) && get_option('newsletter_install_time') && get_option('newsletter_install_time') < time() - 86400 * 15) { ?>
|
292 |
-
<div class="tnp-notice">
|
293 |
-
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-subscribe' ?>" class="tnp-dismiss">×</a>
|
294 |
-
Subscribe to our news, promotions and getting started lessons!
|
295 |
-
Proceeding you agree to the <a href="https://www.thenewsletterplugin.com/privacy" target="_blank">privacy policy</a>.
|
296 |
-
<br>
|
297 |
-
<form action="https://www.thenewsletterplugin.com/?na=s" target="_blank" method="post">
|
298 |
-
<input type="hidden" value="plugin-header" name="nr">
|
299 |
-
<input type="hidden" value="3" name="nl[]">
|
300 |
-
<input type="hidden" value="1" name="nl[]">
|
301 |
-
<input type="hidden" value="double" name="optin">
|
302 |
-
<input type="email" name="ne" value="<?php echo esc_attr($current_user_email) ?>">
|
303 |
-
<input type="submit" value="<?php esc_attr_e('Subscribe', 'newsletter') ?>">
|
304 |
-
</form>
|
305 |
-
</div>
|
306 |
-
<?php } ?>
|
307 |
-
|
308 |
-
<?php
|
309 |
-
if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
|
310 |
-
$x = NewsletterSystem::instance()->get_job_status();
|
311 |
-
if ($x !== NewsletterSystem::JOB_OK) {
|
312 |
-
echo '<div class="tnpc-warning">The are issues with the delivery engine. Please <a href="?page=newsletter_system_scheduler">check them here</a>.</div>';
|
313 |
-
}
|
314 |
-
}
|
315 |
-
?>
|
316 |
-
|
317 |
-
<?php
|
318 |
-
if ($_GET['page'] !== 'newsletter_emails_edit') {
|
319 |
-
|
320 |
-
$last_failed_newsletters = Newsletter::instance()->get_emails_by_status(TNP_Email::STATUS_ERROR);
|
321 |
-
if ($last_failed_newsletters) {
|
322 |
-
$c = new NewsletterControls();
|
323 |
-
foreach ($last_failed_newsletters as $n) {
|
324 |
-
echo '<div class="tnpc-error">';
|
325 |
-
printf(__('Newsletter "%s" stopped by fatal error.', 'newsletter'), esc_html($n->subject));
|
326 |
-
echo ' ';
|
327 |
-
|
328 |
-
$c->btn_link('?page=newsletter_emails_edit&id=' . $n->id, __('Check', 'newsletter'));
|
329 |
-
echo '</div>';
|
330 |
-
}
|
331 |
-
}
|
332 |
-
}
|
333 |
-
?>
|
334 |
-
|
335 |
-
<div id="tnp-notification">
|
336 |
-
<?php
|
337 |
-
if (isset($controls)) {
|
338 |
-
$controls->show();
|
339 |
-
$controls->messages = '';
|
340 |
-
$controls->errors = '';
|
341 |
-
}
|
342 |
-
?>
|
343 |
-
</div>
|
344 |
-
|
345 |
-
|
1 |
+
<?php
|
2 |
+
global $current_user, $wpdb;
|
3 |
+
|
4 |
+
defined('ABSPATH') || exit;
|
5 |
+
|
6 |
+
$dismissed = get_option('newsletter_dismissed', []);
|
7 |
+
|
8 |
+
$user_count = Newsletter::instance()->get_user_count();
|
9 |
+
|
10 |
+
$is_administrator = current_user_can('administrator');
|
11 |
+
|
12 |
+
function newsletter_print_entries($group) {
|
13 |
+
$entries = apply_filters('newsletter_menu_' . $group, array());
|
14 |
+
if (!$entries) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
foreach ($entries as &$entry) {
|
19 |
+
echo '<li><a href="', $entry['url'], '">', $entry['label'];
|
20 |
+
if (!empty($entry['description'])) {
|
21 |
+
echo '<small>', $entry['description'], '</small>';
|
22 |
+
}
|
23 |
+
echo '</a></li>';
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
// Check the status to show a warning if needed
|
28 |
+
$status_options = Newsletter::instance()->get_options('status');
|
29 |
+
$warning = false;
|
30 |
+
|
31 |
+
//$warning |= empty($status_options['mail']);
|
32 |
+
|
33 |
+
$current_user_email = ''; //$current_user->user_email;
|
34 |
+
//if (strpos($current_user_email, 'admin@') === 0) {
|
35 |
+
// $current_user_email = '';
|
36 |
+
//}
|
37 |
+
?>
|
38 |
+
|
39 |
+
<div class="tnp-drowpdown" id="tnp-header">
|
40 |
+
<a href="?page=newsletter_main_index"><img src="<?php echo plugins_url('newsletter'); ?>/admin/images/logo-red.png" class="tnp-header-logo" style="vertical-align: bottom;"></a>
|
41 |
+
<ul>
|
42 |
+
<li><a href="#"><i class="fas fa-users"></i> <?php _e('Subscribers', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
43 |
+
<ul>
|
44 |
+
<li>
|
45 |
+
<a href="?page=newsletter_users_index"><i class="fas fa-search"></i> <?php _e('Search And Edit', 'newsletter') ?>
|
46 |
+
<small><?php _e('Add, edit, search', 'newsletter') ?></small></a>
|
47 |
+
</li>
|
48 |
+
|
49 |
+
<li>
|
50 |
+
<a href="?page=newsletter_profile_index"><i class="fas fa-user-circle"></i> <?php _e('Profile page', 'newsletter') ?>
|
51 |
+
<small><?php _e('The subscriber personal profile editing panel', 'newsletter') ?></small></a>
|
52 |
+
</li>
|
53 |
+
|
54 |
+
<?php if (!class_exists('NewsletterImport')) { ?>
|
55 |
+
<li>
|
56 |
+
<a href="?page=newsletter_users_import"><i class="fas fa-upload"></i> <?php _e('Import', 'newsletter') ?>
|
57 |
+
<small><?php _e('Import from external sources', 'newsletter') ?></small></a>
|
58 |
+
</li>
|
59 |
+
<?php } ?>
|
60 |
+
|
61 |
+
<li>
|
62 |
+
<a href="?page=newsletter_users_export"><i class="fas fa-download"></i> <?php _e('Export', 'newsletter') ?>
|
63 |
+
<small><?php _e('Export your subscribers list', 'newsletter') ?></small></a>
|
64 |
+
</li>
|
65 |
+
|
66 |
+
<li>
|
67 |
+
<a href="?page=newsletter_users_massive"><i class="fas fa-wrench"></i> <?php _e('Maintenance', 'newsletter') ?>
|
68 |
+
<small><?php _e('Massive actions: change list, clean up, ...', 'newsletter') ?></small></a>
|
69 |
+
</li>
|
70 |
+
|
71 |
+
<li>
|
72 |
+
<a href="?page=newsletter_users_statistics"><i class="fas fa-chart-bar"></i> <?php _e('Statistics', 'newsletter') ?>
|
73 |
+
<small><?php _e('All about your subscribers', 'newsletter') ?></small></a>
|
74 |
+
</li>
|
75 |
+
|
76 |
+
<?php newsletter_print_entries('subscribers') ?>
|
77 |
+
</ul>
|
78 |
+
</li>
|
79 |
+
<li><a href="#"><i class="fas fa-list"></i> <?php _e('List Building', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
80 |
+
<ul>
|
81 |
+
<li>
|
82 |
+
<a href="?page=newsletter_subscription_profile"><i class="fas fa-check-square"></i> <?php _e('Subscription Form Fields, Buttons, Labels', 'newsletter') ?>
|
83 |
+
<small><?php _e('When and what data to collect', 'newsletter') ?></small></a>
|
84 |
+
</li>
|
85 |
+
|
86 |
+
<li>
|
87 |
+
<a href="?page=newsletter_subscription_options"><i class="fas fa-sign-in-alt"></i> <?php _e('Subscription', 'newsletter') ?>
|
88 |
+
<small><?php _e('The subscription process in detail', 'newsletter') ?></small></a>
|
89 |
+
</li>
|
90 |
+
|
91 |
+
<li>
|
92 |
+
<a href="?page=newsletter_subscription_lists"><i class="fas fa-th-list"></i> <?php _e('Lists', 'newsletter') ?>
|
93 |
+
<small><?php _e('Profile the subscribers for a better targeting', 'newsletter') ?></small></a>
|
94 |
+
</li>
|
95 |
+
|
96 |
+
<li>
|
97 |
+
<a href="?page=newsletter_subscription_antibot"><i class="fas fa-lock"></i> <?php _e('Security', 'newsletter') ?>
|
98 |
+
<small><?php _e('Spam subscriptions control', 'newsletter') ?></small></a>
|
99 |
+
</li>
|
100 |
+
|
101 |
+
<li>
|
102 |
+
<a href="?page=newsletter_unsubscription_index"><i class="fas fa-sign-out-alt"></i> <?php _e('Unsubscription', 'newsletter') ?>
|
103 |
+
<small><?php _e('How to give the last goodbye (or avoid it!)', 'newsletter') ?></small></a>
|
104 |
+
</li>
|
105 |
+
|
106 |
+
<?php
|
107 |
+
newsletter_print_entries('subscription');
|
108 |
+
?>
|
109 |
+
</ul>
|
110 |
+
</li>
|
111 |
+
|
112 |
+
<li>
|
113 |
+
<a href="#"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
114 |
+
<ul>
|
115 |
+
<li>
|
116 |
+
<a href="?page=newsletter_emails_composer"><i class="fas fa-plus"></i> <?php _e('Create newsletter', 'newsletter') ?>
|
117 |
+
<small><?php _e('Start your new campaign', 'newsletter') ?></small></a>
|
118 |
+
</li>
|
119 |
+
|
120 |
+
<li>
|
121 |
+
<a href="?page=newsletter_emails_index"><i class="fas fa-newspaper"></i> <?php _e('Newsletters', 'newsletter') ?>
|
122 |
+
<small><?php _e('The classic "write & send" newsletters', 'newsletter') ?></small></a>
|
123 |
+
</li>
|
124 |
+
|
125 |
+
<li>
|
126 |
+
<a href="<?php echo NewsletterStatistics::instance()->get_index_url() ?>"><i class="fas fa-chart-bar"></i> <?php _e('Statistics', 'newsletter') ?>
|
127 |
+
<small><?php _e('Tracking configuration and basic data', 'newsletter') ?></small></a>
|
128 |
+
</li>
|
129 |
+
<?php
|
130 |
+
newsletter_print_entries('newsletters');
|
131 |
+
?>
|
132 |
+
</ul>
|
133 |
+
</li>
|
134 |
+
|
135 |
+
<li>
|
136 |
+
<a href="#"><i class="fas fa-cog"></i> <?php _e('Settings', 'newsletter') ?> <i class="fas fa-chevron-down"></i></a>
|
137 |
+
<ul>
|
138 |
+
<?php if ($is_administrator) { ?>
|
139 |
+
<li>
|
140 |
+
<a href="?page=newsletter_main_main"><i class="fas fa-cogs"></i> <?php _e('General Settings', 'newsletter') ?>
|
141 |
+
<small><?php _e('Delivery speed, sender details, ...', 'newsletter') ?></small></a>
|
142 |
+
</li>
|
143 |
+
<?php if (!class_exists('NewsletterSmtp')) { ?>
|
144 |
+
<li>
|
145 |
+
<a href="?page=newsletter_main_smtp"><i class="fas fa-server"></i> <?php _e('SMTP', 'newsletter') ?>
|
146 |
+
<small><?php _e('External mail server', 'newsletter') ?></small>
|
147 |
+
</a>
|
148 |
+
</li>
|
149 |
+
<?php } ?>
|
150 |
+
<?php } ?>
|
151 |
+
|
152 |
+
<li>
|
153 |
+
<a href="?page=newsletter_main_info"><i class="fas fa-info"></i> <?php _e('Company Info', 'newsletter') ?>
|
154 |
+
<small><?php _e('Social, address, logo and general info', 'newsletter') ?></small></a>
|
155 |
+
</li>
|
156 |
+
|
157 |
+
<li>
|
158 |
+
<a href="?page=newsletter_subscription_template"><i class="fas fa-file-alt"></i> <?php _e('Messages Template', 'newsletter') ?>
|
159 |
+
<small><?php _e('Change the look of your service emails', 'newsletter') ?></small></a>
|
160 |
+
</li>
|
161 |
+
|
162 |
+
<?php
|
163 |
+
newsletter_print_entries('settings');
|
164 |
+
?>
|
165 |
+
</ul>
|
166 |
+
</li>
|
167 |
+
|
168 |
+
<?php if ($is_administrator) { ?>
|
169 |
+
<li>
|
170 |
+
<a href="#"><i class="fas fa-thermometer"></i> <?php _e('System', 'newsletter') ?>
|
171 |
+
<?php if ($warning) { ?>
|
172 |
+
<i class="fas fa-exclamation-triangle" style="color: red;"></i>
|
173 |
+
<?php } ?>
|
174 |
+
</a>
|
175 |
+
<ul>
|
176 |
+
<li>
|
177 |
+
<a href="<?php echo admin_url('site-health.php') ?> "><i class="fas fa-file"></i> <?php _e('Site health') ?>
|
178 |
+
<small><?php _e('WP native site health checks', 'newsletter') ?></small></a>
|
179 |
+
</li>
|
180 |
+
<li>
|
181 |
+
<a href="?page=newsletter_system_delivery"><i class="fas fa-file"></i> <?php _e('Delivery Diagnostic', 'newsletter') ?>
|
182 |
+
<small><?php _e('Delivery analysis and test', 'newsletter') ?></small></a>
|
183 |
+
</li>
|
184 |
+
<li>
|
185 |
+
<a href="?page=newsletter_system_scheduler"><i class="fas fa-robot"></i> <?php _e('Scheduler', 'newsletter') ?>
|
186 |
+
<small><?php _e('WordPress background jobs', 'newsletter') ?></small></a>
|
187 |
+
</li>
|
188 |
+
<li>
|
189 |
+
<a href="?page=newsletter_system_status"><i class="fas fa-file"></i> <?php _e('Status', 'newsletter') ?>
|
190 |
+
<small><?php _e('Checks and parameters', 'newsletter') ?></small></a>
|
191 |
+
</li>
|
192 |
+
|
193 |
+
<li>
|
194 |
+
<a href="?page=newsletter_system_logs"><i class="fas fa-file"></i> <?php _e('Logs', 'newsletter') ?>
|
195 |
+
<small><?php _e('Plugin and addons logs', 'newsletter') ?></small></a>
|
196 |
+
</li>
|
197 |
+
</ul>
|
198 |
+
</li>
|
199 |
+
<?php } ?>
|
200 |
+
|
201 |
+
<?php
|
202 |
+
$license_data = Newsletter::instance()->get_license_data();
|
203 |
+
$premium_url = 'https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=plugin&utm_content=' . urlencode($_GET['page']);
|
204 |
+
?>
|
205 |
+
|
206 |
+
<?php if (empty($license_data)) { ?>
|
207 |
+
<?php if (time() < 1638226799) { ?>
|
208 |
+
<li class="tnp-professional-extensions-button" style="background-color: #000; color: #fff; border-color: #FF5F65!important; border-width: 2px !important;"><a href="https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=black-friday" target="_blank">
|
209 |
+
<i class="fas fa-trophy"></i> BLACK FRIDAY IS LIVE</a>
|
210 |
+
</li>
|
211 |
+
<?php } else { ?>
|
212 |
+
<li class="tnp-professional-extensions-button"><a href="<?php echo $premium_url ?>" target="_blank">
|
213 |
+
<i class="fas fa-trophy"></i> <?php _e('Get Professional Addons', 'newsletter') ?></a>
|
214 |
+
</li>
|
215 |
+
<?php } ?>
|
216 |
+
<?php } elseif (is_wp_error($license_data)) { ?>
|
217 |
+
<li class="tnp-professional-extensions-button-red">
|
218 |
+
<a href="?page=newsletter_main_main"><i class="fas fa-hand-paper" style="color: white"></i> <?php _e('Unable to check', 'newsletter') ?></a>
|
219 |
+
</li>
|
220 |
+
|
221 |
+
<?php } elseif ($license_data->expire == 0) { ?>
|
222 |
+
<?php if (time() < 1638226799) { ?>
|
223 |
+
<li class="tnp-professional-extensions-button" style="background-color: #000; color: #fff; border-color: #FF5F65!important; border-width: 2px !important;"><a href="https://www.thenewsletterplugin.com/premium?utm_source=header&utm_medium=link&utm_campaign=black-friday" target="_blank">
|
224 |
+
<i class="fas fa-trophy"></i> BLACK FRIDAY IS LIVE</a>
|
225 |
+
</li>
|
226 |
+
<?php } else { ?>
|
227 |
+
<li class="tnp-professional-extensions-button"><a href="<?php echo $premium_url ?>" target="_blank">
|
228 |
+
<i class="fas fa-trophy"></i> <?php _e('Get Professional Addons', 'newsletter') ?></a>
|
229 |
+
</li>
|
230 |
+
<?php } ?>
|
231 |
+
|
232 |
+
<?php } elseif ($license_data->expire < time()) { ?>
|
233 |
+
|
234 |
+
<li class="tnp-professional-extensions-button-red">
|
235 |
+
<a href="?page=newsletter_main_main"><i class="fas fa-hand-paper" style="color: white"></i> <?php _e('License expired', 'newsletter') ?></a>
|
236 |
+
</li>
|
237 |
+
|
238 |
+
<?php } elseif ($license_data->expire >= time()) { ?>
|
239 |
+
|
240 |
+
<?php $p = class_exists('NewsletterExtensions') ? 'newsletter_extensions_index' : 'newsletter_main_extensions'; ?>
|
241 |
+
<li class="tnp-professional-extensions-button">
|
242 |
+
<a href="?page=<?php echo $p ?>"><i class="fas fa-check-square"></i> <?php _e('License active', 'newsletter') ?></a>
|
243 |
+
</li>
|
244 |
+
|
245 |
+
<?php } ?>
|
246 |
+
</ul>
|
247 |
+
</div>
|
248 |
+
|
249 |
+
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-shortcode'])) { ?>
|
250 |
+
<?php
|
251 |
+
// Check of Newsletter dedicated page
|
252 |
+
if (!empty(Newsletter::instance()->options['page'])) {
|
253 |
+
if (get_post_status(Newsletter::instance()->options['page']) === 'publish') {
|
254 |
+
$content = get_post_field('post_content', Newsletter::instance()->options['page']);
|
255 |
+
// With and without attributes
|
256 |
+
if (strpos($content, '[newsletter]') === false && strpos($content, '[newsletter ') === false) {
|
257 |
+
?>
|
258 |
+
<div class="tnp-notice">
|
259 |
+
<a href="<?php echo esc_attr($_SERVER['REQUEST_URI']) . '&noheader=1&dismiss=newsletter-shortcode' ?>" class="tnp-dismiss">×</a>
|
260 |
+
The Newsletter dedicated page does not contain the [newsletter] shortcode. If you're using a visual composer it could be ok.
|
261 |
+
<a href="<?php echo site_url('/wp-admin/post.php') ?>?post=<?php echo esc_attr(Newsletter::instance()->options['page']) ?>&action=edit"><strong>Edit the page</strong></a>.
|
262 |
+
|
263 |
+
</div>
|
264 |
+
<?php
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
?>
|
269 |
+
<?php } ?>
|
270 |
+
|
271 |
+
<?php if (isset($_GET['debug']) || !isset($dismissed['rate']) && $user_count > 300) { ?>
|
272 |
+
<div class="tnp-notice">
|
273 |
+
<a href="<?php echo esc_attr($_SERVER['REQUEST_URI']) . '&noheader=1&dismiss=rate' ?>" class="tnp-dismiss">×</a>
|
274 |
+
|
275 |
+
We never asked before and we're curious: <a href="http://wordpress.org/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
|
276 |
+
(few seconds required - account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, The Newsletter Team</strong>.
|
277 |
+
|
278 |
+
</div>
|
279 |
+
<?php } ?>
|
280 |
+
|
281 |
+
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-page']) && empty(Newsletter::instance()->options['page'])) { ?>
|
282 |
+
<div class="tnp-notice">
|
283 |
+
<a href="<?php echo esc_attr($_SERVER['REQUEST_URI']) . '&noheader=1&dismiss=newsletter-page' ?>" class="tnp-dismiss">×</a>
|
284 |
+
|
285 |
+
You should create a blog page to show the subscription form and the subscription messages. Go to the
|
286 |
+
<a href="?page=newsletter_main_main">general settings panel</a> to configure it.
|
287 |
+
|
288 |
+
</div>
|
289 |
+
<?php } ?>
|
290 |
+
|
291 |
+
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-subscribe']) && get_option('newsletter_install_time') && get_option('newsletter_install_time') < time() - 86400 * 15) { ?>
|
292 |
+
<div class="tnp-notice">
|
293 |
+
<a href="<?php echo esc_attr($_SERVER['REQUEST_URI']) . '&noheader=1&dismiss=newsletter-subscribe' ?>" class="tnp-dismiss">×</a>
|
294 |
+
Subscribe to our news, promotions and getting started lessons!
|
295 |
+
Proceeding you agree to the <a href="https://www.thenewsletterplugin.com/privacy" target="_blank">privacy policy</a>.
|
296 |
+
<br>
|
297 |
+
<form action="https://www.thenewsletterplugin.com/?na=s" target="_blank" method="post">
|
298 |
+
<input type="hidden" value="plugin-header" name="nr">
|
299 |
+
<input type="hidden" value="3" name="nl[]">
|
300 |
+
<input type="hidden" value="1" name="nl[]">
|
301 |
+
<input type="hidden" value="double" name="optin">
|
302 |
+
<input type="email" name="ne" value="<?php echo esc_attr($current_user_email) ?>">
|
303 |
+
<input type="submit" value="<?php esc_attr_e('Subscribe', 'newsletter') ?>">
|
304 |
+
</form>
|
305 |
+
</div>
|
306 |
+
<?php } ?>
|
307 |
+
|
308 |
+
<?php
|
309 |
+
if (!defined('NEWSLETTER_CRON_WARNINGS') || NEWSLETTER_CRON_WARNINGS) {
|
310 |
+
$x = NewsletterSystem::instance()->get_job_status();
|
311 |
+
if ($x !== NewsletterSystem::JOB_OK) {
|
312 |
+
echo '<div class="tnpc-warning">The are issues with the delivery engine. Please <a href="?page=newsletter_system_scheduler">check them here</a>.</div>';
|
313 |
+
}
|
314 |
+
}
|
315 |
+
?>
|
316 |
+
|
317 |
+
<?php
|
318 |
+
if ($_GET['page'] !== 'newsletter_emails_edit') {
|
319 |
+
|
320 |
+
$last_failed_newsletters = Newsletter::instance()->get_emails_by_status(TNP_Email::STATUS_ERROR);
|
321 |
+
if ($last_failed_newsletters) {
|
322 |
+
$c = new NewsletterControls();
|
323 |
+
foreach ($last_failed_newsletters as $n) {
|
324 |
+
echo '<div class="tnpc-error">';
|
325 |
+
printf(__('Newsletter "%s" stopped by fatal error.', 'newsletter'), esc_html($n->subject));
|
326 |
+
echo ' ';
|
327 |
+
|
328 |
+
$c->btn_link('?page=newsletter_emails_edit&id=' . $n->id, __('Check', 'newsletter'));
|
329 |
+
echo '</div>';
|
330 |
+
}
|
331 |
+
}
|
332 |
+
}
|
333 |
+
?>
|
334 |
+
|
335 |
+
<div id="tnp-notification">
|
336 |
+
<?php
|
337 |
+
if (isset($controls)) {
|
338 |
+
$controls->show();
|
339 |
+
$controls->messages = '';
|
340 |
+
$controls->errors = '';
|
341 |
+
}
|
342 |
+
?>
|
343 |
+
</div>
|
344 |
+
|
345 |
+
|