Newsletter - Version 4.9.7

Version Description

=

  • Fixed setup script throwing a debug notice
  • Changed chart library

=

Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 4.9.7
Comparing to
See all releases

Code changes from version 4.9.6 to 4.9.7

Files changed (6) hide show
  1. emails/index.php +1 -1
  2. main/main.php +2 -1
  3. plugin.php +2 -2
  4. readme.txt +6 -1
  5. users/statistics.php +82 -52
  6. users/users.php +5 -6
emails/index.php CHANGED
@@ -133,7 +133,7 @@ $emails = Newsletter::instance()->get_emails('message');
133
  </td>
134
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
135
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
136
- <td><?php echo $email->track == 1 ? __('Yes', 'newsletter') : __('Yes', 'newsletter'); ?></td>
137
  <td><a class="button-primary" href="<?php echo $module->get_admin_page_url($composer ? 'composer' : 'edit'); ?>&amp;id=<?php echo $email->id; ?>"><i class="fa fa-<?php echo $composer?'th-large':'pencil'?>"></i> <?php _e('Edit', 'newsletter') ?></a></td>
138
  <td>
139
  <a class="button-primary" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i> <?php _e('Statistics', 'newsletter') ?></a>
133
  </td>
134
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
135
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
136
+ <td><?php echo $email->track == 1 ? __('Yes', 'newsletter') : __('No', 'newsletter'); ?></td>
137
  <td><a class="button-primary" href="<?php echo $module->get_admin_page_url($composer ? 'composer' : 'edit'); ?>&amp;id=<?php echo $email->id; ?>"><i class="fa fa-<?php echo $composer?'th-large':'pencil'?>"></i> <?php _e('Edit', 'newsletter') ?></a></td>
138
  <td>
139
  <a class="button-primary" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i> <?php _e('Statistics', 'newsletter') ?></a>
main/main.php CHANGED
@@ -71,7 +71,8 @@ if (!empty($controls->data['contract_key'])) {
71
  $controls->errors .= esc_html($response->get_error_code()) . ' - ' . esc_html($response->get_error_message());
72
  $controls->data['licence_expires'] = "";
73
  } else if ($response['response']['code'] != 200) {
74
- $controls->errors .= 'The license seems expired or not valid, please check your <a href="https://www.thenewsletterplugin.com/account">license code and status</a>, thank you.';
 
75
  $controls->data['licence_expires'] = "";
76
  } elseif ($expires = json_decode(wp_remote_retrieve_body($response))) {
77
  $controls->data['licence_expires'] = $expires->expire;
71
  $controls->errors .= esc_html($response->get_error_code()) . ' - ' . esc_html($response->get_error_message());
72
  $controls->data['licence_expires'] = "";
73
  } else if ($response['response']['code'] != 200) {
74
+ $controls->errors .= '[' . $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.';
75
+ $controls->errors .= '<br>You can anyway download the professional extension from https://www.thenewsletterplugin.com.';
76
  $controls->data['licence_expires'] = "";
77
  } elseif ($expires = json_decode(wp_remote_retrieve_body($response))) {
78
  $controls->data['licence_expires'] = $expires->expire;
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: 4.9.6
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.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '4.9.6');
18
 
19
  global $wpdb, $newsletter;
20
 
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: 4.9.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.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '4.9.7');
18
 
19
  global $wpdb, $newsletter;
20
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.7.5
5
- Stable tag: 4.9.6
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -85,6 +85,11 @@ Thank you, The Newsletter Team
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
88
  == 4.9.6 ==
89
 
90
  * Extension version check improved
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
  Tested up to: 4.7.5
5
+ Stable tag: 4.9.7
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
85
 
86
  == Changelog ==
87
 
88
+ == 4.9.7 ==
89
+
90
+ * Fixed setup script throwing a debug notice
91
+ * Changed chart library
92
+
93
  == 4.9.6 ==
94
 
95
  * Extension version check improved
users/statistics.php CHANGED
@@ -1,8 +1,11 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
3
 
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
 
 
6
  $all_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE);
7
  $options_profile = get_option('newsletter_profile');
8
 
@@ -19,7 +22,7 @@ $controls = new NewsletterControls();
19
 
20
  <div class="wrap" id="tnp-wrap">
21
 
22
- <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
23
 
24
  <div id="tnp-heading">
25
 
@@ -29,7 +32,7 @@ $controls = new NewsletterControls();
29
 
30
  <div id="tnp-body" class="tnp-users-statistics">
31
 
32
- <?php $controls->init(); ?>
33
 
34
  <div id="tabs">
35
 
@@ -50,37 +53,37 @@ $controls = new NewsletterControls();
50
  <tr valign="top">
51
  <td>Any</td>
52
  <td>
53
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE); ?>
54
  </td>
55
  </tr>
56
  <tr>
57
  <td>Confirmed</td>
58
  <td>
59
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C'"); ?>
60
  </td>
61
  </tr>
62
  <tr>
63
  <td>Not confirmed</td>
64
  <td>
65
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='S'"); ?>
66
  </td>
67
  </tr>
68
  <tr>
69
  <td>Subscribed to feed by mail</td>
70
  <td>
71
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C' and feed=1"); ?>
72
  </td>
73
  </tr>
74
  <tr>
75
  <td>Unsubscribed</td>
76
  <td>
77
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='U'"); ?>
78
  </td>
79
  </tr>
80
  <tr>
81
  <td>Bounced</td>
82
  <td>
83
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='B'"); ?>
84
  </td>
85
  </tr>
86
  </table>
@@ -105,14 +108,14 @@ $controls = new NewsletterControls();
105
  <th>Total</th>
106
  </thead>
107
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
108
- <?php if (empty($options_profile['list_' . $i])) continue; ?>
109
  <tr>
110
  <td><?php echo '(' . $i . ') ' . esc_html($options_profile['list_' . $i]) ?></td>
111
  <td>
112
- <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where list_" . $i . "=1 and status='C'"); ?>
113
  </td>
114
  </tr>
115
- <?php } ?>
116
  </table>
117
 
118
  </div>
@@ -143,12 +146,12 @@ $controls = new NewsletterControls();
143
  <thead>
144
  <tr><th>Referrer</th><th>Total</th>
145
  </thead>
146
- <?php foreach ($list as $row) { ?>
147
  <tr>
148
  <td><?php echo empty($row->referrer) ? '[undefined]' : esc_html($row->referrer) ?></td>
149
  <td><?php echo $row->total; ?></td>
150
  </tr>
151
- <?php } ?>
152
  </table>
153
 
154
  </div>
@@ -173,12 +176,12 @@ $controls = new NewsletterControls();
173
  <th>Total</th>
174
  </thead>
175
  <tbody>
176
- <?php foreach ($list as $row) { ?>
177
- <tr>
178
- <td><?php echo empty($row->http_referer)?'[undefined]':esc_html($row->http_referer) ?></td>
179
- <td><?php echo $row->total; ?></td>
180
- </tr>
181
- <?php } ?>
182
  <tbody>
183
  </table>
184
 
@@ -187,42 +190,71 @@ $controls = new NewsletterControls();
187
 
188
  <div id="tabs-gender">
189
 
 
190
  <?php
191
  $male_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where sex='m' and status='C'");
192
  $female_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where sex='f' and status='C'");
193
- $other_count = ($all_count - $male_count - $female_count)
 
194
  ?>
195
-
196
 
197
- <div id="tnp-gender-chart" style="width: 600px; height: 300px"></div>
198
-
199
- <script type="text/javascript">
200
- google.charts.setOnLoadCallback(drawGenderChart);
201
-
202
- function drawGenderChart() {
203
- var data = new google.visualization.DataTable();
204
- data.addColumn('string', 'Gender');
205
- data.addColumn('number', 'Total');
206
- data.addRows([
207
- ['None', <?php echo $other_count; ?>],
208
- ['Female', <?php echo $female_count; ?>],
209
- ['Male', <?php echo $male_count; ?>]
210
- ]);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
 
212
- var options = {'title': 'Gender'};
213
 
214
- var chart = new google.visualization.PieChart(document.getElementById('tnp-gender-chart'));
215
- chart.draw(data, options);
216
- }
217
- </script>
218
-
219
- <br><br>
220
- <table class="widefat" style="width: auto">
221
- <thead><tr><th>Sex</th><th>Total</th></thead>
222
- <tr><td>Male</td><td><?php echo $male_count; ?></td></tr>
223
- <tr><td>Female</td><td><?php echo $female_count; ?></td></tr>
224
- <tr><td>Not specified</td><td><?php echo $other_count; ?></td></tr>
225
- </table>
226
  </div>
227
 
228
 
@@ -236,8 +268,6 @@ $controls = new NewsletterControls();
236
  }
237
  ?>
238
 
239
-
240
-
241
  </div>
242
 
243
  <?php
@@ -251,7 +281,7 @@ $controls = new NewsletterControls();
251
 
252
  </div>
253
 
254
- <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
255
 
256
  </div>
257
 
1
  <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
 
5
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
6
 
7
+ wp_enqueue_script('tnp-chart');
8
+
9
  $all_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE);
10
  $options_profile = get_option('newsletter_profile');
11
 
22
 
23
  <div class="wrap" id="tnp-wrap">
24
 
25
+ <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
26
 
27
  <div id="tnp-heading">
28
 
32
 
33
  <div id="tnp-body" class="tnp-users-statistics">
34
 
35
+ <?php $controls->init(); ?>
36
 
37
  <div id="tabs">
38
 
53
  <tr valign="top">
54
  <td>Any</td>
55
  <td>
56
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE); ?>
57
  </td>
58
  </tr>
59
  <tr>
60
  <td>Confirmed</td>
61
  <td>
62
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C'"); ?>
63
  </td>
64
  </tr>
65
  <tr>
66
  <td>Not confirmed</td>
67
  <td>
68
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='S'"); ?>
69
  </td>
70
  </tr>
71
  <tr>
72
  <td>Subscribed to feed by mail</td>
73
  <td>
74
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C' and feed=1"); ?>
75
  </td>
76
  </tr>
77
  <tr>
78
  <td>Unsubscribed</td>
79
  <td>
80
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='U'"); ?>
81
  </td>
82
  </tr>
83
  <tr>
84
  <td>Bounced</td>
85
  <td>
86
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='B'"); ?>
87
  </td>
88
  </tr>
89
  </table>
108
  <th>Total</th>
109
  </thead>
110
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
111
+ <?php if (empty($options_profile['list_' . $i])) continue; ?>
112
  <tr>
113
  <td><?php echo '(' . $i . ') ' . esc_html($options_profile['list_' . $i]) ?></td>
114
  <td>
115
+ <?php echo $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where list_" . $i . "=1 and status='C'"); ?>
116
  </td>
117
  </tr>
118
+ <?php } ?>
119
  </table>
120
 
121
  </div>
146
  <thead>
147
  <tr><th>Referrer</th><th>Total</th>
148
  </thead>
149
+ <?php foreach ($list as $row) { ?>
150
  <tr>
151
  <td><?php echo empty($row->referrer) ? '[undefined]' : esc_html($row->referrer) ?></td>
152
  <td><?php echo $row->total; ?></td>
153
  </tr>
154
+ <?php } ?>
155
  </table>
156
 
157
  </div>
176
  <th>Total</th>
177
  </thead>
178
  <tbody>
179
+ <?php foreach ($list as $row) { ?>
180
+ <tr>
181
+ <td><?php echo empty($row->http_referer) ? '[undefined]' : esc_html($row->http_referer) ?></td>
182
+ <td><?php echo $row->total; ?></td>
183
+ </tr>
184
+ <?php } ?>
185
  <tbody>
186
  </table>
187
 
190
 
191
  <div id="tabs-gender">
192
 
193
+
194
  <?php
195
  $male_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where sex='m' and status='C'");
196
  $female_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where sex='f' and status='C'");
197
+ $other_count = ($all_count - $male_count - $female_count);
198
+ $gender_data = array($female_count, $male_count, $other_count);
199
  ?>
 
200
 
201
+ <div class="row">
202
+ <div class="col-md-6">
203
+ <canvas id="tnp-gender-chart" style="width: 300px!important; height: 300px!important"></canvas>
204
+ </div>
205
+
206
+ <div class="col-md-6">
207
+ <table class="widefat" style="width: auto">
208
+ <thead>
209
+ <tr>
210
+ <th>Gender</th>
211
+ <th>Total</th>
212
+ </thead>
213
+ <tbody>
214
+ <tr>
215
+ <td>Male</td>
216
+ <td><?php echo $male_count; ?></td>
217
+ </tr>
218
+ <tr>
219
+ <td>Female</td>
220
+ <td><?php echo $female_count; ?></td>
221
+ </tr>
222
+ <tr>
223
+ <td>Other</td>
224
+ <td><?php echo $other_count; ?></td>
225
+ </tr>
226
+ </table>
227
+ </div>
228
+ </div>
229
+ <script>
230
+ var gender_data = {
231
+ labels: [
232
+ "Female",
233
+ "Male",
234
+ "Other"
235
+ ],
236
+ datasets: [
237
+ {
238
+ data: <?php echo json_encode($gender_data) ?>,
239
+ backgroundColor: [
240
+ "#2980B9",
241
+ "#27AE60",
242
+ "#555555"
243
+ ],
244
+ hoverBackgroundColor: [
245
+ "#2980B9",
246
+ "#27AE60",
247
+ "#555555"
248
+ ]
249
+ }]};
250
+
251
+ jQuery(document).ready(function ($) {
252
+ gender_ctx = $('#tnp-gender-chart').get(0).getContext("2d");
253
+ new Chart(gender_ctx, {type: 'doughnut', data: gender_data, options: {responsive: false, legend: {labels: {boxWidth: 10}}}});
254
+ });
255
+ </script>
256
 
 
257
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  </div>
259
 
260
 
268
  }
269
  ?>
270
 
 
 
271
  </div>
272
 
273
  <?php
281
 
282
  </div>
283
 
284
+ <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
285
 
286
  </div>
287
 
users/users.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
 
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
@@ -70,7 +72,6 @@ class NewsletterUsers extends NewsletterModule {
70
  `country` varchar(4) NOT NULL DEFAULT '',
71
  `region` varchar(100) NOT NULL DEFAULT '',
72
  `city` varchar(100) NOT NULL DEFAULT '',
73
-
74
  `unsub_email_id` int(11) NOT NULL DEFAULT '0',
75
  `unsub_time` int(11) NOT NULL DEFAULT '0',\n";
76
 
@@ -83,12 +84,10 @@ class NewsletterUsers extends NewsletterModule {
83
  }
84
  // Leave as last
85
  $sql .= "`test` tinyint(4) NOT NULL DEFAULT '0',\n";
86
- $sql .= "PRIMARY KEY (`id`),
87
- UNIQUE KEY `email` (`email`)
88
- ) ENGINE=MyISAM $charset_collate;";
89
 
90
  dbDelta($sql);
91
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set $charset_collate");
92
  }
93
 
94
  function admin_menu() {
1
  <?php
2
+
3
+ if (!defined('ABSPATH'))
4
+ exit;
5
 
6
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
7
 
72
  `country` varchar(4) NOT NULL DEFAULT '',
73
  `region` varchar(100) NOT NULL DEFAULT '',
74
  `city` varchar(100) NOT NULL DEFAULT '',
 
75
  `unsub_email_id` int(11) NOT NULL DEFAULT '0',
76
  `unsub_time` int(11) NOT NULL DEFAULT '0',\n";
77
 
84
  }
85
  // Leave as last
86
  $sql .= "`test` tinyint(4) NOT NULL DEFAULT '0',\n";
87
+ $sql .= "PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`)) ENGINE=MyISAM $charset_collate;";
 
 
88
 
89
  dbDelta($sql);
90
+ $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set $charset_collate");
91
  }
92
 
93
  function admin_menu() {