Version Description
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.0.0 |
Comparing to | |
See all releases |
Code changes from version 6.9.9 to 7.0.0
- emails/index.php +10 -18
- emails/subjects.php +8 -0
- includes/module.php +61 -49
- includes/store.php +1 -1
- plugin.php +18 -4
- readme.txt +9 -3
- subscription/subscription.php +32 -9
- users/index.php +1 -1
emails/index.php
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
<?php
|
|
|
2 |
defined('ABSPATH') || exit;
|
3 |
|
4 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
5 |
require_once NEWSLETTER_INCLUDES_DIR . '/paginator.php';
|
6 |
|
7 |
$controls = new NewsletterControls();
|
8 |
-
$module = NewsletterEmails::instance();
|
9 |
|
10 |
if ($controls->is_action('copy')) {
|
11 |
$original = Newsletter::instance()->get_email($_POST['btn']);
|
@@ -19,12 +19,12 @@ if ($controls->is_action('copy')) {
|
|
19 |
$email['track'] = $original->track;
|
20 |
$email['options'] = $original->options;
|
21 |
|
22 |
-
$
|
23 |
$controls->messages .= __('Message duplicated.', 'newsletter');
|
24 |
}
|
25 |
|
26 |
if ($controls->is_action('delete')) {
|
27 |
-
$
|
28 |
$controls->add_message_deleted();
|
29 |
}
|
30 |
|
@@ -33,17 +33,9 @@ if ($controls->is_action('delete_selected')) {
|
|
33 |
$controls->messages .= $r . ' message(s) deleted';
|
34 |
}
|
35 |
|
36 |
-
/* ====================================== */
|
37 |
-
/* ======= PAGINATION CONTROLLERS ======= */
|
38 |
-
/* ====================================== */
|
39 |
-
|
40 |
$pagination_controller = new TNP_Pagination_Controller( NEWSLETTER_EMAILS_TABLE, 'id', [ 'type' => 'message' ] );
|
41 |
$emails = $pagination_controller->get_items();
|
42 |
|
43 |
-
/* ====================================== */
|
44 |
-
/* ===== END PAGINATION CONTROLLERS ===== */
|
45 |
-
/* ====================================== */
|
46 |
-
|
47 |
?>
|
48 |
|
49 |
<div class="wrap tnp-emails tnp-emails-index" id="tnp-wrap">
|
@@ -61,7 +53,7 @@ $emails = $pagination_controller->get_items();
|
|
61 |
<form method="post" action="">
|
62 |
<?php $controls->init(); ?>
|
63 |
|
64 |
-
<a href="<?php echo $
|
65 |
<?php $controls->button_confirm('delete_selected', __('Delete selected newsletters', 'newsletter')); ?>
|
66 |
|
67 |
<?php $pagination_controller->display_paginator(); ?>
|
@@ -69,7 +61,7 @@ $emails = $pagination_controller->get_items();
|
|
69 |
<table class="widefat tnp-newsletters-list" style="width: 100%">
|
70 |
<thead>
|
71 |
<tr>
|
72 |
-
<th
|
73 |
<th>Id</th>
|
74 |
<th><?php _e('Subject', 'newsletter') ?></th>
|
75 |
<th><?php _e('Status', 'newsletter') ?></th>
|
@@ -87,7 +79,7 @@ $emails = $pagination_controller->get_items();
|
|
87 |
<?php
|
88 |
foreach ($emails as $email) { ?>
|
89 |
<tr>
|
90 |
-
<td><input type="checkbox" name="ids[]" value="<?php echo $email->id; ?>"/></td>
|
91 |
<td><?php echo $email->id; ?></td>
|
92 |
<td><?php
|
93 |
if ($email->subject)
|
@@ -98,14 +90,14 @@ $emails = $pagination_controller->get_items();
|
|
98 |
</td>
|
99 |
|
100 |
<td>
|
101 |
-
<?php $
|
102 |
</td>
|
103 |
<td>
|
104 |
-
<?php $
|
105 |
</td>
|
106 |
-
<td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $
|
107 |
<td>
|
108 |
-
<?php echo $
|
109 |
</td>
|
110 |
|
111 |
<td>
|
1 |
<?php
|
2 |
+
/* @var $this NewsletterEmails */
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
5 |
require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
|
6 |
require_once NEWSLETTER_INCLUDES_DIR . '/paginator.php';
|
7 |
|
8 |
$controls = new NewsletterControls();
|
|
|
9 |
|
10 |
if ($controls->is_action('copy')) {
|
11 |
$original = Newsletter::instance()->get_email($_POST['btn']);
|
19 |
$email['track'] = $original->track;
|
20 |
$email['options'] = $original->options;
|
21 |
|
22 |
+
$this->save_email($email);
|
23 |
$controls->messages .= __('Message duplicated.', 'newsletter');
|
24 |
}
|
25 |
|
26 |
if ($controls->is_action('delete')) {
|
27 |
+
$this->delete_email($_POST['btn']);
|
28 |
$controls->add_message_deleted();
|
29 |
}
|
30 |
|
33 |
$controls->messages .= $r . ' message(s) deleted';
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
36 |
$pagination_controller = new TNP_Pagination_Controller( NEWSLETTER_EMAILS_TABLE, 'id', [ 'type' => 'message' ] );
|
37 |
$emails = $pagination_controller->get_items();
|
38 |
|
|
|
|
|
|
|
|
|
39 |
?>
|
40 |
|
41 |
<div class="wrap tnp-emails tnp-emails-index" id="tnp-wrap">
|
53 |
<form method="post" action="">
|
54 |
<?php $controls->init(); ?>
|
55 |
|
56 |
+
<a href="<?php echo $this->get_admin_page_url('theme'); ?>" class="button-primary"><?php _e('New newsletter', 'newsletter') ?></a>
|
57 |
<?php $controls->button_confirm('delete_selected', __('Delete selected newsletters', 'newsletter')); ?>
|
58 |
|
59 |
<?php $pagination_controller->display_paginator(); ?>
|
61 |
<table class="widefat tnp-newsletters-list" style="width: 100%">
|
62 |
<thead>
|
63 |
<tr>
|
64 |
+
<th><input type="checkbox" onchange="jQuery('input.tnp-selector').prop('checked', this.checked)"></th>
|
65 |
<th>Id</th>
|
66 |
<th><?php _e('Subject', 'newsletter') ?></th>
|
67 |
<th><?php _e('Status', 'newsletter') ?></th>
|
79 |
<?php
|
80 |
foreach ($emails as $email) { ?>
|
81 |
<tr>
|
82 |
+
<td><input type="checkbox" class="tnp-selector" name="ids[]" value="<?php echo $email->id; ?>"/></td>
|
83 |
<td><?php echo $email->id; ?></td>
|
84 |
<td><?php
|
85 |
if ($email->subject)
|
90 |
</td>
|
91 |
|
92 |
<td>
|
93 |
+
<?php $this->show_email_status_label($email) ?>
|
94 |
</td>
|
95 |
<td>
|
96 |
+
<?php $this->show_email_progress_bar($email, array('numbers'=>true)) ?>
|
97 |
</td>
|
98 |
+
<td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $this->format_date($email->send_on); ?></td>
|
99 |
<td>
|
100 |
+
<?php echo $this->get_edit_button($email) ?>
|
101 |
</td>
|
102 |
|
103 |
<td>
|
emails/subjects.php
CHANGED
@@ -41,6 +41,14 @@
|
|
41 |
<a href="#"><?php _e('10 Warning Signs That <em>[something]</em>', 'newsletter') ?></a><br>
|
42 |
<a href="#"><?php _e('10 Lies <em>[kind of people]</em> Likes to Tell', 'newsletter') ?></a><br>
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
<h3 class="tnp-subject-category"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" xml:space="preserve" width="18" height="18"><g class="nc-icon-wrapper"><path fill="#7C5839" d="M38.75586,31.34473C38.56543,31.12598,38.29004,31,38,31H10c-0.29004,0-0.56543,0.12598-0.75586,0.34473 c-0.18945,0.21924-0.27539,0.50977-0.23438,0.79688l2,14C11.08008,46.63428,11.50195,47,12,47h24 c0.49805,0,0.91992-0.36572,0.99023-0.8584l2-14C39.03125,31.85449,38.94531,31.56396,38.75586,31.34473z"></path> <path fill="#72C472" d="M34,6c-3.96655,0-7.38348,2.31537-9,5.66302V2c0-0.55225-0.44727-1-1-1s-1,0.44775-1,1v26 c0,0.55225,0.44727,1,1,1s1-0.44775,1-1v-8h1c5.52283,0,10-4.47717,10-10V6H34z"></path> <path fill="#A67C52" d="M42,33H6c-0.55273,0-1-0.44775-1-1v-4c0-0.55225,0.44727-1,1-1h36c0.55273,0,1,0.44775,1,1v4 C43,32.55225,42.55273,33,42,33z"></path></g></svg>Better life, problem management</h3>
|
45 |
<a href="#"><?php _e('10 Ways to Simplify Your <em>[something]</em>', 'newsletter') ?></a><br>
|
46 |
<a href="#"><?php _e('Get Rid of <em>[problem]</em> Once and Forever', 'newsletter') ?></a><br>
|
41 |
<a href="#"><?php _e('10 Warning Signs That <em>[something]</em>', 'newsletter') ?></a><br>
|
42 |
<a href="#"><?php _e('10 Lies <em>[kind of people]</em> Likes to Tell', 'newsletter') ?></a><br>
|
43 |
|
44 |
+
<h3 class="tnp-subject-category"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" xml:space="preserve" width="18" height="18"><g class="nc-icon-wrapper"><path fill="#43A6DD" d="M10,5C9.668,5,9.358,5.165,9.172,5.439C8.986,5.714,8.948,6.063,9.071,6.371 c0.078,0.194,7.669,19.475,0.222,26.922c-0.286,0.286-0.372,0.716-0.217,1.09C9.23,34.757,9.596,35,10,35h28c0.553,0,1-0.447,1-1 C39,18.01,25.99,5,10,5z"></path> <path fill="#BADEFC" d="M46,43c0.552,0,1-0.448,1-1V30.544c-0.646,0.29-1.257,0.684-1.787,1.214c-2.343,2.343-6.142,2.343-8.485,0 c-2.343-2.343-6.142-2.343-8.485,0c-2.343,2.343-6.142,2.343-8.485,0s-6.142-2.343-8.485,0s-6.142,2.343-8.485,0 c-0.53-0.53-1.141-0.924-1.787-1.214V42c0,0.552,0.448,1,1,1H46z"></path></g></svg>Dangers</h3>
|
45 |
+
<a href="#"><?php _e('Last day to save 30%', 'newsletter') ?></a><br>
|
46 |
+
<a href="#"><?php _e('Black Friday Sale is almost over', 'newsletter') ?></a><br>
|
47 |
+
<a href="#"><?php _e('Black Friday 65% off ending soon!', 'newsletter') ?></a><br>
|
48 |
+
<a href="#"><?php _e('Your Final 24 Hours | Last Call for Black Friday Deals', 'newsletter') ?></a><br>
|
49 |
+
<a href="#"><?php _e('Black Friday Sale is Live', 'newsletter') ?></a><br>
|
50 |
+
<a href="#"><?php _e('Black Friday Sale: few hours left!', 'newsletter') ?></a><br>
|
51 |
+
|
52 |
<h3 class="tnp-subject-category"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 48 48" xml:space="preserve" width="18" height="18"><g class="nc-icon-wrapper"><path fill="#7C5839" d="M38.75586,31.34473C38.56543,31.12598,38.29004,31,38,31H10c-0.29004,0-0.56543,0.12598-0.75586,0.34473 c-0.18945,0.21924-0.27539,0.50977-0.23438,0.79688l2,14C11.08008,46.63428,11.50195,47,12,47h24 c0.49805,0,0.91992-0.36572,0.99023-0.8584l2-14C39.03125,31.85449,38.94531,31.56396,38.75586,31.34473z"></path> <path fill="#72C472" d="M34,6c-3.96655,0-7.38348,2.31537-9,5.66302V2c0-0.55225-0.44727-1-1-1s-1,0.44775-1,1v26 c0,0.55225,0.44727,1,1,1s1-0.44775,1-1v-8h1c5.52283,0,10-4.47717,10-10V6H34z"></path> <path fill="#A67C52" d="M42,33H6c-0.55273,0-1-0.44775-1-1v-4c0-0.55225,0.44727-1,1-1h36c0.55273,0,1,0.44775,1,1v4 C43,32.55225,42.55273,33,42,33z"></path></g></svg>Better life, problem management</h3>
|
53 |
<a href="#"><?php _e('10 Ways to Simplify Your <em>[something]</em>', 'newsletter') ?></a><br>
|
54 |
<a href="#"><?php _e('Get Rid of <em>[problem]</em> Once and Forever', 'newsletter') ?></a><br>
|
includes/module.php
CHANGED
@@ -230,12 +230,12 @@ class TNP_Subscription_Data {
|
|
230 |
$subscriber->referrer = $this->referrer;
|
231 |
if (!empty($this->http_referrer))
|
232 |
$subscriber->http_referrer = $this->http_referrer;
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
|
240 |
|
241 |
foreach ($this->lists as $id => $value) {
|
@@ -267,8 +267,6 @@ class TNP_Subscription {
|
|
267 |
*/
|
268 |
var $data;
|
269 |
var $spamcheck = true;
|
270 |
-
|
271 |
-
|
272 |
// The optin to use, empty for the plugin default. It's a string to facilitate the use by addons (which have a selector for the desired
|
273 |
// optin as empty (for default), 'single' or 'double'.
|
274 |
var $optin = null;
|
@@ -363,7 +361,6 @@ class NewsletterModule {
|
|
363 |
*/
|
364 |
var $themes;
|
365 |
var $components;
|
366 |
-
|
367 |
static $current_language = '';
|
368 |
|
369 |
function __construct($module, $version, $module_id = null, $components = array()) {
|
@@ -847,7 +844,7 @@ class NewsletterModule {
|
|
847 |
}
|
848 |
|
849 |
function admin_menu() {
|
850 |
-
|
851 |
}
|
852 |
|
853 |
function add_menu_page($page, $title, $capability = '') {
|
@@ -993,8 +990,9 @@ class NewsletterModule {
|
|
993 |
|
994 |
/**
|
995 |
* Delete one or more emails identified by ID (single value or array of ID)
|
|
|
996 |
* @global wpdb $wpdb
|
997 |
-
* @param int|array $id
|
998 |
* @return boolean
|
999 |
*/
|
1000 |
function delete_email($id) {
|
@@ -1004,8 +1002,8 @@ class NewsletterModule {
|
|
1004 |
// $id could be an array if IDs
|
1005 |
$id = (array) $id;
|
1006 |
foreach ($id as $email_id) {
|
1007 |
-
$wpdb->delete(NEWSLETTER_STATS_TABLE,
|
1008 |
-
$wpdb->delete(NEWSLETTER_SENT_TABLE,
|
1009 |
}
|
1010 |
}
|
1011 |
return $r;
|
@@ -1060,7 +1058,7 @@ class NewsletterModule {
|
|
1060 |
if ($attrs['scheduled']) {
|
1061 |
echo '<span class="tnp-progress-date">', $this->format_date($email->send_on), '</span>';
|
1062 |
}
|
1063 |
-
|
1064 |
} else if ($email->status == 'new') {
|
1065 |
echo '';
|
1066 |
return;
|
@@ -1343,7 +1341,8 @@ class NewsletterModule {
|
|
1343 |
$profiles[$language] = [];
|
1344 |
$all = $this->get_profiles($language);
|
1345 |
foreach ($all as $profile) {
|
1346 |
-
if ($profile->is_private())
|
|
|
1347 |
|
1348 |
$profiles[$language]['' . $profile->id] = $profile;
|
1349 |
}
|
@@ -1365,7 +1364,8 @@ class NewsletterModule {
|
|
1365 |
$profiles[$language] = [];
|
1366 |
$all = $this->get_profiles($language);
|
1367 |
foreach ($all as $profile) {
|
1368 |
-
if (!$profile->show_on_profile())
|
|
|
1369 |
|
1370 |
$profiles[$language]['' . $profile->id] = $profile;
|
1371 |
}
|
@@ -1395,35 +1395,34 @@ class NewsletterModule {
|
|
1395 |
return $lists[$language];
|
1396 |
}
|
1397 |
|
1398 |
-
|
1399 |
-
|
1400 |
-
|
1401 |
-
|
1402 |
-
|
1403 |
-
|
1404 |
-
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
-
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
}
|
1427 |
|
1428 |
/**
|
1429 |
* Returns an array of TNP_List objects of lists that are public.
|
@@ -1528,7 +1527,20 @@ class NewsletterModule {
|
|
1528 |
$user['token'] = NewsletterModule::get_token();
|
1529 |
}
|
1530 |
}
|
1531 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1532 |
return $this->store->save(NEWSLETTER_USERS_TABLE, $user, $return_format);
|
1533 |
}
|
1534 |
|
@@ -2056,9 +2068,9 @@ class NewsletterModule {
|
|
2056 |
|
2057 |
public static function antibot_form_check($captcha = false) {
|
2058 |
|
2059 |
-
|
2060 |
-
|
2061 |
-
|
2062 |
|
2063 |
if (strtolower($_SERVER['REQUEST_METHOD']) != 'post') {
|
2064 |
return false;
|
230 |
$subscriber->referrer = $this->referrer;
|
231 |
if (!empty($this->http_referrer))
|
232 |
$subscriber->http_referrer = $this->http_referrer;
|
233 |
+
if (!empty($this->country))
|
234 |
+
$subscriber->country = $this->country;
|
235 |
+
if (!empty($this->region))
|
236 |
+
$subscriber->region = $this->region;
|
237 |
+
if (!empty($this->city))
|
238 |
+
$subscriber->city = $this->city;
|
239 |
|
240 |
|
241 |
foreach ($this->lists as $id => $value) {
|
267 |
*/
|
268 |
var $data;
|
269 |
var $spamcheck = true;
|
|
|
|
|
270 |
// The optin to use, empty for the plugin default. It's a string to facilitate the use by addons (which have a selector for the desired
|
271 |
// optin as empty (for default), 'single' or 'double'.
|
272 |
var $optin = null;
|
361 |
*/
|
362 |
var $themes;
|
363 |
var $components;
|
|
|
364 |
static $current_language = '';
|
365 |
|
366 |
function __construct($module, $version, $module_id = null, $components = array()) {
|
844 |
}
|
845 |
|
846 |
function admin_menu() {
|
847 |
+
|
848 |
}
|
849 |
|
850 |
function add_menu_page($page, $title, $capability = '') {
|
990 |
|
991 |
/**
|
992 |
* Delete one or more emails identified by ID (single value or array of ID)
|
993 |
+
*
|
994 |
* @global wpdb $wpdb
|
995 |
+
* @param int|array $id Single numeric ID or an array of IDs to be deleted
|
996 |
* @return boolean
|
997 |
*/
|
998 |
function delete_email($id) {
|
1002 |
// $id could be an array if IDs
|
1003 |
$id = (array) $id;
|
1004 |
foreach ($id as $email_id) {
|
1005 |
+
$wpdb->delete(NEWSLETTER_STATS_TABLE, ['email_id' => $email_id]);
|
1006 |
+
$wpdb->delete(NEWSLETTER_SENT_TABLE, ['email_id' => $email_id]);
|
1007 |
}
|
1008 |
}
|
1009 |
return $r;
|
1058 |
if ($attrs['scheduled']) {
|
1059 |
echo '<span class="tnp-progress-date">', $this->format_date($email->send_on), '</span>';
|
1060 |
}
|
1061 |
+
return;
|
1062 |
} else if ($email->status == 'new') {
|
1063 |
echo '';
|
1064 |
return;
|
1341 |
$profiles[$language] = [];
|
1342 |
$all = $this->get_profiles($language);
|
1343 |
foreach ($all as $profile) {
|
1344 |
+
if ($profile->is_private())
|
1345 |
+
continue;
|
1346 |
|
1347 |
$profiles[$language]['' . $profile->id] = $profile;
|
1348 |
}
|
1364 |
$profiles[$language] = [];
|
1365 |
$all = $this->get_profiles($language);
|
1366 |
foreach ($all as $profile) {
|
1367 |
+
if (!$profile->show_on_profile())
|
1368 |
+
continue;
|
1369 |
|
1370 |
$profiles[$language]['' . $profile->id] = $profile;
|
1371 |
}
|
1395 |
return $lists[$language];
|
1396 |
}
|
1397 |
|
1398 |
+
public function create_tnp_list_from_db_lists_array($db_lists_array, $list_id) {
|
1399 |
+
|
1400 |
+
$list = new TNP_List();
|
1401 |
+
$list->name = $db_lists_array['list_' . $list_id];
|
1402 |
+
$list->id = $list_id;
|
1403 |
+
|
1404 |
+
// New format
|
1405 |
+
if (isset($db_lists_array['list_' . $list_id . '_subscription'])) {
|
1406 |
+
$list->forced = !empty($db_lists_array['list_' . $list_id . '_forced']);
|
1407 |
+
$list->status = empty($db_lists_array['list_' . $list_id . '_status']) ? TNP_List::STATUS_PRIVATE : TNP_List::STATUS_PUBLIC;
|
1408 |
+
$list->checked = $db_lists_array['list_' . $list_id . '_subscription'] == 2;
|
1409 |
+
$list->show_on_subscription = $list->status != TNP_List::STATUS_PRIVATE && !empty($db_lists_array['list_' . $list_id . '_subscription']) && !$list->forced;
|
1410 |
+
$list->show_on_profile = $list->status != TNP_List::STATUS_PRIVATE && !empty($db_lists_array['list_' . $list_id . '_profile']);
|
1411 |
+
} else {
|
1412 |
+
$list->forced = !empty($db_lists_array['list_' . $list_id . '_forced']);
|
1413 |
+
$list->status = empty($db_lists_array['list_' . $list_id . '_status']) ? TNP_List::STATUS_PRIVATE : TNP_List::STATUS_PUBLIC;
|
1414 |
+
$list->checked = !empty($db_lists_array['list_' . $list_id . '_checked']);
|
1415 |
+
$list->show_on_subscription = $db_lists_array['list_' . $list_id . '_status'] == 2 && !$list->forced;
|
1416 |
+
$list->show_on_profile = $db_lists_array['list_' . $list_id . '_status'] == 1 || $db_lists_array['list_' . $list_id . '_status'] == 2;
|
1417 |
+
}
|
1418 |
+
if (empty($db_lists_array['list_' . $list_id . '_languages'])) {
|
1419 |
+
$list->languages = array();
|
1420 |
+
} else {
|
1421 |
+
$list->languages = $db_lists_array['list_' . $list_id . '_languages'];
|
1422 |
+
}
|
1423 |
+
|
1424 |
+
return $list;
|
1425 |
+
}
|
|
|
1426 |
|
1427 |
/**
|
1428 |
* Returns an array of TNP_List objects of lists that are public.
|
1527 |
$user['token'] = NewsletterModule::get_token();
|
1528 |
}
|
1529 |
}
|
1530 |
+
|
1531 |
+
// We still don't know when it happens but under some conditions, matbe external, lists are passed as NULL
|
1532 |
+
foreach ($user as $key => $value) {
|
1533 |
+
if (strpos($key, 'list_') !== 0) {
|
1534 |
+
continue;
|
1535 |
+
}
|
1536 |
+
if (is_null($value)) {
|
1537 |
+
unset($user[$key]);
|
1538 |
+
} else {
|
1539 |
+
$user[$key] = (int) $value;
|
1540 |
+
}
|
1541 |
+
}
|
1542 |
+
|
1543 |
+
// Due to the unique index on email field, this can fail.
|
1544 |
return $this->store->save(NEWSLETTER_USERS_TABLE, $user, $return_format);
|
1545 |
}
|
1546 |
|
2068 |
|
2069 |
public static function antibot_form_check($captcha = false) {
|
2070 |
|
2071 |
+
if (defined('NEWSLETTER_ANTIBOT') && !NEWSLETTER_ANTIBOT) {
|
2072 |
+
return true;
|
2073 |
+
}
|
2074 |
|
2075 |
if (strtolower($_SERVER['REQUEST_METHOD']) != 'post') {
|
2076 |
return false;
|
includes/store.php
CHANGED
@@ -189,7 +189,7 @@ class NewsletterStore {
|
|
189 |
}
|
190 |
$wpdb->query("delete from " . $table . " where id in (" . implode(',', $id) . ")");
|
191 |
} else {
|
192 |
-
$wpdb->delete($table,
|
193 |
}
|
194 |
if ($wpdb->last_error) {
|
195 |
$this->logger->error($wpdb->last_error);
|
189 |
}
|
190 |
$wpdb->query("delete from " . $table . " where id in (" . implode(',', $id) . ")");
|
191 |
} else {
|
192 |
+
$wpdb->delete($table, ['id' => (int)$id]);
|
193 |
}
|
194 |
if ($wpdb->last_error) {
|
195 |
$this->logger->error($wpdb->last_error);
|
plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
-
Version:
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
|
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
-
define('NEWSLETTER_VERSION', '
|
39 |
|
40 |
global $newsletter, $wpdb;
|
41 |
|
@@ -151,7 +151,7 @@ class Newsletter extends NewsletterModule {
|
|
151 |
return $schedules;
|
152 |
}, 1000);
|
153 |
|
154 |
-
parent::__construct('main', '1.6.
|
155 |
|
156 |
$max = $this->options['scheduler_max'];
|
157 |
if (!is_numeric($max)) {
|
@@ -314,6 +314,8 @@ class Newsletter extends NewsletterModule {
|
|
314 |
if (!$install_time) {
|
315 |
update_option('newsletter_install_time', time(), false);
|
316 |
}
|
|
|
|
|
317 |
|
318 |
Newsletter::instance()->upgrade();
|
319 |
NewsletterUsers::instance()->upgrade();
|
@@ -433,6 +435,8 @@ class Newsletter extends NewsletterModule {
|
|
433 |
|
434 |
delete_transient("tnp_extensions_json");
|
435 |
|
|
|
|
|
436 |
return true;
|
437 |
}
|
438 |
|
@@ -971,7 +975,17 @@ class Newsletter extends NewsletterModule {
|
|
971 |
$mailer->from_name = $this->options['sender_name'];
|
972 |
return $mailer->send($message);
|
973 |
}
|
974 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
975 |
function mail($to, $subject, $message, $headers = array(), $enqueue = false, $from = false) {
|
976 |
|
977 |
if (empty($subject)) {
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
+
Version: 7.0.0
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
+
define('NEWSLETTER_VERSION', '7.0.0');
|
39 |
|
40 |
global $newsletter, $wpdb;
|
41 |
|
151 |
return $schedules;
|
152 |
}, 1000);
|
153 |
|
154 |
+
parent::__construct('main', '1.6.5', null, array('info', 'smtp'));
|
155 |
|
156 |
$max = $this->options['scheduler_max'];
|
157 |
if (!is_numeric($max)) {
|
314 |
if (!$install_time) {
|
315 |
update_option('newsletter_install_time', time(), false);
|
316 |
}
|
317 |
+
|
318 |
+
touch(NEWSLETTER_LOG_DIR . '/index.html');
|
319 |
|
320 |
Newsletter::instance()->upgrade();
|
321 |
NewsletterUsers::instance()->upgrade();
|
435 |
|
436 |
delete_transient("tnp_extensions_json");
|
437 |
|
438 |
+
touch(NEWSLETTER_LOG_DIR . '/index.html');
|
439 |
+
|
440 |
return true;
|
441 |
}
|
442 |
|
975 |
$mailer->from_name = $this->options['sender_name'];
|
976 |
return $mailer->send($message);
|
977 |
}
|
978 |
+
|
979 |
+
/**
|
980 |
+
*
|
981 |
+
* @param type $to
|
982 |
+
* @param type $subject
|
983 |
+
* @param string|array $message If string is considered HTML, is array should contains the keys "html" and "text"
|
984 |
+
* @param type $headers
|
985 |
+
* @param type $enqueue
|
986 |
+
* @param type $from
|
987 |
+
* @return boolean
|
988 |
+
*/
|
989 |
function mail($to, $subject, $message, $headers = array(), $enqueue = false, $from = false) {
|
990 |
|
991 |
if (empty($subject)) {
|
readme.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
=== Newsletter ===
|
2 |
Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
-
Tested up to: 5.
|
5 |
-
Stable tag:
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
@@ -59,7 +59,7 @@ Improve The Newsletter Plugin with these free addons:
|
|
59 |
|
60 |
= Addons on WordPress.org =
|
61 |
|
62 |
-
* [RSS Composer Block](https://wordpress.org/plugins/newsletter-rss-block/) - (3rd party) a composer block which builds its content
|
63 |
* [Popup Maker Integration](https://wordpress.org/plugins/newsletter-popupmaker/) - (3rd party) integration of Newsletter forms with Popup Maker plugin
|
64 |
* [BuddyPress integration](https://wordpress.org/plugins/newsletter-buddypress/) - subscription opt-in inside BuddyPress signup form
|
65 |
* [WP User Manager addon for Newsletter](https://wordpress.org/plugins/wpum-newsletter/) - adds the subscription option on registration forms
|
@@ -118,6 +118,12 @@ Thank you, The Newsletter Team
|
|
118 |
|
119 |
== Changelog ==
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
= 6.9.9 =
|
122 |
|
123 |
* Not specified gender fix
|
1 |
=== Newsletter ===
|
2 |
Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
+
Tested up to: 5.6
|
5 |
+
Stable tag: 7.0.0
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
59 |
|
60 |
= Addons on WordPress.org =
|
61 |
|
62 |
+
* [RSS Composer Block](https://wordpress.org/plugins/newsletter-rss-block/) - (3rd party) a composer block which builds its content from a RSS feed
|
63 |
* [Popup Maker Integration](https://wordpress.org/plugins/newsletter-popupmaker/) - (3rd party) integration of Newsletter forms with Popup Maker plugin
|
64 |
* [BuddyPress integration](https://wordpress.org/plugins/newsletter-buddypress/) - subscription opt-in inside BuddyPress signup form
|
65 |
* [WP User Manager addon for Newsletter](https://wordpress.org/plugins/wpum-newsletter/) - adds the subscription option on registration forms
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
* Added multiple newsletter selection for deletion
|
122 |
+
* Added text part on welcome and activation email
|
123 |
+
* Added the attribute "show_form" to "newsletter" shortcode
|
124 |
+
* Added filter on subscriber saving (from external systems) with wrong list field values
|
125 |
+
* Added index.html on log folder
|
126 |
+
|
127 |
= 6.9.9 =
|
128 |
|
129 |
* Not specified gender fix
|
subscription/subscription.php
CHANGED
@@ -912,11 +912,11 @@ class NewsletterSubscription extends NewsletterModule {
|
|
912 |
}
|
913 |
|
914 |
/**
|
915 |
-
* Sends a service message applying the template
|
916 |
*
|
917 |
* @param TNP_User $user
|
918 |
* @param string $subject
|
919 |
-
* @param string $message
|
920 |
* @return type
|
921 |
*/
|
922 |
function mail($user, $subject, $message) {
|
@@ -928,14 +928,21 @@ class NewsletterSubscription extends NewsletterModule {
|
|
928 |
if (empty($template) || strpos($template, '{message}') === false) {
|
929 |
$template = '{message}';
|
930 |
}
|
931 |
-
|
932 |
-
|
933 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
934 |
|
935 |
-
$headers =
|
936 |
|
937 |
// Replaces tags from the template
|
938 |
-
|
939 |
$subject = $this->replace($subject, $user);
|
940 |
|
941 |
return Newsletter::instance()->mail($user->email, $subject, $message, $headers);
|
@@ -1020,14 +1027,26 @@ class NewsletterSubscription extends NewsletterModule {
|
|
1020 |
$language = $this->get_user_language($user);
|
1021 |
|
1022 |
$options = $this->get_options('', $language);
|
1023 |
-
$message =
|
|
|
|
|
1024 |
if ($user->status == Newsletter::STATUS_NOT_CONFIRMED) {
|
1025 |
-
$message = $this->add_microdata($message);
|
1026 |
}
|
1027 |
$subject = $options[$type . '_subject'];
|
1028 |
|
1029 |
return $this->mail($user, $subject, $message);
|
1030 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1031 |
|
1032 |
function is_double_optin() {
|
1033 |
return $this->options['noconfirmation'] == 0;
|
@@ -1814,6 +1833,10 @@ class NewsletterSubscription extends NewsletterModule {
|
|
1814 |
|
1815 |
// Now check what form must be added
|
1816 |
if ($message_key == 'subscription') {
|
|
|
|
|
|
|
|
|
1817 |
|
1818 |
// Compatibility check
|
1819 |
if (stripos($message, '<form') !== false) {
|
912 |
}
|
913 |
|
914 |
/**
|
915 |
+
* Sends a service message applying the template to the HTML part
|
916 |
*
|
917 |
* @param TNP_User $user
|
918 |
* @param string $subject
|
919 |
+
* @param string|array $message If string it is considered HTML, if array it should contains the key "html" and "text"
|
920 |
* @return type
|
921 |
*/
|
922 |
function mail($user, $subject, $message) {
|
928 |
if (empty($template) || strpos($template, '{message}') === false) {
|
929 |
$template = '{message}';
|
930 |
}
|
931 |
+
|
932 |
+
if (is_array($message)) {
|
933 |
+
$message['html'] = str_replace('{message}', $message['html'], $template);
|
934 |
+
$message['html'] = $this->replace($message['html'], $user);
|
935 |
+
$message['text'] = $this->replace($message['text'], $user);
|
936 |
+
}
|
937 |
+
else {
|
938 |
+
$message = str_replace('{message}', $message, $template);
|
939 |
+
$message = $this->replace($message, $user);
|
940 |
+
}
|
941 |
|
942 |
+
$headers = [];
|
943 |
|
944 |
// Replaces tags from the template
|
945 |
+
|
946 |
$subject = $this->replace($subject, $user);
|
947 |
|
948 |
return Newsletter::instance()->mail($user->email, $subject, $message, $headers);
|
1027 |
$language = $this->get_user_language($user);
|
1028 |
|
1029 |
$options = $this->get_options('', $language);
|
1030 |
+
$message = [];
|
1031 |
+
$message['html'] = $options[$type . '_message'];
|
1032 |
+
$message['text'] = $this->get_text_message($type);
|
1033 |
if ($user->status == Newsletter::STATUS_NOT_CONFIRMED) {
|
1034 |
+
$message['html'] = $this->add_microdata($message['html']);
|
1035 |
}
|
1036 |
$subject = $options[$type . '_subject'];
|
1037 |
|
1038 |
return $this->mail($user, $subject, $message);
|
1039 |
}
|
1040 |
+
|
1041 |
+
function get_text_message($type) {
|
1042 |
+
switch ($type) {
|
1043 |
+
case 'confirmation':
|
1044 |
+
return __('To confirm your subscription follow the link below.', 'newsletter') . "\n\n{subscription_confirm_url}";
|
1045 |
+
case 'confirmed':
|
1046 |
+
return __('Your subscription has been confirmed.', 'newsletter');
|
1047 |
+
}
|
1048 |
+
return '';
|
1049 |
+
}
|
1050 |
|
1051 |
function is_double_optin() {
|
1052 |
return $this->options['noconfirmation'] == 0;
|
1833 |
|
1834 |
// Now check what form must be added
|
1835 |
if ($message_key == 'subscription') {
|
1836 |
+
if (isset($attrs['show_form']) && $attrs['show_form'] === 'false') {
|
1837 |
+
//return $this->build_field_admin_notice('The [newsletter] shortcode is configured to not show the subscription form.');
|
1838 |
+
return;
|
1839 |
+
}
|
1840 |
|
1841 |
// Compatibility check
|
1842 |
if (stripos($message, '<form') !== false) {
|
users/index.php
CHANGED
@@ -169,7 +169,7 @@ $controls->data['search_page'] ++;
|
|
169 |
<table class="widefat">
|
170 |
<thead>
|
171 |
<tr>
|
172 |
-
<th><input type="checkbox" onchange="jQuery('input.tnp-selector').prop('checked', this.checked)"
|
173 |
<th>Id</th>
|
174 |
<th>Email</th>
|
175 |
<th><?php _e('Name', 'newsletter') ?></th>
|
169 |
<table class="widefat">
|
170 |
<thead>
|
171 |
<tr>
|
172 |
+
<th><input type="checkbox" onchange="jQuery('input.tnp-selector').prop('checked', this.checked)"></th>
|
173 |
<th>Id</th>
|
174 |
<th>Email</th>
|
175 |
<th><?php _e('Name', 'newsletter') ?></th>
|