Newsletter - Version 5.6.3

Version Description

  • Removed unused files
  • Fixed few links with permalink disabled and WMPL language as parameter
  • Fixed the minimal form with WPML
Download this release

Release Info

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

Code changes from version 5.6.2 to 5.6.3

includes/module.php CHANGED
@@ -1158,12 +1158,12 @@ class NewsletterModule {
1158
  * Add to a destination url the parameters to identify the user, the email and to show
1159
  * an alert message, if required. The parameters and them managed by the [newsletter] shortcode.
1160
  *
1161
- * @param string $url If empty the standard newsletter page URL is used
1162
- * @param string $message_key
1163
  * @param TNP_User|int $user
1164
  * @param TNP_Email|int $email
1165
- * @param string $alert
1166
- * @return string The final url
1167
  */
1168
  function build_message_url($url = '', $message_key = '', $user = null, $email = null, $alert = '') {
1169
  $params = 'nm=' . urlencode($message_key);
@@ -1194,6 +1194,14 @@ class NewsletterModule {
1194
  return self::add_qs($url, $params, false);
1195
  }
1196
 
 
 
 
 
 
 
 
 
1197
  function build_action_url($action, $user = null, $email = null) {
1198
  $url = $this->add_qs($this->get_home_url(), 'na=' . urlencode($action));
1199
  if ($user) {
@@ -1244,18 +1252,21 @@ class NewsletterModule {
1244
 
1245
  function process_ip($ip) {
1246
  $option = Newsletter::instance()->options['ip'];
1247
- if (empty($option))
1248
  return $ip;
1249
- if ($option == 'anonymize')
 
1250
  return $this->anonymize_ip($ip);
 
1251
  return '';
1252
  }
1253
 
1254
  function anonymize_user($id) {
1255
  global $wpdb;
1256
  $user = $this->get_user($id);
1257
- if (!$user)
1258
  return null;
 
1259
 
1260
  $user->name = '';
1261
  $user->surname = '';
@@ -1473,15 +1484,15 @@ class NewsletterModule {
1473
  $text = str_replace('{email_id}', $email->id, $text);
1474
  $text = str_replace('{email_key}', $nek, $text);
1475
  $text = str_replace('{email_subject}', $email->subject, $text);
1476
- $text = $this->replace_url($text, 'EMAIL_URL', $home_url . '?na=v&id=' . $email->id . '&nk=' . $nk);
1477
  }
1478
 
1479
 
1480
  //$text = str_replace('{activation_link}', '<a href="{activation_url}">' . $options_subscription['confirmation_label'] . '</a>', $text);
1481
 
1482
 
1483
- $text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', $home_url . '?na=c&nk=' . $nk);
1484
- $text = $this->replace_url($text, 'ACTIVATION_URL', $home_url . '?na=c&nk=' . $nk);
1485
 
1486
  // Obsolete.
1487
  $text = $this->replace_url($text, 'FOLLOWUP_SUBSCRIPTION_URL', self::add_qs($base, 'nm=fs' . $id_token));
@@ -1489,17 +1500,7 @@ class NewsletterModule {
1489
  $text = $this->replace_url($text, 'FEED_SUBSCRIPTION_URL', self::add_qs($base, 'nm=es' . $id_token));
1490
  $text = $this->replace_url($text, 'FEED_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=eu' . $id_token));
1491
 
1492
-
1493
- if (empty($options_profile['profile_url'])) {
1494
- $profile_url = $home_url . '?na=p&nk=' . $nk;
1495
- } else {
1496
- $profile_url = self::add_qs($options_profile['profile_url'], 'nk=' . $nk);
1497
- }
1498
-
1499
- $profile_url = apply_filters('newsletter_profile_url', $profile_url, $user);
1500
- $text = $this->replace_url($text, 'PROFILE_URL', $profile_url);
1501
-
1502
- $text = $this->replace_url($text, 'UNLOCK_URL', $home_url . '?na=ul&nk=' . $nk);
1503
  } else {
1504
  $text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', '#');
1505
  $text = $this->replace_url($text, 'ACTIVATION_URL', '#');
1158
  * Add to a destination url the parameters to identify the user, the email and to show
1159
  * an alert message, if required. The parameters and them managed by the [newsletter] shortcode.
1160
  *
1161
+ * @param string $url If empty the standard newsletter page URL is used (usually it is empty, but sometime a custom URL has been specified)
1162
+ * @param string $message_key The message identifier
1163
  * @param TNP_User|int $user
1164
  * @param TNP_Email|int $email
1165
+ * @param string $alert An optional alter message to be shown. Does not work with custom URLs
1166
+ * @return string The final URL with parameters
1167
  */
1168
  function build_message_url($url = '', $message_key = '', $user = null, $email = null, $alert = '') {
1169
  $params = 'nm=' . urlencode($message_key);
1194
  return self::add_qs($url, $params, false);
1195
  }
1196
 
1197
+ /**
1198
+ * Builds a standard Newsletter action URL for the specified action.
1199
+ *
1200
+ * @param string $action
1201
+ * @param TNP_User $user
1202
+ * @param TNP_Email $email
1203
+ * @return string
1204
+ */
1205
  function build_action_url($action, $user = null, $email = null) {
1206
  $url = $this->add_qs($this->get_home_url(), 'na=' . urlencode($action));
1207
  if ($user) {
1252
 
1253
  function process_ip($ip) {
1254
  $option = Newsletter::instance()->options['ip'];
1255
+ if (empty($option)) {
1256
  return $ip;
1257
+ }
1258
+ if ($option == 'anonymize') {
1259
  return $this->anonymize_ip($ip);
1260
+ }
1261
  return '';
1262
  }
1263
 
1264
  function anonymize_user($id) {
1265
  global $wpdb;
1266
  $user = $this->get_user($id);
1267
+ if (!$user) {
1268
  return null;
1269
+ }
1270
 
1271
  $user->name = '';
1272
  $user->surname = '';
1484
  $text = str_replace('{email_id}', $email->id, $text);
1485
  $text = str_replace('{email_key}', $nek, $text);
1486
  $text = str_replace('{email_subject}', $email->subject, $text);
1487
+ $text = $this->replace_url($text, 'EMAIL_URL', $this->build_action_url('v', $user) . '&id=' . $email->id);
1488
  }
1489
 
1490
 
1491
  //$text = str_replace('{activation_link}', '<a href="{activation_url}">' . $options_subscription['confirmation_label'] . '</a>', $text);
1492
 
1493
 
1494
+ $text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', $this->build_action_url('c', $user));
1495
+ $text = $this->replace_url($text, 'ACTIVATION_URL', $this->build_action_url('v', $user));
1496
 
1497
  // Obsolete.
1498
  $text = $this->replace_url($text, 'FOLLOWUP_SUBSCRIPTION_URL', self::add_qs($base, 'nm=fs' . $id_token));
1500
  $text = $this->replace_url($text, 'FEED_SUBSCRIPTION_URL', self::add_qs($base, 'nm=es' . $id_token));
1501
  $text = $this->replace_url($text, 'FEED_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=eu' . $id_token));
1502
 
1503
+ $text = $this->replace_url($text, 'UNLOCK_URL', $this->build_action_url('ul', $user));
 
 
 
 
 
 
 
 
 
 
1504
  } else {
1505
  $text = $this->replace_url($text, 'SUBSCRIPTION_CONFIRM_URL', '#');
1506
  $text = $this->replace_url($text, 'ACTIVATION_URL', '#');
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.6.2
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '5.6.2');
18
 
19
  global $newsletter, $wpdb;
20
 
@@ -641,7 +641,7 @@ class Newsletter extends NewsletterModule {
641
  break;
642
  }
643
 
644
- $headers = array('List-Unsubscribe' => '<' . home_url('/') . '?na=u&nk=' . $user->id . '-' . $user->token . '>');
645
  $headers['Precedence'] = 'bulk';
646
  $headers['X-Newsletter-Email-Id'] = $email->id;
647
 
@@ -1250,7 +1250,7 @@ class Newsletter extends NewsletterModule {
1250
  }
1251
  }
1252
  if (!$this->newsletter_page_url) {
1253
- $this->newsletter_page_url = self::get_home_url() . '?na=m';
1254
  }
1255
  //}
1256
  return $this->newsletter_page_url;
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.6.3
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', '5.6.3');
18
 
19
  global $newsletter, $wpdb;
20
 
641
  break;
642
  }
643
 
644
+ $headers = array('List-Unsubscribe' => '<' . $this->build_action_url('u', $user, $email) . '>');
645
  $headers['Precedence'] = 'bulk';
646
  $headers['X-Newsletter-Email-Id'] = $email->id;
647
 
1250
  }
1251
  }
1252
  if (!$this->newsletter_page_url) {
1253
+ $this->newsletter_page_url = $this->build_action_url('m');
1254
  }
1255
  //}
1256
  return $this->newsletter_page_url;
profile/profile.php CHANGED
@@ -197,7 +197,7 @@ class NewsletterProfile extends NewsletterModule {
197
  $buffer = '';
198
 
199
  $buffer .= '<div class="tnp tnp-profile">';
200
- $buffer .= '<form action="' . esc_attr($this->get_home_url() . '?na=ps') . '" method="post" onsubmit="return newsletter_check(this)">';
201
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
202
 
203
  $buffer .= '<div class="tnp-field tnp-field-email">';
197
  $buffer = '';
198
 
199
  $buffer .= '<div class="tnp tnp-profile">';
200
+ $buffer .= '<form action="' . $this->build_action_url('ps') . '" method="post" onsubmit="return newsletter_check(this)">';
201
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
202
 
203
  $buffer .= '<div class="tnp-field tnp-field-email">';
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.9.7
5
- Stable tag: 5.6.2
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -108,6 +108,12 @@ Thank you, The Newsletter Team
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
111
  = 5.6.2 =
112
 
113
  * readme.txt improvements
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.9.7
5
+ Stable tag: 5.6.3
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
108
 
109
  == Changelog ==
110
 
111
+ = 5.6.3 =
112
+
113
+ * Removed unused files
114
+ * Fixed few links with permalink disabled and WMPL language as parameter
115
+ * Fixed the minimal form with WPML
116
+
117
  = 5.6.2 =
118
 
119
  * readme.txt improvements
subscription/lists.php CHANGED
@@ -80,6 +80,11 @@ $status = array(0 => 'Disabled/Private use', 1 => 'Only on profile page', 2 => '
80
  </tr>
81
  </thead>
82
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
 
 
 
 
 
83
  <tr>
84
  <td><?php echo $i; ?></td>
85
  <td><?php $controls->text('list_' . $i, 50); ?></td>
80
  </tr>
81
  </thead>
82
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
83
+ <?php
84
+ if (!$is_all_languages && empty($controls->data['list_' . $i])) {
85
+ continue;
86
+ }
87
+ ?>
88
  <tr>
89
  <td><?php echo $i; ?></td>
90
  <td><?php $controls->text('list_' . $i, 50); ?></td>
subscription/subscription.php CHANGED
@@ -1611,11 +1611,11 @@ class NewsletterSubscription extends NewsletterModule {
1611
  }
1612
 
1613
  function get_subscription_form_minimal($attrs) {
1614
-
1615
  if (!is_array($attrs)) {
1616
  $attrs = array();
1617
  }
1618
- $options_profile = $this->get_options('profile', $this->get_current_language());
1619
  $attrs = array_merge(array('class' => '', 'referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1620
 
1621
  $form = '';
@@ -1628,6 +1628,7 @@ class NewsletterSubscription extends NewsletterModule {
1628
  }
1629
  }
1630
  $form .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">';
 
1631
  $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1632
  $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($attrs['button']) . '">';
1633
  if (!empty($this->options_profile['privacy_status'])) {
1611
  }
1612
 
1613
  function get_subscription_form_minimal($attrs) {
1614
+ $language = $this->get_current_language();
1615
  if (!is_array($attrs)) {
1616
  $attrs = array();
1617
  }
1618
+ $options_profile = $this->get_options('profile', $language);
1619
  $attrs = array_merge(array('class' => '', 'referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1620
 
1621
  $form = '';
1628
  }
1629
  }
1630
  $form .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">';
1631
+ $form .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1632
  $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1633
  $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($attrs['button']) . '">';
1634
  if (!empty($this->options_profile['privacy_status'])) {