Version Description
- Delivery expected time indicator on status panel
- Fixed notice on email token missing
- Addons installation availability on status panel
- Option to remove the dedicated page check
Download this release
Release Info
Developer | satollo |
Plugin | Newsletter |
Version | 5.8.1 |
Comparing to | |
See all releases |
Code changes from version 5.8.0 to 5.8.1
- includes/controls.php +4 -1
- includes/module.php +4 -1
- main/main.php +1 -1
- main/status.php +93 -35
- plugin.php +53 -57
- readme.txt +8 -1
- tnp-header.php +27 -4
includes/controls.php
CHANGED
@@ -549,7 +549,7 @@ class NewsletterControls {
|
|
549 |
$this->select($name, $options);
|
550 |
}
|
551 |
|
552 |
-
function page($name = 'page', $first = null, $language = '') {
|
553 |
$args = array(
|
554 |
'post_type' => 'page',
|
555 |
'posts_per_page' => 1000,
|
@@ -568,6 +568,9 @@ class NewsletterControls {
|
|
568 |
if ($page->post_status != 'publish') {
|
569 |
$label .= ' (' . $page->post_status . ')';
|
570 |
}
|
|
|
|
|
|
|
571 |
$options[$page->ID] = $label;
|
572 |
}
|
573 |
$this->select($name, $options, $first);
|
549 |
$this->select($name, $options);
|
550 |
}
|
551 |
|
552 |
+
function page($name = 'page', $first = null, $language = '', $show_id = false) {
|
553 |
$args = array(
|
554 |
'post_type' => 'page',
|
555 |
'posts_per_page' => 1000,
|
568 |
if ($page->post_status != 'publish') {
|
569 |
$label .= ' (' . $page->post_status . ')';
|
570 |
}
|
571 |
+
if ($show_id) {
|
572 |
+
$label .= ' [' . $page->ID . ']';
|
573 |
+
}
|
574 |
$options[$page->ID] = $label;
|
575 |
}
|
576 |
$this->select($name, $options, $first);
|
includes/module.php
CHANGED
@@ -852,6 +852,9 @@ class NewsletterModule {
|
|
852 |
* @return string
|
853 |
*/
|
854 |
function get_email_key($email) {
|
|
|
|
|
|
|
855 |
return $email->id . '-' . $email->token;
|
856 |
}
|
857 |
|
@@ -1507,7 +1510,7 @@ class NewsletterModule {
|
|
1507 |
|
1508 |
$nek = false;
|
1509 |
if ($email) {
|
1510 |
-
$nek = $
|
1511 |
$text = str_replace('{email_id}', $email->id, $text);
|
1512 |
$text = str_replace('{email_key}', $nek, $text);
|
1513 |
$text = str_replace('{email_subject}', $email->subject, $text);
|
852 |
* @return string
|
853 |
*/
|
854 |
function get_email_key($email) {
|
855 |
+
if (!isset($email->token)) {
|
856 |
+
return $email->id . '-';
|
857 |
+
}
|
858 |
return $email->id . '-' . $email->token;
|
859 |
}
|
860 |
|
1510 |
|
1511 |
$nek = false;
|
1512 |
if ($email) {
|
1513 |
+
$nek = $this->get_email_key($email);
|
1514 |
$text = str_replace('{email_id}', $email->id, $text);
|
1515 |
$text = str_replace('{email_key}', $nek, $text);
|
1516 |
$text = str_replace('{email_subject}', $email->subject, $text);
|
main/main.php
CHANGED
@@ -195,7 +195,7 @@ if (!empty($return_path)) {
|
|
195 |
<tr>
|
196 |
<th><?php _e('Dedicated page', 'newsletter') ?></th>
|
197 |
<td>
|
198 |
-
<?php $controls->page('page', __('Unstyled page', 'newsletter')); ?>
|
199 |
<?php
|
200 |
if (empty($controls->data['page'])) {
|
201 |
$controls->button('create', __('Create the page', 'newsletter'));
|
195 |
<tr>
|
196 |
<th><?php _e('Dedicated page', 'newsletter') ?></th>
|
197 |
<td>
|
198 |
+
<?php $controls->page('page', __('Unstyled page', 'newsletter'), '', true); ?>
|
199 |
<?php
|
200 |
if (empty($controls->data['page'])) {
|
201 |
$controls->button('create', __('Create the page', 'newsletter'));
|
main/status.php
CHANGED
@@ -121,6 +121,16 @@ if ($controls->is_action('test')) {
|
|
121 |
}
|
122 |
|
123 |
$options = $module->get_options('status');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
?>
|
125 |
|
126 |
<div class="wrap tnp-main-status" id="tnp-wrap">
|
@@ -150,7 +160,55 @@ $options = $module->get_options('status');
|
|
150 |
</thead>
|
151 |
|
152 |
<tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
153 |
|
|
|
154 |
<tr>
|
155 |
<td>Mailing</td>
|
156 |
<td>
|
@@ -798,43 +856,43 @@ $options = $module->get_options('status');
|
|
798 |
|
799 |
|
800 |
<?php /*
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
|
824 |
-
|
825 |
-
|
826 |
-
|
827 |
-
|
828 |
-
|
829 |
-
|
830 |
-
|
831 |
-
|
832 |
-
|
833 |
|
834 |
-
|
835 |
-
|
836 |
*/ ?>
|
837 |
-
|
838 |
<?php
|
839 |
$ip = gethostbyname($_SERVER['HTTP_HOST']);
|
840 |
$name = gethostbyaddr($ip);
|
121 |
}
|
122 |
|
123 |
$options = $module->get_options('status');
|
124 |
+
|
125 |
+
// Compute the number of newsletters ongoing and other stats
|
126 |
+
$emails = $wpdb->get_results("select * from " . NEWSLETTER_EMAILS_TABLE . " where status='sending' and send_on<" . time() . " order by id asc");
|
127 |
+
$total = 0;
|
128 |
+
$queued = 0;
|
129 |
+
foreach ($emails as $email) {
|
130 |
+
$total += $email->total;
|
131 |
+
$queued += $email->total - $email->sent;
|
132 |
+
}
|
133 |
+
$speed = Newsletter::$instance->options['scheduler_max'];
|
134 |
?>
|
135 |
|
136 |
<div class="wrap tnp-main-status" id="tnp-wrap">
|
160 |
</thead>
|
161 |
|
162 |
<tbody>
|
163 |
+
<?php
|
164 |
+
$method = '';
|
165 |
+
if (function_exists('get_filesystem_method')) {
|
166 |
+
$method = get_filesystem_method(array(), WP_PLUGIN_DIR);
|
167 |
+
}
|
168 |
+
?>
|
169 |
+
<tr>
|
170 |
+
<td>Add-ons installable</td>
|
171 |
+
<td>
|
172 |
+
<?php if (empty($method)) { ?>
|
173 |
+
<span class="tnp-maybe">MAYBE</span>
|
174 |
+
|
175 |
+
<?php } else if ($method == 'direct') { ?>
|
176 |
+
<span class="tnp-ok">OK</span>
|
177 |
+
<?php } else { ?>
|
178 |
+
<span class="tnp-ko">KO</span>
|
179 |
+
<?php } ?>
|
180 |
+
|
181 |
+
</td>
|
182 |
+
<td>
|
183 |
+
<?php if (empty($method)) { ?>
|
184 |
+
No able to check, just try the add-ons manager one click install
|
185 |
+
<?php } else if ($method == 'direct') { ?>
|
186 |
+
The add-ons manager can install our add-ons
|
187 |
+
<?php } else { ?>
|
188 |
+
The plugins dir could be read-only, you can install add-ons uploading the package from the
|
189 |
+
plugins panel (or uploading them directly via FTP). This is unusual you should ask te provider
|
190 |
+
about file and folder permissions.
|
191 |
+
<?php } ?>
|
192 |
+
</td>
|
193 |
+
|
194 |
+
</tr>
|
195 |
+
get_filesystem_method
|
196 |
+
<tr>
|
197 |
+
<td>Delivering</td>
|
198 |
+
<td>
|
199 |
+
|
200 |
+
</td>
|
201 |
+
<td>
|
202 |
+
<?php if (count($emails)) { ?>
|
203 |
+
Delivering <?php echo count($emails) ?> newsletters to about <?php echo $queued ?> recipients.
|
204 |
+
At speed of <?php echo $speed ?> emails per hour it will take <?php printf('%.1f', $queued / $speed) ?> hours to finish.
|
205 |
+
|
206 |
+
<?php } else { ?>
|
207 |
+
Nothing delivering right now
|
208 |
+
<?php } ?>
|
209 |
+
</td>
|
210 |
|
211 |
+
</tr>
|
212 |
<tr>
|
213 |
<td>Mailing</td>
|
214 |
<td>
|
856 |
|
857 |
|
858 |
<?php /*
|
859 |
+
$memory = intval(WP_MEMORY_LIMIT);
|
860 |
+
if (false !== strpos(WP_MEMORY_LIMIT, 'G'))
|
861 |
+
$memory *= 1024;
|
862 |
+
?>
|
863 |
+
<tr>
|
864 |
+
<td>
|
865 |
+
PHP memory limit
|
866 |
+
</td>
|
867 |
+
<td>
|
868 |
+
<?php if ($memory < 64) { ?>
|
869 |
+
<span class="tnp-ko">MAYBE</span>
|
870 |
+
<?php } else if ($memory < 128) { ?>
|
871 |
+
<span class="tnp-maybe">MAYBE</span>
|
872 |
+
<?php } else { ?>
|
873 |
+
<span class="tnp-ok">OK</span>
|
874 |
+
<?php } ?>
|
875 |
+
</td>
|
876 |
+
<td>
|
877 |
+
WordPress WP_MEMORY_LIMIT is set to <?php echo $memory ?> megabyte but your PHP setting could allow more than that.
|
878 |
+
Anyway we suggest to set the value to at least 64M.
|
879 |
+
<a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
|
880 |
+
<?php if ($memory < 64) { ?>
|
881 |
+
This value is too low you should increase it adding <code>define('WP_MEMORY_LIMIT', '64M');</code> to your <code>wp-config.php</code>.
|
882 |
+
<a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
|
883 |
+
<?php } else if ($memory < 128) { ?>
|
884 |
+
The value should be fine, it depends on how many plugins you're running and how many resource are required by your theme.
|
885 |
+
Blank pages may happen with low memory problems. Eventually increase it adding <code>define('WP_MEMORY_LIMIT', '128M');</code>
|
886 |
+
to your <code>wp-config.php</code>.
|
887 |
+
<a href="https://www.thenewsletterplugin.com/documentation/status-panel#status-memory" target="_blank">Read more</a>.
|
888 |
+
<?php } else { ?>
|
889 |
+
|
890 |
+
<?php } ?>
|
891 |
|
892 |
+
</td>
|
893 |
+
</tr>
|
894 |
*/ ?>
|
895 |
+
|
896 |
<?php
|
897 |
$ip = gethostbyname($_SERVER['HTTP_HOST']);
|
898 |
$name = gethostbyaddr($ip);
|
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: 5.8.
|
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', '5.8.
|
33 |
|
34 |
global $newsletter, $wpdb;
|
35 |
|
@@ -105,6 +105,8 @@ class Newsletter extends NewsletterModule {
|
|
105 |
var $theme_posts; // WP_Query object
|
106 |
// Secret key to create a unique log file name (and may be other)
|
107 |
var $action = '';
|
|
|
|
|
108 |
static $instance;
|
109 |
|
110 |
const MAX_CRON_SAMPLES = 100;
|
@@ -360,9 +362,9 @@ class Newsletter extends NewsletterModule {
|
|
360 |
* if there are no warnings.
|
361 |
*/
|
362 |
function warnings() {
|
363 |
-
|
364 |
}
|
365 |
-
|
366 |
function hook_init() {
|
367 |
global $cache_stop, $hyper_cache_stop, $wpdb;
|
368 |
|
@@ -407,7 +409,7 @@ class Newsletter extends NewsletterModule {
|
|
407 |
} else {
|
408 |
add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
|
409 |
}
|
410 |
-
|
411 |
//add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
|
412 |
|
413 |
if (empty($this->action)) {
|
@@ -440,19 +442,13 @@ class Newsletter extends NewsletterModule {
|
|
440 |
if (!empty($this->options['page'])) {
|
441 |
if (get_post_status($this->options['page']) !== 'publish') {
|
442 |
echo '<div class="notice notice-error"><p>The Newsletter dedicated page is not published. <a href="', site_url('/wp-admin/post.php') . '?post=', $this->options['page'], '&action=edit"><strong>Edit the page</strong></a> or <a href="admin.php?page=newsletter_main_main"><strong>review the main settings</strong></a>.</p></div>';
|
443 |
-
} else {
|
444 |
-
$content = get_post_field('post_content', $this->options['page']);
|
445 |
-
// With and without attributes
|
446 |
-
if (strpos($content, '[newsletter]') === false && strpos($content, '[newsletter ') === false) {
|
447 |
-
echo '<div class="notice notice-error"><p>The Newsletter dedicated page does not contain the [newsletter] shortcode. <a href="', site_url('/wp-admin/post.php'), '?post=', $this->options['page'], '&action=edit"><strong>Edit the page</strong></a> or <a href="admin.php?page=newsletter_main_main"><strong>review the main settings</strong></a>.</p></div>';
|
448 |
-
}
|
449 |
}
|
450 |
}
|
451 |
-
|
452 |
if (isset($this->options['debug']) && $this->options['debug'] == 1) {
|
453 |
echo '<div class="notice notice-warning"><p>The Newsletter plugin is in <strong>debug mode</strong>. When done change it on Newsletter <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>. Do not keep the debug mode active on production sites.</p></div>';
|
454 |
}
|
455 |
-
|
456 |
$x = wp_next_scheduled('newsletter');
|
457 |
if ($x === false) {
|
458 |
echo '<div class="notice notice-error"><p>The Newsletter delivery engine is off (it should never be off). Deactivate and reactivate the Newsletter plugin.</p></div>';
|
@@ -641,7 +637,7 @@ class Newsletter extends NewsletterModule {
|
|
641 |
if (!$test) {
|
642 |
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set sent=sent+1, last_id=" . $user->id . " where id=" . $email->id . " limit 1");
|
643 |
}
|
644 |
-
|
645 |
$user = apply_filters('newsletter_send_user', $user);
|
646 |
|
647 |
$m = $this->replace($email->message, $user, $email);
|
@@ -663,12 +659,12 @@ class Newsletter extends NewsletterModule {
|
|
663 |
if (!$test) {
|
664 |
$this->save_sent($user, $email);
|
665 |
}
|
666 |
-
|
667 |
$this->email_limit--;
|
668 |
$count++;
|
669 |
}
|
670 |
-
|
671 |
-
|
672 |
if ($this->the_mailer != null) {
|
673 |
$this->logger->debug('Flushing and checking errors');
|
674 |
$this->the_mailer->flush();
|
@@ -678,9 +674,8 @@ class Newsletter extends NewsletterModule {
|
|
678 |
$this->logger->debug('Error on email ' . $error['email']);
|
679 |
$this->save_sent($error['email'], $email, 1, $error['message']);
|
680 |
}
|
681 |
-
|
682 |
}
|
683 |
-
|
684 |
$this->logger->debug('Clearing errors');
|
685 |
if (method_exists($this->the_mailer, 'get_errors')) {
|
686 |
$this->the_mailer->clear_errors();
|
@@ -1148,7 +1143,7 @@ class Newsletter extends NewsletterModule {
|
|
1148 |
$value->response[$extension->plugin] = $plugin;
|
1149 |
|
1150 |
$value->response[$extension->plugin]->package = '';
|
1151 |
-
|
1152 |
if (class_exists('NewsletterExtensions')) {
|
1153 |
// NO filters here!
|
1154 |
$value->response[$extension->plugin]->package = NewsletterExtensions::$instance->get_package($extension->id);
|
@@ -1192,7 +1187,7 @@ class Newsletter extends NewsletterModule {
|
|
1192 |
if (function_exists('load_plugin_textdomain')) {
|
1193 |
load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
|
1194 |
}
|
1195 |
-
|
1196 |
if (!empty($this->action)) {
|
1197 |
do_action('newsletter_action', $this->action);
|
1198 |
}
|
@@ -1220,53 +1215,54 @@ class Newsletter extends NewsletterModule {
|
|
1220 |
* @return string
|
1221 |
*/
|
1222 |
var $newsletter_page_url = false;
|
|
|
1223 |
function get_newsletter_page_url($language = '') {
|
1224 |
-
|
1225 |
// TODO: Reintroduce the cache
|
1226 |
//if (!$this->newsletter_page_url) {
|
1227 |
-
|
1228 |
-
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
}
|
1236 |
}
|
1237 |
}
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
|
|
1241 |
//}
|
1242 |
return $this->newsletter_page_url;
|
1243 |
}
|
1244 |
|
1245 |
-
|
1246 |
-
|
1247 |
-
|
1248 |
-
|
1249 |
-
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
|
1256 |
public static function check_license($license_key) {
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
|
1263 |
-
|
1264 |
-
|
1265 |
-
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
}
|
1271 |
|
1272 |
}
|
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: 5.8.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', '5.8.1');
|
33 |
|
34 |
global $newsletter, $wpdb;
|
35 |
|
105 |
var $theme_posts; // WP_Query object
|
106 |
// Secret key to create a unique log file name (and may be other)
|
107 |
var $action = '';
|
108 |
+
|
109 |
+
/** @var Newsletter */
|
110 |
static $instance;
|
111 |
|
112 |
const MAX_CRON_SAMPLES = 100;
|
362 |
* if there are no warnings.
|
363 |
*/
|
364 |
function warnings() {
|
365 |
+
|
366 |
}
|
367 |
+
|
368 |
function hook_init() {
|
369 |
global $cache_stop, $hyper_cache_stop, $wpdb;
|
370 |
|
409 |
} else {
|
410 |
add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
|
411 |
}
|
412 |
+
|
413 |
//add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
|
414 |
|
415 |
if (empty($this->action)) {
|
442 |
if (!empty($this->options['page'])) {
|
443 |
if (get_post_status($this->options['page']) !== 'publish') {
|
444 |
echo '<div class="notice notice-error"><p>The Newsletter dedicated page is not published. <a href="', site_url('/wp-admin/post.php') . '?post=', $this->options['page'], '&action=edit"><strong>Edit the page</strong></a> or <a href="admin.php?page=newsletter_main_main"><strong>review the main settings</strong></a>.</p></div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
}
|
446 |
}
|
447 |
+
|
448 |
if (isset($this->options['debug']) && $this->options['debug'] == 1) {
|
449 |
echo '<div class="notice notice-warning"><p>The Newsletter plugin is in <strong>debug mode</strong>. When done change it on Newsletter <a href="admin.php?page=newsletter_main_main"><strong>main settings</strong></a>. Do not keep the debug mode active on production sites.</p></div>';
|
450 |
}
|
451 |
+
|
452 |
$x = wp_next_scheduled('newsletter');
|
453 |
if ($x === false) {
|
454 |
echo '<div class="notice notice-error"><p>The Newsletter delivery engine is off (it should never be off). Deactivate and reactivate the Newsletter plugin.</p></div>';
|
637 |
if (!$test) {
|
638 |
$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set sent=sent+1, last_id=" . $user->id . " where id=" . $email->id . " limit 1");
|
639 |
}
|
640 |
+
|
641 |
$user = apply_filters('newsletter_send_user', $user);
|
642 |
|
643 |
$m = $this->replace($email->message, $user, $email);
|
659 |
if (!$test) {
|
660 |
$this->save_sent($user, $email);
|
661 |
}
|
662 |
+
|
663 |
$this->email_limit--;
|
664 |
$count++;
|
665 |
}
|
666 |
+
|
667 |
+
|
668 |
if ($this->the_mailer != null) {
|
669 |
$this->logger->debug('Flushing and checking errors');
|
670 |
$this->the_mailer->flush();
|
674 |
$this->logger->debug('Error on email ' . $error['email']);
|
675 |
$this->save_sent($error['email'], $email, 1, $error['message']);
|
676 |
}
|
|
|
677 |
}
|
678 |
+
|
679 |
$this->logger->debug('Clearing errors');
|
680 |
if (method_exists($this->the_mailer, 'get_errors')) {
|
681 |
$this->the_mailer->clear_errors();
|
1143 |
$value->response[$extension->plugin] = $plugin;
|
1144 |
|
1145 |
$value->response[$extension->plugin]->package = '';
|
1146 |
+
|
1147 |
if (class_exists('NewsletterExtensions')) {
|
1148 |
// NO filters here!
|
1149 |
$value->response[$extension->plugin]->package = NewsletterExtensions::$instance->get_package($extension->id);
|
1187 |
if (function_exists('load_plugin_textdomain')) {
|
1188 |
load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
|
1189 |
}
|
1190 |
+
|
1191 |
if (!empty($this->action)) {
|
1192 |
do_action('newsletter_action', $this->action);
|
1193 |
}
|
1215 |
* @return string
|
1216 |
*/
|
1217 |
var $newsletter_page_url = false;
|
1218 |
+
|
1219 |
function get_newsletter_page_url($language = '') {
|
1220 |
+
|
1221 |
// TODO: Reintroduce the cache
|
1222 |
//if (!$this->newsletter_page_url) {
|
1223 |
+
if (!empty($this->options['page'])) {
|
1224 |
+
$this->newsletter_page_url = get_permalink($this->options['page']);
|
1225 |
+
if ($language && $this->newsletter_page_url) {
|
1226 |
+
if (class_exists('SitePress')) {
|
1227 |
+
$this->newsletter_page_url = apply_filters('wpml_permalink', $this->newsletter_page_url, $language);
|
1228 |
+
}
|
1229 |
+
if (function_exists('pll_get_post')) {
|
1230 |
+
$this->newsletter_page_url = get_permalink(pll_get_post($this->options['page']));
|
|
|
1231 |
}
|
1232 |
}
|
1233 |
+
}
|
1234 |
+
if (!$this->newsletter_page_url) {
|
1235 |
+
$this->newsletter_page_url = $this->build_action_url('m');
|
1236 |
+
}
|
1237 |
//}
|
1238 |
return $this->newsletter_page_url;
|
1239 |
}
|
1240 |
|
1241 |
+
function get_license_key() {
|
1242 |
+
if (defined('NEWSLETTER_LICENSE_KEY')) {
|
1243 |
+
return NEWSLETTER_LICENSE_KEY;
|
1244 |
+
} else {
|
1245 |
+
if (!empty($this->options['contract_key'])) {
|
1246 |
+
return $this->options['contract_key'];
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
return false;
|
1250 |
+
}
|
1251 |
|
1252 |
public static function check_license($license_key) {
|
1253 |
+
$response = wp_remote_get('http://www.thenewsletterplugin.com/wp-content/plugins/file-commerce-pro/check.php?k=' . urlencode($license_key), array('sslverify' => false));
|
1254 |
+
if (is_wp_error($response)) {
|
1255 |
+
/* @var $response WP_Error */
|
1256 |
+
return new WP_Error(-1, 'It seems that your blog cannot contact the license validator. Ask your provider to unlock the HTTP/HTTPS connections to www.thenewsletterplugin.com<br>'
|
1257 |
+
. esc_html($response->get_error_code()) . ' - ' . esc_html($response->get_error_message()));
|
1258 |
+
} else if ($response['response']['code'] != 200) {
|
1259 |
+
return new WP_Error(-1, '[' . $response['response']['code'] . '] The license seems expired or not valid, please check your <a href="https://www.thenewsletterplugin.com/account">license code and status</a>, thank you.'
|
1260 |
+
. '<br>You can anyway download the professional extension from https://www.thenewsletterplugin.com.');
|
1261 |
+
} elseif ($expires = json_decode(wp_remote_retrieve_body($response))) {
|
1262 |
+
return array('expires' => $expires->expire, 'message' => 'Your license is valid and expires on ' . esc_html(date('Y-m-d', $expires->expire)));
|
1263 |
+
} else {
|
1264 |
+
return new WP_Error(-1, 'Unable to detect the license expiration. Debug data to report to the support: <code>' . esc_html(wp_remote_retrieve_body($response)) . '</code>');
|
1265 |
+
}
|
1266 |
}
|
1267 |
|
1268 |
}
|
readme.txt
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 4.9.8
|
5 |
-
Stable tag: 5.8.
|
6 |
Contributors: satollo,webagile,michael-travan
|
7 |
|
8 |
Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
|
@@ -117,6 +117,13 @@ Thank you, The Newsletter Team
|
|
117 |
|
118 |
== Changelog ==
|
119 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
= 5.8.0 =
|
121 |
|
122 |
* Add-ons manager compatibility
|
2 |
Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
|
3 |
Requires at least: 3.4.0
|
4 |
Tested up to: 4.9.8
|
5 |
+
Stable tag: 5.8.1
|
6 |
Contributors: satollo,webagile,michael-travan
|
7 |
|
8 |
Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
|
117 |
|
118 |
== Changelog ==
|
119 |
|
120 |
+
= 5.8.1 =
|
121 |
+
|
122 |
+
* Delivery expected time indicator on status panel
|
123 |
+
* Fixed notice on email token missing
|
124 |
+
* Addons installation availability on status panel
|
125 |
+
* Option to remove the dedicated page check
|
126 |
+
|
127 |
= 5.8.0 =
|
128 |
|
129 |
* Add-ons manager compatibility
|
tnp-header.php
CHANGED
@@ -143,11 +143,13 @@ $warning |= empty($status_options['mail']);
|
|
143 |
<?php } else { ?>
|
144 |
<?php if (Newsletter::instance()->options['licence_expires'] > time()) { ?>
|
145 |
<li class="tnp-professional-extensions-button">
|
146 |
-
|
147 |
-
|
|
|
148 |
} else {
|
149 |
-
|
150 |
-
}
|
|
|
151 |
<i class="fa fa-check-square-o"></i> <?php _e('Licence active', 'newsletter') ?></a>
|
152 |
<?php } elseif (Newsletter::instance()->options['licence_expires'] < time()) { ?>
|
153 |
<li class="tnp-professional-extensions-button-red">
|
@@ -159,6 +161,27 @@ $warning |= empty($status_options['mail']);
|
|
159 |
</ul>
|
160 |
</div>
|
161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
<?php if (isset($_GET['debug']) || !isset($dismissed['rate']) && $user_count > 300) { ?>
|
164 |
<div class="tnp-notice">
|
143 |
<?php } else { ?>
|
144 |
<?php if (Newsletter::instance()->options['licence_expires'] > time()) { ?>
|
145 |
<li class="tnp-professional-extensions-button">
|
146 |
+
<?php
|
147 |
+
if (!class_exists('NewsletterExtensions')) {
|
148 |
+
echo '<a href="?page=newsletter_main_extensions">';
|
149 |
} else {
|
150 |
+
echo '<a href="?page=newsletter_extensions_index">';
|
151 |
+
}
|
152 |
+
?>
|
153 |
<i class="fa fa-check-square-o"></i> <?php _e('Licence active', 'newsletter') ?></a>
|
154 |
<?php } elseif (Newsletter::instance()->options['licence_expires'] < time()) { ?>
|
155 |
<li class="tnp-professional-extensions-button-red">
|
161 |
</ul>
|
162 |
</div>
|
163 |
|
164 |
+
<?php if (isset($_GET['debug']) || !isset($dismissed['newsletter-shortcode'])) { ?>
|
165 |
+
<?php
|
166 |
+
// Check of Newsletter dedicated page
|
167 |
+
if (!empty(Newsletter::instance()->options['page'])) {
|
168 |
+
if (get_post_status(Newsletter::instance()->options['page']) === 'publish') {
|
169 |
+
$content = get_post_field('post_content', $this->options['page']);
|
170 |
+
// With and without attributes
|
171 |
+
if (strpos($content, '[newsletter]') === false && strpos($content, '[newsletter ') === false) {
|
172 |
+
?>
|
173 |
+
<div class="tnp-notice">
|
174 |
+
<a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-shortcode' ?>" class="tnp-dismiss">×</a>
|
175 |
+
The Newsletter dedicated page does not contain the [newsletter] shortcode. If you're using a visual composer it could be ok.
|
176 |
+
<a href="<?php echo site_url('/wp-admin/post.php') ?>?post=<?php echo esc_attr(Newsletter::instance()->options['page']) ?>&action=edit"><strong>Edit the page</strong></a>.
|
177 |
+
|
178 |
+
</div>
|
179 |
+
<?php
|
180 |
+
}
|
181 |
+
}
|
182 |
+
}
|
183 |
+
?>
|
184 |
+
<?php } ?>
|
185 |
|
186 |
<?php if (isset($_GET['debug']) || !isset($dismissed['rate']) && $user_count > 300) { ?>
|
187 |
<div class="tnp-notice">
|