Newsletter - Version 4.9.1

Version Description

=

  • Small code fixes
  • Chart js conflict fix
  • Curl SSL version on status panel

=

Download this release

Release Info

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

Code changes from version 4.9.0 to 4.9.1

admin.css CHANGED
@@ -76,9 +76,9 @@
76
 
77
  /* Global Fonts */
78
 
79
- /*#tnp-wrap {
80
  font-family: "Open Sans", sans-serif;
81
- }*/
82
 
83
 
84
  /* HEADER *********************************************************************/
@@ -262,15 +262,19 @@
262
 
263
  #tnp-body .form-table {
264
  background-color: #fff;
265
- border: 1px solid #ddd;
 
266
  }
267
 
268
  #tnp-body .form-table th {
269
  text-align: right;
270
  font-weight: bold;
271
- border-right: 1px solid #ddd;
272
  max-width: 200px;
273
  color: #000000;
 
 
 
 
274
  }
275
 
276
  #tnp-body .form-table th small {
@@ -341,13 +345,13 @@
341
  }
342
 
343
  #tnp-body #tabs .ui-widget-header {
344
- background: none;
345
  border: 0;
346
- border-bottom: 1px solid #ddd;
347
  }
348
 
349
  #tnp-body #tabs .ui-tabs-panel {
350
  padding: 15px!important;
 
351
  }
352
 
353
  #tnp-body #tabs a.ui-tabs-anchor,
@@ -424,6 +428,18 @@ table.clicks {
424
  padding: 1px 5px;
425
  }
426
 
 
 
 
 
 
 
 
 
 
 
 
 
427
  .newsletter-checkbox-group, .nl-checkbox-group {
428
  float: left;
429
  margin-right: 5px;
@@ -478,7 +494,7 @@ table.clicks {
478
  }
479
 
480
  .ui-tabs .ui-tabs-nav li a {
481
- font-size: 12px;
482
  }
483
 
484
 
@@ -799,8 +815,8 @@ p.description {
799
  /* Stefano 4.0 */
800
 
801
  .ui-tabs {
802
- border-color: #ddd;
803
- background-color: #f2f2f2;
804
  border: 0;
805
  }
806
 
@@ -844,6 +860,14 @@ p.description {
844
  #tnp-body h3 {
845
  margin-top: 25px;
846
  clear: both;
 
 
 
 
 
 
 
 
847
  }
848
 
849
  .tnp-body-lite {
@@ -891,7 +915,7 @@ p.description {
891
 
892
  #tnp-heading p {
893
  margin: 0px;
894
- color: #fff;
895
  }
896
 
897
  #tnp-heading .tnp-btn-h1 {
@@ -1569,4 +1593,18 @@ img.tnp-extensions-free-badge {
1569
  color: #666;
1570
  margin-top: 20px;
1571
  margin-bottom: 20px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1572
  }
76
 
77
  /* Global Fonts */
78
 
79
+ #tnp-wrap {
80
  font-family: "Open Sans", sans-serif;
81
+ }
82
 
83
 
84
  /* HEADER *********************************************************************/
262
 
263
  #tnp-body .form-table {
264
  background-color: #fff;
265
+ border: 1px solid #ECF0F1;
266
+ margin-top: 2em;
267
  }
268
 
269
  #tnp-body .form-table th {
270
  text-align: right;
271
  font-weight: bold;
 
272
  max-width: 200px;
273
  color: #000000;
274
+ background-color: #ECF0F1;
275
+ border-bottom: 4px solid #fff;
276
+
277
+
278
  }
279
 
280
  #tnp-body .form-table th small {
345
  }
346
 
347
  #tnp-body #tabs .ui-widget-header {
348
+ background: #28313C;
349
  border: 0;
 
350
  }
351
 
352
  #tnp-body #tabs .ui-tabs-panel {
353
  padding: 15px!important;
354
+ background-color: #fff;
355
  }
356
 
357
  #tnp-body #tabs a.ui-tabs-anchor,
428
  padding: 1px 5px;
429
  }
430
 
431
+ .tnp-checkboxes label {
432
+ display: block;
433
+ float: left;
434
+ width: 220px;
435
+ border: 1px solid #ccc;
436
+ background-color: #f4f4f4;
437
+ margin-bottom: 5px;
438
+ padding: 5px;
439
+ white-space: nowrap;
440
+ margin-right: 5px;
441
+ }
442
+
443
  .newsletter-checkbox-group, .nl-checkbox-group {
444
  float: left;
445
  margin-right: 5px;
494
  }
495
 
496
  .ui-tabs .ui-tabs-nav li a {
497
+ font-size: 14px;
498
  }
499
 
500
 
815
  /* Stefano 4.0 */
816
 
817
  .ui-tabs {
818
+ border-color: #28313C;
819
+ background-color: #28313C;
820
  border: 0;
821
  }
822
 
860
  #tnp-body h3 {
861
  margin-top: 25px;
862
  clear: both;
863
+ /* display: inline-block; */
864
+ /* background-color: #34495E; */
865
+ /* color: #fff !important; */
866
+ padding: 15px 0px;
867
+ margin-bottom: 10px;
868
+ width: 200px;
869
+ /* text-align: right; */
870
+ border-bottom: 2px solid #27AE60;
871
  }
872
 
873
  .tnp-body-lite {
915
 
916
  #tnp-heading p {
917
  margin: 0px;
918
+ color: #ccc;
919
  }
920
 
921
  #tnp-heading .tnp-btn-h1 {
1593
  color: #666;
1594
  margin-top: 20px;
1595
  margin-bottom: 20px;
1596
+ }
1597
+
1598
+ /* Michael - Nuovo Stile Tabelle Plugin */
1599
+
1600
+ .ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {
1601
+ background: #fff !important;
1602
+ font-weight: normal;
1603
+ font-family: "Montserrat", sans-serif;
1604
+ }
1605
+
1606
+ .ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default {
1607
+ border: none;
1608
+ background: #ECF0F1;
1609
+ font-family: "Montserrat", sans-serif;
1610
  }
emails/cpreview.php CHANGED
@@ -6,7 +6,10 @@ require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
6
  $controls = new NewsletterControls();
7
  $module = NewsletterEmails::instance();
8
 
 
9
  $email = Newsletter::instance()->get_email((int) $_GET['id'], ARRAY_A);
 
 
10
 
11
  // TNP Composer style
12
  wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builder.css', __FILE__));
@@ -27,15 +30,13 @@ if (!$controls->is_action()) {
27
  if (!empty($email['sex'])) {
28
  $controls->data['sex'] = explode(',', $email['sex']);
29
  }
30
- $email_options = unserialize($email['options']);
31
- if (is_array($email_options)) {
32
- $controls->data = array_merge($controls->data, $email_options);
33
 
34
- foreach ($email_options as $name => $value) {
 
 
35
  $controls->data['options_' . $name] = $value;
36
  }
37
  }
38
- }
39
 
40
  if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
41
 
@@ -52,13 +53,17 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
52
  $email['private'] = $controls->data['private'];
53
 
54
  // Builds the extended options
55
- $email['options'] = array();
56
  $email['options']['preferences_status'] = $controls->data['preferences_status'];
57
  if (isset($controls->data['preferences'])) {
58
  $email['options']['preferences'] = $controls->data['preferences'];
 
 
59
  }
60
  if (isset($controls->data['sex'])) {
61
  $email['options']['sex'] = $controls->data['sex'];
 
 
62
  }
63
 
64
  foreach ($controls->data as $name => $value) {
@@ -107,14 +112,14 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
107
  if ($controls->data['preferences_status'] == 1) {
108
  $query .= " and (";
109
  foreach ($preferences as $x) {
110
- $query .= "list_" . $x . "=0" . $operator;
111
  }
112
  $query = substr($query, 0, -4);
113
  $query .= ")";
114
  } else {
115
  $query .= " and (";
116
  foreach ($preferences as $x) {
117
- $query .= "list_" . $x . "=1" . $operator;
118
  }
119
  $query = substr($query, 0, -4);
120
  $query .= ")";
@@ -126,21 +131,25 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
126
  if (is_array($sex)) {
127
  $query .= " and sex in (";
128
  foreach ($sex as $x) {
129
- $query .= "'" . $x . "', ";
130
  }
131
  $query = substr($query, 0, -2);
132
  $query .= ")";
133
  }
134
  }
135
 
 
 
 
 
 
 
136
  $email['query'] = $query;
137
  if ($email['status'] == 'sent') {
138
  $email['total'] = $email['sent'];
139
  } else {
140
  $email['total'] = $wpdb->get_var(str_replace('*', 'count(*)', $query));
141
  }
142
-
143
-
144
  if ($controls->is_action('send') && $controls->data['send_on'] < time()) {
145
  $controls->data['send_on'] = time();
146
  }
@@ -381,7 +390,7 @@ if ($controls->is_action('test')) {
381
  <?php $controls->yesno('wp_users'); ?>
382
 
383
  <p class="description">
384
- Limit to the subscribers which are WordPress users.
385
  </p>
386
  </td>
387
  </tr>
@@ -391,7 +400,11 @@ if ($controls->is_action('test')) {
391
  </th>
392
  <td>
393
  <?php
 
394
  echo $wpdb->get_var(str_replace('*', 'count(*)', $email['query']));
 
 
 
395
  ?>
396
  <p class="description">
397
  <?php _e('Save to update if on targeting filters have been changed', 'newsletter') ?>
@@ -399,6 +412,8 @@ if ($controls->is_action('test')) {
399
  </td>
400
  </tr>
401
  </table>
 
 
402
  </div>
403
 
404
 
@@ -432,13 +447,13 @@ if ($controls->is_action('test')) {
432
  </table>
433
 
434
  <?php do_action('newsletter_emails_edit_other', $module->get_email($email_id), $controls) ?>
435
-
436
  </div>
 
437
  <div id="tabs-status">
438
  <table class="form-table">
439
  <tr valign="top">
440
  <th>Email status</th>
441
- <td><?php echo $email['status'] ?></td>
442
  </tr>
443
  <tr valign="top">
444
  <th>Messages sent</th>
@@ -485,4 +500,3 @@ if ($controls->is_action('test')) {
485
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
486
 
487
  </div>
488
-
6
  $controls = new NewsletterControls();
7
  $module = NewsletterEmails::instance();
8
 
9
+ // Always required
10
  $email = Newsletter::instance()->get_email((int) $_GET['id'], ARRAY_A);
11
+ $email['options'] = maybe_unserialize($email['options']);
12
+ if (!is_array($email['options'])) $email['options'] = array();
13
 
14
  // TNP Composer style
15
  wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builder.css', __FILE__));
30
  if (!empty($email['sex'])) {
31
  $controls->data['sex'] = explode(',', $email['sex']);
32
  }
 
 
 
33
 
34
+ $controls->data = array_merge($controls->data, $email['options']);
35
+
36
+ foreach ($email['options'] as $name => $value) {
37
  $controls->data['options_' . $name] = $value;
38
  }
39
  }
 
40
 
41
  if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
42
 
53
  $email['private'] = $controls->data['private'];
54
 
55
  // Builds the extended options
56
+ //$email['options'] = array();
57
  $email['options']['preferences_status'] = $controls->data['preferences_status'];
58
  if (isset($controls->data['preferences'])) {
59
  $email['options']['preferences'] = $controls->data['preferences'];
60
+ } else {
61
+ $email['options']['preferences'] = array();
62
  }
63
  if (isset($controls->data['sex'])) {
64
  $email['options']['sex'] = $controls->data['sex'];
65
+ } else {
66
+ $email['options']['sex'] = array();
67
  }
68
 
69
  foreach ($controls->data as $name => $value) {
112
  if ($controls->data['preferences_status'] == 1) {
113
  $query .= " and (";
114
  foreach ($preferences as $x) {
115
+ $query .= "list_" . ((int) $x) . "=0" . $operator;
116
  }
117
  $query = substr($query, 0, -4);
118
  $query .= ")";
119
  } else {
120
  $query .= " and (";
121
  foreach ($preferences as $x) {
122
+ $query .= "list_" . ((int) $x) . "=1" . $operator;
123
  }
124
  $query = substr($query, 0, -4);
125
  $query .= ")";
131
  if (is_array($sex)) {
132
  $query .= " and sex in (";
133
  foreach ($sex as $x) {
134
+ $query .= "'" . esc_sql($x) . "', ";
135
  }
136
  $query = substr($query, 0, -2);
137
  $query .= ")";
138
  }
139
  }
140
 
141
+ $res = Newsletter::instance()->save_email($email);
142
+
143
+ $e = $module->get_email($email_id);
144
+ $e->options = maybe_unserialize($e->options);
145
+ $query = apply_filters('newsletter_emails_email_query', $query, $e);
146
+
147
  $email['query'] = $query;
148
  if ($email['status'] == 'sent') {
149
  $email['total'] = $email['sent'];
150
  } else {
151
  $email['total'] = $wpdb->get_var(str_replace('*', 'count(*)', $query));
152
  }
 
 
153
  if ($controls->is_action('send') && $controls->data['send_on'] < time()) {
154
  $controls->data['send_on'] = time();
155
  }
390
  <?php $controls->yesno('wp_users'); ?>
391
 
392
  <p class="description">
393
+ Limit to the subscribers which are WordPress users as well.
394
  </p>
395
  </td>
396
  </tr>
400
  </th>
401
  <td>
402
  <?php
403
+ if ($email['status'] != 'sent') {
404
  echo $wpdb->get_var(str_replace('*', 'count(*)', $email['query']));
405
+ } else {
406
+ echo $email['sent'];
407
+ }
408
  ?>
409
  <p class="description">
410
  <?php _e('Save to update if on targeting filters have been changed', 'newsletter') ?>
412
  </td>
413
  </tr>
414
  </table>
415
+
416
+ <?php do_action('newsletter_emails_edit_target', $module->get_email($email_id), $controls) ?>
417
  </div>
418
 
419
 
447
  </table>
448
 
449
  <?php do_action('newsletter_emails_edit_other', $module->get_email($email_id), $controls) ?>
 
450
  </div>
451
+
452
  <div id="tabs-status">
453
  <table class="form-table">
454
  <tr valign="top">
455
  <th>Email status</th>
456
+ <td><?php echo esc_html($email['status']); ?></td>
457
  </tr>
458
  <tr valign="top">
459
  <th>Messages sent</th>
500
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
501
 
502
  </div>
 
emails/edit.php CHANGED
@@ -138,6 +138,12 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
138
  $query .= ")";
139
  }
140
  }
 
 
 
 
 
 
141
 
142
  $email['query'] = $query;
143
  if ($email['status'] == 'sent') {
@@ -461,6 +467,8 @@ if ($email['editor'] == 0) {
461
  </td>
462
  </tr>
463
  </table>
 
 
464
  </div>
465
 
466
 
138
  $query .= ")";
139
  }
140
  }
141
+
142
+ $res = Newsletter::instance()->save_email($email);
143
+
144
+ $e = $module->get_email($email_id);
145
+ $e->options = maybe_unserialize($e->options);
146
+ $query = apply_filters('newsletter_emails_email_query', $query, $e);
147
 
148
  $email['query'] = $query;
149
  if ($email['status'] == 'sent') {
467
  </td>
468
  </tr>
469
  </table>
470
+
471
+ <?php do_action('newsletter_emails_edit_target', $module->get_email($email_id), $controls) ?>
472
  </div>
473
 
474
 
emails/tnp-composer/_css/newsletter-builder.css CHANGED
@@ -566,4 +566,20 @@
566
 
567
  #tnpc-block-options-form, #tnpc-block-options-form p {
568
  color: #444;
569
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
566
 
567
  #tnpc-block-options-form, #tnpc-block-options-form p {
568
  color: #444;
569
+ }
570
+
571
+
572
+ /* List Block Styles */ *
573
+
574
+ .tnp-select2-option {
575
+ /* background-color: red; */
576
+ }
577
+
578
+ .tnp-select2-option img {
579
+ height: 15px;
580
+ margin-right: 5px;
581
+ vertical-align: middle;
582
+ background-color: rgba(234, 234, 234, 0.25);
583
+ padding: 10px;
584
+ border-radius: 5px;
585
+ }
includes/controls.php CHANGED
@@ -10,6 +10,253 @@ class NewsletterControls {
10
  var $errors = '';
11
  var $messages = '';
12
  var $warnings = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
  function __construct($options = null) {
15
  if ($options == null) {
@@ -315,7 +562,7 @@ class NewsletterControls {
315
  }
316
  echo '</select>';
317
  }
318
-
319
  function select_images($name, $options, $first = null) {
320
  $value = $this->get_value($name);
321
 
@@ -337,8 +584,30 @@ class NewsletterControls {
337
  echo '</select>';
338
  echo '<script>jQuery("#options-' . esc_attr($name) . '").select2({templateResult: tnp_select_images, templateSelection: tnp_select_images_selection});</script>';
339
  }
340
-
341
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
342
  function select_grouped($name, $groups) {
343
  $value = $this->get_value($name);
344
 
@@ -521,7 +790,7 @@ class NewsletterControls {
521
  function wp_editor($name, $settings = array()) {
522
  $value = $this->get_value($name);
523
  wp_editor($value, $name, array_merge(array('textarea_name' => 'options[' . esc_attr($name) . ']', 'wpautop' => false), $settings));
524
- echo '<p class="description">You can install <a href="https://wordpress.org/plugins/tinymce-advanced/" target="_blank">TinyMCE Advanced</a> for advanced editing features</p>';
525
  }
526
 
527
  function textarea($name, $width = '100%', $height = '50') {
@@ -636,6 +905,15 @@ class NewsletterControls {
636
  echo '</label>';
637
  }
638
 
 
 
 
 
 
 
 
 
 
639
  function color($name) {
640
  echo $this->text($name, 10);
641
  }
@@ -855,7 +1133,7 @@ class NewsletterControls {
855
  function hours($name) {
856
  $hours = array();
857
  for ($i = 0; $i < 24; $i++) {
858
- $hours['' . $i] = '' . $i;
859
  }
860
  $this->select($name, $hours);
861
  }
@@ -1022,7 +1300,7 @@ class NewsletterControls {
1022
 
1023
  function media($name) {
1024
  if (isset($this->data[$name])) {
1025
- $media_id = (int)$this->data[$name]['id'];
1026
  $media = wp_get_attachment_image_src($media_id, 'medium');
1027
  $media_full = wp_get_attachment_image_src($media_id, 'full');
1028
  } else {
@@ -1038,7 +1316,7 @@ class NewsletterControls {
1038
  } else {
1039
  echo '<img style="max-width: 200px; max-height: 200px;" id="' . esc_attr($name) . '_img" src="' . esc_attr($media[0]) . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1040
  }
1041
-
1042
  echo '</div>';
1043
  echo '<input type="hidden" id="' . esc_attr($name) . '_id" name="options[' . esc_attr($name) . '][id]" value="' . esc_attr($media_id) . '" size="5">';
1044
  echo '<input type="hidden" id="' . esc_attr($name) . '_url" name="options[' . esc_attr($name) . '][url]" value="' . esc_attr($media_full[0]) . '" size="50">';
10
  var $errors = '';
11
  var $messages = '';
12
  var $warnings = array();
13
+ var $countries = array(
14
+ 'AF' => 'Afghanistan',
15
+ 'AX' => 'Aland Islands',
16
+ 'AL' => 'Albania',
17
+ 'DZ' => 'Algeria',
18
+ 'AS' => 'American Samoa',
19
+ 'AD' => 'Andorra',
20
+ 'AO' => 'Angola',
21
+ 'AI' => 'Anguilla',
22
+ 'AQ' => 'Antarctica',
23
+ 'AG' => 'Antigua And Barbuda',
24
+ 'AR' => 'Argentina',
25
+ 'AM' => 'Armenia',
26
+ 'AW' => 'Aruba',
27
+ 'AU' => 'Australia',
28
+ 'AT' => 'Austria',
29
+ 'AZ' => 'Azerbaijan',
30
+ 'BS' => 'Bahamas',
31
+ 'BH' => 'Bahrain',
32
+ 'BD' => 'Bangladesh',
33
+ 'BB' => 'Barbados',
34
+ 'BY' => 'Belarus',
35
+ 'BE' => 'Belgium',
36
+ 'BZ' => 'Belize',
37
+ 'BJ' => 'Benin',
38
+ 'BM' => 'Bermuda',
39
+ 'BT' => 'Bhutan',
40
+ 'BO' => 'Bolivia',
41
+ 'BA' => 'Bosnia And Herzegovina',
42
+ 'BW' => 'Botswana',
43
+ 'BV' => 'Bouvet Island',
44
+ 'BR' => 'Brazil',
45
+ 'IO' => 'British Indian Ocean Territory',
46
+ 'BN' => 'Brunei Darussalam',
47
+ 'BG' => 'Bulgaria',
48
+ 'BF' => 'Burkina Faso',
49
+ 'BI' => 'Burundi',
50
+ 'KH' => 'Cambodia',
51
+ 'CM' => 'Cameroon',
52
+ 'CA' => 'Canada',
53
+ 'CV' => 'Cape Verde',
54
+ 'KY' => 'Cayman Islands',
55
+ 'CF' => 'Central African Republic',
56
+ 'TD' => 'Chad',
57
+ 'CL' => 'Chile',
58
+ 'CN' => 'China',
59
+ 'CX' => 'Christmas Island',
60
+ 'CC' => 'Cocos (Keeling) Islands',
61
+ 'CO' => 'Colombia',
62
+ 'KM' => 'Comoros',
63
+ 'CG' => 'Congo',
64
+ 'CD' => 'Congo, Democratic Republic',
65
+ 'CK' => 'Cook Islands',
66
+ 'CR' => 'Costa Rica',
67
+ 'CI' => 'Cote D\'Ivoire',
68
+ 'HR' => 'Croatia',
69
+ 'CU' => 'Cuba',
70
+ 'CY' => 'Cyprus',
71
+ 'CZ' => 'Czech Republic',
72
+ 'DK' => 'Denmark',
73
+ 'DJ' => 'Djibouti',
74
+ 'DM' => 'Dominica',
75
+ 'DO' => 'Dominican Republic',
76
+ 'EC' => 'Ecuador',
77
+ 'EG' => 'Egypt',
78
+ 'SV' => 'El Salvador',
79
+ 'GQ' => 'Equatorial Guinea',
80
+ 'ER' => 'Eritrea',
81
+ 'EE' => 'Estonia',
82
+ 'ET' => 'Ethiopia',
83
+ 'FK' => 'Falkland Islands (Malvinas)',
84
+ 'FO' => 'Faroe Islands',
85
+ 'FJ' => 'Fiji',
86
+ 'FI' => 'Finland',
87
+ 'FR' => 'France',
88
+ 'GF' => 'French Guiana',
89
+ 'PF' => 'French Polynesia',
90
+ 'TF' => 'French Southern Territories',
91
+ 'GA' => 'Gabon',
92
+ 'GM' => 'Gambia',
93
+ 'GE' => 'Georgia',
94
+ 'DE' => 'Germany',
95
+ 'GH' => 'Ghana',
96
+ 'GI' => 'Gibraltar',
97
+ 'GR' => 'Greece',
98
+ 'GL' => 'Greenland',
99
+ 'GD' => 'Grenada',
100
+ 'GP' => 'Guadeloupe',
101
+ 'GU' => 'Guam',
102
+ 'GT' => 'Guatemala',
103
+ 'GG' => 'Guernsey',
104
+ 'GN' => 'Guinea',
105
+ 'GW' => 'Guinea-Bissau',
106
+ 'GY' => 'Guyana',
107
+ 'HT' => 'Haiti',
108
+ 'HM' => 'Heard Island & Mcdonald Islands',
109
+ 'VA' => 'Holy See (Vatican City State)',
110
+ 'HN' => 'Honduras',
111
+ 'HK' => 'Hong Kong',
112
+ 'HU' => 'Hungary',
113
+ 'IS' => 'Iceland',
114
+ 'IN' => 'India',
115
+ 'ID' => 'Indonesia',
116
+ 'IR' => 'Iran, Islamic Republic Of',
117
+ 'IQ' => 'Iraq',
118
+ 'IE' => 'Ireland',
119
+ 'IM' => 'Isle Of Man',
120
+ 'IL' => 'Israel',
121
+ 'IT' => 'Italy',
122
+ 'JM' => 'Jamaica',
123
+ 'JP' => 'Japan',
124
+ 'JE' => 'Jersey',
125
+ 'JO' => 'Jordan',
126
+ 'KZ' => 'Kazakhstan',
127
+ 'KE' => 'Kenya',
128
+ 'KI' => 'Kiribati',
129
+ 'KR' => 'Korea',
130
+ 'KW' => 'Kuwait',
131
+ 'KG' => 'Kyrgyzstan',
132
+ 'LA' => 'Lao People\'s Democratic Republic',
133
+ 'LV' => 'Latvia',
134
+ 'LB' => 'Lebanon',
135
+ 'LS' => 'Lesotho',
136
+ 'LR' => 'Liberia',
137
+ 'LY' => 'Libyan Arab Jamahiriya',
138
+ 'LI' => 'Liechtenstein',
139
+ 'LT' => 'Lithuania',
140
+ 'LU' => 'Luxembourg',
141
+ 'MO' => 'Macao',
142
+ 'MK' => 'Macedonia',
143
+ 'MG' => 'Madagascar',
144
+ 'MW' => 'Malawi',
145
+ 'MY' => 'Malaysia',
146
+ 'MV' => 'Maldives',
147
+ 'ML' => 'Mali',
148
+ 'MT' => 'Malta',
149
+ 'MH' => 'Marshall Islands',
150
+ 'MQ' => 'Martinique',
151
+ 'MR' => 'Mauritania',
152
+ 'MU' => 'Mauritius',
153
+ 'YT' => 'Mayotte',
154
+ 'MX' => 'Mexico',
155
+ 'FM' => 'Micronesia, Federated States Of',
156
+ 'MD' => 'Moldova',
157
+ 'MC' => 'Monaco',
158
+ 'MN' => 'Mongolia',
159
+ 'ME' => 'Montenegro',
160
+ 'MS' => 'Montserrat',
161
+ 'MA' => 'Morocco',
162
+ 'MZ' => 'Mozambique',
163
+ 'MM' => 'Myanmar',
164
+ 'NA' => 'Namibia',
165
+ 'NR' => 'Nauru',
166
+ 'NP' => 'Nepal',
167
+ 'NL' => 'Netherlands',
168
+ 'AN' => 'Netherlands Antilles',
169
+ 'NC' => 'New Caledonia',
170
+ 'NZ' => 'New Zealand',
171
+ 'NI' => 'Nicaragua',
172
+ 'NE' => 'Niger',
173
+ 'NG' => 'Nigeria',
174
+ 'NU' => 'Niue',
175
+ 'NF' => 'Norfolk Island',
176
+ 'MP' => 'Northern Mariana Islands',
177
+ 'NO' => 'Norway',
178
+ 'OM' => 'Oman',
179
+ 'PK' => 'Pakistan',
180
+ 'PW' => 'Palau',
181
+ 'PS' => 'Palestinian Territory, Occupied',
182
+ 'PA' => 'Panama',
183
+ 'PG' => 'Papua New Guinea',
184
+ 'PY' => 'Paraguay',
185
+ 'PE' => 'Peru',
186
+ 'PH' => 'Philippines',
187
+ 'PN' => 'Pitcairn',
188
+ 'PL' => 'Poland',
189
+ 'PT' => 'Portugal',
190
+ 'PR' => 'Puerto Rico',
191
+ 'QA' => 'Qatar',
192
+ 'RE' => 'Reunion',
193
+ 'RO' => 'Romania',
194
+ 'RU' => 'Russian Federation',
195
+ 'RW' => 'Rwanda',
196
+ 'BL' => 'Saint Barthelemy',
197
+ 'SH' => 'Saint Helena',
198
+ 'KN' => 'Saint Kitts And Nevis',
199
+ 'LC' => 'Saint Lucia',
200
+ 'MF' => 'Saint Martin',
201
+ 'PM' => 'Saint Pierre And Miquelon',
202
+ 'VC' => 'Saint Vincent And Grenadines',
203
+ 'WS' => 'Samoa',
204
+ 'SM' => 'San Marino',
205
+ 'ST' => 'Sao Tome And Principe',
206
+ 'SA' => 'Saudi Arabia',
207
+ 'SN' => 'Senegal',
208
+ 'RS' => 'Serbia',
209
+ 'SC' => 'Seychelles',
210
+ 'SL' => 'Sierra Leone',
211
+ 'SG' => 'Singapore',
212
+ 'SK' => 'Slovakia',
213
+ 'SI' => 'Slovenia',
214
+ 'SB' => 'Solomon Islands',
215
+ 'SO' => 'Somalia',
216
+ 'ZA' => 'South Africa',
217
+ 'GS' => 'South Georgia And Sandwich Isl.',
218
+ 'ES' => 'Spain',
219
+ 'LK' => 'Sri Lanka',
220
+ 'SD' => 'Sudan',
221
+ 'SR' => 'Suriname',
222
+ 'SJ' => 'Svalbard And Jan Mayen',
223
+ 'SZ' => 'Swaziland',
224
+ 'SE' => 'Sweden',
225
+ 'CH' => 'Switzerland',
226
+ 'SY' => 'Syrian Arab Republic',
227
+ 'TW' => 'Taiwan',
228
+ 'TJ' => 'Tajikistan',
229
+ 'TZ' => 'Tanzania',
230
+ 'TH' => 'Thailand',
231
+ 'TL' => 'Timor-Leste',
232
+ 'TG' => 'Togo',
233
+ 'TK' => 'Tokelau',
234
+ 'TO' => 'Tonga',
235
+ 'TT' => 'Trinidad And Tobago',
236
+ 'TN' => 'Tunisia',
237
+ 'TR' => 'Turkey',
238
+ 'TM' => 'Turkmenistan',
239
+ 'TC' => 'Turks And Caicos Islands',
240
+ 'TV' => 'Tuvalu',
241
+ 'UG' => 'Uganda',
242
+ 'UA' => 'Ukraine',
243
+ 'AE' => 'United Arab Emirates',
244
+ 'GB' => 'United Kingdom',
245
+ 'US' => 'United States',
246
+ 'UM' => 'United States Outlying Islands',
247
+ 'UY' => 'Uruguay',
248
+ 'UZ' => 'Uzbekistan',
249
+ 'VU' => 'Vanuatu',
250
+ 'VE' => 'Venezuela',
251
+ 'VN' => 'Viet Nam',
252
+ 'VG' => 'Virgin Islands, British',
253
+ 'VI' => 'Virgin Islands, U.S.',
254
+ 'WF' => 'Wallis And Futuna',
255
+ 'EH' => 'Western Sahara',
256
+ 'YE' => 'Yemen',
257
+ 'ZM' => 'Zambia',
258
+ 'ZW' => 'Zimbabwe',
259
+ );
260
 
261
  function __construct($options = null) {
262
  if ($options == null) {
562
  }
563
  echo '</select>';
564
  }
565
+
566
  function select_images($name, $options, $first = null) {
567
  $value = $this->get_value($name);
568
 
584
  echo '</select>';
585
  echo '<script>jQuery("#options-' . esc_attr($name) . '").select2({templateResult: tnp_select_images, templateSelection: tnp_select_images_selection});</script>';
586
  }
 
587
 
588
+ function select2($name, $options, $first = null, $multiple = false) {
589
+
590
+ if ($multiple)
591
+ $option_name = "options[" . esc_attr($name) . "][]";
592
+ else $option_name = "options[" . esc_attr($name) . "]";
593
+
594
+ $value = $this->get_value($name);
595
+
596
+ echo '<select id="options-' . esc_attr($name) . '" name="' . $option_name . '" style="width: 100%" ' . ($multiple ? 'multiple="multiple"' : '') . '>';
597
+ if (!empty($first)) {
598
+ echo '<option value="">' . esc_html($first) . '</option>';
599
+ }
600
+
601
+ foreach ($options as $key => $data) {
602
+ echo '<option value="' . esc_attr($key) . '"';
603
+ if (is_array($value) && in_array($key, $value) || $value == $key)
604
+ echo ' selected';
605
+ echo '>' . esc_html($data) . '</option>';
606
+ }
607
+ echo '</select>';
608
+ echo '<script>jQuery("#options-' . esc_attr($name) . '").select2();</script>';
609
+ }
610
+
611
  function select_grouped($name, $groups) {
612
  $value = $this->get_value($name);
613
 
790
  function wp_editor($name, $settings = array()) {
791
  $value = $this->get_value($name);
792
  wp_editor($value, $name, array_merge(array('textarea_name' => 'options[' . esc_attr($name) . ']', 'wpautop' => false), $settings));
793
+ echo '<p class="description">You can install <a href="https://wordpress.org/plugins/tinymce-advanced/" target="_blank">TinyMCE Advanced</a> for advanced editing features</p>';
794
  }
795
 
796
  function textarea($name, $width = '100%', $height = '50') {
905
  echo '</label>';
906
  }
907
 
908
+ function checkboxes($name, $options) {
909
+ echo '<div class="tnp-checkboxes">';
910
+ foreach ($options as $value => $label) {
911
+ $this->checkbox_group($name, $value, $label);
912
+ }
913
+ echo '<div style="clear: both"></div>';
914
+ echo '</div>';
915
+ }
916
+
917
  function color($name) {
918
  echo $this->text($name, 10);
919
  }
1133
  function hours($name) {
1134
  $hours = array();
1135
  for ($i = 0; $i < 24; $i++) {
1136
+ $hours['' . $i] = sprintf('%02d', $i) . ':00';
1137
  }
1138
  $this->select($name, $hours);
1139
  }
1300
 
1301
  function media($name) {
1302
  if (isset($this->data[$name])) {
1303
+ $media_id = (int) $this->data[$name]['id'];
1304
  $media = wp_get_attachment_image_src($media_id, 'medium');
1305
  $media_full = wp_get_attachment_image_src($media_id, 'full');
1306
  } else {
1316
  } else {
1317
  echo '<img style="max-width: 200px; max-height: 200px;" id="' . esc_attr($name) . '_img" src="' . esc_attr($media[0]) . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
1318
  }
1319
+
1320
  echo '</div>';
1321
  echo '<input type="hidden" id="' . esc_attr($name) . '_id" name="options[' . esc_attr($name) . '][id]" value="' . esc_attr($media_id) . '" size="5">';
1322
  echo '<input type="hidden" id="' . esc_attr($name) . '_url" name="options[' . esc_attr($name) . '][url]" value="' . esc_attr($media_full[0]) . '" size="50">';
includes/module.php CHANGED
@@ -63,11 +63,13 @@ class NewsletterModule {
63
  $this->old_version = get_option($this->prefix . '_version', '0.0.0');
64
 
65
  if ($this->old_version == '0.0.0') {
 
66
  $this->first_install();
67
  update_option($this->prefix . "_first_install_time", time(), FALSE);
68
  }
69
 
70
  if (strcmp($this->old_version, $this->version) != 0) {
 
71
  $this->logger->info('Version changed from ' . $this->old_version . ' to ' . $this->version);
72
  // Do all the stuff for this version change
73
  $this->upgrade();
@@ -147,13 +149,11 @@ class NewsletterModule {
147
  }
148
 
149
  /**
150
- * Returns the options of a module.
151
  */
152
  function get_options($sub = '') {
153
- $options = get_option($this->get_prefix($sub));
154
- if ($options === false) {
155
- return array();
156
- }
157
  return $options;
158
  }
159
 
@@ -208,14 +208,14 @@ class NewsletterModule {
208
  }
209
 
210
  function merge_options($options, $sub = '') {
 
211
  $old_options = $this->get_options($sub);
212
  $this->save_options(array_merge($old_options, $options), $sub);
213
  }
214
 
215
  function backup_options($sub) {
216
  $options = $this->get_options($sub);
217
- add_option($this->get_prefix($sub) . '_backup', '', null, 'no');
218
- update_option($this->get_prefix($sub) . '_backup', $options);
219
  }
220
 
221
  function get_last_run($sub = '') {
@@ -256,7 +256,7 @@ class NewsletterModule {
256
  function check_transient($name, $time) {
257
  if ($time < 60)
258
  $time = 60;
259
- usleep(rand(0, 1000000));
260
  if (($value = get_transient($this->get_prefix() . '_' . $name)) !== false) {
261
  $this->logger->error('Blocked by transient ' . $this->get_prefix() . '_' . $name . ' set ' . (time() - $value) . ' seconds ago');
262
  return false;
63
  $this->old_version = get_option($this->prefix . '_version', '0.0.0');
64
 
65
  if ($this->old_version == '0.0.0') {
66
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
67
  $this->first_install();
68
  update_option($this->prefix . "_first_install_time", time(), FALSE);
69
  }
70
 
71
  if (strcmp($this->old_version, $this->version) != 0) {
72
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
73
  $this->logger->info('Version changed from ' . $this->old_version . ' to ' . $this->version);
74
  // Do all the stuff for this version change
75
  $this->upgrade();
149
  }
150
 
151
  /**
152
+ * Returns the options of a module, if not found an empty array.
153
  */
154
  function get_options($sub = '') {
155
+ $options = get_option($this->get_prefix($sub), array());
156
+ if (!is_array($options)) return array();
 
 
157
  return $options;
158
  }
159
 
208
  }
209
 
210
  function merge_options($options, $sub = '') {
211
+ if (!is_array($options)) $options = array();
212
  $old_options = $this->get_options($sub);
213
  $this->save_options(array_merge($old_options, $options), $sub);
214
  }
215
 
216
  function backup_options($sub) {
217
  $options = $this->get_options($sub);
218
+ update_option($this->get_prefix($sub) . '_backup', $options, false);
 
219
  }
220
 
221
  function get_last_run($sub = '') {
256
  function check_transient($name, $time) {
257
  if ($time < 60)
258
  $time = 60;
259
+ //usleep(rand(0, 1000000));
260
  if (($value = get_transient($this->get_prefix() . '_' . $name)) !== false) {
261
  $this->logger->error('Blocked by transient ' . $this->get_prefix() . '_' . $name . ' set ' . (time() - $value) . ' seconds ago');
262
  return false;
main/extensions.php CHANGED
@@ -230,7 +230,7 @@ function newsletter_subscribe(id) {
230
  <div id="tnp-subscribe-overlay">
231
  <div id="tnp-subscribe-modal">
232
  <div>
233
- <img src="http://cdn.thenewsletterplugin.com/newsletters-img/tnp-logo-colore-text-white@2x.png">
234
  </div>
235
  <div id="tnp-subscribe-title">
236
  Subscribe our newsletter to get this extension<br>
230
  <div id="tnp-subscribe-overlay">
231
  <div id="tnp-subscribe-modal">
232
  <div>
233
+ <img src="https://cdn.thenewsletterplugin.com/newsletters-img/tnp-logo-colore-text-white@2x.png">
234
  </div>
235
  <div id="tnp-subscribe-title">
236
  Subscribe our newsletter to get this extension<br>
main/index.php CHANGED
@@ -5,6 +5,8 @@ if (!defined('ABSPATH')) exit;
5
 
6
  $controls = new NewsletterControls();
7
 
 
 
8
  if ($controls->is_action('feed_enable')) {
9
  delete_option('newsletter_feed_demo_disable');
10
  $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
5
 
6
  $controls = new NewsletterControls();
7
 
8
+ wp_enqueue_script('tnp-chart');
9
+
10
  if ($controls->is_action('feed_enable')) {
11
  delete_option('newsletter_feed_demo_disable');
12
  $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
main/main.php CHANGED
@@ -68,16 +68,16 @@ if (!empty($controls->data['contract_key'])) {
68
  if (is_wp_error($response)) {
69
  /* @var $response WP_Error */
70
  $controls->errors .= 'It seems that your blog cannot contact the license validator. Ask your provider to unlock the HTTP/HTTPS connections to www.thenewsletterplugin.com<br>';
71
- $controls->errors .= $response->get_error_code() . ' - ' . $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;
78
- $controls->messages = 'Your license is valid and expires on ' . date('Y-m-d', $expires->expire);
79
  } else {
80
- $controls->errors = 'Unable to detect the license expiration. Debug data to report to the support: <code>' . wp_remote_retrieve_body($response) . '</code>';
81
  $controls->data['licence_expires'] = "";
82
  }
83
  $module->merge_options($controls->data);
68
  if (is_wp_error($response)) {
69
  /* @var $response WP_Error */
70
  $controls->errors .= 'It seems that your blog cannot contact the license validator. Ask your provider to unlock the HTTP/HTTPS connections to www.thenewsletterplugin.com<br>';
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;
78
+ $controls->messages = 'Your license is valid and expires on ' . esc_html(date('Y-m-d', $expires->expire));
79
  } else {
80
+ $controls->errors = 'Unable to detect the license expiration. Debug data to report to the support: <code>' . esc_html(wp_remote_retrieve_body($response)) . '</code>';
81
  $controls->data['licence_expires'] = "";
82
  }
83
  $module->merge_options($controls->data);
main/status.php CHANGED
@@ -253,6 +253,30 @@ $options = $module->get_options('status');
253
  </td>
254
 
255
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
  <?php
258
  $value = (int) ini_get('max_execution_time');
@@ -492,6 +516,29 @@ $options = $module->get_options('status');
492
  <?php } ?>
493
  </td>
494
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
495
 
496
  <?php
497
  $res = true;
253
  </td>
254
 
255
  </tr>
256
+
257
+ <tr>
258
+ <td>Curl version</td>
259
+ <td>
260
+ <?php if (!function_exists('curl_version')) { ?>
261
+ <span class="tnp-ko">KO</span>
262
+ <?php } else { ?>
263
+ <span class="tnp-ok">OK</span>
264
+ <?php } ?>
265
+
266
+ </td>
267
+ <td>
268
+ <?php if (!function_exists('curl_version')) { ?>
269
+ cUrl is not available, ask the provider to install it and activate the PHP cUrl library
270
+ <?php } else {
271
+ $version = curl_version();
272
+ echo 'Version: ' . $version['version'] . '<br>';
273
+ echo 'SSL Version: ' . $version['ssl_version'] . '<br>';
274
+
275
+ } ?>
276
+ </td>
277
+
278
+ </tr>
279
+
280
 
281
  <?php
282
  $value = (int) ini_get('max_execution_time');
516
  <?php } ?>
517
  </td>
518
  </tr>
519
+
520
+ <tr>
521
+ <td>
522
+ Cron calls
523
+ </td>
524
+ <td>
525
+ <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL*1.1) { ?>
526
+ <span class="tnp-ko">KO</span>
527
+ <?php } else { ?>
528
+ <span class="tnp-ok">OK</span>
529
+ <?php } ?>
530
+ </td>
531
+ <td>
532
+ <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL*1.1) { ?>
533
+ The blog cron system is NOT triggere enough often.
534
+
535
+ <?php } else { ?>
536
+
537
+ <?php } ?>
538
+ <br>
539
+ Trigger interval: average <?php echo $wp_cron_calls_avg ?>&nbsp;s, max <?php echo $wp_cron_calls_max ?>&nbsp;s, min <?php echo $wp_cron_calls_min ?>&nbsp;s
540
+ </td>
541
+ </tr>
542
 
543
  <?php
544
  $res = true;
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.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.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '4.9.0');
18
 
19
  global $wpdb, $newsletter;
20
 
@@ -209,7 +209,7 @@ class Newsletter extends NewsletterModule {
209
  }
210
 
211
  function hook_in_admin_header() {
212
- remove_all_filters('admin_notices');
213
  }
214
 
215
  function hook_activate() {
@@ -426,17 +426,17 @@ class Newsletter extends NewsletterModule {
426
  if ($this->is_admin_page()) {
427
  wp_enqueue_script('jquery-ui-tabs');
428
  wp_enqueue_media();
429
- wp_enqueue_style('newsletter-admin', plugins_url('newsletter') . '/admin.css', array(), time());
430
- wp_enqueue_script('newsletter-admin', plugins_url('newsletter') . '/admin.js', array(), time());
431
 
432
- wp_enqueue_style('newsletter-select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css');
433
- wp_enqueue_script('newsletter-select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js');
434
- wp_enqueue_script('newsletter-chart', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.0/Chart.min.js');
435
- wp_enqueue_script('newsletter-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jquery.vmap.min.js');
436
- wp_enqueue_script('newsletter-jquery-vmap-world', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/maps/jquery.vmap.world.js', array('newsletter-jquery-vmap'));
437
- wp_enqueue_style('newsletter-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jqvmap.min.css');
 
438
 
439
-
440
  $dismissed = get_option('newsletter_dismissed', array());
441
 
442
  if (isset($_GET['dismiss'])) {
@@ -523,14 +523,12 @@ class Newsletter extends NewsletterModule {
523
  return;
524
  }
525
 
526
- // Retrieve all email in "sending" status
527
  $emails = $wpdb->get_results("select * from " . NEWSLETTER_EMAILS_TABLE . " where status='sending' and send_on<" . time() . " order by id asc");
528
  $this->logger->debug('hook_newsletter> Emails found in sending status: ' . count($emails));
529
  foreach ($emails as $email) {
530
  $this->logger->debug('hook_newsletter> Sending email ' . $email->id);
531
- if (!$this->send($email)) {
532
- break;
533
- }
534
  }
535
  // Remove the semaphore so the delivery engine can be activated again
536
  $this->delete_transient('engine');
@@ -564,8 +562,8 @@ class Newsletter extends NewsletterModule {
564
 
565
  if ($users == null) {
566
 
567
- // $skip_this_run = apply_filters('newsletter_skip_run', false, $email);
568
- // if ($skip_this_run) return false;
569
 
570
  if (empty($email->query)) {
571
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
@@ -581,7 +579,9 @@ class Newsletter extends NewsletterModule {
581
  $max_emails = $this->max_emails;
582
  }
583
 
584
- $query = $email->query . " and id>" . $email->last_id . " order by id limit " . $max_emails;
 
 
585
 
586
  $this->logger->debug('send> Query: ' . $query);
587
 
@@ -594,12 +594,15 @@ class Newsletter extends NewsletterModule {
594
  $this->logger->fatal($wpdb->last_error);
595
  return;
596
  }
597
-
598
  if (empty($users)) {
599
  $this->logger->info('send> No more users, set as sent');
600
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set status='sent', total=sent where id=" . $email->id . " limit 1");
601
  return true;
602
  }
 
 
 
603
  }
604
 
605
  $start_time = microtime(true);
@@ -626,13 +629,15 @@ class Newsletter extends NewsletterModule {
626
 
627
  $m = $this->replace($email->message, $user, $email->id);
628
  $mt = $this->replace($email->message_text, $user, $email->id);
629
-
 
630
 
631
  if ($email->track == 1) {
632
  $m = $this->relink($m, $email->id, $user->id, $email->token);
633
  }
634
 
635
  $s = $this->replace($email->subject, $user);
 
636
 
637
  if (!empty($user->wp_user_id)) {
638
  $this->logger->debug('send> Has wp_user_id: ' . $user->wp_user_id);
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.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.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '4.9.1');
18
 
19
  global $wpdb, $newsletter;
20
 
209
  }
210
 
211
  function hook_in_admin_header() {
212
+ //remove_all_filters('admin_notices');
213
  }
214
 
215
  function hook_activate() {
426
  if ($this->is_admin_page()) {
427
  wp_enqueue_script('jquery-ui-tabs');
428
  wp_enqueue_media();
429
+ wp_enqueue_style('tnp-admin', plugins_url('newsletter') . '/admin.css', array(), time());
430
+ wp_enqueue_script('tnp-admin', plugins_url('newsletter') . '/admin.js', array(), time());
431
 
432
+ wp_enqueue_style('tnp-select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css');
433
+ wp_enqueue_script('tnp-select2', 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js');
434
+ wp_enqueue_script('tnp-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jquery.vmap.min.js');
435
+ wp_enqueue_script('tnp-jquery-vmap-world', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/maps/jquery.vmap.world.js', array('tnp-jquery-vmap'));
436
+ wp_enqueue_style('tnp-jquery-vmap', 'https://cdnjs.cloudflare.com/ajax/libs/jqvmap/1.5.1/jqvmap.min.css');
437
+
438
+ wp_register_script('tnp-chart', 'https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js');
439
 
 
440
  $dismissed = get_option('newsletter_dismissed', array());
441
 
442
  if (isset($_GET['dismiss'])) {
523
  return;
524
  }
525
 
526
+ // Retrieve all emails in "sending" status
527
  $emails = $wpdb->get_results("select * from " . NEWSLETTER_EMAILS_TABLE . " where status='sending' and send_on<" . time() . " order by id asc");
528
  $this->logger->debug('hook_newsletter> Emails found in sending status: ' . count($emails));
529
  foreach ($emails as $email) {
530
  $this->logger->debug('hook_newsletter> Sending email ' . $email->id);
531
+ $this->send($email);
 
 
532
  }
533
  // Remove the semaphore so the delivery engine can be activated again
534
  $this->delete_transient('engine');
562
 
563
  if ($users == null) {
564
 
565
+ $skip_this_run = apply_filters('newsletter_send_skip', false, $email);
566
+ if ($skip_this_run) return false;
567
 
568
  if (empty($email->query)) {
569
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
579
  $max_emails = $this->max_emails;
580
  }
581
 
582
+ //$query = apply_filters('newsletter_send_query', $email->query, $email);
583
+
584
+ $query .= " and id>" . $email->last_id . " order by id limit " . $max_emails;
585
 
586
  $this->logger->debug('send> Query: ' . $query);
587
 
594
  $this->logger->fatal($wpdb->last_error);
595
  return;
596
  }
597
+
598
  if (empty($users)) {
599
  $this->logger->info('send> No more users, set as sent');
600
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set status='sent', total=sent where id=" . $email->id . " limit 1");
601
  return true;
602
  }
603
+
604
+ //$users = apply_filters('newsletter_send_users', $users, $email);
605
+
606
  }
607
 
608
  $start_time = microtime(true);
629
 
630
  $m = $this->replace($email->message, $user, $email->id);
631
  $mt = $this->replace($email->message_text, $user, $email->id);
632
+
633
+ $m = apply_filters('newsletter_message_html', $m, $email, $user);
634
 
635
  if ($email->track == 1) {
636
  $m = $this->relink($m, $email->id, $user->id, $email->token);
637
  }
638
 
639
  $s = $this->replace($email->subject, $user);
640
+ $m = apply_filters('newsletter_message_subject', $s, $email, $user);
641
 
642
  if (!empty($user->wp_user_id)) {
643
  $this->logger->debug('send> Has wp_user_id: ' . $user->wp_user_id);
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
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.4
5
- Stable tag: 4.9.0
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,12 @@ Thank you, The Newsletter Team
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
88
  == 4.9.0 ==
89
 
90
  * Fixed logo editing when not set in the Company Info
1
  === Newsletter ===
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.1
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.1 ==
89
+
90
+ * Small code fixes
91
+ * Chart js conflict fix
92
+ * Curl SSL version on status panel
93
+
94
  == 4.9.0 ==
95
 
96
  * Fixed logo editing when not set in the Company Info
statistics/index.php CHANGED
@@ -7,6 +7,8 @@ require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
  $module = NewsletterStatistics::instance();
8
  $controls = new NewsletterControls();
9
 
 
 
10
  if ($controls->is_action('country')) {
11
  $module->country();
12
  $controls->messages = $module->country_result;
7
  $module = NewsletterStatistics::instance();
8
  $controls = new NewsletterControls();
9
 
10
+ wp_enqueue_script('tnp-chart');
11
+
12
  if ($controls->is_action('country')) {
13
  $module->country();
14
  $controls->messages = $module->country_result;
statistics/statistics.php CHANGED
@@ -29,7 +29,7 @@ class NewsletterStatistics extends NewsletterModule {
29
 
30
  function hook_admin_enqueue_scripts() {
31
  if (isset($_GET['page']) && (strpos($_GET['page'], 'newsletter_statistics') === 0 || strpos($_GET['page'], 'newsletter_reports') === 0)) {
32
- wp_enqueue_style('newsletter-admin-statistics', plugins_url('newsletter') . '/statistics/css/tnp-statistics.css', array('newsletter-admin'), time());
33
  }
34
  }
35
 
@@ -280,7 +280,7 @@ class NewsletterStatistics extends NewsletterModule {
280
  $email = $this->get_email($email->id);
281
  }
282
 
283
- $count = $wpdb->get_var($wpdb->prepare("select count(*) from " . NEWSLETTER_SENT_TABLE . " where email_id=%d", $email_id));
284
 
285
  if (!$count) {
286
  return;
@@ -290,7 +290,7 @@ class NewsletterStatistics extends NewsletterModule {
290
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
291
  }
292
 
293
- $query .= $email->query . " and unix_timestamp(created)<" . $email->send_on;
294
 
295
  $query = str_replace('*', 'id, ' . $email->id . ', ' . $email->send_on, $query);
296
  $wpdb->query("insert ignore into " . NEWSLETTER_SENT_TABLE . " (user_id, email_id, time) " . $query);
29
 
30
  function hook_admin_enqueue_scripts() {
31
  if (isset($_GET['page']) && (strpos($_GET['page'], 'newsletter_statistics') === 0 || strpos($_GET['page'], 'newsletter_reports') === 0)) {
32
+ wp_enqueue_style('newsletter-admin-statistics', plugins_url('newsletter') . '/statistics/css/tnp-statistics.css', array('tnp-admin'), time());
33
  }
34
  }
35
 
280
  $email = $this->get_email($email->id);
281
  }
282
 
283
+ $count = $wpdb->get_var($wpdb->prepare("select count(*) from " . NEWSLETTER_SENT_TABLE . " where email_id=%d", $email->id));
284
 
285
  if (!$count) {
286
  return;
290
  $email->query = "select * from " . NEWSLETTER_USERS_TABLE . " where status='C'";
291
  }
292
 
293
+ $query = $email->query . " and unix_timestamp(created)<" . $email->send_on;
294
 
295
  $query = str_replace('*', 'id, ' . $email->id . ', ' . $email->send_on, $query);
296
  $wpdb->query("insert ignore into " . NEWSLETTER_SENT_TABLE . " (user_id, email_id, time) " . $query);
statistics/view.php CHANGED
@@ -6,6 +6,8 @@ require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
6
  $module = NewsletterStatistics::instance();
7
  $controls = new NewsletterControls();
8
 
 
 
9
  $email_id = (int) $_GET['id'];
10
  $email = $module->get_email($email_id);
11
 
6
  $module = NewsletterStatistics::instance();
7
  $controls = new NewsletterControls();
8
 
9
+ wp_enqueue_script('tnp-chart');
10
+
11
  $email_id = (int) $_GET['id'];
12
  $email = $module->get_email($email_id);
13
 
subscription/style.css CHANGED
@@ -88,7 +88,7 @@ CUSTOM CSS RULES.
88
  padding: 0;
89
  }
90
 
91
- tnp-profile form .tnp-field label {
92
  display: block;
93
  color: #333;
94
  font-size: 14px;
@@ -97,6 +97,7 @@ tnp-profile form .tnp-field label {
97
  .tnp-profile form .tnp-field input[type=text],
98
  .tnp-profile form .tnp-field input[type=email],
99
  .tnp-profile form .tnp-field input[type=submit],
 
100
  .tnp-profile form .tnp-field select {
101
  padding: 10px;
102
  display: block;
@@ -112,6 +113,7 @@ tnp-profile form .tnp-field label {
112
  box-sizing: border-box;
113
  border-radius: 0;
114
  height: auto;
 
115
  }
116
 
117
  .tnp-profile form input[type=checkbox], .tnp-profile input[type=radio] {
88
  padding: 0;
89
  }
90
 
91
+ .tnp-profile form .tnp-field label {
92
  display: block;
93
  color: #333;
94
  font-size: 14px;
97
  .tnp-profile form .tnp-field input[type=text],
98
  .tnp-profile form .tnp-field input[type=email],
99
  .tnp-profile form .tnp-field input[type=submit],
100
+ .tnp-profile form .tnp-field textarea,
101
  .tnp-profile form .tnp-field select {
102
  padding: 10px;
103
  display: block;
113
  box-sizing: border-box;
114
  border-radius: 0;
115
  height: auto;
116
+ float: none;
117
  }
118
 
119
  .tnp-profile form input[type=checkbox], .tnp-profile input[type=radio] {
subscription/subscription.php CHANGED
@@ -288,7 +288,10 @@ class NewsletterSubscription extends NewsletterModule {
288
  function get_options($sub = '') {
289
  if ($sub == '') {
290
  // For compatibility the options are wrongly named
291
- return get_option('newsletter', array());
 
 
 
292
  }
293
  if ($sub == 'profile') {
294
  // For compatibility the options are wrongly named
288
  function get_options($sub = '') {
289
  if ($sub == '') {
290
  // For compatibility the options are wrongly named
291
+ $options = get_option('newsletter', array());
292
+ if (!is_array($options)) $options = array();
293
+ return $options;
294
+
295
  }
296
  if ($sub == 'profile') {
297
  // For compatibility the options are wrongly named
users/edit.php CHANGED
@@ -107,7 +107,7 @@ function percentValue($value, $total) {
107
 
108
  <div id="tabs-general">
109
 
110
- <?php do_action('newsletter_users_edit_general', $id) ?>
111
 
112
  <table class="form-table">
113
 
107
 
108
  <div id="tabs-general">
109
 
110
+ <?php do_action('newsletter_users_edit_general', $id, $controls) ?>
111
 
112
  <table class="form-table">
113
 
users/users.php CHANGED
@@ -18,7 +18,7 @@ class NewsletterUsers extends NewsletterModule {
18
  }
19
 
20
  function __construct() {
21
- parent::__construct('users', '1.0.6');
22
  add_action('init', array($this, 'hook_init'));
23
  }
24
 
@@ -47,52 +47,48 @@ class NewsletterUsers extends NewsletterModule {
47
 
48
  parent::upgrade();
49
 
50
- $this->upgrade_query("create table if not exists " . NEWSLETTER_USERS_TABLE . " (id int auto_increment, `email` varchar(100) not null default '', primary key (id), unique key email (email)) $charset_collate");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
- // User personal data
53
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column name varchar(100) not null default ''");
54
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column surname varchar(100) not null default ''");
55
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column sex char(1) not null default 'n'");
56
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " change column sex sex char(1) not null default 'n'");
57
-
58
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column status char(1) not null default 'S'");
59
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column created timestamp not null default current_timestamp");
60
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column token varchar(50) not null default ''");
61
-
62
- // Feed by mail
63
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column feed tinyint(4) not null default 0");
64
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column feed_time bigint(20) not null default 0");
65
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column country varchar(4) not null default ''");
66
-
67
- // List/Preferences
68
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
69
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column list_$i tinyint(4) not null default 0");
70
  }
71
 
72
- // Profiles
73
  for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
74
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column profile_$i varchar(255) not null default ''");
75
- }
76
-
77
- // TODO: Still makes sense the referrer?
78
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column referrer varchar(50) not null default ''");
79
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column http_referer varchar(255) not null default ''");
80
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column wp_user_id int not null default 0");
81
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column ip varchar(50) not null default ''");
82
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column test tinyint(4) not null default 0");
83
-
84
- // TODO: Flow module should add that it self (?)
85
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column flow tinyint(4) not null default 0");
86
-
87
- // Old problems...
88
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set utf8");
89
-
90
- $this->upgrade_query("update " . NEWSLETTER_USERS_TABLE . " set sex='n' where sex='' or sex=' '");
91
-
92
- if ($this->old_version < '1.0.5') {
93
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column unsub_email_id int not null default 0");
94
- $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " add column unsub_time int not null default 0");
95
  }
 
 
 
 
 
 
 
 
96
  }
97
 
98
  function admin_menu() {
18
  }
19
 
20
  function __construct() {
21
+ parent::__construct('users', '1.0.7');
22
  add_action('init', array($this, 'hook_init'));
23
  }
24
 
47
 
48
  parent::upgrade();
49
 
50
+ $sql = "CREATE TABLE `" . $wpdb->prefix . "newsletter` (
51
+ `name` varchar(100) NOT NULL DEFAULT '',
52
+ `email` varchar(100) NOT NULL DEFAULT '',
53
+ `token` varchar(50) NOT NULL DEFAULT '',
54
+ `status` varchar(1) NOT NULL DEFAULT 'S',
55
+ `id` int(11) NOT NULL AUTO_INCREMENT,
56
+ `list` int(11) NOT NULL DEFAULT '0',
57
+ `profile` mediumtext,
58
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
59
+ `followup_step` tinyint(4) NOT NULL DEFAULT '0',
60
+ `followup_time` bigint(20) NOT NULL DEFAULT '0',
61
+ `followup` tinyint(4) NOT NULL DEFAULT '0',
62
+ `surname` varchar(100) NOT NULL DEFAULT '',
63
+ `sex` char(1) NOT NULL DEFAULT 'n',
64
+ `feed_time` bigint(20) NOT NULL DEFAULT '0',
65
+ `feed` tinyint(4) NOT NULL DEFAULT '0',
66
+ `referrer` varchar(50) NOT NULL DEFAULT '',
67
+ `ip` varchar(50) NOT NULL DEFAULT '',
68
+ `wp_user_id` int(11) NOT NULL DEFAULT '0',
69
+ `http_referer` varchar(255) NOT NULL DEFAULT '',
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
78
+ $sql .= "`list_$i` tinyint(4) NOT NULL DEFAULT '0',\n";
79
  }
80
 
 
81
  for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
82
+ $sql .= "`profile_$i` varchar(255) NOT NULL DEFAULT '',\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 DEFAULT CHARSET=$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() {