Version Description
- Added more detailed admin logging
- Fixed scheduled date sometimes reset to 1/1/1970
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.2.1 |
Comparing to | |
See all releases |
Code changes from version 7.2.0 to 7.2.1
- emails/composer.php +14 -14
- emails/edit.php +24 -8
- includes/logger.php +21 -11
- includes/module.php +8 -0
- plugin.php +2 -2
- readme.txt +7 -2
emails/composer.php
CHANGED
@@ -24,12 +24,12 @@ if ($controls->is_action()) {
|
|
24 |
$email->subject = $module->sanitize_preset_name($controls->data['subject']);
|
25 |
$email->message = $controls->data['message'];
|
26 |
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
|
34 |
$email = Newsletter::instance()->save_email($email);
|
35 |
|
@@ -53,11 +53,11 @@ if ($controls->is_action()) {
|
|
53 |
$email = Newsletter::instance()->save_email($email);
|
54 |
|
55 |
//Save Global Style options
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
|
62 |
$redirect = $module->get_admin_page_url('composer');
|
63 |
$controls->js_redirect($redirect);
|
@@ -68,6 +68,8 @@ if ($controls->is_action()) {
|
|
68 |
|
69 |
if (empty($_GET['id'])) {
|
70 |
|
|
|
|
|
71 |
// Create a new email
|
72 |
$email = new stdClass();
|
73 |
$email->status = 'new';
|
@@ -84,7 +86,7 @@ if ($controls->is_action()) {
|
|
84 |
|
85 |
$email = Newsletter::instance()->save_email($email);
|
86 |
} else {
|
87 |
-
|
88 |
$email = Newsletter::instance()->get_email($_GET['id']);
|
89 |
TNP_Composer::update_email($email, $controls);
|
90 |
$email = Newsletter::instance()->save_email($email);
|
@@ -92,7 +94,6 @@ if ($controls->is_action()) {
|
|
92 |
|
93 |
$controls->add_message_saved();
|
94 |
|
95 |
-
|
96 |
if ($controls->is_action('test')) {
|
97 |
$module->send_test_email($module->get_email($email->id), $controls);
|
98 |
}
|
@@ -114,7 +115,6 @@ if ($controls->is_action()) {
|
|
114 |
}
|
115 |
|
116 |
TNP_Composer::prepare_controls($controls, $email);
|
117 |
-
|
118 |
?>
|
119 |
|
120 |
<div id="tnp-notification">
|
24 |
$email->subject = $module->sanitize_preset_name($controls->data['subject']);
|
25 |
$email->message = $controls->data['message'];
|
26 |
|
27 |
+
//Save Global Style options
|
28 |
+
foreach ($controls->data as $name => $value) {
|
29 |
+
if (strpos($name, 'options_composer_') === 0) {
|
30 |
+
$email->options[substr($name, 8)] = $value;
|
31 |
+
}
|
32 |
+
}
|
33 |
|
34 |
$email = Newsletter::instance()->save_email($email);
|
35 |
|
53 |
$email = Newsletter::instance()->save_email($email);
|
54 |
|
55 |
//Save Global Style options
|
56 |
+
foreach ($controls->data as $name => $value) {
|
57 |
+
if (strpos($name, 'options_composer_') === 0) {
|
58 |
+
$email->options[substr($name, 8)] = $value;
|
59 |
+
}
|
60 |
+
}
|
61 |
|
62 |
$redirect = $module->get_admin_page_url('composer');
|
63 |
$controls->js_redirect($redirect);
|
68 |
|
69 |
if (empty($_GET['id'])) {
|
70 |
|
71 |
+
$this->admin_logger->info('Saving new newsletter from composer');
|
72 |
+
|
73 |
// Create a new email
|
74 |
$email = new stdClass();
|
75 |
$email->status = 'new';
|
86 |
|
87 |
$email = Newsletter::instance()->save_email($email);
|
88 |
} else {
|
89 |
+
$this->admin_logger->info('Saving newsletter ' . $_GET['id'] . ' from composer');
|
90 |
$email = Newsletter::instance()->get_email($_GET['id']);
|
91 |
TNP_Composer::update_email($email, $controls);
|
92 |
$email = Newsletter::instance()->save_email($email);
|
94 |
|
95 |
$controls->add_message_saved();
|
96 |
|
|
|
97 |
if ($controls->is_action('test')) {
|
98 |
$module->send_test_email($module->get_email($email->id), $controls);
|
99 |
}
|
115 |
}
|
116 |
|
117 |
TNP_Composer::prepare_controls($controls, $email);
|
|
|
118 |
?>
|
119 |
|
120 |
<div id="tnp-notification">
|
emails/edit.php
CHANGED
@@ -27,18 +27,21 @@ $email_id = $email['id'];
|
|
27 |
|
28 |
/* Satus changes which require a reload */
|
29 |
if ($controls->is_action('pause')) {
|
|
|
30 |
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'paused'), array('id' => $email_id));
|
31 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
32 |
tnp_prepare_controls($email, $controls);
|
33 |
}
|
34 |
|
35 |
if ($controls->is_action('continue')) {
|
|
|
36 |
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'sending'), array('id' => $email_id));
|
37 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
38 |
tnp_prepare_controls($email, $controls);
|
39 |
}
|
40 |
|
41 |
if ($controls->is_action('abort')) {
|
|
|
42 |
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set last_id=0, sent=0, status='new' where id=" . $email_id);
|
43 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
44 |
tnp_prepare_controls($email, $controls);
|
@@ -56,7 +59,7 @@ if ($controls->is_action('change-private')) {
|
|
56 |
}
|
57 |
|
58 |
|
59 |
-
$editor_type = $
|
60 |
|
61 |
// Backward compatibility: preferences conversion
|
62 |
if (!$controls->is_action()) {
|
@@ -94,6 +97,8 @@ if (!$controls->is_action()) {
|
|
94 |
|
95 |
if ($controls->is_action('html')) {
|
96 |
|
|
|
|
|
97 |
$data = [];
|
98 |
$data['editor'] = NewsletterEmails::EDITOR_HTML;
|
99 |
$data['id'] = $email_id;
|
@@ -115,6 +120,14 @@ if ($controls->is_action('html')) {
|
|
115 |
|
116 |
if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('schedule')) {
|
117 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
$email['subject'] = $controls->data['subject'];
|
119 |
$email['track'] = $controls->data['track'];
|
120 |
$email['editor'] = $editor_type;
|
@@ -123,7 +136,10 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
|
|
123 |
if ($controls->is_action('send')) {
|
124 |
$email['send_on'] = time();
|
125 |
} else {
|
126 |
-
|
|
|
|
|
|
|
127 |
}
|
128 |
|
129 |
// Reset and refill the options
|
@@ -253,8 +269,8 @@ if ($controls->is_action('send') || $controls->is_action('schedule')) {
|
|
253 |
if ($email['subject'] == '') {
|
254 |
$controls->errors = __('A subject is required to send', 'newsletter');
|
255 |
} else {
|
256 |
-
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' =>
|
257 |
-
$email['status'] =
|
258 |
if ($controls->is_action('send')) {
|
259 |
$controls->messages = __('Now sending.', 'newsletter');
|
260 |
} else {
|
@@ -486,19 +502,19 @@ if ($email['status'] != 'sent') {
|
|
486 |
<td>
|
487 |
<?php $controls->text_email('options_sender_email', 40); ?>
|
488 |
<div class="tnpc-hint">
|
489 |
-
Original: <?php echo esc_html(Newsletter::instance()->get_sender_email())?>.<br>
|
490 |
If you use a delivery service, be sure to use a validated email address.
|
491 |
</div>
|
492 |
</td>
|
493 |
</tr>
|
494 |
-
|
495 |
<th>
|
496 |
<?php _e('Sender name', 'newsletter') ?>
|
497 |
</th>
|
498 |
<td>
|
499 |
<?php $controls->text('options_sender_name', 40); ?>
|
500 |
-
|
501 |
-
|
502 |
</div>
|
503 |
</td>
|
504 |
</tr>
|
27 |
|
28 |
/* Satus changes which require a reload */
|
29 |
if ($controls->is_action('pause')) {
|
30 |
+
$this->admin_logger->info('Newsletter ' . $email_id . ' paused');
|
31 |
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'paused'), array('id' => $email_id));
|
32 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
33 |
tnp_prepare_controls($email, $controls);
|
34 |
}
|
35 |
|
36 |
if ($controls->is_action('continue')) {
|
37 |
+
$this->admin_logger->info('Newsletter ' . $email_id . ' restarted');
|
38 |
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => 'sending'), array('id' => $email_id));
|
39 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
40 |
tnp_prepare_controls($email, $controls);
|
41 |
}
|
42 |
|
43 |
if ($controls->is_action('abort')) {
|
44 |
+
$this->admin_logger->info('Newsletter ' . $email_id . ' aborted');
|
45 |
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set last_id=0, sent=0, status='new' where id=" . $email_id);
|
46 |
$email = $this->get_email($_GET['id'], ARRAY_A);
|
47 |
tnp_prepare_controls($email, $controls);
|
59 |
}
|
60 |
|
61 |
|
62 |
+
$editor_type = $this->get_editor_type($email);
|
63 |
|
64 |
// Backward compatibility: preferences conversion
|
65 |
if (!$controls->is_action()) {
|
97 |
|
98 |
if ($controls->is_action('html')) {
|
99 |
|
100 |
+
$this->admin_logger->info('Newsletter ' . $email_id . ' converted to HTML');
|
101 |
+
|
102 |
$data = [];
|
103 |
$data['editor'] = NewsletterEmails::EDITOR_HTML;
|
104 |
$data['id'] = $email_id;
|
120 |
|
121 |
if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('schedule')) {
|
122 |
|
123 |
+
if ($controls->is_action('save')) {
|
124 |
+
$this->admin_logger->info('Saving newsletter: ' . $email_id);
|
125 |
+
} else if ($controls->is_action('send')) {
|
126 |
+
$this->admin_logger->info('Sending newsletter: ' . $email_id);
|
127 |
+
} else if ($controls->is_action('schedule')) {
|
128 |
+
$this->admin_logger->info('Scheduling newsletter: ' . $email_id);
|
129 |
+
}
|
130 |
+
|
131 |
$email['subject'] = $controls->data['subject'];
|
132 |
$email['track'] = $controls->data['track'];
|
133 |
$email['editor'] = $editor_type;
|
136 |
if ($controls->is_action('send')) {
|
137 |
$email['send_on'] = time();
|
138 |
} else {
|
139 |
+
// Patch, empty on continuation
|
140 |
+
if (!empty($controls->data['send_on'])) {
|
141 |
+
$email['send_on'] = $controls->data['send_on'];
|
142 |
+
}
|
143 |
}
|
144 |
|
145 |
// Reset and refill the options
|
269 |
if ($email['subject'] == '') {
|
270 |
$controls->errors = __('A subject is required to send', 'newsletter');
|
271 |
} else {
|
272 |
+
$wpdb->update(NEWSLETTER_EMAILS_TABLE, array('status' => TNP_Email::STATUS_SENDING), array('id' => $email_id));
|
273 |
+
$email['status'] = TNP_Email::STATUS_SENDING;
|
274 |
if ($controls->is_action('send')) {
|
275 |
$controls->messages = __('Now sending.', 'newsletter');
|
276 |
} else {
|
502 |
<td>
|
503 |
<?php $controls->text_email('options_sender_email', 40); ?>
|
504 |
<div class="tnpc-hint">
|
505 |
+
Original: <?php echo esc_html(Newsletter::instance()->get_sender_email()) ?>.<br>
|
506 |
If you use a delivery service, be sure to use a validated email address.
|
507 |
</div>
|
508 |
</td>
|
509 |
</tr>
|
510 |
+
<tr>
|
511 |
<th>
|
512 |
<?php _e('Sender name', 'newsletter') ?>
|
513 |
</th>
|
514 |
<td>
|
515 |
<?php $controls->text('options_sender_name', 40); ?>
|
516 |
+
<div class="tnpc-hint">
|
517 |
+
Original: <?php echo esc_html(Newsletter::instance()->get_sender_name()) ?>
|
518 |
</div>
|
519 |
</td>
|
520 |
</tr>
|
includes/logger.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
defined('ABSPATH') || exit;
|
3 |
|
4 |
if (!defined('NEWSLETTER_LOG_DIR')) {
|
@@ -19,8 +20,10 @@ class NewsletterLogger {
|
|
19 |
|
20 |
function __construct($module) {
|
21 |
$this->module = $module;
|
22 |
-
if (defined('NEWSLETTER_LOG_LEVEL'))
|
23 |
-
|
|
|
|
|
24 |
|
25 |
$secret = get_option('newsletter_logger_secret');
|
26 |
if (strlen($secret) < 8) {
|
@@ -42,13 +45,17 @@ class NewsletterLogger {
|
|
42 |
*/
|
43 |
function log($text, $level = self::ERROR) {
|
44 |
global $current_user;
|
45 |
-
|
46 |
-
if ($level != self::FATAL && $this->level < $level)
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
50 |
} else {
|
51 |
-
$
|
52 |
}
|
53 |
|
54 |
$time = date('d-m-Y H:i:s ');
|
@@ -66,11 +73,14 @@ class NewsletterLogger {
|
|
66 |
/* @var $text WP_Error */
|
67 |
$text = $text->get_error_message() . ' (' . $text->get_error_code() . ') - ' . print_r($text->get_error_data(), true);
|
68 |
} else {
|
69 |
-
if (is_array($text) || is_object($text))
|
|
|
70 |
}
|
71 |
-
|
|
|
|
|
72 |
// The "logs" dir is created on Newsletter constructor.
|
73 |
-
$res = @file_put_contents($this->file, $time . ' -
|
74 |
if ($res === false) {
|
75 |
//$this->level = self::NONE;
|
76 |
}
|
1 |
<?php
|
2 |
+
|
3 |
defined('ABSPATH') || exit;
|
4 |
|
5 |
if (!defined('NEWSLETTER_LOG_DIR')) {
|
20 |
|
21 |
function __construct($module) {
|
22 |
$this->module = $module;
|
23 |
+
if (defined('NEWSLETTER_LOG_LEVEL'))
|
24 |
+
$this->level = NEWSLETTER_LOG_LEVEL;
|
25 |
+
else
|
26 |
+
$this->level = (int) get_option('newsletter_log_level', self::ERROR);
|
27 |
|
28 |
$secret = get_option('newsletter_logger_secret');
|
29 |
if (strlen($secret) < 8) {
|
45 |
*/
|
46 |
function log($text, $level = self::ERROR) {
|
47 |
global $current_user;
|
48 |
+
|
49 |
+
if ($level != self::FATAL && $this->level < $level) {
|
50 |
+
return;
|
51 |
+
}
|
52 |
+
|
53 |
+
if (defined('DOING_CRON') && DOING_CRON) {
|
54 |
+
$user = '[cron]';
|
55 |
+
} else if ($current_user) {
|
56 |
+
$user = $current_user->user_login;
|
57 |
} else {
|
58 |
+
$user = '[no user]';
|
59 |
}
|
60 |
|
61 |
$time = date('d-m-Y H:i:s ');
|
73 |
/* @var $text WP_Error */
|
74 |
$text = $text->get_error_message() . ' (' . $text->get_error_code() . ') - ' . print_r($text->get_error_data(), true);
|
75 |
} else {
|
76 |
+
if (is_array($text) || is_object($text))
|
77 |
+
$text = print_r($text, true);
|
78 |
}
|
79 |
+
|
80 |
+
$memory_limit = size_format(wp_convert_hr_to_bytes(ini_get('memory_limit')));
|
81 |
+
|
82 |
// The "logs" dir is created on Newsletter constructor.
|
83 |
+
$res = @file_put_contents($this->file, $time . ' - ' . NEWSLETTER_VERSION . ' - ' . size_format(memory_get_usage(), 1) . '/' . $memory_limit . ' - ' . $user . ' > ' . $text . "\n", FILE_APPEND | FILE_TEXT);
|
84 |
if ($res === false) {
|
85 |
//$this->level = self::NONE;
|
86 |
}
|
includes/module.php
CHANGED
@@ -368,6 +368,11 @@ class NewsletterModule {
|
|
368 |
* @var NewsletterLogger
|
369 |
*/
|
370 |
var $logger;
|
|
|
|
|
|
|
|
|
|
|
371 |
|
372 |
/**
|
373 |
* @var NewsletterStore
|
@@ -413,12 +418,15 @@ class NewsletterModule {
|
|
413 |
$this->components = $components;
|
414 |
|
415 |
$this->logger = new NewsletterLogger($module);
|
|
|
|
|
416 |
$this->options = $this->get_options();
|
417 |
$this->store = NewsletterStore::singleton();
|
418 |
|
419 |
//$this->logger->debug($module . ' constructed');
|
420 |
// Version check
|
421 |
if (is_admin()) {
|
|
|
422 |
$this->old_version = get_option($this->prefix . '_version', '0.0.0');
|
423 |
|
424 |
if ($this->old_version == '0.0.0') {
|
368 |
* @var NewsletterLogger
|
369 |
*/
|
370 |
var $logger;
|
371 |
+
|
372 |
+
/**
|
373 |
+
* @var NewsletterLogger
|
374 |
+
*/
|
375 |
+
var $admin_logger;
|
376 |
|
377 |
/**
|
378 |
* @var NewsletterStore
|
418 |
$this->components = $components;
|
419 |
|
420 |
$this->logger = new NewsletterLogger($module);
|
421 |
+
|
422 |
+
|
423 |
$this->options = $this->get_options();
|
424 |
$this->store = NewsletterStore::singleton();
|
425 |
|
426 |
//$this->logger->debug($module . ' constructed');
|
427 |
// Version check
|
428 |
if (is_admin()) {
|
429 |
+
$this->admin_logger = new NewsletterLogger($module . '-admin');
|
430 |
$this->old_version = get_option($this->prefix . '_version', '0.0.0');
|
431 |
|
432 |
if ($this->old_version == '0.0.0') {
|
plugin.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Newsletter
|
5 |
Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
|
6 |
Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
|
7 |
-
Version: 7.2.
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
|
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
-
define('NEWSLETTER_VERSION', '7.2.
|
39 |
|
40 |
global $newsletter, $wpdb;
|
41 |
|
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.2.1
|
8 |
Author: Stefano Lissa & The Newsletter Team
|
9 |
Author URI: https://www.thenewsletterplugin.com
|
10 |
Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
|
35 |
return;
|
36 |
}
|
37 |
|
38 |
+
define('NEWSLETTER_VERSION', '7.2.1');
|
39 |
|
40 |
global $newsletter, $wpdb;
|
41 |
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, contact, lead generation, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 5.7.2
|
5 |
-
Stable tag: 7.2.
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
@@ -120,11 +120,16 @@ Thank you, The Newsletter Team
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
|
|
|
|
123 |
= 7.2.0 =
|
124 |
|
125 |
* Fixed activation email on profile change
|
126 |
* Extended year selection on newsletter scheduling
|
127 |
-
* [DELIVERY] Breaking change: old enqueue() and flush() methods
|
128 |
* Fixed alert message on some buttons
|
129 |
* Fixed error message on multiple subscriptions (when not allowed)
|
130 |
* Fixed erratic error log line on main log
|
2 |
Tags: newsletter, email marketing, welcome email, signup forms, contact, lead generation, marketing automation
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 5.7.2
|
5 |
+
Stable tag: 7.2.1
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
120 |
|
121 |
== Changelog ==
|
122 |
|
123 |
+
= 7.2.1 =
|
124 |
+
|
125 |
+
* Added more detailed admin logging
|
126 |
+
* Fixed scheduled date sometimes reset to 1/1/1970
|
127 |
+
|
128 |
= 7.2.0 =
|
129 |
|
130 |
* Fixed activation email on profile change
|
131 |
* Extended year selection on newsletter scheduling
|
132 |
+
* [DELIVERY] Breaking change: old enqueue() and flush() methods have been removed
|
133 |
* Fixed alert message on some buttons
|
134 |
* Fixed error message on multiple subscriptions (when not allowed)
|
135 |
* Fixed erratic error log line on main log
|