Version Description
- Default theme thumbnail fix
- Profile saving antispam check
- Fixed hero block (button)
- Added logging on spam checking (enable info lov level to see the spam check results in the logs)
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 6.4.7 |
Comparing to | |
See all releases |
Code changes from version 6.4.5 to 6.4.7
- admin.css +16 -24
- css/dropdown.css +1 -0
- css/fields.css +51 -1
- emails/blocks/hero/block.php +16 -62
- emails/blocks/hero/options.php +14 -3
- emails/edit.php +12 -0
- emails/editortinymce.php +5 -2
- emails/emails.php +83 -134
- emails/new.php +79 -101
- emails/theme.php +13 -15
- emails/themes/blank/screenshot.png +0 -0
- emails/themes/blank/theme.php +9 -1
- emails/themes/cta-2015/screenshot.png +0 -0
- emails/themes/default/screenshot.png +0 -0
- emails/themes/default/theme-defaults.php +9 -0
- emails/themes/default/theme-options.php +13 -3
- emails/themes/default/theme.php +173 -90
- emails/tnp-composer/index.php +31 -44
- images/theme-screenshot.png +0 -0
- includes/controls.php +11 -4
- includes/fields.php +9 -2
- includes/helper.php +8 -0
- includes/module.php +58 -24
- includes/themes.php +114 -155
- main/status.php +13 -3
- plugin.php +11 -5
- profile/profile.php +6 -0
- readme.txt +21 -3
- subscription/subscription.php +17 -3
- unsubscription/unsubscription.php +8 -7
- users/index.php +0 -1
admin.css
CHANGED
@@ -1247,6 +1247,13 @@ table.widefat {
|
|
1247 |
font-family: "Circular Std", sans-serif;
|
1248 |
}
|
1249 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1250 |
#tnp-body #tabs .ui-widget-header {
|
1251 |
background: #28313C;
|
1252 |
border: 0;
|
@@ -1262,23 +1269,27 @@ table.widefat {
|
|
1262 |
color: #444;
|
1263 |
}
|
1264 |
|
|
|
|
|
|
|
|
|
1265 |
#tnp-body .ui-tabs .ui-tabs-nav li a {
|
1266 |
font-size: 14px;
|
1267 |
}
|
1268 |
|
1269 |
-
#tnp-body .ui-tabs {
|
1270 |
border-color: #28313C;
|
1271 |
background-color: #28313C;
|
1272 |
border: 0;
|
1273 |
}
|
1274 |
|
1275 |
-
#tnp-body .ui-tabs .ui-tabs-nav {
|
1276 |
margin: 0;
|
1277 |
padding: .2em .2em 0 0;
|
1278 |
background-color: #f2f2f2;
|
1279 |
}
|
1280 |
|
1281 |
-
#tnp-body .ui-tabs .ui-tabs-panel {
|
1282 |
padding: 1em 0;
|
1283 |
background-color: #f2f2f2;
|
1284 |
margin: 0;
|
@@ -1291,8 +1302,9 @@ table.widefat {
|
|
1291 |
font-family: "Circular Std", sans-serif;
|
1292 |
}
|
1293 |
|
|
|
1294 |
#tnp-body .ui-widget-content {
|
1295 |
-
background: #fff
|
1296 |
}
|
1297 |
|
1298 |
#tnp-body .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
|
@@ -2369,26 +2381,6 @@ span.tnp-email-status-sent {
|
|
2369 |
background-color: #5AC05A;
|
2370 |
}
|
2371 |
|
2372 |
-
.tnp-field-row {
|
2373 |
-
clear: both;
|
2374 |
-
margin-left: -10px;
|
2375 |
-
margin-right: -10px;
|
2376 |
-
}
|
2377 |
-
|
2378 |
-
.tnp-field-col-2 {
|
2379 |
-
width: 50%;
|
2380 |
-
box-sizing: border-box;
|
2381 |
-
padding: 10px;
|
2382 |
-
float: left;
|
2383 |
-
}
|
2384 |
-
|
2385 |
-
.tnp-field-col-3 {
|
2386 |
-
width: 33%;
|
2387 |
-
box-sizing: border-box;
|
2388 |
-
padding: 10px;
|
2389 |
-
float: left;
|
2390 |
-
}
|
2391 |
-
|
2392 |
/* Addons page */
|
2393 |
|
2394 |
#tnp-promo {
|
1247 |
font-family: "Circular Std", sans-serif;
|
1248 |
}
|
1249 |
|
1250 |
+
#tnp-body #tabs {
|
1251 |
+
background-color: transparent;
|
1252 |
+
border: 0!important;
|
1253 |
+
padding: 0;
|
1254 |
+
margin: 0;
|
1255 |
+
}
|
1256 |
+
|
1257 |
#tnp-body #tabs .ui-widget-header {
|
1258 |
background: #28313C;
|
1259 |
border: 0;
|
1269 |
color: #444;
|
1270 |
}
|
1271 |
|
1272 |
+
#tnp-body .ui-tabs .ui-tabs-nav {
|
1273 |
+
padding: 0;
|
1274 |
+
}
|
1275 |
+
|
1276 |
#tnp-body .ui-tabs .ui-tabs-nav li a {
|
1277 |
font-size: 14px;
|
1278 |
}
|
1279 |
|
1280 |
+
#tnp-body #tabs .ui-tabs {
|
1281 |
border-color: #28313C;
|
1282 |
background-color: #28313C;
|
1283 |
border: 0;
|
1284 |
}
|
1285 |
|
1286 |
+
#tnp-body #tabs .ui-tabs .ui-tabs-nav {
|
1287 |
margin: 0;
|
1288 |
padding: .2em .2em 0 0;
|
1289 |
background-color: #f2f2f2;
|
1290 |
}
|
1291 |
|
1292 |
+
#tnp-body #tabs .ui-tabs .ui-tabs-panel {
|
1293 |
padding: 1em 0;
|
1294 |
background-color: #f2f2f2;
|
1295 |
margin: 0;
|
1302 |
font-family: "Circular Std", sans-serif;
|
1303 |
}
|
1304 |
|
1305 |
+
|
1306 |
#tnp-body .ui-widget-content {
|
1307 |
+
background: #fff;
|
1308 |
}
|
1309 |
|
1310 |
#tnp-body .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
|
2381 |
background-color: #5AC05A;
|
2382 |
}
|
2383 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2384 |
/* Addons page */
|
2385 |
|
2386 |
#tnp-promo {
|
css/dropdown.css
CHANGED
@@ -77,6 +77,7 @@
|
|
77 |
.tnp-drowpdown ul li a small {
|
78 |
display: block;
|
79 |
color: #afafaf;
|
|
|
80 |
}
|
81 |
|
82 |
.tnp-drowpdown ul ul {
|
77 |
.tnp-drowpdown ul li a small {
|
78 |
display: block;
|
79 |
color: #afafaf;
|
80 |
+
float: none !important;
|
81 |
}
|
82 |
|
83 |
.tnp-drowpdown ul ul {
|
css/fields.css
CHANGED
@@ -3,6 +3,55 @@
|
|
3 |
/*border: 1px dashed #999;*/
|
4 |
/*}*/
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
.tnp-section {
|
7 |
|
8 |
}
|
@@ -81,7 +130,8 @@ tnp-field.tnp-font {
|
|
81 |
|
82 |
.tnp-field input[type=color] {
|
83 |
width: 40px;
|
84 |
-
height:
|
|
|
85 |
}
|
86 |
|
87 |
.tnp-field input[type=submit] {
|
3 |
/*border: 1px dashed #999;*/
|
4 |
/*}*/
|
5 |
|
6 |
+
/* STRUCTURE */
|
7 |
+
.tnp-field-row {
|
8 |
+
clear: both;
|
9 |
+
margin-left: -10px;
|
10 |
+
margin-right: -10px;
|
11 |
+
}
|
12 |
+
|
13 |
+
.tnp-field-col-2 {
|
14 |
+
width: 50%;
|
15 |
+
box-sizing: border-box;
|
16 |
+
padding: 10px;
|
17 |
+
float: left;
|
18 |
+
}
|
19 |
+
|
20 |
+
.tnp-field-col-3 {
|
21 |
+
width: 33%;
|
22 |
+
box-sizing: border-box;
|
23 |
+
padding: 10px;
|
24 |
+
float: left;
|
25 |
+
}
|
26 |
+
|
27 |
+
.tnp-field-col-20 {
|
28 |
+
width: 20%;
|
29 |
+
box-sizing: border-box;
|
30 |
+
padding: 10px;
|
31 |
+
float: left;
|
32 |
+
}
|
33 |
+
|
34 |
+
.tnp-field-col-33 {
|
35 |
+
width: 33%;
|
36 |
+
box-sizing: border-box;
|
37 |
+
padding: 10px;
|
38 |
+
float: left;
|
39 |
+
}
|
40 |
+
|
41 |
+
.tnp-field-col-66 {
|
42 |
+
width: 66%;
|
43 |
+
box-sizing: border-box;
|
44 |
+
padding: 10px;
|
45 |
+
float: left;
|
46 |
+
}
|
47 |
+
|
48 |
+
.tnp-field-col-80 {
|
49 |
+
width: 80%;
|
50 |
+
box-sizing: border-box;
|
51 |
+
padding: 10px;
|
52 |
+
float: left;
|
53 |
+
}
|
54 |
+
|
55 |
.tnp-section {
|
56 |
|
57 |
}
|
130 |
|
131 |
.tnp-field input[type=color] {
|
132 |
width: 40px;
|
133 |
+
min-height: 30px;
|
134 |
+
vertical-align: middle;
|
135 |
}
|
136 |
|
137 |
.tnp-field input[type=submit] {
|
emails/blocks/hero/block.php
CHANGED
@@ -1,15 +1,14 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
-
* Name:
|
4 |
* Section: content
|
5 |
-
* Description:
|
6 |
*/
|
7 |
|
8 |
/* @var $options array */
|
9 |
/* @var $wpdb wpdb */
|
10 |
|
11 |
$defaults = array(
|
12 |
-
'button_url' => '',
|
13 |
'title' => 'An Awesome Title',
|
14 |
'text' => 'This is just a simple text you should change',
|
15 |
'font_family' => 'Helvetica, Arial, sans-serif',
|
@@ -22,8 +21,10 @@ $defaults = array(
|
|
22 |
'title_font_color' => '#000000',
|
23 |
'block_background' => '#ffffff',
|
24 |
'layout' => 'full',
|
|
|
25 |
'button_label' => 'Click Here',
|
26 |
'button_color' => '#ffffff',
|
|
|
27 |
'button_background' => '#256F9C',
|
28 |
'layout' => 'full',
|
29 |
'block_padding_top'=>20,
|
@@ -83,27 +84,6 @@ if (!empty($options['image']['id'])) {
|
|
83 |
color: <?php echo $font_color ?>;
|
84 |
font-family: <?php echo $font_family ?>;
|
85 |
}
|
86 |
-
.hero-button-table {
|
87 |
-
background-color: <?php echo $button_background ?>;
|
88 |
-
/*border:1px solid #353535;*/
|
89 |
-
border-radius:5px;
|
90 |
-
}
|
91 |
-
.hero-button-td {
|
92 |
-
color: <?php echo $button_color ?>;
|
93 |
-
font-family:<?php echo $font_family ?>;
|
94 |
-
font-size:16px;
|
95 |
-
font-weight:normal;
|
96 |
-
letter-spacing:-.5px;
|
97 |
-
line-height:150%;
|
98 |
-
padding-top:15px;
|
99 |
-
padding-right:30px;
|
100 |
-
padding-bottom:15px;
|
101 |
-
padding-left:30px;
|
102 |
-
}
|
103 |
-
.hero-button-a {
|
104 |
-
color:<?php echo $button_color ?>;
|
105 |
-
text-decoration:none;
|
106 |
-
}
|
107 |
.hero-image {
|
108 |
max-width: 100%!important;
|
109 |
display: block;
|
@@ -114,6 +94,7 @@ if (!empty($options['image']['id'])) {
|
|
114 |
|
115 |
<!-- HERO IMAGE -->
|
116 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
117 |
<tr>
|
118 |
<td class="padding-copy tnpc-row-edit">
|
119 |
<a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
|
@@ -121,6 +102,7 @@ if (!empty($options['image']['id'])) {
|
|
121 |
</a>
|
122 |
</td>
|
123 |
</tr>
|
|
|
124 |
<tr>
|
125 |
<td>
|
126 |
<!-- COPY -->
|
@@ -138,15 +120,7 @@ if (!empty($options['image']['id'])) {
|
|
138 |
|
139 |
<tr>
|
140 |
<td align="center">
|
141 |
-
|
142 |
-
<table border="0" cellpadding="0" cellspacing="0" inline-class="hero-button-table" align="center">
|
143 |
-
<tr>
|
144 |
-
<td align="center" valign="middle" inline-class="hero-button-td">
|
145 |
-
<a href="<?php echo esc_attr($url) ?>" target="_blank" inline-class="hero-button-a"><?php echo $button_label ?></a>
|
146 |
-
</td>
|
147 |
-
</tr>
|
148 |
-
</table>
|
149 |
-
|
150 |
</td>
|
151 |
</tr>
|
152 |
</table>
|
@@ -174,27 +148,6 @@ if (!empty($options['image']['id'])) {
|
|
174 |
font-family: <?php echo $font_family ?>;
|
175 |
font-weight: <?php echo $font_weight ?>;
|
176 |
}
|
177 |
-
.hero-button-table {
|
178 |
-
background-color: <?php echo $button_background ?>;
|
179 |
-
/*border:1px solid #353535;*/
|
180 |
-
border-radius:5px;
|
181 |
-
}
|
182 |
-
.hero-button-td {
|
183 |
-
color: <?php echo $button_color ?>;
|
184 |
-
font-family:<?php echo $font_family ?>;
|
185 |
-
font-size:<?php echo $font_size ?>px;
|
186 |
-
font-weight:bold;
|
187 |
-
letter-spacing:-.5px;
|
188 |
-
line-height:150%;
|
189 |
-
padding-top:10px;
|
190 |
-
padding-right:30px;
|
191 |
-
padding-bottom:10px;
|
192 |
-
padding-left:30px;
|
193 |
-
}
|
194 |
-
.hero-button-a {
|
195 |
-
color:<?php echo $button_color ?>;
|
196 |
-
text-decoration:none;
|
197 |
-
}
|
198 |
</style>
|
199 |
|
200 |
<table width="290" align="left" class="hero-table">
|
@@ -207,7 +160,7 @@ if (!empty($options['image']['id'])) {
|
|
207 |
|
208 |
<table width="290" align="right" class="hero-table hero-table-right">
|
209 |
<tr>
|
210 |
-
<td>
|
211 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
212 |
<tr>
|
213 |
<td align="center" inline-class="hero-title">
|
@@ -221,13 +174,14 @@ if (!empty($options['image']['id'])) {
|
|
221 |
</tr>
|
222 |
</table>
|
223 |
<br>
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
|
|
231 |
|
232 |
</td>
|
233 |
</tr>
|
1 |
<?php
|
2 |
/*
|
3 |
+
* Name: Hero
|
4 |
* Section: content
|
5 |
+
* Description: Image, title, text and call to action all in one
|
6 |
*/
|
7 |
|
8 |
/* @var $options array */
|
9 |
/* @var $wpdb wpdb */
|
10 |
|
11 |
$defaults = array(
|
|
|
12 |
'title' => 'An Awesome Title',
|
13 |
'text' => 'This is just a simple text you should change',
|
14 |
'font_family' => 'Helvetica, Arial, sans-serif',
|
21 |
'title_font_color' => '#000000',
|
22 |
'block_background' => '#ffffff',
|
23 |
'layout' => 'full',
|
24 |
+
'button_url' => '',
|
25 |
'button_label' => 'Click Here',
|
26 |
'button_color' => '#ffffff',
|
27 |
+
'button_font_size' => 20,
|
28 |
'button_background' => '#256F9C',
|
29 |
'layout' => 'full',
|
30 |
'block_padding_top'=>20,
|
84 |
color: <?php echo $font_color ?>;
|
85 |
font-family: <?php echo $font_family ?>;
|
86 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
.hero-image {
|
88 |
max-width: 100%!important;
|
89 |
display: block;
|
94 |
|
95 |
<!-- HERO IMAGE -->
|
96 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
97 |
+
<?php if ($image) { ?>
|
98 |
<tr>
|
99 |
<td class="padding-copy tnpc-row-edit">
|
100 |
<a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
|
102 |
</a>
|
103 |
</td>
|
104 |
</tr>
|
105 |
+
<?php } ?>
|
106 |
<tr>
|
107 |
<td>
|
108 |
<!-- COPY -->
|
120 |
|
121 |
<tr>
|
122 |
<td align="center">
|
123 |
+
<?php echo tnpc_button($options)?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
</td>
|
125 |
</tr>
|
126 |
</table>
|
148 |
font-family: <?php echo $font_family ?>;
|
149 |
font-weight: <?php echo $font_weight ?>;
|
150 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
</style>
|
152 |
|
153 |
<table width="290" align="left" class="hero-table">
|
160 |
|
161 |
<table width="290" align="right" class="hero-table hero-table-right">
|
162 |
<tr>
|
163 |
+
<td align="center" style="text-align: center">
|
164 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
165 |
<tr>
|
166 |
<td align="center" inline-class="hero-title">
|
174 |
</tr>
|
175 |
</table>
|
176 |
<br>
|
177 |
+
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
|
178 |
+
<tr>
|
179 |
+
<td align="center" vertical-align="middle" style="font-size:0px;padding:10px 25px;word-break:break-word;">
|
180 |
+
<?php echo tnpc_button($options)?>
|
181 |
+
</td>
|
182 |
+
</tr>
|
183 |
+
</table>
|
184 |
+
|
185 |
|
186 |
</td>
|
187 |
</tr>
|
emails/blocks/hero/options.php
CHANGED
@@ -6,14 +6,25 @@
|
|
6 |
/* @var $fields NewsletterFields */
|
7 |
?>
|
8 |
|
|
|
|
|
9 |
<?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Left'))?>
|
10 |
-
|
|
|
11 |
|
12 |
<?php $fields->text('title', __('Title', 'newsletter')) ?>
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
<?php $fields->textarea('text', __('Text', 'newsletter')) ?>
|
16 |
-
<?php $fields->font('font')?>
|
17 |
|
18 |
<?php $fields->button('button', __('Button', 'newsletter'))?>
|
19 |
|
6 |
/* @var $fields NewsletterFields */
|
7 |
?>
|
8 |
|
9 |
+
<div class="tnp-field-row">
|
10 |
+
<div class="tnp-field-col-20">
|
11 |
<?php $fields->select('layout', __('Layout', 'newsletter'), array('full' => 'Full', 'left' => 'Left'))?>
|
12 |
+
</div>
|
13 |
+
<div class="tnp-field-col-80">
|
14 |
|
15 |
<?php $fields->text('title', __('Title', 'newsletter')) ?>
|
16 |
+
</div>
|
17 |
+
|
18 |
+
</div>
|
19 |
+
|
20 |
+
<?php $fields->font('title_font', '')?>
|
21 |
+
|
22 |
+
<?php $fields->media('image', __('Image', 'newsletter'))?>
|
23 |
+
|
24 |
+
|
25 |
|
26 |
<?php $fields->textarea('text', __('Text', 'newsletter')) ?>
|
27 |
+
<?php $fields->font('font', '')?>
|
28 |
|
29 |
<?php $fields->button('button', __('Button', 'newsletter'))?>
|
30 |
|
emails/edit.php
CHANGED
@@ -146,6 +146,10 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
|
|
146 |
$query .= " and wp_user_id<>0";
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
149 |
|
150 |
$list_where = array();
|
151 |
if (isset($email['options']['lists']) && count($email['options']['lists'])) {
|
@@ -376,6 +380,14 @@ if ($email['status'] != 'sent') {
|
|
376 |
<?php $controls->select2('options_lists_exclude', $lists, null, true, null, __('None', 'newsletter')); ?>
|
377 |
</td>
|
378 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
379 |
<tr>
|
380 |
<th><?php _e('Gender', 'newsletter') ?></th>
|
381 |
<td>
|
146 |
$query .= " and wp_user_id<>0";
|
147 |
}
|
148 |
|
149 |
+
if (!empty($email['options']['language'])) {
|
150 |
+
$query .= " and language='" . esc_sql((string) $email['options']['language']) . "'";
|
151 |
+
}
|
152 |
+
|
153 |
|
154 |
$list_where = array();
|
155 |
if (isset($email['options']['lists']) && count($email['options']['lists'])) {
|
380 |
<?php $controls->select2('options_lists_exclude', $lists, null, true, null, __('None', 'newsletter')); ?>
|
381 |
</td>
|
382 |
</tr>
|
383 |
+
|
384 |
+
<tr>
|
385 |
+
<th><?php _e('Language', 'newsletter') ?></th>
|
386 |
+
<td>
|
387 |
+
<?php $controls->language('options_language'); ?>
|
388 |
+
</td>
|
389 |
+
</tr>
|
390 |
+
|
391 |
<tr>
|
392 |
<th><?php _e('Gender', 'newsletter') ?></th>
|
393 |
<td>
|
emails/editortinymce.php
CHANGED
@@ -81,10 +81,13 @@ $controls->data = Newsletter::instance()->get_email($email_id, ARRAY_A);
|
|
81 |
tinyMCE.execCommand('mceInsertLink', false, media.attributes.url);
|
82 |
|
83 |
} else {
|
|
|
84 |
var display = tnp_uploader.state().display(media);
|
85 |
var url = media.attributes.sizes[display.attributes.size].url;
|
86 |
-
|
87 |
-
|
|
|
|
|
88 |
|
89 |
}
|
90 |
}).open();
|
81 |
tinyMCE.execCommand('mceInsertLink', false, media.attributes.url);
|
82 |
|
83 |
} else {
|
84 |
+
debugger;
|
85 |
var display = tnp_uploader.state().display(media);
|
86 |
var url = media.attributes.sizes[display.attributes.size].url;
|
87 |
+
var width = media.attributes.sizes[display.attributes.size].width;
|
88 |
+
var height = media.attributes.sizes[display.attributes.size].height;
|
89 |
+
var img = '<img src="' + url + '" style="width: ' + width + 'px; height: ' + height + 'px">';
|
90 |
+
tinyMCE.execCommand('mceInsertContent', false, img);
|
91 |
|
92 |
}
|
93 |
}).open();
|
emails/emails.php
CHANGED
@@ -2,8 +2,6 @@
|
|
2 |
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
5 |
-
require_once NEWSLETTER_INCLUDES_DIR . '/themes.php';
|
6 |
-
|
7 |
class NewsletterEmails extends NewsletterModule {
|
8 |
|
9 |
static $instance;
|
@@ -91,9 +89,10 @@ class NewsletterEmails extends NewsletterModule {
|
|
91 |
include NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
92 |
}
|
93 |
$options = $this->options_decode(stripslashes_deep($_REQUEST['options']));
|
94 |
-
|
95 |
-
$context = array('type'=>'');
|
96 |
-
if (isset($_REQUEST['context_type']))
|
|
|
97 |
|
98 |
// $defaults = array(
|
99 |
// 'block_padding_top' => 15,
|
@@ -251,6 +250,14 @@ class NewsletterEmails extends NewsletterModule {
|
|
251 |
return $text;
|
252 |
}
|
253 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
254 |
/**
|
255 |
* Renders a block identified by its id, using the block options and adding a wrapper
|
256 |
* if required (for the first block rendering.
|
@@ -282,19 +289,19 @@ class NewsletterEmails extends NewsletterModule {
|
|
282 |
echo '<tr>';
|
283 |
echo '<td data-options="" bgcolor="#ffffff" align="center" style="padding: 0; font-family: Helvetica, Arial, sans-serif;" class="edit-block">';
|
284 |
}
|
285 |
-
echo
|
286 |
-
|
|
|
287 |
|
288 |
-
echo
|
289 |
|
290 |
-
echo "<!--[if mso]></td></tr></table><![endif]-->\n";
|
291 |
if ($wrapper) {
|
292 |
echo '</td></tr></table>';
|
293 |
}
|
294 |
return;
|
295 |
}
|
296 |
|
297 |
-
$out = array('subject' => '', 'return_empty_message'=>false);
|
298 |
|
299 |
|
300 |
ob_start();
|
@@ -350,8 +357,8 @@ class NewsletterEmails extends NewsletterModule {
|
|
350 |
}
|
351 |
|
352 |
// Container that fixes the width and makes the block responsive
|
353 |
-
echo
|
354 |
-
|
355 |
echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
|
356 |
echo "<tr>";
|
357 |
echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
|
@@ -361,7 +368,7 @@ class NewsletterEmails extends NewsletterModule {
|
|
361 |
//echo "\n<!-- /block generated content -->\n";
|
362 |
|
363 |
echo "\n</td></tr></table>";
|
364 |
-
echo
|
365 |
|
366 |
// First time block creation wrapper
|
367 |
if ($wrapper) {
|
@@ -544,12 +551,17 @@ class NewsletterEmails extends NewsletterModule {
|
|
544 |
die();
|
545 |
}
|
546 |
|
|
|
|
|
|
|
547 |
// Used by theme code
|
548 |
-
$theme_options = $this->
|
549 |
-
|
|
|
|
|
550 |
header('Content-Type: text/html;charset=UTF-8');
|
551 |
|
552 |
-
include
|
553 |
|
554 |
die();
|
555 |
break;
|
@@ -567,17 +579,20 @@ class NewsletterEmails extends NewsletterModule {
|
|
567 |
// Used by theme code
|
568 |
$theme_options = $this->get_current_theme_options();
|
569 |
|
570 |
-
$file = $
|
|
|
571 |
if (is_file($file)) {
|
572 |
-
include
|
573 |
}
|
574 |
|
575 |
die();
|
576 |
break;
|
577 |
|
578 |
|
|
|
579 |
case 'emails-create':
|
580 |
-
|
|
|
581 |
if (!Newsletter::instance()->is_allowed()) {
|
582 |
die('Not enough privileges');
|
583 |
}
|
@@ -585,64 +600,58 @@ class NewsletterEmails extends NewsletterModule {
|
|
585 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
586 |
$controls = new NewsletterControls();
|
587 |
|
588 |
-
if (
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
$email['track'] = 1;
|
595 |
|
596 |
-
|
|
|
|
|
|
|
|
|
597 |
|
598 |
-
|
599 |
-
|
|
|
|
|
|
|
|
|
|
|
600 |
|
601 |
-
|
602 |
-
include $this->get_current_theme_file_path('theme.php');
|
603 |
-
$email['message'] = ob_get_clean();
|
604 |
|
605 |
-
|
606 |
-
|
607 |
-
}
|
608 |
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
|
613 |
-
$email['type'] = 'message';
|
614 |
-
$email['send_on'] = time();
|
615 |
-
$email = $newsletter->save_email($email);
|
616 |
|
617 |
-
|
|
|
|
|
618 |
|
619 |
-
|
|
|
|
|
|
|
|
|
|
|
620 |
}
|
621 |
-
die();
|
622 |
-
break;
|
623 |
-
}
|
624 |
-
}
|
625 |
|
626 |
-
|
627 |
-
global $wpdb, $charset_collate;
|
628 |
|
629 |
-
|
630 |
|
631 |
-
|
632 |
-
$this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column token varchar(10) not null default ''");
|
633 |
-
$this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column visibility");
|
634 |
-
$this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column private tinyint(1) not null default 0");
|
635 |
|
636 |
-
|
637 |
-
|
638 |
-
//$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token='" . $token . "' where token=''");
|
639 |
-
if ($this->old_version < '1.1.5') {
|
640 |
-
$this->upgrade_query("update " . NEWSLETTER_EMAILS_TABLE . " set type='message' where type=''");
|
641 |
-
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token=''");
|
642 |
}
|
643 |
-
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set total=sent where status='sent' and type='message'");
|
644 |
-
|
645 |
-
return true;
|
646 |
}
|
647 |
|
648 |
function admin_menu() {
|
@@ -654,80 +663,15 @@ class NewsletterEmails extends NewsletterModule {
|
|
654 |
$this->add_admin_page('composer', 'The Composer');
|
655 |
$this->add_admin_page('editorhtml', 'HTML Editor');
|
656 |
$this->add_admin_page('editortinymce', 'TinyMCE Editor');
|
657 |
-
//$this->add_admin_page('cpreview', 'The Composer Preview');
|
658 |
-
}
|
659 |
-
|
660 |
-
/**
|
661 |
-
* Returns the current selected theme.
|
662 |
-
*/
|
663 |
-
function get_current_theme() {
|
664 |
-
$theme = $this->options['theme'];
|
665 |
-
if (empty($theme))
|
666 |
-
return 'blank';
|
667 |
-
else
|
668 |
-
return $theme;
|
669 |
-
}
|
670 |
-
|
671 |
-
function get_current_theme_options() {
|
672 |
-
$theme_options = $this->themes->get_options($this->get_current_theme());
|
673 |
-
// main options merge
|
674 |
-
$main_options = Newsletter::instance()->options;
|
675 |
-
foreach ($main_options as $key => $value) {
|
676 |
-
$theme_options['main_' . $key] = $value;
|
677 |
-
}
|
678 |
-
$info_options = Newsletter::instance()->get_options('info');
|
679 |
-
foreach ($info_options as $key => $value) {
|
680 |
-
$theme_options['main_' . $key] = $value;
|
681 |
-
}
|
682 |
-
return $theme_options;
|
683 |
-
}
|
684 |
-
|
685 |
-
/**
|
686 |
-
* Returns the file path to a theme using the theme overriding rules.
|
687 |
-
* @param type $theme
|
688 |
-
* @param type $file
|
689 |
-
*/
|
690 |
-
function get_theme_file_path($theme, $file) {
|
691 |
-
return $this->themes->get_file_path($theme);
|
692 |
-
}
|
693 |
-
|
694 |
-
function get_current_theme_file_path($file) {
|
695 |
-
return $this->themes->get_file_path($this->get_current_theme(), $file);
|
696 |
-
}
|
697 |
-
|
698 |
-
function get_current_theme_url() {
|
699 |
-
return $this->themes->get_theme_url($this->get_current_theme());
|
700 |
}
|
701 |
|
702 |
/**
|
703 |
-
*
|
704 |
-
*
|
705 |
-
*
|
|
|
|
|
706 |
*/
|
707 |
-
function has_old_emails() {
|
708 |
-
return $this->store->get_count(NEWSLETTER_EMAILS_TABLE, "where type='email'") > 0;
|
709 |
-
}
|
710 |
-
|
711 |
-
function convert_old_emails() {
|
712 |
-
global $newsletter;
|
713 |
-
$list = $newsletter->get_emails('email', ARRAY_A);
|
714 |
-
foreach ($list as &$email) {
|
715 |
-
$email['type'] = 'message';
|
716 |
-
$query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
|
717 |
-
|
718 |
-
if ($email['list'] != 0)
|
719 |
-
$query .= " and list_" . $email['list'] . "=1";
|
720 |
-
$email['preferences'] = $email['list'];
|
721 |
-
|
722 |
-
if (!empty($email['sex'])) {
|
723 |
-
$query .= " and sex='" . $email['sex'] . "'";
|
724 |
-
}
|
725 |
-
$email['query'] = $query;
|
726 |
-
|
727 |
-
$newsletter->save_email($email);
|
728 |
-
}
|
729 |
-
}
|
730 |
-
|
731 |
function build_block($dir) {
|
732 |
$file = basename($dir);
|
733 |
$block_id = sanitize_key($file);
|
@@ -758,6 +702,11 @@ class NewsletterEmails extends NewsletterModule {
|
|
758 |
return $data;
|
759 |
}
|
760 |
|
|
|
|
|
|
|
|
|
|
|
761 |
function scan_blocks_dir($dir) {
|
762 |
|
763 |
if (!is_dir($dir)) {
|
@@ -983,7 +932,7 @@ class NewsletterEmails extends NewsletterModule {
|
|
983 |
$controls->errors .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank"><strong>' . __('Read more about delivery issues', 'newsletter') . '</strong></a>.';
|
984 |
} else {
|
985 |
$controls->messages = __('Test subscribers:', 'newsletter');
|
986 |
-
|
987 |
$controls->messages .= ' ' . implode(', ', $emails);
|
988 |
$controls->messages .= '.<br>';
|
989 |
$controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/subscribers#test" target="_blank"><strong>' .
|
2 |
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
|
|
|
|
5 |
class NewsletterEmails extends NewsletterModule {
|
6 |
|
7 |
static $instance;
|
89 |
include NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
90 |
}
|
91 |
$options = $this->options_decode(stripslashes_deep($_REQUEST['options']));
|
92 |
+
|
93 |
+
$context = array('type' => '');
|
94 |
+
if (isset($_REQUEST['context_type']))
|
95 |
+
$context['type'] = $_REQUEST['context_type'];
|
96 |
|
97 |
// $defaults = array(
|
98 |
// 'block_padding_top' => 15,
|
250 |
return $text;
|
251 |
}
|
252 |
|
253 |
+
static function get_outlook_wrapper_open($width = 600) {
|
254 |
+
return '<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" align="center" cellspacing="0" width="' . $width . '"><tr><td width="' . $width . '" style="vertical-align:top;width:' . $width . 'px;"><![endif]-->' . "\n";
|
255 |
+
}
|
256 |
+
|
257 |
+
static function get_outlook_wrapper_close() {
|
258 |
+
echo "<!--[if mso | IE]></td></tr></table><![endif]-->\n";
|
259 |
+
}
|
260 |
+
|
261 |
/**
|
262 |
* Renders a block identified by its id, using the block options and adding a wrapper
|
263 |
* if required (for the first block rendering.
|
289 |
echo '<tr>';
|
290 |
echo '<td data-options="" bgcolor="#ffffff" align="center" style="padding: 0; font-family: Helvetica, Arial, sans-serif;" class="edit-block">';
|
291 |
}
|
292 |
+
echo $this->get_outlook_wrapper_open($width);
|
293 |
+
|
294 |
+
echo '<p>Ops, this block type is no more registered!</p>';
|
295 |
|
296 |
+
echo $this->get_outlook_wrapper_close();
|
297 |
|
|
|
298 |
if ($wrapper) {
|
299 |
echo '</td></tr></table>';
|
300 |
}
|
301 |
return;
|
302 |
}
|
303 |
|
304 |
+
$out = array('subject' => '', 'return_empty_message' => false);
|
305 |
|
306 |
|
307 |
ob_start();
|
357 |
}
|
358 |
|
359 |
// Container that fixes the width and makes the block responsive
|
360 |
+
echo $this->get_outlook_wrapper_open($width);
|
361 |
+
|
362 |
echo '<table type="options" data-json="', esc_attr($data), '" class="tnpc-block-content" border="0" cellpadding="0" align="center" cellspacing="0" width="100%" style="width: 100%!important; max-width: ', $width, 'px!important">', "\n";
|
363 |
echo "<tr>";
|
364 |
echo '<td align="center" style="', $style, '" bgcolor="', $options['block_background'], '" width="100%">', "\n";
|
368 |
//echo "\n<!-- /block generated content -->\n";
|
369 |
|
370 |
echo "\n</td></tr></table>";
|
371 |
+
echo $this->get_outlook_wrapper_close();
|
372 |
|
373 |
// First time block creation wrapper
|
374 |
if ($wrapper) {
|
551 |
die();
|
552 |
}
|
553 |
|
554 |
+
$theme_id = $_GET['id'];
|
555 |
+
$theme = $this->themes->get_theme($theme_id);
|
556 |
+
|
557 |
// Used by theme code
|
558 |
+
$theme_options = $this->themes->get_options($theme_id);
|
559 |
+
|
560 |
+
$theme_url = $theme['url'];
|
561 |
+
|
562 |
header('Content-Type: text/html;charset=UTF-8');
|
563 |
|
564 |
+
include $theme['dir'] . '/theme.php';
|
565 |
|
566 |
die();
|
567 |
break;
|
579 |
// Used by theme code
|
580 |
$theme_options = $this->get_current_theme_options();
|
581 |
|
582 |
+
$file = include $theme['dir'] . '/theme-text.php';
|
583 |
+
|
584 |
if (is_file($file)) {
|
585 |
+
include $file;
|
586 |
}
|
587 |
|
588 |
die();
|
589 |
break;
|
590 |
|
591 |
|
592 |
+
|
593 |
case 'emails-create':
|
594 |
+
// Newsletter from themes are created on frontend context because sometime WP themes change the way the content,
|
595 |
+
// excerpt, thumbnail are extracted.
|
596 |
if (!Newsletter::instance()->is_allowed()) {
|
597 |
die('Not enough privileges');
|
598 |
}
|
600 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
601 |
$controls = new NewsletterControls();
|
602 |
|
603 |
+
if (!$controls->is_action('create')) {
|
604 |
+
die('Wrong call');
|
605 |
+
}
|
606 |
+
|
607 |
+
$theme_id = $controls->data['id'];
|
608 |
+
$theme = $this->themes->get_theme($theme_id);
|
|
|
609 |
|
610 |
+
if (!$theme) {
|
611 |
+
die('invalid theme');
|
612 |
+
}
|
613 |
+
|
614 |
+
$this->themes->save_options($theme_id, $controls->data);
|
615 |
|
616 |
+
$email = array();
|
617 |
+
$email['status'] = 'new';
|
618 |
+
$email['subject'] = ''; //__('Here the email subject', 'newsletter');
|
619 |
+
$email['track'] = 1;
|
620 |
+
$email['send_on'] = time();
|
621 |
+
$email['editor'] = NewsletterEmails::EDITOR_TINYMCE;
|
622 |
+
$email['type'] = 'message';
|
623 |
|
624 |
+
$theme_options = $this->themes->get_options($theme_id);
|
|
|
|
|
625 |
|
626 |
+
$theme_url = $theme['url'];
|
627 |
+
$theme_subject = '';
|
|
|
628 |
|
629 |
+
ob_start();
|
630 |
+
include $theme['dir'] . '/theme.php';
|
631 |
+
$email['message'] = ob_get_clean();
|
632 |
|
|
|
|
|
|
|
633 |
|
634 |
+
if (!empty($theme_subject)) {
|
635 |
+
$email['subject'] = $theme_subject;
|
636 |
+
}
|
637 |
|
638 |
+
if (file_exists($theme['dir'] . '/theme-text.php')) {
|
639 |
+
ob_start();
|
640 |
+
include $theme['dir'] . '/theme-text.php';
|
641 |
+
$email['message_text'] = ob_get_clean();
|
642 |
+
} else {
|
643 |
+
$email['message_text'] = 'You need a modern email client to read this email. Read it online: {email_url}.';
|
644 |
}
|
|
|
|
|
|
|
|
|
645 |
|
646 |
+
$email = $newsletter->save_email($email);
|
|
|
647 |
|
648 |
+
$edit_url = $this->get_editor_url($email->id, $email->editor);
|
649 |
|
650 |
+
header('Location: ' . $edit_url);
|
|
|
|
|
|
|
651 |
|
652 |
+
die();
|
653 |
+
break;
|
|
|
|
|
|
|
|
|
654 |
}
|
|
|
|
|
|
|
655 |
}
|
656 |
|
657 |
function admin_menu() {
|
663 |
$this->add_admin_page('composer', 'The Composer');
|
664 |
$this->add_admin_page('editorhtml', 'HTML Editor');
|
665 |
$this->add_admin_page('editortinymce', 'TinyMCE Editor');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
666 |
}
|
667 |
|
668 |
/**
|
669 |
+
* Builds a block data structure starting from the folder containing the block
|
670 |
+
* files.
|
671 |
+
*
|
672 |
+
* @param string $dir
|
673 |
+
* @return array | WP_Error
|
674 |
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
675 |
function build_block($dir) {
|
676 |
$file = basename($dir);
|
677 |
$block_id = sanitize_key($file);
|
702 |
return $data;
|
703 |
}
|
704 |
|
705 |
+
/**
|
706 |
+
*
|
707 |
+
* @param type $dir
|
708 |
+
* @return type
|
709 |
+
*/
|
710 |
function scan_blocks_dir($dir) {
|
711 |
|
712 |
if (!is_dir($dir)) {
|
932 |
$controls->errors .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank"><strong>' . __('Read more about delivery issues', 'newsletter') . '</strong></a>.';
|
933 |
} else {
|
934 |
$controls->messages = __('Test subscribers:', 'newsletter');
|
935 |
+
|
936 |
$controls->messages .= ' ' . implode(', ', $emails);
|
937 |
$controls->messages .= '.<br>';
|
938 |
$controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/subscribers#test" target="_blank"><strong>' .
|
emails/new.php
CHANGED
@@ -1,133 +1,112 @@
|
|
1 |
<?php
|
|
|
2 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
3 |
|
4 |
$controls = new NewsletterControls();
|
5 |
-
$module = NewsletterEmails::instance();
|
6 |
|
7 |
-
|
8 |
-
if ($controls->data['theme'] != 'rawhtml') {
|
9 |
-
$controls->merge($module->themes->get_options($controls->data['theme']));
|
10 |
-
$module->save_options($controls->data);
|
11 |
-
}
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
} else {
|
25 |
-
$theme_options = $module->get_current_theme_options();
|
26 |
-
$theme_url = $module->get_current_theme_url();
|
27 |
-
$theme_subject = '';
|
28 |
-
|
29 |
-
ob_start();
|
30 |
-
include $module->get_current_theme_file_path('theme.php');
|
31 |
-
$email['message'] = ob_get_clean();
|
32 |
-
|
33 |
-
if (!empty($theme_subject)) {
|
34 |
-
$email['subject'] = $theme_subject;
|
35 |
-
}
|
36 |
-
|
37 |
-
$file = $module->get_current_theme_file_path('theme-text.php');
|
38 |
-
if (file_exists($file)) {
|
39 |
-
ob_start();
|
40 |
-
include $module->get_current_theme_file_path('theme-text.php');
|
41 |
-
$email['message_text'] = ob_get_clean();
|
42 |
-
} else {
|
43 |
-
$email['message_text'] = 'You need a modern email client to read this email. Read it online: {email_url}.';
|
44 |
-
}
|
45 |
-
$email['editor'] = NewsletterEmails::EDITOR_TINYMCE;
|
46 |
-
}
|
47 |
-
|
48 |
-
$email['type'] = 'message';
|
49 |
-
$email['send_on'] = time();
|
50 |
-
$email = Newsletter::instance()->save_email($email);
|
51 |
-
|
52 |
-
$controls->js_redirect($module->get_editor_url($email->id, $email->editor));
|
53 |
-
return;
|
54 |
-
}
|
55 |
-
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
//$controls->messages = 'Saved.';
|
60 |
}
|
61 |
|
62 |
-
if ($controls->is_action('create')) {
|
63 |
-
$module->save_options($controls->data);
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
$email = array();
|
66 |
$email['status'] = 'new';
|
67 |
$email['subject'] = __('Here the email subject', 'newsletter');
|
68 |
$email['track'] = Newsletter::instance()->options['track'];
|
|
|
|
|
|
|
|
|
69 |
|
70 |
-
$theme_options = $
|
71 |
-
|
72 |
-
$theme_url = $module->get_current_theme_url();
|
73 |
$theme_subject = '';
|
74 |
|
75 |
ob_start();
|
76 |
-
include $
|
77 |
$email['message'] = ob_get_clean();
|
78 |
|
79 |
if (!empty($theme_subject)) {
|
80 |
$email['subject'] = $theme_subject;
|
81 |
}
|
82 |
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
|
|
89 |
$email = Newsletter::instance()->save_email($email);
|
90 |
-
|
91 |
-
|
92 |
-
location.href = "<?php echo $module->get_admin_page_url('edit'); ?>&id=<?php echo $email->id; ?>";
|
93 |
-
</script>
|
94 |
-
<div class="wrap">
|
95 |
-
<p><a href="<?php echo $module->get_admin_page_url('edit'); ?>&id=<?php echo $email->id; ?>">click here to proceed</a>.</p>
|
96 |
-
</div>
|
97 |
-
<?php
|
98 |
return;
|
99 |
}
|
100 |
|
101 |
-
if ($controls->
|
102 |
-
$
|
103 |
}
|
104 |
|
105 |
-
|
106 |
-
add_option('newsletter_emails', '', null, 'no');
|
107 |
-
update_option('newsletter_emails', $options);
|
108 |
-
}
|
109 |
|
110 |
-
|
111 |
-
$x = strrpos($theme, '/');
|
112 |
-
if ($x !== false) {
|
113 |
-
$theme = substr($theme, $x + 1);
|
114 |
-
}
|
115 |
-
add_option('newsletter_emails_' . $theme, '', null, 'no');
|
116 |
-
update_option('newsletter_emails_' . $theme, $options);
|
117 |
-
}
|
118 |
|
119 |
-
|
120 |
-
$
|
121 |
-
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
$
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
}
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
132 |
?>
|
133 |
|
@@ -149,12 +128,11 @@ function newsletter_emails_get_theme_options($theme) {
|
|
149 |
|
150 |
<form method="post" action="">
|
151 |
<?php $controls->init(); ?>
|
152 |
-
<?php $controls->hidden('
|
153 |
-
|
154 |
<table style="width: 100%; border-collapse: collapse">
|
155 |
<tr>
|
156 |
<td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
|
157 |
-
<div style="float: right; margin-left: 15px;"><?php $controls->button_primary('
|
158 |
|
159 |
</td>
|
160 |
<td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
|
@@ -165,11 +143,11 @@ function newsletter_emails_get_theme_options($theme) {
|
|
165 |
<tr>
|
166 |
<td style="width: 500px; vertical-align: top;">
|
167 |
<div class="tnp-emails-theme-options">
|
168 |
-
|
169 |
</div>
|
170 |
</td>
|
171 |
<td style="vertical-align: top; padding-top: 15px; padding-left: 15px">
|
172 |
-
<iframe src="<?php echo wp_nonce_url(home_url('/', is_ssl() ? 'https' : 'http') . '?na=emails-preview&ts=' . time(), 'view'); ?>" height="700" style="width: 100%; border: 1px solid #ccc"></iframe>
|
173 |
</td>
|
174 |
</tr>
|
175 |
</table>
|
1 |
<?php
|
2 |
+
/* @var $this NewsletterEmails */
|
3 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
4 |
|
5 |
$controls = new NewsletterControls();
|
|
|
6 |
|
7 |
+
$theme_id = $_GET['id'];
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
if ($theme_id === 'rawhtml' && check_admin_referer('newsletter-new')) {
|
10 |
+
$email = array();
|
11 |
+
$email['status'] = 'new';
|
12 |
+
$email['subject'] = __('Here the email subject', 'newsletter');
|
13 |
+
$email['track'] = Newsletter::instance()->options['track'];
|
14 |
+
$email['token'] = $this->get_token();
|
15 |
+
$email['type'] = 'message';
|
16 |
+
$email['send_on'] = time();
|
17 |
+
$email['editor'] = NewsletterEmails::EDITOR_HTML;
|
18 |
+
$email['message'] = "<!DOCTYPE html>\n<html>\n<head>\n<title>Your email title</title>\n</head>\n<body>\n</body>\n</html>";
|
19 |
+
$email = Newsletter::instance()->save_email($email);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
$controls->js_redirect($this->get_editor_url($email->id, $email->editor));
|
22 |
+
return;
|
|
|
23 |
}
|
24 |
|
|
|
|
|
25 |
|
26 |
+
$theme = $this->themes->get_theme($theme_id);
|
27 |
+
|
28 |
+
// Should never happen
|
29 |
+
if (!$theme) {
|
30 |
+
die('Invalid theme');
|
31 |
+
}
|
32 |
+
|
33 |
+
if (!file_exists($theme['dir'] . '/theme-options.php') && check_admin_referer('newsletter-new')) {
|
34 |
$email = array();
|
35 |
$email['status'] = 'new';
|
36 |
$email['subject'] = __('Here the email subject', 'newsletter');
|
37 |
$email['track'] = Newsletter::instance()->options['track'];
|
38 |
+
$email['token'] = $this->get_token();
|
39 |
+
$email['type'] = 'message';
|
40 |
+
$email['send_on'] = time();
|
41 |
+
$email['editor'] = NewsletterEmails::EDITOR_TINYMCE;
|
42 |
|
43 |
+
$theme_options = $this->themes->get_options($controls->data['theme']);
|
44 |
+
$theme_url = $theme['url'];
|
|
|
45 |
$theme_subject = '';
|
46 |
|
47 |
ob_start();
|
48 |
+
include $theme['dir'] . '/theme.php';
|
49 |
$email['message'] = ob_get_clean();
|
50 |
|
51 |
if (!empty($theme_subject)) {
|
52 |
$email['subject'] = $theme_subject;
|
53 |
}
|
54 |
|
55 |
+
if (file_exists($theme['dir'] . '/theme-text.php')) {
|
56 |
+
ob_start();
|
57 |
+
include $theme['dir'] . '/theme-text.php';
|
58 |
+
$email['message_text'] = ob_get_clean();
|
59 |
+
} else {
|
60 |
+
$email['message_text'] = 'You need a modern email client to read this email. Read it online: {email_url}.';
|
61 |
+
}
|
62 |
$email = Newsletter::instance()->save_email($email);
|
63 |
+
|
64 |
+
$controls->js_redirect($this->get_editor_url($email->id, $email->editor));
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
return;
|
66 |
}
|
67 |
|
68 |
+
if ($controls->is_action('refresh')) {
|
69 |
+
$this->themes->save_options($theme_id, $controls->data);
|
70 |
}
|
71 |
|
72 |
+
if ($controls->is_action('create')) {
|
|
|
|
|
|
|
73 |
|
74 |
+
$this->themes->save_options($theme_id, $controls->data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
$email = array();
|
77 |
+
$email['status'] = 'new';
|
78 |
+
$email['subject'] = __('Here the email subject', 'newsletter');
|
79 |
+
$email['track'] = Newsletter::instance()->options['track'];
|
80 |
+
$email['message_text'] = '';
|
81 |
+
$email['type'] = 'message';
|
82 |
+
$email['send_on'] = time();
|
83 |
+
$email['editor'] = NewsletterEmails::EDITOR_TINYMCE;
|
84 |
+
|
85 |
+
$theme_options = $this->themes->get_options($theme_id);
|
86 |
|
87 |
+
$theme_url = $theme['url'];
|
88 |
+
$theme_subject = '';
|
89 |
+
|
90 |
+
ob_start();
|
91 |
+
include $theme['dir'] . '/theme.php';
|
92 |
+
$email['message'] = ob_get_clean();
|
93 |
+
|
94 |
+
if (!empty($theme_subject)) {
|
95 |
+
$email['subject'] = $theme_subject;
|
96 |
+
}
|
97 |
+
|
98 |
+
if (is_file($theme['dir'] . '/theme-text.php')) {
|
99 |
+
ob_start();
|
100 |
+
include $theme['dir'] . '/theme-text.php';
|
101 |
+
$email['message_text'] = ob_get_clean();
|
102 |
}
|
103 |
+
|
104 |
+
$email = $this->save_email($email);
|
105 |
+
$controls->js_redirect($this->get_editor_url($email->id, $email->editor));
|
106 |
+
return;
|
107 |
+
} else {
|
108 |
+
$controls->data = $this->themes->get_options($theme_id);
|
109 |
+
$controls->data['id'] = $theme_id;
|
110 |
}
|
111 |
?>
|
112 |
|
128 |
|
129 |
<form method="post" action="">
|
130 |
<?php $controls->init(); ?>
|
131 |
+
<?php $controls->hidden('id'); ?>
|
|
|
132 |
<table style="width: 100%; border-collapse: collapse">
|
133 |
<tr>
|
134 |
<td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
|
135 |
+
<div style="float: right; margin-left: 15px;"><?php $controls->button_primary('refresh', __('Refresh the preview', 'newsletter')); ?></div>
|
136 |
|
137 |
</td>
|
138 |
<td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
|
143 |
<tr>
|
144 |
<td style="width: 500px; vertical-align: top;">
|
145 |
<div class="tnp-emails-theme-options">
|
146 |
+
<?php @include $theme['dir'] . '/theme-options.php'; ?>
|
147 |
</div>
|
148 |
</td>
|
149 |
<td style="vertical-align: top; padding-top: 15px; padding-left: 15px">
|
150 |
+
<iframe src="<?php echo wp_nonce_url(home_url('/', is_ssl() ? 'https' : 'http') . '?na=emails-preview&id=' . urlencode($theme_id) . '&ts=' . time(), 'view'); ?>" height="700" style="width: 100%; border: 1px solid #ccc"></iframe>
|
151 |
</td>
|
152 |
</tr>
|
153 |
</table>
|
emails/theme.php
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
<?php
|
2 |
-
|
3 |
-
exit;
|
4 |
|
5 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
6 |
$controls = new NewsletterControls();
|
@@ -47,7 +46,14 @@ function newsletter_emails_get_theme_options($theme) {
|
|
47 |
|
48 |
$themes = $module->themes->get_all_with_data();
|
49 |
?>
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
<div class="wrap tnp-emails tnp-emails-theme" id="tnp-wrap">
|
52 |
|
53 |
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
|
@@ -76,26 +82,18 @@ $themes = $module->themes->get_all_with_data();
|
|
76 |
|
77 |
<div class="tnp-theme-preview">
|
78 |
<p><> Raw HTML</p>
|
79 |
-
|
80 |
-
f.act.value = 'theme';
|
81 |
-
f.elements['options[theme]'].value = 'rawhtml';
|
82 |
-
f.submit();
|
83 |
-
return false;" style="margin-right: 20px; margin-bottom: 20px">
|
84 |
<img src="<?php echo plugins_url('newsletter') . '/emails/images/html.png' ?>" width="200" height="200">
|
85 |
</a>
|
86 |
</div>
|
87 |
|
88 |
</div>
|
89 |
|
90 |
-
<?php foreach ($themes as $
|
91 |
<div class="tnp-theme-preview">
|
92 |
<p><?php echo esc_html($data['name']) ?></p>
|
93 |
-
<a href="
|
94 |
-
|
95 |
-
f.elements['options[theme]'].value = '<?php echo esc_js($data['id']) ?>';
|
96 |
-
f.submit();
|
97 |
-
return false;" style="margin-right: 20px; margin-bottom: 20px">
|
98 |
-
<img src="<?php echo esc_attr($data['screenshot']) ?>" width="200" height="200">
|
99 |
</a>
|
100 |
</div>
|
101 |
<?php } ?>
|
1 |
<?php
|
2 |
+
defined('ABSPATH') || exit;
|
|
|
3 |
|
4 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
5 |
$controls = new NewsletterControls();
|
46 |
|
47 |
$themes = $module->themes->get_all_with_data();
|
48 |
?>
|
49 |
+
<script>
|
50 |
+
function tnp_select_theme(id) {
|
51 |
+
var f = document.getElementById('newsletter-form');
|
52 |
+
f.act.value = 'theme';
|
53 |
+
f.elements['options[theme]'].value = id;
|
54 |
+
f.submit();
|
55 |
+
}
|
56 |
+
</script>
|
57 |
<div class="wrap tnp-emails tnp-emails-theme" id="tnp-wrap">
|
58 |
|
59 |
<?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
|
82 |
|
83 |
<div class="tnp-theme-preview">
|
84 |
<p><> Raw HTML</p>
|
85 |
+
<a href="<?php echo wp_nonce_url('admin.php?page=newsletter_emails_new&id=rawhtml', 'newsletter-new') ?>" style="margin-right: 20px; margin-bottom: 20px">
|
|
|
|
|
|
|
|
|
86 |
<img src="<?php echo plugins_url('newsletter') . '/emails/images/html.png' ?>" width="200" height="200">
|
87 |
</a>
|
88 |
</div>
|
89 |
|
90 |
</div>
|
91 |
|
92 |
+
<?php foreach ($themes as $id => $data) { ?>
|
93 |
<div class="tnp-theme-preview">
|
94 |
<p><?php echo esc_html($data['name']) ?></p>
|
95 |
+
<a href="<?php echo wp_nonce_url('admin.php?page=newsletter_emails_new&id=' . urlencode($id), 'newsletter-new') ?>" style="margin-right: 20px; margin-bottom: 20px">
|
96 |
+
<img src="<?php echo esc_attr($data['screenshot']) ?>" width="300" height="450">
|
|
|
|
|
|
|
|
|
97 |
</a>
|
98 |
</div>
|
99 |
<?php } ?>
|
emails/themes/blank/screenshot.png
CHANGED
Binary file
|
emails/themes/blank/theme.php
CHANGED
@@ -1,5 +1,12 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
?><html>
|
4 |
<head>
|
5 |
<style>
|
@@ -41,5 +48,6 @@ if (!defined('ABSPATH')) exit;
|
|
41 |
<p>
|
42 |
<?php echo $theme_options['main_footer_legal'] ?>
|
43 |
</p>
|
|
|
44 |
</body>
|
45 |
</html>
|
1 |
<?php
|
2 |
+
/*
|
3 |
+
* Name: Really minimal
|
4 |
+
* Type: standard
|
5 |
+
* Description: -
|
6 |
+
*/
|
7 |
+
|
8 |
+
defined('ABSPATH') || exit;
|
9 |
+
|
10 |
?><html>
|
11 |
<head>
|
12 |
<style>
|
48 |
<p>
|
49 |
<?php echo $theme_options['main_footer_legal'] ?>
|
50 |
</p>
|
51 |
+
|
52 |
</body>
|
53 |
</html>
|
emails/themes/cta-2015/screenshot.png
CHANGED
Binary file
|
emails/themes/default/screenshot.png
CHANGED
Binary file
|
emails/themes/default/theme-defaults.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$theme_defaults = array(
|
4 |
+
'theme_background' => '#f4f4f4',
|
5 |
+
'theme_color' => '#555555',
|
6 |
+
'theme_max_posts' => 10,
|
7 |
+
'theme_image_size' => 'thumbnail'
|
8 |
+
);
|
9 |
+
|
emails/themes/default/theme-options.php
CHANGED
@@ -11,6 +11,13 @@ defined('ABSPATH') || exit;
|
|
11 |
<p class="description" style="display: inline">Hex values, e.g. #FF0000</p>
|
12 |
</td>
|
13 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
<tr>
|
15 |
<th><?php _e('Disable social links', 'newsletter') ?></th>
|
16 |
<td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
|
@@ -23,7 +30,7 @@ defined('ABSPATH') || exit;
|
|
23 |
<tr>
|
24 |
<th>Language</th>
|
25 |
<td>
|
26 |
-
<?php $controls->language(); ?>
|
27 |
</td>
|
28 |
</tr>
|
29 |
<tr>
|
@@ -31,9 +38,12 @@ defined('ABSPATH') || exit;
|
|
31 |
<td>
|
32 |
<?php $controls->checkbox('theme_posts', 'Add latest posts'); ?>
|
33 |
<br>
|
34 |
-
<?php $controls->checkbox('theme_thumbnails', 'Add post thumbnails'); ?>
|
35 |
-
<br>
|
36 |
<?php $controls->checkbox('theme_excerpts', 'Add post excerpts'); ?>
|
|
|
|
|
|
|
|
|
|
|
37 |
</td>
|
38 |
</tr>
|
39 |
<tr>
|
11 |
<p class="description" style="display: inline">Hex values, e.g. #FF0000</p>
|
12 |
</td>
|
13 |
</tr>
|
14 |
+
<tr>
|
15 |
+
<th><?php _e('External background color', 'newsletter') ?></th>
|
16 |
+
<td>
|
17 |
+
<?php $controls->color('theme_background'); ?>
|
18 |
+
<p class="description" style="display: inline">Hex values, e.g. #FF0000</p>
|
19 |
+
</td>
|
20 |
+
</tr>
|
21 |
<tr>
|
22 |
<th><?php _e('Disable social links', 'newsletter') ?></th>
|
23 |
<td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
|
30 |
<tr>
|
31 |
<th>Language</th>
|
32 |
<td>
|
33 |
+
<?php $controls->language('theme_language'); ?>
|
34 |
</td>
|
35 |
</tr>
|
36 |
<tr>
|
38 |
<td>
|
39 |
<?php $controls->checkbox('theme_posts', 'Add latest posts'); ?>
|
40 |
<br>
|
|
|
|
|
41 |
<?php $controls->checkbox('theme_excerpts', 'Add post excerpts'); ?>
|
42 |
+
<br>
|
43 |
+
<?php $controls->checkbox('theme_thumbnails', 'Add post thumbnails'); ?>
|
44 |
+
<?php $controls->select('theme_image_size', array('thumbnail'=>'Thumbnail', 'medium'=>'Medium')); ?>
|
45 |
+
<br>
|
46 |
+
|
47 |
</td>
|
48 |
</tr>
|
49 |
<tr>
|
emails/themes/default/theme.php
CHANGED
@@ -14,18 +14,23 @@ global $newsletter, $post;
|
|
14 |
|
15 |
defined('ABSPATH') || exit;
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
if (isset($theme_options['theme_posts'])) {
|
23 |
$filters = array();
|
24 |
|
25 |
-
|
26 |
-
$filters['posts_per_page'] = 10;
|
27 |
-
else
|
28 |
-
$filters['posts_per_page'] = (int) $theme_options['theme_max_posts'];
|
29 |
|
30 |
if (!empty($theme_options['theme_categories'])) {
|
31 |
$filters['category__in'] = $theme_options['theme_categories'];
|
@@ -39,95 +44,173 @@ if (isset($theme_options['theme_posts'])) {
|
|
39 |
$filters['post_type'] = $theme_options['theme_post_types'];
|
40 |
}
|
41 |
|
42 |
-
|
43 |
-
$filters['suppress_filters'] = false;
|
44 |
-
do_action('wpml_switch_language', $theme_options['language']);
|
45 |
-
}
|
46 |
-
|
47 |
-
$posts = get_posts($filters);
|
48 |
}
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
-
|
59 |
-
</
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
<?php
|
|
|
|
|
|
|
|
|
97 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
|
|
99 |
|
100 |
-
|
101 |
|
102 |
-
|
|
|
|
|
103 |
|
104 |
-
|
105 |
-
<?php if (!empty($posts)) { ?>
|
106 |
-
<table cellpadding="5">
|
107 |
-
<?php foreach ($posts as $post) {
|
108 |
-
setup_postdata($post); ?>
|
109 |
-
<tr>
|
110 |
-
<?php if (isset($theme_options['theme_thumbnails'])) { ?>
|
111 |
-
<td valign="top"><a target="_blank" href="<?php echo get_permalink($post); ?>"><img width="75" style="width: 75px; min-width: 75px" src="<?php echo newsletter_get_post_image($post->ID); ?>" alt="image"></a></td>
|
112 |
-
<?php } ?>
|
113 |
-
<td valign="top">
|
114 |
-
<a target="_blank" href="<?php echo get_permalink(); ?>" style="font-size: 20px; line-height: 26px"><?php the_title(); ?></a>
|
115 |
-
<?php if (isset($theme_options['theme_excerpts'])) newsletter_the_excerpt($post); ?>
|
116 |
-
</td>
|
117 |
-
</tr>
|
118 |
-
<?php } ?>
|
119 |
-
</table>
|
120 |
-
<?php } ?>
|
121 |
|
122 |
-
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
</td>
|
128 |
-
</tr>
|
129 |
-
</table>
|
130 |
-
<br><br>
|
131 |
-
</div>
|
132 |
-
</body>
|
133 |
</html>
|
14 |
|
15 |
defined('ABSPATH') || exit;
|
16 |
|
17 |
+
include NEWSLETTER_INCLUDES_DIR . '/helper.php';
|
18 |
+
|
19 |
+
$color = $theme_options['theme_color'];
|
20 |
+
$background = $theme_options['theme_background'];
|
21 |
+
$logo = false;
|
22 |
+
|
23 |
+
if ($theme_options['main_header_logo']['id']) {
|
24 |
+
$logo = tnp_media_resize($theme_options['main_header_logo']['id'], array(600, 200));
|
25 |
+
}
|
26 |
+
|
27 |
+
$title = $theme_options['main_header_title'];
|
28 |
+
if (empty($title)) $title = get_option('blogname');
|
29 |
|
30 |
if (isset($theme_options['theme_posts'])) {
|
31 |
$filters = array();
|
32 |
|
33 |
+
$filters['posts_per_page'] = (int) $theme_options['theme_max_posts'];
|
|
|
|
|
|
|
34 |
|
35 |
if (!empty($theme_options['theme_categories'])) {
|
36 |
$filters['category__in'] = $theme_options['theme_categories'];
|
44 |
$filters['post_type'] = $theme_options['theme_post_types'];
|
45 |
}
|
46 |
|
47 |
+
$posts = Newsletter::instance()->get_posts($filters, $theme_options['theme_language']);
|
|
|
|
|
|
|
|
|
|
|
48 |
}
|
49 |
+
|
50 |
+
?><!doctype html>
|
51 |
+
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
|
52 |
+
<head>
|
53 |
+
<title>{email_subject}</title>
|
54 |
+
<!--[if !mso]><!-- -->
|
55 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
56 |
+
<!--<![endif]-->
|
57 |
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
58 |
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
59 |
+
<style type="text/css">
|
60 |
+
a {
|
61 |
+
text-decoration: none;
|
62 |
+
color: <?php echo $color; ?>;
|
63 |
+
}
|
64 |
+
#outlook a {
|
65 |
+
padding: 0;
|
66 |
+
}
|
67 |
+
|
68 |
+
body {
|
69 |
+
margin: 0;
|
70 |
+
padding: 0;
|
71 |
+
-webkit-text-size-adjust: 100%;
|
72 |
+
-ms-text-size-adjust: 100%;
|
73 |
+
}
|
74 |
+
|
75 |
+
table,
|
76 |
+
td {
|
77 |
+
border-collapse: collapse;
|
78 |
+
mso-table-lspace: 0pt;
|
79 |
+
mso-table-rspace: 0pt;
|
80 |
+
}
|
81 |
+
|
82 |
+
img {
|
83 |
+
border: 0;
|
84 |
+
height: auto;
|
85 |
+
line-height: 100%;
|
86 |
+
outline: none;
|
87 |
+
text-decoration: none;
|
88 |
+
-ms-interpolation-mode: bicubic;
|
89 |
+
max-width: 100%;
|
90 |
+
}
|
91 |
+
|
92 |
+
p {
|
93 |
+
display: block;
|
94 |
+
margin: 13px 0;
|
95 |
+
}
|
96 |
+
@media all and (max-width: 525px) {
|
97 |
+
td {
|
98 |
+
float: left;
|
99 |
+
display: block;
|
100 |
}
|
101 |
+
}
|
102 |
+
</style>
|
103 |
+
<!--[if mso]>
|
104 |
+
<xml>
|
105 |
+
<o:OfficeDocumentSettings>
|
106 |
+
<o:AllowPNG/>
|
107 |
+
<o:PixelsPerInch>96</o:PixelsPerInch>
|
108 |
+
</o:OfficeDocumentSettings>
|
109 |
+
</xml>
|
110 |
+
<![endif]-->
|
111 |
+
|
112 |
+
<!--[if lte mso 11]>
|
113 |
+
<style type="text/css">
|
114 |
+
.mj-outlook-group-fix { width:100% !important; }
|
115 |
+
</style>
|
116 |
+
<![endif]-->
|
117 |
+
</head>
|
118 |
+
|
119 |
+
<body style="margin: 0!important; padding: 0!important; background-color: <?php echo $background ?>;">
|
120 |
+
|
121 |
+
<div style="background-color: <?php echo $background ?>;">
|
122 |
+
|
123 |
+
<br>
|
124 |
+
|
125 |
+
<div style="background-color: #ffffff; margin:0px auto;max-width:600px;font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666; padding: 0; border: 0">
|
126 |
+
|
127 |
+
<?php echo tnp_outlook_wrapper_open() ?>
|
128 |
+
|
129 |
+
<table align="center" bgcolor="#ffffff" width="100%" style="max-width: 600px; width: 100%; border-collapse: collapse;" cellpadding="0" cellspacing="0" border="0">
|
130 |
+
<tr>
|
131 |
+
<td valign="top" bgcolor="#ffffff" width="100%" align="left" style="text-align: left; font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666;">
|
132 |
+
|
133 |
+
<div style="text-align: center">
|
134 |
+
|
135 |
+
<?php if ($logo) { ?>
|
136 |
+
<img style="max-width: 500px" alt="<?php echo esc_attr($title) ?>" src="<?php echo esc_attr($logo) ?>">
|
137 |
+
<?php } else { ?>
|
138 |
+
<div style="padding: 30px 0; color: #000; font-size: 28px; border-bottom: 1px solid #ddd; text-align: center;">
|
139 |
+
<?php echo $title ?>
|
140 |
+
</div>
|
141 |
+
<?php if (!empty($theme_options['main_header_sub'])) { ?>
|
142 |
+
<div style="padding: 10px 0; color: #000; font-size: 16px; text-align: center;">
|
143 |
+
<?php echo $theme_options['main_header_sub'] ?>
|
144 |
</div>
|
145 |
+
<?php } ?>
|
146 |
+
<?php } ?>
|
147 |
+
|
148 |
+
</div>
|
149 |
+
|
150 |
+
|
151 |
+
<div style="padding: 10px 20px 20px 20px; background-color: #fff; line-height: 18px">
|
152 |
+
|
153 |
+
<p style="text-align: center; font-size: small;"><a target="_blank" href="{email_url}">View this email online</a></p>
|
154 |
+
|
155 |
+
<p>Here you can start to write your message. Be polite with your readers! Don't forget the subject of this message.</p>
|
156 |
+
|
157 |
+
<?php if (!empty($posts)) { ?>
|
158 |
+
|
159 |
+
<table cellpadding="5">
|
160 |
+
<?php foreach ($posts as $post) { ?>
|
161 |
+
<?php
|
162 |
+
setup_postdata($post);
|
163 |
+
$image = false;
|
164 |
+
|
165 |
+
if (isset($theme_options['theme_thumbnails'])) {
|
166 |
+
// Will be replaces with the new media resizer
|
167 |
+
$image = tnp_post_thumbnail_src($post, $theme_options['theme_image_size']);
|
168 |
+
}
|
169 |
+
|
170 |
+
if ($theme_options['theme_image_size'] == 'thumbnail') {
|
171 |
+
$image_width = 150;
|
172 |
+
} else {
|
173 |
+
$image_width = 300;
|
174 |
+
}
|
175 |
+
|
176 |
+
$url = get_permalink($post);
|
177 |
+
$excerpt = '';
|
178 |
+
if (isset($theme_options['theme_excerpts'])) {
|
179 |
+
$excerpt = '<p>' . tnp_post_excerpt($post) . '</p>';
|
180 |
+
}
|
181 |
+
?>
|
182 |
+
<tr>
|
183 |
+
<!-- Image column -->
|
184 |
+
<?php if (isset($theme_options['theme_thumbnails'])) { ?>
|
185 |
+
<td valign="top" width="<?php echo $image_width?>">
|
186 |
+
<?php if ($image) { ?>
|
187 |
+
<a target="_blank" href="<?php echo $url ?>"><img width="<?php echo $image_width?>" style="width: <?php echo $image_width?>px; min-width: <?php echo $image_width?>px;" src="<?php echo $image ?>" alt="image"></a>
|
188 |
+
<?php } ?>
|
189 |
+
</td>
|
190 |
+
<?php } ?>
|
191 |
+
|
192 |
+
<td valign="top">
|
193 |
+
<a target="_blank" href="<?php echo $url ?>" style="font-size: 20px; line-height: 26px"><?php the_title(); ?></a>
|
194 |
+
<?php echo $excerpt ?>
|
195 |
+
</td>
|
196 |
+
</tr>
|
197 |
+
<?php } ?>
|
198 |
+
</table>
|
199 |
+
<?php } ?>
|
200 |
|
201 |
+
<?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/footer.php'; ?>
|
202 |
|
203 |
+
</div>
|
204 |
|
205 |
+
</td>
|
206 |
+
</tr>
|
207 |
+
</table>
|
208 |
|
209 |
+
<?php echo tnp_outlook_wrapper_close() ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
+
</div>
|
212 |
|
213 |
+
</div>
|
214 |
+
|
215 |
+
</body>
|
|
|
|
|
|
|
|
|
|
|
|
|
216 |
</html>
|
emails/tnp-composer/index.php
CHANGED
@@ -5,8 +5,9 @@ $list = NewsletterEmails::instance()->get_blocks();
|
|
5 |
|
6 |
$blocks = array();
|
7 |
foreach ($list as $key => $data) {
|
8 |
-
if (!isset($blocks[$data['section']]))
|
9 |
$blocks[$data['section']] = array();
|
|
|
10 |
$blocks[$data['section']][$key]['name'] = $data['name'];
|
11 |
$blocks[$data['section']][$key]['filename'] = $key;
|
12 |
$blocks[$data['section']][$key]['icon'] = $data['icon'];
|
@@ -18,8 +19,6 @@ $blocks = array_merge(array_flip(array('header', 'content', 'footer')), $blocks)
|
|
18 |
// prepare the options for the default blocks
|
19 |
$block_options = get_option('newsletter_main');
|
20 |
|
21 |
-
/* @var $this NewsletterControls */
|
22 |
-
|
23 |
?>
|
24 |
<style>
|
25 |
.placeholder {
|
@@ -36,7 +35,7 @@ $block_options = get_option('newsletter_main');
|
|
36 |
</style>
|
37 |
|
38 |
<style>
|
39 |
-
|
40 |
</style>
|
41 |
|
42 |
<div id="newsletter-builder">
|
@@ -44,10 +43,10 @@ $block_options = get_option('newsletter_main');
|
|
44 |
<div id="newsletter-builder-area" class="tnp-builder-column">
|
45 |
|
46 |
<?php if ($tnpc_show_subject) { ?>
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
<?php } ?>
|
52 |
|
53 |
<div id="newsletter-builder-area-center-frame-content">
|
@@ -60,38 +59,28 @@ $block_options = get_option('newsletter_main');
|
|
60 |
<div id="newsletter-builder-sidebar" class="tnp-builder-column">
|
61 |
|
62 |
<div class="tnpc-tabs">
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
</div>
|
71 |
|
72 |
<div id="tnpc-blocks" class="tabcontent">
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
</div>
|
84 |
|
85 |
-
<?php /* <div id="tnpc-general-options" class="tabcontent">
|
86 |
-
|
87 |
-
<h4 class="tnpc-general-options-title"><?php _e('Background color', 'newsletter') ?></h4><?php $this->color('general-bgcolor') ?>
|
88 |
-
<h4 class="tnpc-general-options-title"><?php _e('Title font', 'newsletter') ?></h4><?php $this->css_font('general-text-font') ?>
|
89 |
-
<h4 class="tnpc-general-options-title"><?php _e('Text font', 'newsletter') ?></h4><?php $this->css_font('general-title-font') ?>
|
90 |
-
<!-- Width? -->
|
91 |
-
|
92 |
-
</div>*/ ?>
|
93 |
-
|
94 |
-
|
95 |
<div id="tnpc-mobile-tab" class="tabcontent">
|
96 |
|
97 |
<iframe id="tnpc-mobile-preview"></iframe>
|
@@ -113,14 +102,14 @@ $block_options = get_option('newsletter_main');
|
|
113 |
</p>
|
114 |
</div>
|
115 |
|
116 |
-
|
117 |
<div id="tnpc-block-options">
|
118 |
<div id="tnpc-block-options-buttons">
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
</div>
|
125 |
|
126 |
</div>
|
@@ -138,12 +127,10 @@ $block_options = get_option('newsletter_main');
|
|
138 |
<script type="text/javascript">
|
139 |
TNP_PLUGIN_URL = "<?php echo NEWSLETTER_URL ?>";
|
140 |
TNP_HOME_URL = "<?php echo home_url('/', is_ssl() ? 'https' : 'http') ?>";
|
141 |
-
tnp_context_type = "<?php echo $context_type?>";
|
142 |
</script>
|
143 |
<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder.js?ver=<?php echo time() ?>"></script>
|
144 |
|
145 |
<?php include NEWSLETTER_DIR . '/emails/subjects.php'; ?>
|
146 |
|
147 |
-
<!--<script src="<?php echo plugins_url('newsletter') ?>/vendor/tinymce/tinymce.min.js"></script>-->
|
148 |
-
|
149 |
<?php if (function_exists('wp_enqueue_editor')) wp_enqueue_editor(); ?>
|
5 |
|
6 |
$blocks = array();
|
7 |
foreach ($list as $key => $data) {
|
8 |
+
if (!isset($blocks[$data['section']])) {
|
9 |
$blocks[$data['section']] = array();
|
10 |
+
}
|
11 |
$blocks[$data['section']][$key]['name'] = $data['name'];
|
12 |
$blocks[$data['section']][$key]['filename'] = $key;
|
13 |
$blocks[$data['section']][$key]['icon'] = $data['icon'];
|
19 |
// prepare the options for the default blocks
|
20 |
$block_options = get_option('newsletter_main');
|
21 |
|
|
|
|
|
22 |
?>
|
23 |
<style>
|
24 |
.placeholder {
|
35 |
</style>
|
36 |
|
37 |
<style>
|
38 |
+
<?php echo NewsletterEmails::instance()->get_composer_css(); ?>
|
39 |
</style>
|
40 |
|
41 |
<div id="newsletter-builder">
|
43 |
<div id="newsletter-builder-area" class="tnp-builder-column">
|
44 |
|
45 |
<?php if ($tnpc_show_subject) { ?>
|
46 |
+
<p>
|
47 |
+
<?php $this->text('title', 60, 'Newsletter subject'); ?>
|
48 |
+
<a href="#" class="tnp-suggest-button" onclick="tnp_suggest_subject(); return false;"><?php _e('Get ideas', 'newsletter') ?></a>
|
49 |
+
</p>
|
50 |
<?php } ?>
|
51 |
|
52 |
<div id="newsletter-builder-area-center-frame-content">
|
59 |
<div id="newsletter-builder-sidebar" class="tnp-builder-column">
|
60 |
|
61 |
<div class="tnpc-tabs">
|
62 |
+
<button class="tablinks" onclick="openTab(event, 'tnpc-blocks')" id="defaultOpen"><?php _e('Blocks', 'newsletter') ?></button>
|
63 |
+
<?php /* <button class="tablinks" onclick="openTab(event, 'tnpc-general-options')"><?php _e('General Options', 'newsletter') ?></button> */ ?>
|
64 |
+
<button class="tablinks" onclick="openTab(event, 'tnpc-mobile-tab')"><i class="fa fa-mobile"></i> <?php _e('Mobile Preview', 'newsletter') ?></button>
|
65 |
+
<?php if ($show_test) { ?>
|
66 |
+
<button class="tablinks" onclick="openTab(event, 'tnpc-test-tab')"><i class="fa fa-paper-plane"></i> <?php _e('Test', 'newsletter') ?></button>
|
67 |
+
<?php } ?>
|
68 |
+
|
69 |
</div>
|
70 |
|
71 |
<div id="tnpc-blocks" class="tabcontent">
|
72 |
+
<?php foreach ($blocks as $k => $section) { ?>
|
73 |
+
<div class="newsletter-sidebar-add-buttons" id="sidebar-add-<?php echo $k ?>">
|
74 |
+
<h4><span><?php echo ucfirst($k) ?></span></h4>
|
75 |
+
<?php foreach ($section AS $key => $block) { ?>
|
76 |
+
<div class="newsletter-sidebar-buttons-content-tab" data-id="<?php echo $key ?>" data-name="<?php echo esc_attr($block['name']) ?>">
|
77 |
+
<img src="<?php echo $block['icon'] ?>" title="<?php echo esc_attr($block['name']) ?>">
|
78 |
+
</div>
|
79 |
+
<?php } ?>
|
80 |
+
</div>
|
81 |
+
<?php } ?>
|
82 |
</div>
|
83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
<div id="tnpc-mobile-tab" class="tabcontent">
|
85 |
|
86 |
<iframe id="tnpc-mobile-preview"></iframe>
|
102 |
</p>
|
103 |
</div>
|
104 |
|
105 |
+
<!-- Block options container (dynamically loaded -->
|
106 |
<div id="tnpc-block-options">
|
107 |
<div id="tnpc-block-options-buttons">
|
108 |
+
<span id="tnpc-block-options-cancel" class="button-secondary"><?php _e("Cancel", "newsletter") ?></span>
|
109 |
+
<span id="tnpc-block-options-save" class="button-primary"><?php _e("Apply", "newsletter") ?></span>
|
110 |
+
</div>
|
111 |
+
<form id="tnpc-block-options-form" onsubmit="return false;"></form>
|
112 |
+
|
113 |
</div>
|
114 |
|
115 |
</div>
|
127 |
<script type="text/javascript">
|
128 |
TNP_PLUGIN_URL = "<?php echo NEWSLETTER_URL ?>";
|
129 |
TNP_HOME_URL = "<?php echo home_url('/', is_ssl() ? 'https' : 'http') ?>";
|
130 |
+
tnp_context_type = "<?php echo $context_type ?>";
|
131 |
</script>
|
132 |
<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder.js?ver=<?php echo time() ?>"></script>
|
133 |
|
134 |
<?php include NEWSLETTER_DIR . '/emails/subjects.php'; ?>
|
135 |
|
|
|
|
|
136 |
<?php if (function_exists('wp_enqueue_editor')) wp_enqueue_editor(); ?>
|
images/theme-screenshot.png
CHANGED
Binary file
|
includes/controls.php
CHANGED
@@ -1416,16 +1416,23 @@ class NewsletterControls {
|
|
1416 |
function css_font_family($name = 'font_family') {
|
1417 |
$value = $this->get_value($name);
|
1418 |
|
1419 |
-
$fonts = array('Helvetica, Arial, sans-serif',
|
1420 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1421 |
|
1422 |
echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
|
1423 |
-
foreach ($fonts as $font) {
|
1424 |
echo '<option value="', esc_attr($font), '"';
|
1425 |
if ($value == $font) {
|
1426 |
echo ' selected';
|
1427 |
}
|
1428 |
-
echo '>', esc_html($
|
1429 |
}
|
1430 |
echo '</select>';
|
1431 |
}
|
1416 |
function css_font_family($name = 'font_family') {
|
1417 |
$value = $this->get_value($name);
|
1418 |
|
1419 |
+
$fonts = array('Helvetica, Arial, sans-serif'=>'Helvetica, Arial',
|
1420 |
+
'Arial Black, Gadget, sans-serif'=>'Arial Black, Gadget',
|
1421 |
+
'Garamond, serif'=>'Garamond',
|
1422 |
+
'Courier, monospace'=>'Courier',
|
1423 |
+
'Comic Sans MS, cursive'=>'Comic Sans MS',
|
1424 |
+
'Impact, Charcoal, sans-serif'=>'Impact, Charcoal',
|
1425 |
+
'Tahoma, Geneva, sans-serif'=>'Tahoma, Geneva',
|
1426 |
+
'Times New Roman, Times, serif'=>'Times New Roman, Times',
|
1427 |
+
'Verdana, Geneva, sans-serif'=>'Verdana, Geneva');
|
1428 |
|
1429 |
echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
|
1430 |
+
foreach ($fonts as $font=>$label) {
|
1431 |
echo '<option value="', esc_attr($font), '"';
|
1432 |
if ($value == $font) {
|
1433 |
echo ' selected';
|
1434 |
}
|
1435 |
+
echo '>', esc_html($label), '</option>';
|
1436 |
}
|
1437 |
echo '</select>';
|
1438 |
}
|
includes/fields.php
CHANGED
@@ -19,6 +19,7 @@ class NewsletterFields {
|
|
19 |
}
|
20 |
|
21 |
public function _label($text, $for = '') {
|
|
|
22 |
echo '<label class="tnp-label">', $text, '</label>';
|
23 |
}
|
24 |
|
@@ -190,16 +191,22 @@ class NewsletterFields {
|
|
190 |
$this->_open('tnp-cta');
|
191 |
$this->_label($label);
|
192 |
$value = $this->controls->get_value($name . '_label');
|
|
|
|
|
193 |
echo '<input id="', $this->_id($name), '" placeholder="', esc_attr($attrs['placeholder']), '" name="options[' . $name . '_label]" type="text"';
|
194 |
-
echo ' style="width:
|
195 |
echo ' value="', esc_attr($value), '">';
|
|
|
196 |
|
197 |
if ($attrs['url']) {
|
|
|
198 |
$value = $this->controls->get_value($name . '_url');
|
199 |
echo '<input id="', $this->_id($name . '_url'), '" placeholder="', esc_attr($attrs['url_placeholder']), '" name="options[' . $name . '_url]" type="url"';
|
200 |
-
echo ' style="width:
|
201 |
echo ' value="', esc_attr($value), '">';
|
|
|
202 |
}
|
|
|
203 |
$this->controls->css_font($name . '_font', array('weight' => false));
|
204 |
$this->controls->color($name . '_background');
|
205 |
$this->_close();
|
19 |
}
|
20 |
|
21 |
public function _label($text, $for = '') {
|
22 |
+
if (empty($text)) return;
|
23 |
echo '<label class="tnp-label">', $text, '</label>';
|
24 |
}
|
25 |
|
191 |
$this->_open('tnp-cta');
|
192 |
$this->_label($label);
|
193 |
$value = $this->controls->get_value($name . '_label');
|
194 |
+
echo '<div class="tnp-field-row">';
|
195 |
+
echo '<div class="tnp-field-col-2">';
|
196 |
echo '<input id="', $this->_id($name), '" placeholder="', esc_attr($attrs['placeholder']), '" name="options[' . $name . '_label]" type="text"';
|
197 |
+
echo ' style="width: 100%"';
|
198 |
echo ' value="', esc_attr($value), '">';
|
199 |
+
echo '</div>';
|
200 |
|
201 |
if ($attrs['url']) {
|
202 |
+
echo '<div class="tnp-field-col-2">';
|
203 |
$value = $this->controls->get_value($name . '_url');
|
204 |
echo '<input id="', $this->_id($name . '_url'), '" placeholder="', esc_attr($attrs['url_placeholder']), '" name="options[' . $name . '_url]" type="url"';
|
205 |
+
echo ' style="width: 100%"';
|
206 |
echo ' value="', esc_attr($value), '">';
|
207 |
+
echo '</div>';
|
208 |
}
|
209 |
+
echo '</div>';
|
210 |
$this->controls->css_font($name . '_font', array('weight' => false));
|
211 |
$this->controls->color($name . '_background');
|
212 |
$this->_close();
|
includes/helper.php
CHANGED
@@ -148,3 +148,11 @@ function tnp_media_resize($media_id, $size) {
|
|
148 |
|
149 |
return $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
150 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
|
149 |
return $uploads['baseurl'] . '/newsletter/thumbnails/' . $relative_thumb;
|
150 |
}
|
151 |
+
|
152 |
+
function tnp_outlook_wrapper_open($width = 600) {
|
153 |
+
return NewsletterEmails::get_outlook_wrapper_open($width);
|
154 |
+
}
|
155 |
+
|
156 |
+
function tnp_outlook_wrapper_close() {
|
157 |
+
return NewsletterEmails::get_outlook_wrapper_close();
|
158 |
+
}
|
includes/module.php
CHANGED
@@ -2,6 +2,20 @@
|
|
2 |
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
class TNP_Composer {
|
6 |
|
7 |
static $block_dirs = array();
|
@@ -17,6 +31,19 @@ class TNP_Composer {
|
|
17 |
self::$block_dirs[] = $dir;
|
18 |
return true;
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
}
|
22 |
|
@@ -808,8 +835,10 @@ class NewsletterModule {
|
|
808 |
}
|
809 |
|
810 |
static function normalize_name($name) {
|
|
|
811 |
$name = str_replace(';', ' ', $name);
|
812 |
$name = strip_tags($name);
|
|
|
813 |
return $name;
|
814 |
}
|
815 |
|
@@ -1127,7 +1156,7 @@ class NewsletterModule {
|
|
1127 |
}
|
1128 |
|
1129 |
$email = $this->get_email($id);
|
1130 |
-
|
1131 |
// TODO: Check the token? It's really useful?
|
1132 |
|
1133 |
return $email;
|
@@ -1339,7 +1368,7 @@ class NewsletterModule {
|
|
1339 |
}
|
1340 |
return $r;
|
1341 |
}
|
1342 |
-
|
1343 |
/**
|
1344 |
* Accepts a user ID or a TNP_User object. Does not check if the user really exists.
|
1345 |
*
|
@@ -1915,6 +1944,12 @@ class NewsletterModule {
|
|
1915 |
*/
|
1916 |
function replace($text, $user = null, $email = null, $referrer = null) {
|
1917 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
1918 |
|
1919 |
static $home_url = false;
|
1920 |
|
@@ -1925,7 +1960,7 @@ class NewsletterModule {
|
|
1925 |
//$this->logger->debug('Replace start');
|
1926 |
if ($user !== null && !is_object($user)) {
|
1927 |
if (is_array($user)) {
|
1928 |
-
$user = (object) $user;
|
1929 |
} else if (is_numeric($user)) {
|
1930 |
$user = $this->get_user($user);
|
1931 |
} else {
|
@@ -1935,7 +1970,7 @@ class NewsletterModule {
|
|
1935 |
|
1936 |
if ($email !== null && !is_object($email)) {
|
1937 |
if (is_array($email)) {
|
1938 |
-
$email = (object) $email;
|
1939 |
} else if (is_numeric($email)) {
|
1940 |
$email = $this->get_email($email);
|
1941 |
} else {
|
@@ -1963,7 +1998,7 @@ class NewsletterModule {
|
|
1963 |
$text = str_replace(' {name}', '', $text);
|
1964 |
$text = str_replace('{name}', '', $text);
|
1965 |
} else {
|
1966 |
-
$text = str_replace('{name}', $name, $text);
|
1967 |
}
|
1968 |
|
1969 |
switch ($user->sex) {
|
@@ -1978,10 +2013,11 @@ class NewsletterModule {
|
|
1978 |
}
|
1979 |
|
1980 |
|
1981 |
-
|
1982 |
-
$text = str_replace('{
|
|
|
1983 |
|
1984 |
-
$full_name = trim($user->name . ' ' . $user->surname);
|
1985 |
if (empty($full_name)) {
|
1986 |
$text = str_replace(' {full_name}', '', $text);
|
1987 |
$text = str_replace('{full_name}', '', $text);
|
@@ -2005,20 +2041,8 @@ class NewsletterModule {
|
|
2005 |
$base = (empty($this->options_main['url']) ? get_option('home') : $this->options_main['url']);
|
2006 |
$id_token = '&ni=' . $user->id . '&nt=' . $user->token;
|
2007 |
|
2008 |
-
|
2009 |
-
$nek = false;
|
2010 |
-
if ($email) {
|
2011 |
-
$nek = $this->get_email_key($email);
|
2012 |
-
$text = str_replace('{email_id}', $email->id, $text);
|
2013 |
-
$text = str_replace('{email_key}', $nek, $text);
|
2014 |
-
$text = str_replace('{email_subject}', $email->subject, $text);
|
2015 |
-
// Deprecated
|
2016 |
-
$text = str_replace('{subject}', $email->subject, $text);
|
2017 |
-
$text = $this->replace_url($text, 'EMAIL_URL', $this->build_action_url('v', $user) . '&id=' . $email->id);
|
2018 |
-
}
|
2019 |
-
|
2020 |
$text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', $this->build_action_url('c', $user));
|
2021 |
-
$text = $this->replace_url($text, 'ACTIVATION_URL', $this->build_action_url('
|
2022 |
|
2023 |
// Obsolete.
|
2024 |
$text = $this->replace_url($text, 'FOLLOWUP_SUBSCRIPTION_URL', self::add_qs($base, 'nm=fs' . $id_token));
|
@@ -2028,8 +2052,18 @@ class NewsletterModule {
|
|
2028 |
} else {
|
2029 |
$text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', '#');
|
2030 |
$text = $this->replace_url($text, 'ACTIVATION_URL', '#');
|
2031 |
-
|
2032 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2033 |
}
|
2034 |
|
2035 |
if (strpos($text, '{subscription_form}') !== false) {
|
@@ -2294,7 +2328,7 @@ class NewsletterModule {
|
|
2294 |
}
|
2295 |
return $current_language;
|
2296 |
}
|
2297 |
-
|
2298 |
// Polylang
|
2299 |
if (function_exists('pll_current_language')) {
|
2300 |
return pll_current_language();
|
2 |
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
5 |
+
class TNP_Media {
|
6 |
+
var $url;
|
7 |
+
var $width;
|
8 |
+
var $height;
|
9 |
+
}
|
10 |
+
|
11 |
+
function tnp_register_block($dir) {
|
12 |
+
TNP_Composer::register_block($dir);
|
13 |
+
}
|
14 |
+
|
15 |
+
function tnpc_button($options, $prefix = 'button') {
|
16 |
+
return TNP_Composer::button($options, $prefix);
|
17 |
+
}
|
18 |
+
|
19 |
class TNP_Composer {
|
20 |
|
21 |
static $block_dirs = array();
|
31 |
self::$block_dirs[] = $dir;
|
32 |
return true;
|
33 |
}
|
34 |
+
|
35 |
+
static function button($options, $prefix = 'button') {
|
36 |
+
$b = '<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="border-collapse:separate;line-height:100%;">';
|
37 |
+
$b .= '<tr>';
|
38 |
+
$b .= '<td align="center" bgcolor="' . $options[$prefix . '_background'] . '" role="presentation" style="border:none;border-radius:3px;cursor:auto;mso-padding-alt:10px 25px;background:' . $options[$prefix . '_background'] . '" valign="middle">';
|
39 |
+
$b .= '<a href="' . $options[$prefix . '_url'] . '"';
|
40 |
+
$b .= ' style="display:inline-block;background:' . $options[$prefix . '_background'] . ';color:' . $options[$prefix . '_font_color'] . ';font-family:' . $options[$prefix . '_font_family'] . ';font-size:' . $options[$prefix . '_font_size'] . 'px;font-weight:' . $options[$prefix . '_font_weight'] . ';line-height:120%;margin:0;text-decoration:none;text-transform:none;padding:10px 25px;mso-padding-alt:0px;border-radius:3px;"';
|
41 |
+
$b .= ' target="_blank">';
|
42 |
+
$b .= $options[$prefix . '_label'];
|
43 |
+
$b .= '</a>';
|
44 |
+
$b .= '</td></tr></table>';
|
45 |
+
return $b;
|
46 |
+
}
|
47 |
|
48 |
}
|
49 |
|
835 |
}
|
836 |
|
837 |
static function normalize_name($name) {
|
838 |
+
$name = html_entity_decode($name, ENT_QUOTES);
|
839 |
$name = str_replace(';', ' ', $name);
|
840 |
$name = strip_tags($name);
|
841 |
+
|
842 |
return $name;
|
843 |
}
|
844 |
|
1156 |
}
|
1157 |
|
1158 |
$email = $this->get_email($id);
|
1159 |
+
|
1160 |
// TODO: Check the token? It's really useful?
|
1161 |
|
1162 |
return $email;
|
1368 |
}
|
1369 |
return $r;
|
1370 |
}
|
1371 |
+
|
1372 |
/**
|
1373 |
* Accepts a user ID or a TNP_User object. Does not check if the user really exists.
|
1374 |
*
|
1944 |
*/
|
1945 |
function replace($text, $user = null, $email = null, $referrer = null) {
|
1946 |
global $wpdb;
|
1947 |
+
|
1948 |
+
if (strpos($text, '<p') !== false) {
|
1949 |
+
$esc_html = true;
|
1950 |
+
} else {
|
1951 |
+
$esc_html = false;
|
1952 |
+
}
|
1953 |
|
1954 |
static $home_url = false;
|
1955 |
|
1960 |
//$this->logger->debug('Replace start');
|
1961 |
if ($user !== null && !is_object($user)) {
|
1962 |
if (is_array($user)) {
|
1963 |
+
$user = (object) $user;
|
1964 |
} else if (is_numeric($user)) {
|
1965 |
$user = $this->get_user($user);
|
1966 |
} else {
|
1970 |
|
1971 |
if ($email !== null && !is_object($email)) {
|
1972 |
if (is_array($email)) {
|
1973 |
+
$email = (object) $email;
|
1974 |
} else if (is_numeric($email)) {
|
1975 |
$email = $this->get_email($email);
|
1976 |
} else {
|
1998 |
$text = str_replace(' {name}', '', $text);
|
1999 |
$text = str_replace('{name}', '', $text);
|
2000 |
} else {
|
2001 |
+
$text = str_replace('{name}', esc_html($name), $text);
|
2002 |
}
|
2003 |
|
2004 |
switch ($user->sex) {
|
2013 |
}
|
2014 |
|
2015 |
|
2016 |
+
// Deprecated
|
2017 |
+
$text = str_replace('{surname}', esc_html($user->surname), $text);
|
2018 |
+
$text = str_replace('{last_name}', esc_html($user->surname), $text);
|
2019 |
|
2020 |
+
$full_name = esc_html(trim($user->name . ' ' . $user->surname));
|
2021 |
if (empty($full_name)) {
|
2022 |
$text = str_replace(' {full_name}', '', $text);
|
2023 |
$text = str_replace('{full_name}', '', $text);
|
2041 |
$base = (empty($this->options_main['url']) ? get_option('home') : $this->options_main['url']);
|
2042 |
$id_token = '&ni=' . $user->id . '&nt=' . $user->token;
|
2043 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2044 |
$text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', $this->build_action_url('c', $user));
|
2045 |
+
$text = $this->replace_url($text, 'ACTIVATION_URL', $this->build_action_url('c', $user));
|
2046 |
|
2047 |
// Obsolete.
|
2048 |
$text = $this->replace_url($text, 'FOLLOWUP_SUBSCRIPTION_URL', self::add_qs($base, 'nm=fs' . $id_token));
|
2052 |
} else {
|
2053 |
$text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', '#');
|
2054 |
$text = $this->replace_url($text, 'ACTIVATION_URL', '#');
|
2055 |
+
}
|
2056 |
+
|
2057 |
+
if ($email) {
|
2058 |
+
$nek = $this->get_email_key($email);
|
2059 |
+
$text = str_replace('{email_id}', $email->id, $text);
|
2060 |
+
$text = str_replace('{email_key}', $nek, $text);
|
2061 |
+
$text = str_replace('{email_subject}', $email->subject, $text);
|
2062 |
+
// Deprecated
|
2063 |
+
$text = str_replace('{subject}', $email->subject, $text);
|
2064 |
+
$text = $this->replace_url($text, 'EMAIL_URL', $this->build_action_url('v', $user) . '&id=' . $email->id);
|
2065 |
+
} else {
|
2066 |
+
$text = $this->replace_url($text, 'EMAIL_URL', '#');
|
2067 |
}
|
2068 |
|
2069 |
if (strpos($text, '{subscription_form}') !== false) {
|
2328 |
}
|
2329 |
return $current_language;
|
2330 |
}
|
2331 |
+
|
2332 |
// Polylang
|
2333 |
if (function_exists('pll_current_language')) {
|
2334 |
return pll_current_language();
|
includes/themes.php
CHANGED
@@ -1,225 +1,184 @@
|
|
1 |
<?php
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
|
4 |
class NewsletterThemes {
|
5 |
|
6 |
var $module;
|
7 |
var $is_extension = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
function __construct($module, $is_extension = false) {
|
10 |
$this->module = $module;
|
11 |
$this->is_extension = $is_extension;
|
12 |
}
|
13 |
|
14 |
-
/**
|
15 |
-
*
|
16 |
-
*
|
17 |
-
*
|
18 |
-
*
|
19 |
-
*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
*/
|
21 |
-
function
|
22 |
-
$list = array();
|
23 |
|
24 |
-
$dir
|
25 |
-
|
26 |
-
|
27 |
-
if ($handle !== false) {
|
28 |
-
while ($file = readdir($handle)) {
|
29 |
-
if ($file == '.' || $file == '..')
|
30 |
-
continue;
|
31 |
-
if (!is_file($dir . '/' . $file . '/theme.php'))
|
32 |
-
continue;
|
33 |
-
$list[$file] = $file;
|
34 |
-
}
|
35 |
-
closedir($handle);
|
36 |
}
|
37 |
-
|
38 |
-
if (
|
39 |
-
|
40 |
-
$handle = @opendir($dir);
|
41 |
-
|
42 |
-
if ($handle !== false) {
|
43 |
-
while ($file = readdir($handle)) {
|
44 |
-
if ($file == '.' || $file == '..')
|
45 |
-
continue;
|
46 |
-
if (isset($list[$file]))
|
47 |
-
continue;
|
48 |
-
if (!is_file($dir . '/' . $file . '/theme.php'))
|
49 |
-
continue;
|
50 |
-
|
51 |
-
$list[$file] = $file;
|
52 |
-
}
|
53 |
-
closedir($handle);
|
54 |
-
}
|
55 |
}
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
}
|
66 |
-
return
|
67 |
}
|
68 |
|
69 |
function get_all_with_data() {
|
70 |
$list = array();
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
$dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
|
73 |
$handle = @opendir($dir);
|
74 |
|
75 |
if ($handle !== false) {
|
76 |
while ($file = readdir($handle)) {
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
if (isset($list[$
|
81 |
-
continue;
|
82 |
-
}
|
83 |
-
if (!is_file($dir . '/' . $file . '/theme.php')) {
|
84 |
continue;
|
85 |
}
|
86 |
-
|
87 |
-
$data['id'] = $
|
88 |
-
if (empty($data['name'])) {
|
89 |
-
$data['name'] = $file;
|
90 |
-
}
|
91 |
-
if (empty($data['type'])) {
|
92 |
-
$data['type'] = 'standard';
|
93 |
-
}
|
94 |
-
$screenshot = $dir . '/' . $file . '/screenshot.png';
|
95 |
-
if (is_file($screenshot)) {
|
96 |
-
$data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
|
97 |
-
} else {
|
98 |
-
$data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
|
99 |
-
}
|
100 |
-
$list[$file] = $data;
|
101 |
}
|
102 |
closedir($handle);
|
103 |
}
|
|
|
|
|
|
|
104 |
|
105 |
-
|
106 |
-
$
|
107 |
-
|
108 |
-
|
109 |
-
if ($handle !== false) {
|
110 |
-
while ($file = readdir($handle)) {
|
111 |
-
if ($file == '.' || $file == '..') {
|
112 |
-
continue;
|
113 |
-
}
|
114 |
-
if (!is_file($dir . '/' . $file . '/theme.php')) {
|
115 |
-
continue;
|
116 |
-
}
|
117 |
-
$data = get_file_data($dir . '/' . $file . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description'=>'Description'));
|
118 |
-
$data['id'] = $file;
|
119 |
-
if (empty($data['name'])) {
|
120 |
-
$data['name'] = $file;
|
121 |
-
}
|
122 |
-
if (empty($data['type'])) {
|
123 |
-
$data['type'] = 'standard';
|
124 |
-
}
|
125 |
-
$screenshot = $dir . '/' . $file . '/screenshot.png';
|
126 |
-
if (is_file($screenshot)) {
|
127 |
-
$data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
|
128 |
-
} else {
|
129 |
-
$data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
|
130 |
-
}
|
131 |
-
$list[$file] = $data;
|
132 |
-
}
|
133 |
-
closedir($handle);
|
134 |
}
|
135 |
-
}
|
136 |
|
137 |
-
|
|
|
138 |
|
139 |
return $list;
|
140 |
}
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
/**
|
143 |
*
|
144 |
* @param type $theme
|
145 |
* @param type $options
|
146 |
* @param type $module
|
147 |
*/
|
148 |
-
function save_options($
|
149 |
-
add_option('newsletter_' . $this->module . '_theme_' . $theme, array(), null, 'no');
|
150 |
$theme_options = array();
|
151 |
foreach ($options as $key => &$value) {
|
152 |
if (substr($key, 0, 6) != 'theme_')
|
153 |
continue;
|
154 |
$theme_options[$key] = $value;
|
155 |
}
|
156 |
-
update_option('newsletter_' . $this->module . '_theme_' . $
|
157 |
}
|
158 |
|
159 |
-
function get_options($
|
160 |
-
$options = get_option('newsletter_' . $this->module . '_theme_' . $
|
161 |
// To avoid merge problems.
|
162 |
if (!is_array($options)) {
|
163 |
$options = array();
|
164 |
}
|
165 |
-
|
|
|
|
|
|
|
166 |
if (is_file($file)) {
|
167 |
@include $file;
|
168 |
}
|
169 |
if (isset($theme_defaults) && is_array($theme_defaults)) {
|
170 |
$options = array_merge($theme_defaults, $options);
|
171 |
}
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
if (is_file($path)) {
|
178 |
-
return $path;
|
179 |
-
} else {
|
180 |
-
return NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/' . $file;
|
181 |
-
}
|
182 |
-
}
|
183 |
-
|
184 |
-
function get_theme_url($theme) {
|
185 |
-
if ($this->is_extension) {
|
186 |
-
return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
|
187 |
-
}
|
188 |
-
|
189 |
-
$path = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme;
|
190 |
-
if (is_dir($path)) {
|
191 |
-
return plugins_url('newsletter') . '/' . $this->module . '/themes/' . $theme;
|
192 |
-
} else {
|
193 |
-
return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
|
194 |
}
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
$path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
|
200 |
-
@include $path2 . '/en_US.php';
|
201 |
-
@include $path2 . '/' . WPLANG . '.php';
|
202 |
-
} else {
|
203 |
-
$path1 = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/languages';
|
204 |
-
$path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
|
205 |
-
@include $path1 . '/en_US.php';
|
206 |
-
@include $path2 . '/en_US.php';
|
207 |
-
@include $path1 . '/' . WPLANG . '.php';
|
208 |
-
@include $path2 . '/' . WPLANG . '.php';
|
209 |
}
|
210 |
-
|
211 |
-
if (!is_array($options))
|
212 |
-
return array();
|
213 |
return $options;
|
214 |
}
|
215 |
-
|
216 |
}
|
217 |
|
218 |
-
function nt_option($name, $def = null) {
|
219 |
-
$options = get_option('newsletter_email');
|
220 |
-
$option = $options['theme_' . $name];
|
221 |
-
if (!isset($option))
|
222 |
-
return $def;
|
223 |
-
else
|
224 |
-
return $option;
|
225 |
-
}
|
1 |
<?php
|
2 |
+
|
3 |
+
defined('ABSPATH') || exit;
|
4 |
+
|
5 |
+
/**
|
6 |
+
* Registers a Newsletter theme to be shown as option on standard newsletter creation
|
7 |
+
* Designers love functions...
|
8 |
+
* @param string $dir The absolute path of a folder containing a Newsletter theme
|
9 |
+
*/
|
10 |
+
function tnp_register_theme($dir) {
|
11 |
+
NewsletterThemes::register_theme($dir);
|
12 |
+
}
|
13 |
|
14 |
class NewsletterThemes {
|
15 |
|
16 |
var $module;
|
17 |
var $is_extension = false;
|
18 |
+
static $registered_theme_dirs = array();
|
19 |
+
|
20 |
+
static function register_theme($dir) {
|
21 |
+
if (!file_exists($dir . '/theme.php')) {
|
22 |
+
$error = new WP_Error('1', 'theme.php missing on folder ' . $dir);
|
23 |
+
return $error;
|
24 |
+
}
|
25 |
+
self::$registered_theme_dirs[] = $dir;
|
26 |
+
return true;
|
27 |
+
}
|
28 |
|
29 |
function __construct($module, $is_extension = false) {
|
30 |
$this->module = $module;
|
31 |
$this->is_extension = $is_extension;
|
32 |
}
|
33 |
|
34 |
+
/**
|
35 |
+
* Build an associative array which represent a theme starting from the theme
|
36 |
+
* parsing the files in the theme folder.<br>
|
37 |
+
* dir - the full path to the theme folder<br>
|
38 |
+
* url - the full url to the theme folder (to reference assets like images)<br>
|
39 |
+
* id - the folder name, used as unique identifier<br>
|
40 |
+
* screenshot - url to an image representing the theme (400x400)<br>
|
41 |
+
* name - the readable theme name extracted from the theme.php<br>
|
42 |
+
*
|
43 |
+
* description - not used
|
44 |
+
* type - not used
|
45 |
+
*
|
46 |
+
* @param string $dir
|
47 |
+
* @return array
|
48 |
*/
|
49 |
+
function build_theme($dir) {
|
|
|
50 |
|
51 |
+
if (!is_dir($dir)) {
|
52 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
}
|
54 |
+
|
55 |
+
if (!is_file($dir . '/theme.php')) {
|
56 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
}
|
58 |
|
59 |
+
$data = get_file_data($dir . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description' => 'Description'));
|
60 |
+
$data['id'] = basename($dir);
|
61 |
+
$data['dir'] = $dir;
|
62 |
+
if (empty($data['name'])) {
|
63 |
+
$data['name'] = $data['id'];
|
64 |
+
}
|
65 |
+
|
66 |
+
if (empty($data['type'])) {
|
67 |
+
$data['type'] = 'standard';
|
68 |
+
}
|
69 |
+
$relative_dir = substr($dir, strlen(WP_CONTENT_DIR));
|
70 |
+
$data['url'] = content_url($relative_dir);
|
71 |
+
$screenshot = $dir . '/screenshot.png';
|
72 |
+
if (is_file($screenshot)) {
|
73 |
+
$relative_dir = substr($dir, strlen(WP_CONTENT_DIR));
|
74 |
+
$data['screenshot'] = $data['url'] . '/screenshot.png';
|
75 |
+
} else {
|
76 |
+
$data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
|
77 |
}
|
78 |
+
return $data;
|
79 |
}
|
80 |
|
81 |
function get_all_with_data() {
|
82 |
$list = array();
|
83 |
|
84 |
+
// Packaged themes
|
85 |
+
$list['default'] = $this->build_theme(NEWSLETTER_DIR . '/emails/themes/default');
|
86 |
+
$list['blank'] = $this->build_theme(NEWSLETTER_DIR . '/emails/themes/blank');
|
87 |
+
$list['cta-2015'] = $this->build_theme(NEWSLETTER_DIR . '/emails/themes/cta-2015');
|
88 |
+
$list['vimeo-like'] = $this->build_theme(NEWSLETTER_DIR . '/emails/themes/vimeo-like');
|
89 |
+
|
90 |
+
// Extensions folder scan
|
91 |
$dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
|
92 |
$handle = @opendir($dir);
|
93 |
|
94 |
if ($handle !== false) {
|
95 |
while ($file = readdir($handle)) {
|
96 |
+
|
97 |
+
$data = $this->build_theme($dir . '/' . $file);
|
98 |
+
|
99 |
+
if (!$data || isset($list[$data['id']])) {
|
|
|
|
|
|
|
100 |
continue;
|
101 |
}
|
102 |
+
|
103 |
+
$list[$data['id']] = $data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
}
|
105 |
closedir($handle);
|
106 |
}
|
107 |
+
|
108 |
+
// Registered themes
|
109 |
+
do_action('newsletter_register_themes');
|
110 |
|
111 |
+
foreach (self::$registered_theme_dirs as $dir) {
|
112 |
+
$data = $this->build_theme($dir);
|
113 |
+
if (!$data || isset($list[$data['id']])) {
|
114 |
+
continue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
|
|
116 |
|
117 |
+
$list[$data['id']] = $data;
|
118 |
+
}
|
119 |
|
120 |
return $list;
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* Returns a data structure containing the theme details.
|
125 |
+
*
|
126 |
+
* @param string $id
|
127 |
+
* @return array
|
128 |
+
*/
|
129 |
+
function get_theme($id) {
|
130 |
+
$themes = $this->get_all_with_data();
|
131 |
+
if (isset($themes[$id])) {
|
132 |
+
return $themes[$id];
|
133 |
+
}
|
134 |
+
return null;
|
135 |
+
}
|
136 |
+
|
137 |
/**
|
138 |
*
|
139 |
* @param type $theme
|
140 |
* @param type $options
|
141 |
* @param type $module
|
142 |
*/
|
143 |
+
function save_options($theme_id, &$options) {
|
|
|
144 |
$theme_options = array();
|
145 |
foreach ($options as $key => &$value) {
|
146 |
if (substr($key, 0, 6) != 'theme_')
|
147 |
continue;
|
148 |
$theme_options[$key] = $value;
|
149 |
}
|
150 |
+
update_option('newsletter_' . $this->module . '_theme_' . $theme_id, $theme_options, false);
|
151 |
}
|
152 |
|
153 |
+
function get_options($theme_id) {
|
154 |
+
$options = get_option('newsletter_' . $this->module . '_theme_' . $theme_id);
|
155 |
// To avoid merge problems.
|
156 |
if (!is_array($options)) {
|
157 |
$options = array();
|
158 |
}
|
159 |
+
|
160 |
+
$theme = $this->get_theme($theme_id);
|
161 |
+
|
162 |
+
$file = $theme['dir'] . '/theme-defaults.php';
|
163 |
if (is_file($file)) {
|
164 |
@include $file;
|
165 |
}
|
166 |
if (isset($theme_defaults) && is_array($theme_defaults)) {
|
167 |
$options = array_merge($theme_defaults, $options);
|
168 |
}
|
169 |
+
|
170 |
+
// main options merge
|
171 |
+
$main_options = Newsletter::instance()->options;
|
172 |
+
foreach ($main_options as $key => $value) {
|
173 |
+
$options['main_' . $key] = $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
}
|
175 |
+
|
176 |
+
$info_options = Newsletter::instance()->get_options('info');
|
177 |
+
foreach ($info_options as $key => $value) {
|
178 |
+
$options['main_' . $key] = $value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
180 |
+
|
|
|
|
|
181 |
return $options;
|
182 |
}
|
|
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
main/status.php
CHANGED
@@ -53,8 +53,16 @@ if ($controls->is_action('conversion')) {
|
|
53 |
$this->logger->info('Maybe convert to utf8mb4');
|
54 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
55 |
if (function_exists('maybe_convert_table_to_utf8mb4')) {
|
56 |
-
maybe_convert_table_to_utf8mb4(NEWSLETTER_EMAILS_TABLE);
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
$controls->messages = 'Done.';
|
59 |
} else {
|
60 |
$controls->errors = 'Table conversion function not available';
|
@@ -1210,13 +1218,14 @@ $speed = Newsletter::$instance->options['scheduler_max'];
|
|
1210 |
|
1211 |
<h4><?php echo $wpdb->prefix ?>newsletter_emails</h4>
|
1212 |
<?php
|
1213 |
-
$rs = $wpdb->get_results("
|
1214 |
?>
|
1215 |
<table class="tnp-db-table">
|
1216 |
<thead>
|
1217 |
<tr>
|
1218 |
<th>Field</th>
|
1219 |
<th>Type</th>
|
|
|
1220 |
<th>Null</th>
|
1221 |
<th>Key</th>
|
1222 |
<th>Default</th>
|
@@ -1228,6 +1237,7 @@ $speed = Newsletter::$instance->options['scheduler_max'];
|
|
1228 |
<tr>
|
1229 |
<td><?php echo esc_html($r->Field) ?></td>
|
1230 |
<td><?php echo esc_html($r->Type) ?></td>
|
|
|
1231 |
<td><?php echo esc_html($r->Null) ?></td>
|
1232 |
<td><?php echo esc_html($r->Key) ?></td>
|
1233 |
<td><?php echo esc_html($r->Default) ?></td>
|
53 |
$this->logger->info('Maybe convert to utf8mb4');
|
54 |
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
|
55 |
if (function_exists('maybe_convert_table_to_utf8mb4')) {
|
56 |
+
$r = maybe_convert_table_to_utf8mb4(NEWSLETTER_EMAILS_TABLE);
|
57 |
+
if (!$r) {
|
58 |
+
$controls->errors .= 'It was not possible to run the conversion for the table ' . NEWSLETTER_EMAILS_TABLE . ' - ';
|
59 |
+
$controls->errors .= $wpdb->last_error . '<br>';
|
60 |
+
}
|
61 |
+
$r = maybe_convert_table_to_utf8mb4(NEWSLETTER_USERS_TABLE);
|
62 |
+
if (!$r) {
|
63 |
+
$controls->errors .= 'It was not possible to run the conversion for the table ' . NEWSLETTER_EMAILS_TABLE . ' - ';
|
64 |
+
$controls->errors .= $wpdb->last_error . '<br>';
|
65 |
+
}
|
66 |
$controls->messages = 'Done.';
|
67 |
} else {
|
68 |
$controls->errors = 'Table conversion function not available';
|
1218 |
|
1219 |
<h4><?php echo $wpdb->prefix ?>newsletter_emails</h4>
|
1220 |
<?php
|
1221 |
+
$rs = $wpdb->get_results("show full columns from {$wpdb->prefix}newsletter_emails");
|
1222 |
?>
|
1223 |
<table class="tnp-db-table">
|
1224 |
<thead>
|
1225 |
<tr>
|
1226 |
<th>Field</th>
|
1227 |
<th>Type</th>
|
1228 |
+
<th>Collation</th>
|
1229 |
<th>Null</th>
|
1230 |
<th>Key</th>
|
1231 |
<th>Default</th>
|
1237 |
<tr>
|
1238 |
<td><?php echo esc_html($r->Field) ?></td>
|
1239 |
<td><?php echo esc_html($r->Type) ?></td>
|
1240 |
+
<td><?php echo esc_html($r->Collation) ?></td>
|
1241 |
<td><?php echo esc_html($r->Null) ?></td>
|
1242 |
<td><?php echo esc_html($r->Key) ?></td>
|
1243 |
<td><?php echo esc_html($r->Default) ?></td>
|
plugin.php
CHANGED
@@ -4,14 +4,14 @@
|
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
-
Version: 6.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.
|
11 |
Text Domain: newsletter
|
12 |
License: GPLv2 or later
|
13 |
|
14 |
-
Copyright 2009-
|
15 |
|
16 |
Newsletter is free software: you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
@@ -28,7 +28,7 @@
|
|
28 |
|
29 |
*/
|
30 |
|
31 |
-
define('NEWSLETTER_VERSION', '6.4.
|
32 |
|
33 |
global $newsletter, $wpdb;
|
34 |
|
@@ -196,8 +196,10 @@ class Newsletter extends NewsletterModule {
|
|
196 |
static $slugs = array();
|
197 |
if (empty($slugs)) {
|
198 |
$addons = $this->getTnpExtensions();
|
199 |
-
|
200 |
-
$
|
|
|
|
|
201 |
}
|
202 |
}
|
203 |
if (array_search($plugin_file, $slugs) !== false) {
|
@@ -1155,6 +1157,10 @@ class Newsletter extends NewsletterModule {
|
|
1155 |
if (empty($extensions_json)) {
|
1156 |
$url = "http://www.thenewsletterplugin.com/wp-content/extensions.json?ver=" . NEWSLETTER_VERSION;
|
1157 |
$extensions_response = wp_remote_get($url);
|
|
|
|
|
|
|
|
|
1158 |
$extensions_json = wp_remote_retrieve_body($extensions_response);
|
1159 |
if (!empty($extensions_json)) {
|
1160 |
set_transient('tnp_extensions_json', $extensions_json, 72 * 60 * 60);
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
+
Version: 6.4.7
|
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.
|
11 |
Text Domain: newsletter
|
12 |
License: GPLv2 or later
|
13 |
|
14 |
+
Copyright 2009-2020 The Newsletter Team (email: info@thenewsletterplugin.com, web: https://www.thenewsletterplugin.com)
|
15 |
|
16 |
Newsletter is free software: you can redistribute it and/or modify
|
17 |
it under the terms of the GNU General Public License as published by
|
28 |
|
29 |
*/
|
30 |
|
31 |
+
define('NEWSLETTER_VERSION', '6.4.7');
|
32 |
|
33 |
global $newsletter, $wpdb;
|
34 |
|
196 |
static $slugs = array();
|
197 |
if (empty($slugs)) {
|
198 |
$addons = $this->getTnpExtensions();
|
199 |
+
if ($addons) {
|
200 |
+
foreach ($addons as $addon) {
|
201 |
+
$slugs[] = $addon->wp_slug;
|
202 |
+
}
|
203 |
}
|
204 |
}
|
205 |
if (array_search($plugin_file, $slugs) !== false) {
|
1157 |
if (empty($extensions_json)) {
|
1158 |
$url = "http://www.thenewsletterplugin.com/wp-content/extensions.json?ver=" . NEWSLETTER_VERSION;
|
1159 |
$extensions_response = wp_remote_get($url);
|
1160 |
+
if (is_wp_error($extensions_response)) {
|
1161 |
+
$this->logger->error($extensions_response);
|
1162 |
+
return false;
|
1163 |
+
}
|
1164 |
$extensions_json = wp_remote_retrieve_body($extensions_response);
|
1165 |
if (!empty($extensions_json)) {
|
1166 |
set_transient('tnp_extensions_json', $extensions_json, 72 * 60 * 60);
|
profile/profile.php
CHANGED
@@ -363,9 +363,15 @@ class NewsletterProfile extends NewsletterModule {
|
|
363 |
$data['email'] = $email;
|
364 |
if (isset($_REQUEST['nn'])) {
|
365 |
$data['name'] = $this->normalize_name(stripslashes($_REQUEST['nn']));
|
|
|
|
|
|
|
366 |
}
|
367 |
if (isset($_REQUEST['ns'])) {
|
368 |
$data['surname'] = $this->normalize_name(stripslashes($_REQUEST['ns']));
|
|
|
|
|
|
|
369 |
}
|
370 |
if ($options_profile['sex_status'] >= 1) {
|
371 |
$data['sex'] = $_REQUEST['nx'][0];
|
363 |
$data['email'] = $email;
|
364 |
if (isset($_REQUEST['nn'])) {
|
365 |
$data['name'] = $this->normalize_name(stripslashes($_REQUEST['nn']));
|
366 |
+
if ($subscription_module->is_spam_text($data['name'])) {
|
367 |
+
die();
|
368 |
+
}
|
369 |
}
|
370 |
if (isset($_REQUEST['ns'])) {
|
371 |
$data['surname'] = $this->normalize_name(stripslashes($_REQUEST['ns']));
|
372 |
+
if ($subscription_module->is_spam_text($data['surname'])) {
|
373 |
+
die();
|
374 |
+
}
|
375 |
}
|
376 |
if ($options_profile['sex_status'] >= 1) {
|
377 |
$data['sex'] = $_REQUEST['nx'][0];
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 5.3.2
|
5 |
-
Stable tag: 6.4.
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
|
@@ -109,9 +109,27 @@ Thank you, The Newsletter Team
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
= 6.4.5 =
|
113 |
|
114 |
-
* Restored a missing
|
115 |
* Added the changelog.txt file
|
116 |
|
117 |
= 6.4.4 =
|
@@ -311,4 +329,4 @@ Thank you, The Newsletter Team
|
|
311 |
= 6.0.0 =
|
312 |
|
313 |
* The Newsletter Plugin Composer - A new revamped drag & drop composer
|
314 |
-
* Several improvements and fixes
|
2 |
Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 5.3.2
|
5 |
+
Stable tag: 6.4.7
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 6.4.7 =
|
113 |
+
|
114 |
+
* Default theme thumbnail fix
|
115 |
+
* Profile saving antispam check
|
116 |
+
* Fixed hero block (button)
|
117 |
+
* Added logging on spam checking (enable info lov level to see the spam check results in the logs)
|
118 |
+
|
119 |
+
= 6.4.6 =
|
120 |
+
|
121 |
+
* Added hook to [register custom theme folders](https://www.thenewsletterplugin.com/developers/newsletter-themes)
|
122 |
+
* Removed old themes
|
123 |
+
* Removed packages theme folder scan (so locally added themes are not loaded, see site documentation if you need to create a custom theme)
|
124 |
+
* Polylang support on default theme
|
125 |
+
* Better error check on addon list retrieval
|
126 |
+
* Added language on targeting options
|
127 |
+
* Fixed user list pagination
|
128 |
+
* Subject replacement for online preview
|
129 |
+
|
130 |
= 6.4.5 =
|
131 |
|
132 |
+
* Restored a missing method used by addons
|
133 |
* Added the changelog.txt file
|
134 |
|
135 |
= 6.4.4 =
|
329 |
= 6.0.0 =
|
330 |
|
331 |
* The Newsletter Plugin Composer - A new revamped drag & drop composer
|
332 |
+
* Several improvements and fixes
|
subscription/subscription.php
CHANGED
@@ -176,7 +176,7 @@ class NewsletterSubscription extends NewsletterModule {
|
|
176 |
}
|
177 |
|
178 |
function is_spam_text($text) {
|
179 |
-
if (stripos($text, 'http
|
180 |
return true;
|
181 |
}
|
182 |
if (stripos($text, 'www.') !== false) {
|
@@ -229,6 +229,8 @@ class NewsletterSubscription extends NewsletterModule {
|
|
229 |
function valid_subscription_or_die($email, $full_name, $ip) {
|
230 |
$antibot_logger = new NewsletterLogger('antibot');
|
231 |
|
|
|
|
|
232 |
if (empty($email)) {
|
233 |
echo 'Wrong email';
|
234 |
header("HTTP/1.0 400 Bad request");
|
@@ -610,17 +612,29 @@ class NewsletterSubscription extends NewsletterModule {
|
|
610 |
*/
|
611 |
function subscribe($status = null, $emails = true) {
|
612 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
613 |
// Validation
|
614 |
$ip = $this->get_remote_ip();
|
615 |
$email = $this->normalize_email(stripslashes($_REQUEST['ne']));
|
616 |
$first_name = '';
|
617 |
if (isset($_REQUEST['nn'])) {
|
618 |
-
$first_name = $this->normalize_name($_REQUEST['nn']);
|
619 |
}
|
620 |
|
621 |
$last_name = '';
|
622 |
if (isset($_REQUEST['ns'])) {
|
623 |
-
$last_name = $this->normalize_name($_REQUEST['ns']);
|
624 |
}
|
625 |
|
626 |
$full_name = trim($first_name . ' ' . $last_name);
|
176 |
}
|
177 |
|
178 |
function is_spam_text($text) {
|
179 |
+
if (stripos($text, 'http:') !== false || stripos($text, 'https:') !== false) {
|
180 |
return true;
|
181 |
}
|
182 |
if (stripos($text, 'www.') !== false) {
|
229 |
function valid_subscription_or_die($email, $full_name, $ip) {
|
230 |
$antibot_logger = new NewsletterLogger('antibot');
|
231 |
|
232 |
+
$antibot_logger->info($_REQUEST);
|
233 |
+
|
234 |
if (empty($email)) {
|
235 |
echo 'Wrong email';
|
236 |
header("HTTP/1.0 400 Bad request");
|
612 |
*/
|
613 |
function subscribe($status = null, $emails = true) {
|
614 |
|
615 |
+
$options_profile = $this->get_options('profile');
|
616 |
+
/*
|
617 |
+
if ($options_profile['name_status'] == 0 && isset($_REQUEST['nn'])) {
|
618 |
+
// Name injection
|
619 |
+
die();
|
620 |
+
}
|
621 |
+
if ($options_profile['surname_status'] == 0 && isset($_REQUEST['ns'])) {
|
622 |
+
// Last name injection
|
623 |
+
die();
|
624 |
+
}
|
625 |
+
*/
|
626 |
+
|
627 |
// Validation
|
628 |
$ip = $this->get_remote_ip();
|
629 |
$email = $this->normalize_email(stripslashes($_REQUEST['ne']));
|
630 |
$first_name = '';
|
631 |
if (isset($_REQUEST['nn'])) {
|
632 |
+
$first_name = $this->normalize_name(stripslashes($_REQUEST['nn']));
|
633 |
}
|
634 |
|
635 |
$last_name = '';
|
636 |
if (isset($_REQUEST['ns'])) {
|
637 |
+
$last_name = $this->normalize_name(stripslashes($_REQUEST['ns']));
|
638 |
}
|
639 |
|
640 |
$full_name = trim($first_name . ' ' . $last_name);
|
unsubscription/unsubscription.php
CHANGED
@@ -38,7 +38,7 @@ class NewsletterUnsubscription extends NewsletterModule {
|
|
38 |
wp_redirect($url);
|
39 |
die();
|
40 |
break;
|
41 |
-
|
42 |
case 'uc':
|
43 |
if ($this->antibot_form_check()) {
|
44 |
$user = $this->unsubscribe();
|
@@ -129,14 +129,15 @@ class NewsletterUnsubscription extends NewsletterModule {
|
|
129 |
|
130 |
function hook_newsletter_replace($text, $user, $email) {
|
131 |
|
132 |
-
if (
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
-
$text = $this->replace_url($text, 'UNSUBSCRIPTION_CONFIRM_URL', $this->build_action_url('uc', $user, $email));
|
137 |
-
$text = $this->replace_url($text, 'UNSUBSCRIPTION_URL', $this->build_action_url('u', $user, $email));
|
138 |
-
$text = $this->replace_url($text, 'REACTIVATE_URL', $this->build_action_url('reactivate', $user, $email));
|
139 |
-
|
140 |
return $text;
|
141 |
}
|
142 |
|
38 |
wp_redirect($url);
|
39 |
die();
|
40 |
break;
|
41 |
+
|
42 |
case 'uc':
|
43 |
if ($this->antibot_form_check()) {
|
44 |
$user = $this->unsubscribe();
|
129 |
|
130 |
function hook_newsletter_replace($text, $user, $email) {
|
131 |
|
132 |
+
if ($user) {
|
133 |
+
$text = $this->replace_url($text, 'UNSUBSCRIPTION_CONFIRM_URL', $this->build_action_url('uc', $user, $email));
|
134 |
+
$text = $this->replace_url($text, 'UNSUBSCRIPTION_URL', $this->build_action_url('u', $user, $email));
|
135 |
+
$text = $this->replace_url($text, 'REACTIVATE_URL', $this->build_action_url('reactivate', $user, $email));
|
136 |
+
} else {
|
137 |
+
$text = $this->replace_url($text, 'UNSUBSCRIPTION_CONFIRM_URL', '#');
|
138 |
+
$text = $this->replace_url($text, 'UNSUBSCRIPTION_URL', '#');
|
139 |
}
|
140 |
|
|
|
|
|
|
|
|
|
141 |
return $text;
|
142 |
}
|
143 |
|
users/index.php
CHANGED
@@ -236,7 +236,6 @@ $controls->data['search_page'] ++;
|
|
236 |
|
237 |
<?php $controls->button('first', '«'); ?>
|
238 |
<?php $controls->button('prev', '‹'); ?>
|
239 |
-
<?php $controls->text('search_page', 3); ?> of <?php echo $last_page + 1 ?> <?php $controls->button('go', __('Go', 'newsletter')); ?>
|
240 |
<?php $controls->button('next', '›'); ?>
|
241 |
<?php $controls->button('last', '»'); ?>
|
242 |
</div>
|
236 |
|
237 |
<?php $controls->button('first', '«'); ?>
|
238 |
<?php $controls->button('prev', '‹'); ?>
|
|
|
239 |
<?php $controls->button('next', '›'); ?>
|
240 |
<?php $controls->button('last', '»'); ?>
|
241 |
</div>
|