Version Description
- Fixed foreach warning
- Added IP on subscription via API
- All addons update logics moved to our free Addons Manager to make Newsletter even lighter
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 6.2.1 |
Comparing to | |
See all releases |
Code changes from version 6.2.0 to 6.2.1
- includes/TNP.php +2 -0
- includes/module.php +34 -11
- plugin.php +16 -9
- readme.txt +7 -1
includes/TNP.php
CHANGED
@@ -225,6 +225,8 @@ class TNP {
|
|
225 |
|
226 |
$user['token'] = $newsletter->get_token();
|
227 |
$user['updated'] = time();
|
|
|
|
|
228 |
|
229 |
$user = $newsletter->save_user($user);
|
230 |
|
225 |
|
226 |
$user['token'] = $newsletter->get_token();
|
227 |
$user['updated'] = time();
|
228 |
+
|
229 |
+
$user['ip'] = Newsletter::get_remote_ip();
|
230 |
|
231 |
$user = $newsletter->save_user($user);
|
232 |
|
includes/module.php
CHANGED
@@ -105,8 +105,10 @@ class NewsletterAddon {
|
|
105 |
var $name;
|
106 |
var $options;
|
107 |
var $version;
|
|
|
108 |
|
109 |
public function __construct($name, $version = '0.0.0') {
|
|
|
110 |
$this->name = $name;
|
111 |
$this->version = $version;
|
112 |
if (is_admin()) {
|
@@ -117,12 +119,29 @@ class NewsletterAddon {
|
|
117 |
}
|
118 |
}
|
119 |
add_action('init', array($this, 'init'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
}
|
121 |
-
|
|
|
|
|
|
|
|
|
122 |
function upgrade($first_install = false) {
|
|
|
123 |
}
|
124 |
-
|
125 |
function init() {
|
|
|
126 |
}
|
127 |
|
128 |
function get_logger() {
|
@@ -140,6 +159,8 @@ class NewsletterAddon {
|
|
140 |
}
|
141 |
|
142 |
function setup_options() {
|
|
|
|
|
143 |
$this->options = get_option('newsletter_' . $this->name, array());
|
144 |
}
|
145 |
|
@@ -147,7 +168,7 @@ class NewsletterAddon {
|
|
147 |
update_option('newsletter_' . $this->name, $options);
|
148 |
$this->setup_options();
|
149 |
}
|
150 |
-
|
151 |
/**
|
152 |
* @global wpdb $wpdb
|
153 |
* @param string $query
|
@@ -162,7 +183,7 @@ class NewsletterAddon {
|
|
162 |
$logger->fatal($wpdb->last_error);
|
163 |
}
|
164 |
return $r;
|
165 |
-
}
|
166 |
|
167 |
}
|
168 |
|
@@ -1016,13 +1037,15 @@ class NewsletterModule {
|
|
1016 |
|
1017 |
if (isset($id)) {
|
1018 |
$user = $this->get_user($id);
|
1019 |
-
if ($
|
1020 |
-
if ($
|
1021 |
-
$user
|
1022 |
-
|
1023 |
-
|
1024 |
-
|
1025 |
-
$user
|
|
|
|
|
1026 |
}
|
1027 |
}
|
1028 |
}
|
105 |
var $name;
|
106 |
var $options;
|
107 |
var $version;
|
108 |
+
static $instance;
|
109 |
|
110 |
public function __construct($name, $version = '0.0.0') {
|
111 |
+
self::$instance = $this;
|
112 |
$this->name = $name;
|
113 |
$this->version = $version;
|
114 |
if (is_admin()) {
|
119 |
}
|
120 |
}
|
121 |
add_action('init', array($this, 'init'));
|
122 |
+
|
123 |
+
if (is_admin()) {
|
124 |
+
if (!class_exists('NewsletterExtensions')) {
|
125 |
+
add_filter('plugin_row_meta', function ($plugin_meta, $plugin_file) {
|
126 |
+
if ($plugin_file === 'newsletter-' . $this->name . '/' . $this->name . '.php') {
|
127 |
+
$plugin_meta[] = '<a href="admin.php?page=newsletter_main_extensions" style="font-weight: bold">Newsletter Addons Manager required</a>';
|
128 |
+
}
|
129 |
+
return $plugin_meta;
|
130 |
+
}, 10, 2);
|
131 |
+
}
|
132 |
+
}
|
133 |
}
|
134 |
+
|
135 |
+
static function instance() {
|
136 |
+
return self::$instance;
|
137 |
+
}
|
138 |
+
|
139 |
function upgrade($first_install = false) {
|
140 |
+
|
141 |
}
|
142 |
+
|
143 |
function init() {
|
144 |
+
|
145 |
}
|
146 |
|
147 |
function get_logger() {
|
159 |
}
|
160 |
|
161 |
function setup_options() {
|
162 |
+
if ($this->options)
|
163 |
+
return;
|
164 |
$this->options = get_option('newsletter_' . $this->name, array());
|
165 |
}
|
166 |
|
168 |
update_option('newsletter_' . $this->name, $options);
|
169 |
$this->setup_options();
|
170 |
}
|
171 |
+
|
172 |
/**
|
173 |
* @global wpdb $wpdb
|
174 |
* @param string $query
|
183 |
$logger->fatal($wpdb->last_error);
|
184 |
}
|
185 |
return $r;
|
186 |
+
}
|
187 |
|
188 |
}
|
189 |
|
1037 |
|
1038 |
if (isset($id)) {
|
1039 |
$user = $this->get_user($id);
|
1040 |
+
if ($user) {
|
1041 |
+
if ($context == 'preconfirm') {
|
1042 |
+
if ($token != md5($user->token)) {
|
1043 |
+
$user = null;
|
1044 |
+
}
|
1045 |
+
} else {
|
1046 |
+
if ($token != $user->token) {
|
1047 |
+
$user = null;
|
1048 |
+
}
|
1049 |
}
|
1050 |
}
|
1051 |
}
|
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: 6.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.
|
@@ -29,7 +29,7 @@
|
|
29 |
*/
|
30 |
|
31 |
// Used as dummy parameter on css and js links
|
32 |
-
define('NEWSLETTER_VERSION', '6.2.
|
33 |
|
34 |
global $newsletter, $wpdb;
|
35 |
|
@@ -390,7 +390,7 @@ class Newsletter extends NewsletterModule {
|
|
390 |
}
|
391 |
|
392 |
function hook_init() {
|
393 |
-
global $
|
394 |
|
395 |
if (isset($this->options['debug']) && $this->options['debug'] == 1) {
|
396 |
ini_set('log_errors', 1);
|
@@ -399,7 +399,9 @@ class Newsletter extends NewsletterModule {
|
|
399 |
|
400 |
add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
|
401 |
|
402 |
-
|
|
|
|
|
403 |
|
404 |
if (is_admin()) {
|
405 |
add_action('in_admin_header', array($this, 'hook_in_admin_header'), 1000);
|
@@ -1097,11 +1099,15 @@ class Newsletter extends NewsletterModule {
|
|
1097 |
|
1098 |
//$this->logger->debug('Update plugins transient called');
|
1099 |
|
1100 |
-
if (!is_object($value)) {
|
1101 |
//$this->logger->info('Empty object');
|
1102 |
return $value;
|
1103 |
}
|
1104 |
|
|
|
|
|
|
|
|
|
1105 |
if ($extra_response) {
|
1106 |
//$this->logger->debug('Already updated');
|
1107 |
$value->response = array_merge($value->response, $extra_response);
|
@@ -1109,7 +1115,9 @@ class Newsletter extends NewsletterModule {
|
|
1109 |
}
|
1110 |
|
1111 |
$extensions = $this->getTnpExtensions();
|
1112 |
-
|
|
|
|
|
1113 |
foreach ($extensions as $extension) {
|
1114 |
unset($value->response[$extension->wp_slug]);
|
1115 |
unset($value->no_update[$extension->wp_slug]);
|
@@ -1221,12 +1229,11 @@ class Newsletter extends NewsletterModule {
|
|
1221 |
|
1222 |
$extensions_json = get_transient('tnp_extensions_json');
|
1223 |
|
1224 |
-
if (
|
1225 |
$url = "http://www.thenewsletterplugin.com/wp-content/extensions.json";
|
1226 |
if (!empty($this->options['contract_key'])) {
|
1227 |
$url = "http://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/extensions.php?k=" . $this->options['contract_key'];
|
1228 |
}
|
1229 |
-
|
1230 |
$extensions_response = wp_remote_get($url);
|
1231 |
$extensions_json = wp_remote_retrieve_body($extensions_response);
|
1232 |
if (!empty($extensions_json)) {
|
@@ -1246,7 +1253,7 @@ class Newsletter extends NewsletterModule {
|
|
1246 |
if (function_exists('load_plugin_textdomain')) {
|
1247 |
load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
|
1248 |
}
|
1249 |
-
|
1250 |
if (!empty($this->action)) {
|
1251 |
do_action('newsletter_action', $this->action);
|
1252 |
}
|
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.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.
|
29 |
*/
|
30 |
|
31 |
// Used as dummy parameter on css and js links
|
32 |
+
define('NEWSLETTER_VERSION', '6.2.1');
|
33 |
|
34 |
global $newsletter, $wpdb;
|
35 |
|
390 |
}
|
391 |
|
392 |
function hook_init() {
|
393 |
+
global $wpdb;
|
394 |
|
395 |
if (isset($this->options['debug']) && $this->options['debug'] == 1) {
|
396 |
ini_set('log_errors', 1);
|
399 |
|
400 |
add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
|
401 |
|
402 |
+
if (!method_exists('NewsletterExtensions', 'hook_site_transient_update_plugins')) {
|
403 |
+
add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
|
404 |
+
}
|
405 |
|
406 |
if (is_admin()) {
|
407 |
add_action('in_admin_header', array($this, 'hook_in_admin_header'), 1000);
|
1099 |
|
1100 |
//$this->logger->debug('Update plugins transient called');
|
1101 |
|
1102 |
+
if (!$value || !is_object($value)) {
|
1103 |
//$this->logger->info('Empty object');
|
1104 |
return $value;
|
1105 |
}
|
1106 |
|
1107 |
+
if (!isset($value->response) || !is_array($value->response)) {
|
1108 |
+
$value->response = array();
|
1109 |
+
}
|
1110 |
+
|
1111 |
if ($extra_response) {
|
1112 |
//$this->logger->debug('Already updated');
|
1113 |
$value->response = array_merge($value->response, $extra_response);
|
1115 |
}
|
1116 |
|
1117 |
$extensions = $this->getTnpExtensions();
|
1118 |
+
|
1119 |
+
if (!$extensions) return $value;
|
1120 |
+
|
1121 |
foreach ($extensions as $extension) {
|
1122 |
unset($value->response[$extension->wp_slug]);
|
1123 |
unset($value->no_update[$extension->wp_slug]);
|
1229 |
|
1230 |
$extensions_json = get_transient('tnp_extensions_json');
|
1231 |
|
1232 |
+
if (empty($extensions_json)) {
|
1233 |
$url = "http://www.thenewsletterplugin.com/wp-content/extensions.json";
|
1234 |
if (!empty($this->options['contract_key'])) {
|
1235 |
$url = "http://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/extensions.php?k=" . $this->options['contract_key'];
|
1236 |
}
|
|
|
1237 |
$extensions_response = wp_remote_get($url);
|
1238 |
$extensions_json = wp_remote_retrieve_body($extensions_response);
|
1239 |
if (!empty($extensions_json)) {
|
1253 |
if (function_exists('load_plugin_textdomain')) {
|
1254 |
load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
|
1255 |
}
|
1256 |
+
|
1257 |
if (!empty($this->action)) {
|
1258 |
do_action('newsletter_action', $this->action);
|
1259 |
}
|
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.2.3
|
5 |
-
Stable tag: 6.2.
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
|
@@ -109,6 +109,12 @@ Thank you, The Newsletter Team
|
|
109 |
|
110 |
== Changelog ==
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
= 6.2.0 =
|
113 |
|
114 |
* Fixed integration with addons manager
|
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.2.3
|
5 |
+
Stable tag: 6.2.1
|
6 |
Requires PHP: 5.6
|
7 |
Contributors: satollo,webagile,michael-travan
|
8 |
|
109 |
|
110 |
== Changelog ==
|
111 |
|
112 |
+
= 6.2.1 =
|
113 |
+
|
114 |
+
* Fixed foreach warning
|
115 |
+
* Added IP on subscription via API
|
116 |
+
* All addons update logics moved to our free [Addons Manager](https://www.thenewsletterplugin.com/documentation/how-to-install-the-addons-manager) to make Newsletter even lighter
|
117 |
+
|
118 |
= 6.2.0 =
|
119 |
|
120 |
* Fixed integration with addons manager
|