Newsletter - Version 6.6.9

Version Description

  • Fixed the admin email preview not showing the correct email after visiting the online view of a newsletter
  • Fixed possible not "100%" display percentage for sent newsletters (was only a display problem)
Download this release

Release Info

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

Code changes from version 6.6.8 to 6.6.9

emails/emails.php CHANGED
@@ -499,9 +499,8 @@ class NewsletterEmails extends NewsletterModule {
499
  switch ($action) {
500
  case 'v':
501
  case 'view':
502
- if (empty($email)) {
503
- $email = $this->get_email($_GET['id']);
504
- }
505
  if (empty($email)) {
506
  header("HTTP/1.0 404 Not Found");
507
  die('Email not found');
499
  switch ($action) {
500
  case 'v':
501
  case 'view':
502
+ $email = $this->get_email($_GET['id']);
503
+
 
504
  if (empty($email)) {
505
  header("HTTP/1.0 404 Not Found");
506
  die('Email not found');
includes/module.php CHANGED
@@ -50,82 +50,76 @@ abstract class TNP_List {
50
  */
51
  class TNP_Profile {
52
 
53
- const STATUS_PRIVATE = 0;
54
- const STATUS_PUBLIC = 2;
55
- const STATUS_PROFILE_ONLY = 1;
56
- const STATUS_HIDDEN = 3; // Public but never shown (can be set with a hidden form field)
57
-
58
- const TYPE_TEXT = 'text';
59
- const TYPE_SELECT = 'select';
60
-
61
- public $id;
62
- public $name;
63
- public $status;
64
- public $type;
65
- public $options;
66
-
67
- public function __construct( $id, $name, $status, $type, $options ) {
68
- $this->id = $id;
69
- $this->name = $name;
70
- $this->status = $status;
71
- $this->type = $type;
72
- $this->options = $options;
73
- }
74
-
75
- function is_select() {
76
- return $this->type == self::TYPE_SELECT;
77
- }
78
-
79
- function is_text() {
80
- return $this->type == self::TYPE_TEXT;
81
- }
82
  }
83
 
84
  class TNP_Profile_Service {
85
 
86
- static function get_profiles( $language = '', $type = null ) {
87
-
88
- static $profiles = array();
89
- if ( isset( $profiles[ $language ] ) ) {
90
- return $profiles[ $language ];
91
- }
92
-
93
- $profiles[ $language ] = array();
94
- $data = NewsletterSubscription::instance()->get_options( 'profile', $language );
95
- for ( $i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i ++ ) {
96
- if ( empty( $data[ 'profile_' . $i ] ) ) {
97
- continue;
98
- }
99
- $profile = new TNP_Profile(
100
- $i,
101
- $data[ 'profile_' . $i ],
102
- (int) $data[ 'profile_' . $i . '_status' ],
103
- $data[ 'profile_' . $i . '_type' ],
104
- self::string_db_options_to_array( $data[ 'profile_' . $i . '_options' ] )
105
- );
106
-
107
- if ( is_null( $type ) ||
108
- ( $type == TNP_Profile::TYPE_SELECT && $profile->is_select() ) ||
109
- ( $type == TNP_Profile::TYPE_TEXT && $profile->is_text() ) ) {
110
- $profiles[ $language ][] = $profile;
111
- }
112
-
113
- }
114
-
115
- return $profiles[ $language ];
116
-
117
- }
118
-
119
- /**
120
- * Returns a list of strings which are the items for the select field.
121
- * @return array
122
- */
123
- private static function string_db_options_to_array( $string_options ) {
124
- $items = array_map( 'trim', explode( ',', $string_options ) );
125
- $items = array_combine($items,$items);
126
-
127
- return $items;
128
- }
129
 
130
  }
131
 
@@ -154,10 +148,12 @@ abstract class TNP_User {
154
  * @property array $options The subscriber status
155
  * */
156
  abstract class TNP_Email {
 
157
  const STATUS_DRAFT = 'new';
158
  const STATUS_SENT = 'sent';
159
  const STATUS_SENDING = 'sending';
160
  const STATUS_PAUSED = 'paused';
 
161
  }
162
 
163
  class NewsletterModule {
@@ -688,7 +684,7 @@ class NewsletterModule {
688
  }
689
 
690
  function admin_menu() {
691
-
692
  }
693
 
694
  function add_menu_page($page, $title, $capability = '') {
@@ -903,16 +899,25 @@ class NewsletterModule {
903
  }
904
  } else if ($email->status == 'new') {
905
  echo '';
 
 
 
906
  } else {
907
  $percent = $this->get_email_progress($email);
908
- $label = $percent;
909
- if ($attrs['format'] == 'numbers') {
910
- $label = $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total;
911
- }
912
- echo '<div class="tnp-progress ', $email->status, '">';
913
- echo '<div class="tnp-progress-bar" role="progressbar" style="width: ', $percent, '%;">&nbsp;', $percent, '%&nbsp;</div>';
914
- echo '</div>';
915
- if ($attrs['numbers']) {
 
 
 
 
 
 
916
  echo '<div class="tnp-progress-numbers">', $email->sent, ' ', __('of', 'newsletter'), ' ', $email->total, '</div>';
917
  }
918
  }
@@ -1115,7 +1120,7 @@ class NewsletterModule {
1115
  }
1116
  return $user;
1117
  }
1118
-
1119
  function get_user_from_logged_in_user() {
1120
  if (is_user_logged_in()) {
1121
  return $this->get_user_by_wp_user_id(get_current_user_id());
@@ -1126,9 +1131,9 @@ class NewsletterModule {
1126
  * @param string $language The language for the list labels (it does not affect the lists returned)
1127
  * @return TNP_Profile[]
1128
  */
1129
- function get_profiles( $language = '' ) {
1130
- return TNP_Profile_Service::get_profiles( $language );
1131
- }
1132
 
1133
  /**
1134
  * @param string $language The language for the list labels (it does not affect the lists returned)
@@ -2118,9 +2123,8 @@ class NewsletterModule {
2118
 
2119
  return '[' . $blogname . '] ' . $subject;
2120
  }
2121
-
2122
- function dienow($message, $admin_message = null)
2123
- {
2124
  if ($admin_message && current_user_can('administrator')) {
2125
  $message .= '<br><br><strong>Text below only visibile to administrarors</strong><br>';
2126
  $message .= $admin_message;
50
  */
51
  class TNP_Profile {
52
 
53
+ const STATUS_PRIVATE = 0;
54
+ const STATUS_PUBLIC = 2;
55
+ const STATUS_PROFILE_ONLY = 1;
56
+ const STATUS_HIDDEN = 3; // Public but never shown (can be set with a hidden form field)
57
+ const TYPE_TEXT = 'text';
58
+ const TYPE_SELECT = 'select';
59
+
60
+ public $id;
61
+ public $name;
62
+ public $status;
63
+ public $type;
64
+ public $options;
65
+
66
+ public function __construct($id, $name, $status, $type, $options) {
67
+ $this->id = $id;
68
+ $this->name = $name;
69
+ $this->status = $status;
70
+ $this->type = $type;
71
+ $this->options = $options;
72
+ }
73
+
74
+ function is_select() {
75
+ return $this->type == self::TYPE_SELECT;
76
+ }
77
+
78
+ function is_text() {
79
+ return $this->type == self::TYPE_TEXT;
80
+ }
81
+
82
  }
83
 
84
  class TNP_Profile_Service {
85
 
86
+ static function get_profiles($language = '', $type = null) {
87
+
88
+ static $profiles = array();
89
+ if (isset($profiles[$language])) {
90
+ return $profiles[$language];
91
+ }
92
+
93
+ $profiles[$language] = array();
94
+ $data = NewsletterSubscription::instance()->get_options('profile', $language);
95
+ for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i ++) {
96
+ if (empty($data['profile_' . $i])) {
97
+ continue;
98
+ }
99
+ $profile = new TNP_Profile(
100
+ $i, $data['profile_' . $i], (int) $data['profile_' . $i . '_status'], $data['profile_' . $i . '_type'], self::string_db_options_to_array($data['profile_' . $i . '_options'])
101
+ );
102
+
103
+ if (is_null($type) ||
104
+ ( $type == TNP_Profile::TYPE_SELECT && $profile->is_select() ) ||
105
+ ( $type == TNP_Profile::TYPE_TEXT && $profile->is_text() )) {
106
+ $profiles[$language][] = $profile;
107
+ }
108
+ }
109
+
110
+ return $profiles[$language];
111
+ }
112
+
113
+ /**
114
+ * Returns a list of strings which are the items for the select field.
115
+ * @return array
116
+ */
117
+ private static function string_db_options_to_array($string_options) {
118
+ $items = array_map('trim', explode(',', $string_options));
119
+ $items = array_combine($items, $items);
120
+
121
+ return $items;
122
+ }
 
 
 
 
 
 
123
 
124
  }
125
 
148
  * @property array $options The subscriber status
149
  * */
150
  abstract class TNP_Email {
151
+
152
  const STATUS_DRAFT = 'new';
153
  const STATUS_SENT = 'sent';
154
  const STATUS_SENDING = 'sending';
155
  const STATUS_PAUSED = 'paused';
156
+
157
  }
158
 
159
  class NewsletterModule {
684
  }
685
 
686
  function admin_menu() {
687
+
688
  }
689
 
690
  function add_menu_page($page, $title, $capability = '') {
899
  }
900
  } else if ($email->status == 'new') {
901
  echo '';
902
+ return;
903
+ } else if ($email->status == 'sent') {
904
+ $percent = 100;
905
  } else {
906
  $percent = $this->get_email_progress($email);
907
+ }
908
+
909
+
910
+ $label = $percent;
911
+ if ($attrs['format'] == 'numbers') {
912
+ $label = $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total;
913
+ }
914
+ echo '<div class="tnp-progress ', $email->status, '">';
915
+ echo '<div class="tnp-progress-bar" role="progressbar" style="width: ', $percent, '%;">&nbsp;', $percent, '%&nbsp;</div>';
916
+ echo '</div>';
917
+ if ($attrs['numbers']) {
918
+ if ($email->status == 'sent') {
919
+ echo '<div class="tnp-progress-numbers">', $email->total, ' ', __('of', 'newsletter'), ' ', $email->total, '</div>';
920
+ } else {
921
  echo '<div class="tnp-progress-numbers">', $email->sent, ' ', __('of', 'newsletter'), ' ', $email->total, '</div>';
922
  }
923
  }
1120
  }
1121
  return $user;
1122
  }
1123
+
1124
  function get_user_from_logged_in_user() {
1125
  if (is_user_logged_in()) {
1126
  return $this->get_user_by_wp_user_id(get_current_user_id());
1131
  * @param string $language The language for the list labels (it does not affect the lists returned)
1132
  * @return TNP_Profile[]
1133
  */
1134
+ function get_profiles($language = '') {
1135
+ return TNP_Profile_Service::get_profiles($language);
1136
+ }
1137
 
1138
  /**
1139
  * @param string $language The language for the list labels (it does not affect the lists returned)
2123
 
2124
  return '[' . $blogname . '] ' . $subject;
2125
  }
2126
+
2127
+ function dienow($message, $admin_message = null) {
 
2128
  if ($admin_message && current_user_can('administrator')) {
2129
  $message .= '<br><br><strong>Text below only visibile to administrarors</strong><br>';
2130
  $message .= $admin_message;
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 6.6.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.
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '6.6.8');
39
 
40
  global $newsletter, $wpdb;
41
 
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 6.6.9
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
35
  return;
36
  }
37
 
38
+ define('NEWSLETTER_VERSION', '6.6.9');
39
 
40
  global $newsletter, $wpdb;
41
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.4.1
5
- Stable tag: 6.6.8
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
@@ -109,6 +109,11 @@ Thank you, The Newsletter Team
109
 
110
  == Changelog ==
111
 
 
 
 
 
 
112
  = 6.6.8 =
113
 
114
  * Fixed newsletter view returning "not found"
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.4.1
5
+ Stable tag: 6.6.9
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
109
 
110
  == Changelog ==
111
 
112
+ = 6.6.9 =
113
+
114
+ * Fixed the admin email preview not showing the correct email after visiting the online view of a newsletter
115
+ * Fixed possible not "100%" display percentage for sent newsletters (was only a display problem)
116
+
117
  = 6.6.8 =
118
 
119
  * Fixed newsletter view returning "not found"
statistics/statistics.php CHANGED
@@ -85,6 +85,7 @@ class NewsletterStatistics extends NewsletterModule {
85
  $ip = $this->process_ip($ip);
86
 
87
  if (!$is_action) {
 
88
  $this->add_click($url, $user_id, $email_id, $ip);
89
  $this->update_open_value(self::SENT_CLICK, $user_id, $email_id, $ip);
90
  } else {
85
  $ip = $this->process_ip($ip);
86
 
87
  if (!$is_action) {
88
+ $url = apply_filters('newsletter_pre_save_url', $url, $email, $user);
89
  $this->add_click($url, $user_id, $email_id, $ip);
90
  $this->update_open_value(self::SENT_CLICK, $user_id, $email_id, $ip);
91
  } else {