Version Description
- Fixed activation email on profile change
- Extended year selection on newsletter scheduling
- [DELIVERY] Breaking change: old enqueue() and flush() methods has been removed
- Fixed alert message on some buttons
- Fixed error message on multiple subscriptions (when not allowed)
- Fixed erratic error log line on main log
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 7.2.0 |
Comparing to | |
See all releases |
Code changes from version 7.1.9 to 7.2.0
- includes/addon.php +112 -3
- includes/controls.php +10 -9
- includes/logger.php +1 -1
- includes/mailer.php +1 -42
- includes/module.php +34 -33
- plugin.php +2 -2
- profile/profile.php +1 -0
- readme.txt +10 -1
- subscription/subscription.php +2 -1
- tnp-header.php +2 -0
includes/addon.php
CHANGED
@@ -55,11 +55,11 @@ class NewsletterAddon {
|
|
55 |
function is_allowed() {
|
56 |
return Newsletter::instance()->is_allowed();
|
57 |
}
|
58 |
-
|
59 |
function get_languages() {
|
60 |
return Newsletter::instance()->get_languages();
|
61 |
}
|
62 |
-
|
63 |
function is_multilanguage() {
|
64 |
return Newsletter::instance()->is_multilanguage();
|
65 |
}
|
@@ -190,9 +190,13 @@ class NewsletterAddon {
|
|
190 |
class NewsletterMailerAddon extends NewsletterAddon {
|
191 |
|
192 |
var $enabled = false;
|
|
|
|
|
|
|
193 |
|
194 |
-
function __construct($name, $version = '0.0.0') {
|
195 |
parent::__construct($name, $version);
|
|
|
196 |
$this->setup_options();
|
197 |
$this->enabled = !empty($this->options['enabled']);
|
198 |
}
|
@@ -207,6 +211,24 @@ class NewsletterMailerAddon extends NewsletterAddon {
|
|
207 |
Newsletter::instance()->register_mailer($this->get_mailer());
|
208 |
}
|
209 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
}
|
211 |
|
212 |
/**
|
@@ -285,3 +307,90 @@ class NewsletterMailerAddon extends NewsletterAddon {
|
|
285 |
}
|
286 |
|
287 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
function is_allowed() {
|
56 |
return Newsletter::instance()->is_allowed();
|
57 |
}
|
58 |
+
|
59 |
function get_languages() {
|
60 |
return Newsletter::instance()->get_languages();
|
61 |
}
|
62 |
+
|
63 |
function is_multilanguage() {
|
64 |
return Newsletter::instance()->is_multilanguage();
|
65 |
}
|
190 |
class NewsletterMailerAddon extends NewsletterAddon {
|
191 |
|
192 |
var $enabled = false;
|
193 |
+
var $menu_title = null;
|
194 |
+
var $menu_description = null;
|
195 |
+
var $dir = '';
|
196 |
|
197 |
+
function __construct($name, $version = '0.0.0', $dir = '') {
|
198 |
parent::__construct($name, $version);
|
199 |
+
$this->dir = $dir;
|
200 |
$this->setup_options();
|
201 |
$this->enabled = !empty($this->options['enabled']);
|
202 |
}
|
211 |
Newsletter::instance()->register_mailer($this->get_mailer());
|
212 |
}
|
213 |
});
|
214 |
+
|
215 |
+
if (is_admin() && !empty($this->menu_title) && !empty($this->dir) && current_user_can('administrator')) {
|
216 |
+
add_action('admin_menu', [$this, 'hook_admin_menu'], 101);
|
217 |
+
add_filter('newsletter_menu_settings', [$this, 'hook_newsletter_menu_settings']);
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
function hook_newsletter_menu_settings($entries) {
|
222 |
+
$entries[] = array('label' => '<i class="fas fa-envelope"></i> ' . $this->menu_title, 'url' => '?page=newsletter_' . $this->name . '_index', 'description' => $this->menu_description);
|
223 |
+
return $entries;
|
224 |
+
}
|
225 |
+
|
226 |
+
function hook_admin_menu() {
|
227 |
+
add_submenu_page('newsletter_main_index', $this->menu_title, '<span class="tnp-side-menu">' . $this->menu_title . '</span>', 'manage_options', 'newsletter_' . $this->name . '_index',
|
228 |
+
function () {
|
229 |
+
require $this->dir . '/index.php';
|
230 |
+
}
|
231 |
+
);
|
232 |
}
|
233 |
|
234 |
/**
|
307 |
}
|
308 |
|
309 |
}
|
310 |
+
|
311 |
+
class NewsletterFormManagerAddon extends NewsletterAddon {
|
312 |
+
|
313 |
+
var $menu_title = null;
|
314 |
+
var $menu_description = null;
|
315 |
+
var $dir = '';
|
316 |
+
|
317 |
+
function __construct($name, $version, $dir) {
|
318 |
+
parent::__construct($name, $version);
|
319 |
+
$this->dir = $dir;
|
320 |
+
$this->setup_options();
|
321 |
+
}
|
322 |
+
|
323 |
+
function init() {
|
324 |
+
parent::init();
|
325 |
+
|
326 |
+
if (is_admin() && !empty($this->menu_title) && !empty($this->dir) && current_user_can('administrator')) {
|
327 |
+
add_action('admin_menu', [$this, 'hook_admin_menu'], 101);
|
328 |
+
add_filter('newsletter_menu_subscription', [$this, 'hook_newsletter_menu_subscription']);
|
329 |
+
}
|
330 |
+
}
|
331 |
+
|
332 |
+
function hook_newsletter_menu_subscription($entries) {
|
333 |
+
$entries[] = array('label' => '<i class="fas fa-envelope"></i> ' . $this->menu_title, 'url' => '?page=newsletter_' . $this->name . '_index', 'description' => $this->menu_description);
|
334 |
+
return $entries;
|
335 |
+
}
|
336 |
+
|
337 |
+
function hook_admin_menu() {
|
338 |
+
add_submenu_page('newsletter_main_index', $this->menu_title, '<span class="tnp-side-menu">' . $this->menu_title . '</span>', 'manage_options', 'newsletter_' . $this->name . '_index',
|
339 |
+
function () {
|
340 |
+
require $this->dir . '/admin/index.php';
|
341 |
+
}
|
342 |
+
);
|
343 |
+
}
|
344 |
+
|
345 |
+
/**
|
346 |
+
* Returns a lists of representations of forms available in the plugin subject of integration.
|
347 |
+
* Usually the $fields is not set up on returned objects.
|
348 |
+
* Must be implemented.
|
349 |
+
*
|
350 |
+
* @return TNP_FormManager_Form[] List of forms by 3rd party plugin
|
351 |
+
*/
|
352 |
+
function get_forms() {
|
353 |
+
return [];
|
354 |
+
}
|
355 |
+
|
356 |
+
/**
|
357 |
+
* Build a form general representation of a real form from a form manager plugin extracting
|
358 |
+
* only the data required to integrate. The form id is domain of the form manager plugin, so it can be
|
359 |
+
* anything.
|
360 |
+
* Must be implemented.
|
361 |
+
*
|
362 |
+
* @param mixed $form_id
|
363 |
+
* @return TNP_FormManager_Form
|
364 |
+
*/
|
365 |
+
function get_form($form_id) {
|
366 |
+
return null;
|
367 |
+
}
|
368 |
+
|
369 |
+
/**
|
370 |
+
* Saves the form mapping and integration settings.
|
371 |
+
* @param mixed $form_id
|
372 |
+
* @param array $data
|
373 |
+
*/
|
374 |
+
public function save_form_options($form_id, $data) {
|
375 |
+
update_option('newsletter_' . $this->name . '_' . $form_id, $data, false);
|
376 |
+
}
|
377 |
+
|
378 |
+
/**
|
379 |
+
* Gets the form mapping and integration settings. Returns an empty array if the dataset is missing.
|
380 |
+
* @param mixed $form_id
|
381 |
+
* @return array
|
382 |
+
*/
|
383 |
+
public function get_form_options($form_id) {
|
384 |
+
return get_option('newsletter_' . $this->name . '_' . $form_id, []);
|
385 |
+
}
|
386 |
+
|
387 |
+
}
|
388 |
+
|
389 |
+
class TNP_FormManager_Form {
|
390 |
+
|
391 |
+
var $id = null;
|
392 |
+
var $title = '';
|
393 |
+
var $fields = [];
|
394 |
+
var $connected = false;
|
395 |
+
|
396 |
+
}
|
includes/controls.php
CHANGED
@@ -284,7 +284,7 @@ class NewsletterControls {
|
|
284 |
$this->data = stripslashes_deep($_POST['options']);
|
285 |
}
|
286 |
} else {
|
287 |
-
$this->data = (array)$options;
|
288 |
}
|
289 |
|
290 |
if (isset($_REQUEST['act'])) {
|
@@ -311,7 +311,8 @@ class NewsletterControls {
|
|
311 |
continue;
|
312 |
}
|
313 |
if ($type === 'array') {
|
314 |
-
if (!isset($this->data[$name]))
|
|
|
315 |
}
|
316 |
}
|
317 |
}
|
@@ -871,9 +872,9 @@ class NewsletterControls {
|
|
871 |
$onclick .= "this.form.btn.value='" . esc_attr(esc_js($attrs['data'])) . "';";
|
872 |
}
|
873 |
if (isset($attrs['confirm'])) {
|
874 |
-
if (
|
875 |
$onclick .= "if (!confirm('" . esc_attr(esc_js($attrs['confirm'])) . "')) return false;";
|
876 |
-
} else {
|
877 |
$onclick .= "if (!confirm('" . esc_attr(esc_js(__('Proceed?', 'newsletter'))) . "')) return false;";
|
878 |
}
|
879 |
}
|
@@ -1164,7 +1165,7 @@ class NewsletterControls {
|
|
1164 |
* the key $name an array containig the passed value.
|
1165 |
*/
|
1166 |
function checkbox_group($name, $value, $label = '', $attrs = []) {
|
1167 |
-
$attrs = wp_parse_args($attrs, ['label_escape'=>true]);
|
1168 |
echo '<label><input type="checkbox" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . '][]" value="' . esc_attr($value) . '"';
|
1169 |
if (isset($this->data[$name]) && is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false) {
|
1170 |
echo ' checked';
|
@@ -1236,7 +1237,7 @@ class NewsletterControls {
|
|
1236 |
}
|
1237 |
echo '<div style="clear: both"></div>';
|
1238 |
}
|
1239 |
-
|
1240 |
/** A list of all lists defined each one with a checkbox to select it. An array
|
1241 |
* of ID of all checked lists is submitted.
|
1242 |
*
|
@@ -1262,7 +1263,7 @@ class NewsletterControls {
|
|
1262 |
|
1263 |
echo '<div class="tnpc-lists">';
|
1264 |
foreach ($lists as $list) {
|
1265 |
-
$this->checkbox_group($name, $list->id, '<span>' . $list->id . '</span> ' . esc_html($list->name), ['label_escape'=>false]);
|
1266 |
}
|
1267 |
echo '<a href="https://www.thenewsletterplugin.com/documentation/newsletter-lists" target="_blank">'
|
1268 |
. 'Click here to read more about lists.'
|
@@ -1486,8 +1487,9 @@ class NewsletterControls {
|
|
1486 |
}
|
1487 |
echo '</select>';
|
1488 |
|
|
|
1489 |
echo '<select name="' . esc_attr($name) . '_year">';
|
1490 |
-
for ($i = 2011; $i <=
|
1491 |
echo '<option value="' . $i . '"';
|
1492 |
if ($year == $i) {
|
1493 |
echo ' selected';
|
@@ -1893,7 +1895,6 @@ tnp_controls_init();
|
|
1893 |
$hours = floor(($delta / (60 * 60)) % 24);
|
1894 |
$days = floor($delta / (24 * 60 * 60));
|
1895 |
|
1896 |
-
|
1897 |
return $days . ' day(s), ' . $hours . ' hour(s), ' . $minutes . ' minute(s)';
|
1898 |
}
|
1899 |
|
284 |
$this->data = stripslashes_deep($_POST['options']);
|
285 |
}
|
286 |
} else {
|
287 |
+
$this->data = (array) $options;
|
288 |
}
|
289 |
|
290 |
if (isset($_REQUEST['act'])) {
|
311 |
continue;
|
312 |
}
|
313 |
if ($type === 'array') {
|
314 |
+
if (!isset($this->data[$name]))
|
315 |
+
$this->data[$name] = [];
|
316 |
}
|
317 |
}
|
318 |
}
|
872 |
$onclick .= "this.form.btn.value='" . esc_attr(esc_js($attrs['data'])) . "';";
|
873 |
}
|
874 |
if (isset($attrs['confirm'])) {
|
875 |
+
if (is_string($attrs['confirm'])) {
|
876 |
$onclick .= "if (!confirm('" . esc_attr(esc_js($attrs['confirm'])) . "')) return false;";
|
877 |
+
} else if ($attrs['confirm'] === true) {
|
878 |
$onclick .= "if (!confirm('" . esc_attr(esc_js(__('Proceed?', 'newsletter'))) . "')) return false;";
|
879 |
}
|
880 |
}
|
1165 |
* the key $name an array containig the passed value.
|
1166 |
*/
|
1167 |
function checkbox_group($name, $value, $label = '', $attrs = []) {
|
1168 |
+
$attrs = wp_parse_args($attrs, ['label_escape' => true]);
|
1169 |
echo '<label><input type="checkbox" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . '][]" value="' . esc_attr($value) . '"';
|
1170 |
if (isset($this->data[$name]) && is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false) {
|
1171 |
echo ' checked';
|
1237 |
}
|
1238 |
echo '<div style="clear: both"></div>';
|
1239 |
}
|
1240 |
+
|
1241 |
/** A list of all lists defined each one with a checkbox to select it. An array
|
1242 |
* of ID of all checked lists is submitted.
|
1243 |
*
|
1263 |
|
1264 |
echo '<div class="tnpc-lists">';
|
1265 |
foreach ($lists as $list) {
|
1266 |
+
$this->checkbox_group($name, $list->id, '<span>' . $list->id . '</span> ' . esc_html($list->name), ['label_escape' => false]);
|
1267 |
}
|
1268 |
echo '<a href="https://www.thenewsletterplugin.com/documentation/newsletter-lists" target="_blank">'
|
1269 |
. 'Click here to read more about lists.'
|
1487 |
}
|
1488 |
echo '</select>';
|
1489 |
|
1490 |
+
$last_year = date('Y') + 2;
|
1491 |
echo '<select name="' . esc_attr($name) . '_year">';
|
1492 |
+
for ($i = 2011; $i <= $last_year; $i++) {
|
1493 |
echo '<option value="' . $i . '"';
|
1494 |
if ($year == $i) {
|
1495 |
echo ' selected';
|
1895 |
$hours = floor(($delta / (60 * 60)) % 24);
|
1896 |
$days = floor($delta / (24 * 60 * 60));
|
1897 |
|
|
|
1898 |
return $days . ' day(s), ' . $hours . ' hour(s), ' . $minutes . ' minute(s)';
|
1899 |
}
|
1900 |
|
includes/logger.php
CHANGED
@@ -20,7 +20,7 @@ class NewsletterLogger {
|
|
20 |
function __construct($module) {
|
21 |
$this->module = $module;
|
22 |
if (defined('NEWSLETTER_LOG_LEVEL')) $this->level = NEWSLETTER_LOG_LEVEL;
|
23 |
-
else $this->level = get_option('newsletter_log_level', self::ERROR);
|
24 |
|
25 |
$secret = get_option('newsletter_logger_secret');
|
26 |
if (strlen($secret) < 8) {
|
20 |
function __construct($module) {
|
21 |
$this->module = $module;
|
22 |
if (defined('NEWSLETTER_LOG_LEVEL')) $this->level = NEWSLETTER_LOG_LEVEL;
|
23 |
+
else $this->level = (int)get_option('newsletter_log_level', self::ERROR);
|
24 |
|
25 |
$secret = get_option('newsletter_logger_secret');
|
26 |
if (strlen($secret) < 8) {
|
includes/mailer.php
CHANGED
@@ -18,7 +18,7 @@ class NewsletterMailer {
|
|
18 |
private $delta;
|
19 |
protected $batch_size = 1;
|
20 |
|
21 |
-
public function __construct($name, $options =
|
22 |
$this->name = $name;
|
23 |
$this->options = $options;
|
24 |
}
|
@@ -122,44 +122,6 @@ class NewsletterMailer {
|
|
122 |
return $this->logger;
|
123 |
}
|
124 |
|
125 |
-
/**
|
126 |
-
*
|
127 |
-
* @param TNP_Mailer_Message $message
|
128 |
-
* @return bool|WP_Error
|
129 |
-
*/
|
130 |
-
public function enqueue(TNP_Mailer_Message $message) {
|
131 |
-
// Optimization when there is no queue
|
132 |
-
if ($this->queue_max == 0) {
|
133 |
-
$r = $this->send($message);
|
134 |
-
return $r;
|
135 |
-
}
|
136 |
-
|
137 |
-
$this->queue[] = $message;
|
138 |
-
if (count($this->queue) >= $this->queue_max) {
|
139 |
-
return $this->flush();
|
140 |
-
}
|
141 |
-
return true;
|
142 |
-
}
|
143 |
-
|
144 |
-
public function flush() {
|
145 |
-
$undelivered = array();
|
146 |
-
foreach ($this->queue as $message) {
|
147 |
-
$r = $this->deliver($message);
|
148 |
-
if (is_wp_error($r)) {
|
149 |
-
$message->error = $r;
|
150 |
-
$undelivered[] = $message;
|
151 |
-
}
|
152 |
-
}
|
153 |
-
|
154 |
-
$this->queue = array();
|
155 |
-
|
156 |
-
if ($undelivered) {
|
157 |
-
return new WP_Error(self::ERROR_GENERAL, 'Error while flushing messages', $undelivered);
|
158 |
-
}
|
159 |
-
|
160 |
-
return true;
|
161 |
-
}
|
162 |
-
|
163 |
/**
|
164 |
* Original mail function simulation for compatibility.
|
165 |
* @deprecated
|
@@ -180,9 +142,6 @@ class NewsletterMailer {
|
|
180 |
$mailer_message->body = $message['html'];
|
181 |
$mailer_message->body_text = $message['text'];
|
182 |
|
183 |
-
if ($enqueue) {
|
184 |
-
return !is_wp_error($this->enqueue($mailer_message));
|
185 |
-
}
|
186 |
return !is_wp_error($this->send($mailer_message));
|
187 |
}
|
188 |
|
18 |
private $delta;
|
19 |
protected $batch_size = 1;
|
20 |
|
21 |
+
public function __construct($name, $options = []) {
|
22 |
$this->name = $name;
|
23 |
$this->options = $options;
|
24 |
}
|
122 |
return $this->logger;
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
/**
|
126 |
* Original mail function simulation for compatibility.
|
127 |
* @deprecated
|
142 |
$mailer_message->body = $message['html'];
|
143 |
$mailer_message->body_text = $message['text'];
|
144 |
|
|
|
|
|
|
|
145 |
return !is_wp_error($this->send($mailer_message));
|
146 |
}
|
147 |
|
includes/module.php
CHANGED
@@ -24,10 +24,10 @@ class TNP_Media {
|
|
24 |
$this->height = floor(($width / $this->width) * $this->height);
|
25 |
$this->width = $width;
|
26 |
}
|
27 |
-
|
28 |
/** Sets the height recalculating the width */
|
29 |
public function set_height($height) {
|
30 |
-
$height = (int)$height;
|
31 |
$this->width = floor(($height / $this->height) * $this->width);
|
32 |
$this->height = $height;
|
33 |
}
|
@@ -258,16 +258,18 @@ class TNP_Subscription_Data {
|
|
258 |
$subscriber->$key = $value;
|
259 |
}
|
260 |
}
|
261 |
-
|
262 |
/** Sets to active a set of lists. Accepts incorrect data (and ignores it).
|
263 |
*
|
264 |
* @param array $list_ids Array of list IDs
|
265 |
*/
|
266 |
function add_lists($list_ids) {
|
267 |
-
if (empty($list_ids) || !is_array($list_ids))
|
|
|
268 |
foreach ($list_ids as $list_id) {
|
269 |
-
$list_id = (int)$list_id;
|
270 |
-
if ($list_id < 0 || $list_id > NEWSLETTER_LIST_MAX)
|
|
|
271 |
$this->lists[$list_id] = 1;
|
272 |
}
|
273 |
}
|
@@ -336,6 +338,7 @@ class TNP_User {
|
|
336 |
break;
|
337 |
}
|
338 |
}
|
|
|
339 |
}
|
340 |
|
341 |
/**
|
@@ -409,7 +412,6 @@ class NewsletterModule {
|
|
409 |
array_unshift($components, '');
|
410 |
$this->components = $components;
|
411 |
|
412 |
-
|
413 |
$this->logger = new NewsletterLogger($module);
|
414 |
$this->options = $this->get_options();
|
415 |
$this->store = NewsletterStore::singleton();
|
@@ -948,36 +950,36 @@ class NewsletterModule {
|
|
948 |
return $list;
|
949 |
}
|
950 |
|
951 |
-
|
952 |
-
|
953 |
-
|
954 |
-
|
955 |
-
|
956 |
-
|
957 |
-
|
958 |
|
959 |
-
|
960 |
|
961 |
-
|
962 |
|
963 |
-
|
964 |
|
965 |
-
|
966 |
-
|
967 |
|
968 |
-
|
969 |
-
|
970 |
|
971 |
-
|
972 |
-
|
973 |
-
|
974 |
-
|
975 |
-
|
976 |
-
|
977 |
-
|
978 |
|
979 |
-
|
980 |
-
|
981 |
|
982 |
/**
|
983 |
* Retrieves an email from DB and unserialize the options.
|
@@ -1140,7 +1142,7 @@ class NewsletterModule {
|
|
1140 |
$percent = $this->get_email_progress($email);
|
1141 |
}
|
1142 |
|
1143 |
-
|
1144 |
echo '<div class="tnp-progress-bar" role="progressbar" style="width: ', $percent, '%;"> ', $percent, '% </div>';
|
1145 |
echo '</div>';
|
1146 |
if ($attrs['numbers']) {
|
@@ -1388,7 +1390,7 @@ class NewsletterModule {
|
|
1388 |
}
|
1389 |
return $user_count;
|
1390 |
}
|
1391 |
-
|
1392 |
function get_profile($id, $language = '') {
|
1393 |
return TNP_Profile_Service::get_profile_by_id($id, $language);
|
1394 |
}
|
@@ -2098,7 +2100,6 @@ class NewsletterModule {
|
|
2098 |
$text = str_replace('{company_name}', $options['footer_title'], $text);
|
2099 |
$text = str_replace('{company_legal}', $options['footer_legal'], $text);
|
2100 |
|
2101 |
-
|
2102 |
$this->switch_language($initial_language);
|
2103 |
//$this->logger->debug('Replace end');
|
2104 |
return $text;
|
24 |
$this->height = floor(($width / $this->width) * $this->height);
|
25 |
$this->width = $width;
|
26 |
}
|
27 |
+
|
28 |
/** Sets the height recalculating the width */
|
29 |
public function set_height($height) {
|
30 |
+
$height = (int) $height;
|
31 |
$this->width = floor(($height / $this->height) * $this->width);
|
32 |
$this->height = $height;
|
33 |
}
|
258 |
$subscriber->$key = $value;
|
259 |
}
|
260 |
}
|
261 |
+
|
262 |
/** Sets to active a set of lists. Accepts incorrect data (and ignores it).
|
263 |
*
|
264 |
* @param array $list_ids Array of list IDs
|
265 |
*/
|
266 |
function add_lists($list_ids) {
|
267 |
+
if (empty($list_ids) || !is_array($list_ids))
|
268 |
+
return;
|
269 |
foreach ($list_ids as $list_id) {
|
270 |
+
$list_id = (int) $list_id;
|
271 |
+
if ($list_id < 0 || $list_id > NEWSLETTER_LIST_MAX)
|
272 |
+
continue;
|
273 |
$this->lists[$list_id] = 1;
|
274 |
}
|
275 |
}
|
338 |
break;
|
339 |
}
|
340 |
}
|
341 |
+
|
342 |
}
|
343 |
|
344 |
/**
|
412 |
array_unshift($components, '');
|
413 |
$this->components = $components;
|
414 |
|
|
|
415 |
$this->logger = new NewsletterLogger($module);
|
416 |
$this->options = $this->get_options();
|
417 |
$this->store = NewsletterStore::singleton();
|
950 |
return $list;
|
951 |
}
|
952 |
|
953 |
+
/**
|
954 |
+
* @param string $key
|
955 |
+
* @param mixed $value
|
956 |
+
* @return TNP_Email[]
|
957 |
+
*/
|
958 |
+
function get_emails_by_field($key, $value) {
|
959 |
+
global $wpdb;
|
960 |
|
961 |
+
$value_placeholder = is_int($value) ? '%d' : '%s';
|
962 |
|
963 |
+
$query = $wpdb->prepare("SELECT * FROM " . NEWSLETTER_EMAILS_TABLE . " WHERE %1s=$value_placeholder ORDER BY id DESC", $key, $value);
|
964 |
|
965 |
+
$email_list = $wpdb->get_results($query);
|
966 |
|
967 |
+
if ($wpdb->last_error) {
|
968 |
+
$this->logger->error($wpdb->last_error);
|
969 |
|
970 |
+
return [];
|
971 |
+
}
|
972 |
|
973 |
+
//Unserialize options
|
974 |
+
array_walk($email_list, function ($email) {
|
975 |
+
$email->options = maybe_unserialize($email->options);
|
976 |
+
if (!is_array($email->options)) {
|
977 |
+
$email->options = [];
|
978 |
+
}
|
979 |
+
});
|
980 |
|
981 |
+
return $email_list;
|
982 |
+
}
|
983 |
|
984 |
/**
|
985 |
* Retrieves an email from DB and unserialize the options.
|
1142 |
$percent = $this->get_email_progress($email);
|
1143 |
}
|
1144 |
|
1145 |
+
echo '<div class="tnp-progress tnp-progress--' . $email->status . '">';
|
1146 |
echo '<div class="tnp-progress-bar" role="progressbar" style="width: ', $percent, '%;"> ', $percent, '% </div>';
|
1147 |
echo '</div>';
|
1148 |
if ($attrs['numbers']) {
|
1390 |
}
|
1391 |
return $user_count;
|
1392 |
}
|
1393 |
+
|
1394 |
function get_profile($id, $language = '') {
|
1395 |
return TNP_Profile_Service::get_profile_by_id($id, $language);
|
1396 |
}
|
2100 |
$text = str_replace('{company_name}', $options['footer_title'], $text);
|
2101 |
$text = str_replace('{company_legal}', $options['footer_legal'], $text);
|
2102 |
|
|
|
2103 |
$this->switch_language($initial_language);
|
2104 |
//$this->logger->debug('Replace end');
|
2105 |
return $text;
|
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.
|
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.
|
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.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.2.0');
|
39 |
|
40 |
global $newsletter, $wpdb;
|
41 |
|
profile/profile.php
CHANGED
@@ -468,6 +468,7 @@ class NewsletterProfile extends NewsletterModule {
|
|
468 |
|
469 |
// Send the activation again only if we use double opt-in, otherwise it has no meaning
|
470 |
if ($email_changed && $subscription_module->is_double_optin()) {
|
|
|
471 |
$subscription_module->send_activation_email($user);
|
472 |
return $options['email_changed'];
|
473 |
}
|
468 |
|
469 |
// Send the activation again only if we use double opt-in, otherwise it has no meaning
|
470 |
if ($email_changed && $subscription_module->is_double_optin()) {
|
471 |
+
$user->email = $email;
|
472 |
$subscription_module->send_activation_email($user);
|
473 |
return $options['email_changed'];
|
474 |
}
|
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.
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
@@ -120,6 +120,15 @@ Thank you, The Newsletter Team
|
|
120 |
|
121 |
== Changelog ==
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
= 7.1.9 =
|
124 |
|
125 |
* [GENERAL] Removed the encodign defatlt to Base 64 when not specified since it seems incompatible with some SMTP plugins
|
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.0
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
License: GPLv2 or later
|
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 has been removed
|
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
|
131 |
+
|
132 |
= 7.1.9 =
|
133 |
|
134 |
* [GENERAL] Removed the encodign defatlt to Base 64 when not specified since it seems incompatible with some SMTP plugins
|
subscription/subscription.php
CHANGED
@@ -532,7 +532,8 @@ class NewsletterSubscription extends NewsletterModule {
|
|
532 |
|
533 |
// Do we accept repeated subscriptions?
|
534 |
if ($user != null && $subscription->if_exists === TNP_Subscription::EXISTING_ERROR) {
|
535 |
-
|
|
|
536 |
}
|
537 |
|
538 |
|
532 |
|
533 |
// Do we accept repeated subscriptions?
|
534 |
if ($user != null && $subscription->if_exists === TNP_Subscription::EXISTING_ERROR) {
|
535 |
+
$this->show_message('error', $user);
|
536 |
+
//return new WP_Error('exists', 'Email address already registered and Newsletter sets to block repeated registrations. You can change this behavior or the user message above on subscription configuration panel.');
|
537 |
}
|
538 |
|
539 |
|
tnp-header.php
CHANGED
@@ -342,3 +342,5 @@ if ( $_GET['page'] !== 'newsletter_emails_edit' ) {
|
|
342 |
}
|
343 |
?>
|
344 |
</div>
|
|
|
|
342 |
}
|
343 |
?>
|
344 |
</div>
|
345 |
+
|
346 |
+
|