Newsletter - Version 5.4.6

Version Description

  • Fixed few debug notices
  • Added more translatable texts
  • Improved performances
  • Profile saving used as confirmation
  • Fixed the captcha layout and style
  • Fix initialization default messages template on first install
Download this release

Release Info

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

Code changes from version 5.4.5 to 5.4.6

emails/composer.php CHANGED
@@ -13,17 +13,17 @@ wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builde
13
  //wp_enqueue_style('tnpc-newsletter-style', plugins_url('/tnp-composer/css/newsletter.css', __FILE__));
14
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
15
 
16
- wp_enqueue_style('tnpc-cm-style1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.css');
17
- wp_enqueue_style('tnpc-cm-style2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.css');
18
-
19
- wp_enqueue_script('tnpc-cm-1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.js');
20
- wp_enqueue_script('tnpc-cm-2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/xml/xml.js');
21
- wp_enqueue_script('tnpc-cm-3', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/css/css.js');
22
- wp_enqueue_script('tnpc-cm-4', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/javascript/javascript.js');
23
- wp_enqueue_script('tnpc-cm-5', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/htmlmixed/htmlmixed.js');
24
- wp_enqueue_script('tnpc-cm-6', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.js');
25
- wp_enqueue_script('tnpc-cm-7', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/xml-hint.js');
26
- wp_enqueue_script('tnpc-cm-8', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/html-hint.js');
27
 
28
  if (($controls->is_action('save') || $controls->is_action('preview')) && !isset($_GET['id'])) {
29
 
13
  //wp_enqueue_style('tnpc-newsletter-style', plugins_url('/tnp-composer/css/newsletter.css', __FILE__));
14
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
15
 
16
+ wp_enqueue_style('tnpc-cm-style1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.css');
17
+ wp_enqueue_style('tnpc-cm-style2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.css');
18
+
19
+ wp_enqueue_script('tnpc-cm-1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.js');
20
+ wp_enqueue_script('tnpc-cm-2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/xml/xml.js');
21
+ wp_enqueue_script('tnpc-cm-3', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/css/css.js');
22
+ wp_enqueue_script('tnpc-cm-4', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/javascript/javascript.js');
23
+ wp_enqueue_script('tnpc-cm-5', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/htmlmixed/htmlmixed.js');
24
+ wp_enqueue_script('tnpc-cm-6', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.js');
25
+ wp_enqueue_script('tnpc-cm-7', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/xml-hint.js');
26
+ wp_enqueue_script('tnpc-cm-8', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/html-hint.js');
27
 
28
  if (($controls->is_action('save') || $controls->is_action('preview')) && !isset($_GET['id'])) {
29
 
emails/edit-html.php CHANGED
@@ -1,18 +1,18 @@
1
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.css" type="text/css">
2
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.css">
3
  <style>
4
  .CodeMirror {
5
  height: 600px;
6
  }
7
  </style>
8
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.js"></script>
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/xml/xml.js"></script>
10
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/css/css.js"></script>
11
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/javascript/javascript.js"></script>
12
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/htmlmixed/htmlmixed.js"></script>
13
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.js"></script>
14
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/xml-hint.js"></script>
15
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/html-hint.js"></script>
16
  <script>
17
  var templateEditor;
18
  jQuery(function () {
1
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.css" type="text/css">
2
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.css">
3
  <style>
4
  .CodeMirror {
5
  height: 600px;
6
  }
7
  </style>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.js"></script>
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/xml/xml.js"></script>
10
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/css/css.js"></script>
11
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/javascript/javascript.js"></script>
12
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/htmlmixed/htmlmixed.js"></script>
13
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.js"></script>
14
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/xml-hint.js"></script>
15
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/html-hint.js"></script>
16
  <script>
17
  var templateEditor;
18
  jQuery(function () {
emails/emails.php CHANGED
@@ -438,6 +438,10 @@ class NewsletterEmails extends NewsletterModule {
438
  foreach ($main_options as $key => $value) {
439
  $theme_options['main_' . $key] = $value;
440
  }
 
 
 
 
441
  return $theme_options;
442
  }
443
 
438
  foreach ($main_options as $key => $value) {
439
  $theme_options['main_' . $key] = $value;
440
  }
441
+ $info_options = Newsletter::instance()->get_options('info');
442
+ foreach ($info_options as $key => $value) {
443
+ $theme_options['main_' . $key] = $value;
444
+ }
445
  return $theme_options;
446
  }
447
 
includes/module.php CHANGED
@@ -30,7 +30,8 @@ abstract class TNP_User {
30
  const STAUTS_CONFIRMED = 'C';
31
  const STAUTS_NOT_CONFIRMED = 'S';
32
  const STAUTS_UNSUBSCRIBED = 'U';
33
- const STAUTS_BOUNCED = 'B';
 
34
  }
35
 
36
  /**
@@ -41,7 +42,7 @@ abstract class TNP_User {
41
  * @property array $options The subscriber status
42
  * */
43
  abstract class TNP_Email {
44
-
45
  }
46
 
47
  class NewsletterModule {
@@ -819,16 +820,13 @@ class NewsletterModule {
819
  * If found, the user object is returned or null.
820
  * The user is returned without regards to his status that should be checked by caller.
821
  *
822
- * @return null
823
  */
824
  function check_user() {
825
  global $wpdb;
826
 
827
  if (isset($_REQUEST['nk'])) {
828
  list($id, $token) = @explode('-', $_REQUEST['nk'], 2);
829
- } else if (isset($_REQUEST['ni'])) {
830
- $id = (int) $_REQUEST['ni'];
831
- $token = $_REQUEST['nt'];
832
  } else if (isset($_COOKIE['newsletter'])) {
833
  list ($id, $token) = @explode('-', $_COOKIE['newsletter'], 2);
834
  }
@@ -977,7 +975,7 @@ class NewsletterModule {
977
  }
978
  return $lists;
979
  }
980
-
981
  /**
982
  *
983
  * @return TNP_List[]
@@ -997,7 +995,7 @@ class NewsletterModule {
997
  $lists[] = $list;
998
  }
999
  return $lists;
1000
- }
1001
 
1002
  /**
1003
  *
@@ -1098,8 +1096,49 @@ class NewsletterModule {
1098
  // Anyway try a table clean up, nothing bad happens
1099
  $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id' => $id));
1100
  $wpdb->delete(NEWSLETTER_SENT_TABLE, array('user_id' => $id));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1101
 
1102
-
 
 
 
 
 
 
 
 
 
 
 
 
1103
  }
1104
 
1105
  function clean_stats_table() {
@@ -1408,7 +1447,7 @@ class NewsletterModule {
1408
  }
1409
  }
1410
  }
1411
-
1412
  // Company info
1413
  // TODO: Move to another module
1414
  $options = Newsletter::instance()->options;
@@ -1491,7 +1530,7 @@ class NewsletterModule {
1491
  echo "<!DOCTYPE html>\n";
1492
  echo '<html><head>'
1493
  . '<style type="text/css">'
1494
- . 'form {margin: 200px auto 0 auto !important; width: 350px !important; padding: 10px !important; font-family: "Open Sans", sans-serif; background: #ECF0F1; border-radius: 5px; padding: 50px !important; border: none !important;}'
1495
  . 'p {text-align: center; padding: 10px; color: #7F8C8D;}'
1496
  . 'input[type=text] {width: 50px; padding: 10px 10px; border: none; border-radius: 2px; margin: 0px 5px;}'
1497
  . 'input[type=submit] {text-align: center; border: none; padding: 10px 15px; font-family: "Open Sans", sans-serif; background-color: #27AE60; color: white; cursor: pointer;}'
@@ -1511,12 +1550,7 @@ class NewsletterModule {
1511
  echo '">';
1512
  }
1513
  } else {
1514
-
1515
- echo '<input type="hidden" name="';
1516
- echo esc_attr($name);
1517
- echo '" value="';
1518
- echo esc_attr(stripslashes($value));
1519
- echo '">';
1520
  }
1521
  }
1522
  if (isset($_SERVER['HTTP_REFERER'])) {
@@ -1524,14 +1558,18 @@ class NewsletterModule {
1524
  }
1525
  echo '<input type="hidden" name="ts" value="' . time() . '">';
1526
  echo '</div>';
 
1527
  if ($captcha) {
1528
- echo '<p>Math question</p>';
1529
- echo '<input type="text" name="n1" value="' . rand(1, 9) . '" readonly style="width: 50px">';
 
1530
  echo '+';
1531
- echo '<input type="text" name="n2" value="' . rand(1, 9) . '" readonly style="width: 50px">';
1532
  echo '=';
1533
  echo '<input type="text" name="n3" value="?" style="width: 50px">';
1534
- echo '&nbsp;<input type="submit" value="', esc_attr($submit_label), '">';
 
 
1535
  }
1536
  echo '<noscript><input type="submit" value="';
1537
  echo esc_attr($submit_label);
30
  const STAUTS_CONFIRMED = 'C';
31
  const STAUTS_NOT_CONFIRMED = 'S';
32
  const STAUTS_UNSUBSCRIBED = 'U';
33
+ const STAUTS_BOUNCED = 'B';
34
+
35
  }
36
 
37
  /**
42
  * @property array $options The subscriber status
43
  * */
44
  abstract class TNP_Email {
45
+
46
  }
47
 
48
  class NewsletterModule {
820
  * If found, the user object is returned or null.
821
  * The user is returned without regards to his status that should be checked by caller.
822
  *
823
+ * @return TNP_User
824
  */
825
  function check_user() {
826
  global $wpdb;
827
 
828
  if (isset($_REQUEST['nk'])) {
829
  list($id, $token) = @explode('-', $_REQUEST['nk'], 2);
 
 
 
830
  } else if (isset($_COOKIE['newsletter'])) {
831
  list ($id, $token) = @explode('-', $_COOKIE['newsletter'], 2);
832
  }
975
  }
976
  return $lists;
977
  }
978
+
979
  /**
980
  *
981
  * @return TNP_List[]
995
  $lists[] = $list;
996
  }
997
  return $lists;
998
+ }
999
 
1000
  /**
1001
  *
1096
  // Anyway try a table clean up, nothing bad happens
1097
  $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id' => $id));
1098
  $wpdb->delete(NEWSLETTER_SENT_TABLE, array('user_id' => $id));
1099
+ }
1100
+
1101
+ /**
1102
+ * Add to a destination url the parameters to identify the user, the email and to show
1103
+ * an alert message, if required. The parameters and them managed by the [newsletter] shortcode.
1104
+ *
1105
+ * @param string $url If empty the standard newsletter page URL is used
1106
+ * @param string $message_key
1107
+ * @param TNP_User|int $user
1108
+ * @param TNP_Email|int $email
1109
+ * @param string $alert
1110
+ * @return string The final url
1111
+ */
1112
+ function build_message_url($url = '', $message_key='', $user = false, $email = false, $alert = '') {
1113
+ $params = 'nm=' . urlencode($message_key);
1114
+
1115
+ if ($user) {
1116
+ if (!is_object($user)) $user = $this->get_user($user);
1117
+ $params .= '&nk=' . urlencode($this->get_user_key($user));
1118
+ }
1119
+
1120
+ if ($email) {
1121
+ if (!is_object($email)) $email = $this->get_email($email);
1122
+ $params .= '&nek=' . urlencode($email->id . '-' . $email->token);
1123
+ }
1124
+
1125
+ if ($alert) {
1126
+ $params .= '&alert=' . urlencode($alert);
1127
+ }
1128
 
1129
+ if (empty($url)) {
1130
+ $url = Newsletter::instance()->get_newsletter_page_url();
1131
+ }
1132
+
1133
+ return self::add_qs($url, $params, false);
1134
+ }
1135
+
1136
+ function build_action_url($action, $user = null, $email = null) {
1137
+ $url = $this->get_home_url() . '?na=' . urlencode($action) . '&nk=' . urlencode($this->get_user_key($user));
1138
+ if ($email) {
1139
+ $url .= '&nek=' . $email->id . '-' . $email->token;
1140
+ }
1141
+ return $url;
1142
  }
1143
 
1144
  function clean_stats_table() {
1447
  }
1448
  }
1449
  }
1450
+
1451
  // Company info
1452
  // TODO: Move to another module
1453
  $options = Newsletter::instance()->options;
1530
  echo "<!DOCTYPE html>\n";
1531
  echo '<html><head>'
1532
  . '<style type="text/css">'
1533
+ . '.tnp-captcha {text-align: center; margin: 200px auto 0 auto !important; max-width: 300px !important; padding: 10px !important; font-family: "Open Sans", sans-serif; background: #ECF0F1; border-radius: 5px; padding: 50px !important; border: none !important;}'
1534
  . 'p {text-align: center; padding: 10px; color: #7F8C8D;}'
1535
  . 'input[type=text] {width: 50px; padding: 10px 10px; border: none; border-radius: 2px; margin: 0px 5px;}'
1536
  . 'input[type=submit] {text-align: center; border: none; padding: 10px 15px; font-family: "Open Sans", sans-serif; background-color: #27AE60; color: white; cursor: pointer;}'
1550
  echo '">';
1551
  }
1552
  } else {
1553
+ echo '<input type="hidden" name="', esc_attr($name), '" value="', esc_attr(stripslashes($value)), '">';
 
 
 
 
 
1554
  }
1555
  }
1556
  if (isset($_SERVER['HTTP_REFERER'])) {
1558
  }
1559
  echo '<input type="hidden" name="ts" value="' . time() . '">';
1560
  echo '</div>';
1561
+
1562
  if ($captcha) {
1563
+ echo '<div class="tnp-captcha">';
1564
+ echo '<p>', __('Math question', 'newsletter'), '</p>';
1565
+ echo '<input type="text" name="n1" value="', rand(1, 9), '" readonly style="width: 50px">';
1566
  echo '+';
1567
+ echo '<input type="text" name="n2" value="', rand(1, 9), '" readonly style="width: 50px">';
1568
  echo '=';
1569
  echo '<input type="text" name="n3" value="?" style="width: 50px">';
1570
+ echo '<br><br>';
1571
+ echo '<input type="submit" value="', esc_attr($submit_label), '">';
1572
+ echo '</div>';
1573
  }
1574
  echo '<noscript><input type="submit" value="';
1575
  echo esc_attr($submit_label);
main/defaults.php CHANGED
@@ -17,5 +17,22 @@ $options = array(
17
  'debug'=>0,
18
  'track'=>1,
19
  'css'=>'',
20
- 'css_disabled'=>0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  );
17
  'debug'=>0,
18
  'track'=>1,
19
  'css'=>'',
20
+ 'css_disabled'=>0,
21
+
22
+ 'header_logo' => '',
23
+ 'header_title' => get_bloginfo('name'),
24
+ 'header_sub' => get_bloginfo('description'),
25
+ 'footer_title' => '',
26
+ 'footer_contact' => '',
27
+ 'footer_legal' => '',
28
+ 'facebook_url' => '',
29
+ 'twitter_url' => '',
30
+ 'instagram_url' => '',
31
+ 'googleplus_url' => '',
32
+ 'pinterest_url' => '',
33
+ 'linkedin_url' => '',
34
+ 'tumblr_url' => '',
35
+ 'youtube_url' => '',
36
+ 'vimeo_url' => '',
37
+ 'soundcloud_url' => ''
38
  );
main/main.php CHANGED
@@ -1,6 +1,5 @@
1
  <?php
2
- if (!defined('ABSPATH'))
3
- exit;
4
 
5
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
6
  $controls = new NewsletterControls();
@@ -14,24 +13,24 @@ if (!$controls->is_action()) {
14
  $errors = null;
15
 
16
  // Validation
17
- $controls->data['sender_email'] = $newsletter->normalize_email($controls->data['sender_email']);
18
  if (!$newsletter->is_email($controls->data['sender_email'])) {
19
  $controls->errors .= __('The sender email address is not correct.', 'newsletter') . '<br>';
20
  } else {
21
- $controls->data['sender_email'] = $newsletter->normalize_email($controls->data['sender_email']);
22
  }
23
 
24
  if (!$newsletter->is_email($controls->data['return_path'], true)) {
25
  $controls->errors .= __('Return path email is not correct.', 'newsletter') . '<br>';
26
  } else {
27
- $controls->data['return_path'] = $newsletter->normalize_email($controls->data['return_path']);
28
  }
29
 
30
 
31
- if (!$newsletter->is_email($controls->data['reply_to'], true)) {
32
  $controls->errors .= __('Reply to email is not correct.', 'newsletter') . '<br>';
33
  } else {
34
- $controls->data['reply_to'] = $newsletter->normalize_email($controls->data['reply_to']);
35
  }
36
 
37
  if (!empty($controls->data['contract_key'])) {
@@ -115,17 +114,17 @@ if (empty($controls->data['page'])) {
115
 
116
  }
117
  ?>
118
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.css" type="text/css">
119
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.css">
120
  <style>
121
  .CodeMirror {
122
  border: 1px solid #ddd;
123
  }
124
  </style>
125
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.js"></script>
126
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/css/css.js"></script>
127
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.js"></script>
128
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/css-hint.js"></script>
129
  <script>
130
  jQuery(function () {
131
  var editor = CodeMirror.fromTextArea(document.getElementById("options-css"), {
1
  <?php
2
+ defined('ABSPATH') || exit;
 
3
 
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
13
  $errors = null;
14
 
15
  // Validation
16
+ $controls->data['sender_email'] = $module->normalize_email($controls->data['sender_email']);
17
  if (!$newsletter->is_email($controls->data['sender_email'])) {
18
  $controls->errors .= __('The sender email address is not correct.', 'newsletter') . '<br>';
19
  } else {
20
+ $controls->data['sender_email'] = $module->normalize_email($controls->data['sender_email']);
21
  }
22
 
23
  if (!$newsletter->is_email($controls->data['return_path'], true)) {
24
  $controls->errors .= __('Return path email is not correct.', 'newsletter') . '<br>';
25
  } else {
26
+ $controls->data['return_path'] = $module->normalize_email($controls->data['return_path']);
27
  }
28
 
29
 
30
+ if (!$module->is_email($controls->data['reply_to'], true)) {
31
  $controls->errors .= __('Reply to email is not correct.', 'newsletter') . '<br>';
32
  } else {
33
+ $controls->data['reply_to'] = $module->normalize_email($controls->data['reply_to']);
34
  }
35
 
36
  if (!empty($controls->data['contract_key'])) {
114
 
115
  }
116
  ?>
117
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.css" type="text/css">
118
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.css">
119
  <style>
120
  .CodeMirror {
121
  border: 1px solid #ddd;
122
  }
123
  </style>
124
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/codemirror.js"></script>
125
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/mode/css/css.js"></script>
126
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/show-hint.js"></script>
127
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.37.0/addon/hint/css-hint.js"></script>
128
  <script>
129
  jQuery(function () {
130
  var editor = CodeMirror.fromTextArea(document.getElementById("options-css"), {
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.4.5
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.4.5');
18
 
19
  global $wpdb, $newsletter;
20
 
@@ -126,7 +126,7 @@ class Newsletter extends NewsletterModule {
126
 
127
  // Here because the upgrade is called by the parent constructor and uses the scheduler
128
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
129
- parent::__construct('main', '1.4.3', null, array('info', 'smtp'));
130
 
131
  $max = $this->options['scheduler_max'];
132
  if (!is_numeric($max)) {
@@ -308,6 +308,13 @@ class Newsletter extends NewsletterModule {
308
  $this->options['css'] = $subscription_options['css'];
309
  $this->save_options($this->options);
310
  }
 
 
 
 
 
 
 
311
 
312
  return true;
313
  }
@@ -366,7 +373,6 @@ class Newsletter extends NewsletterModule {
366
  }
367
 
368
  add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
369
- //add_shortcode('newsletter_action', array($this, 'shortcode_newsletter_action'));
370
 
371
  if (is_admin()) {
372
  if ($this->is_admin_page()) {
@@ -400,8 +406,7 @@ class Newsletter extends NewsletterModule {
400
  add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
401
  }
402
 
403
- $action = isset($_REQUEST['na']) ? $_REQUEST['na'] : '';
404
- if (empty($action) || is_admin()) {
405
  return;
406
  }
407
 
@@ -409,12 +414,7 @@ class Newsletter extends NewsletterModule {
409
  $cache_stop = true;
410
  $hyper_cache_stop = true;
411
 
412
- if ($action == 'of') {
413
- echo $this->subscription_form('os');
414
- die();
415
- }
416
-
417
- if ($action == 'fu') {
418
  $user = $this->check_user();
419
  if ($user == null) {
420
  die('No user');
@@ -425,7 +425,7 @@ class Newsletter extends NewsletterModule {
425
  return;
426
  }
427
 
428
- if ($action == 'test') {
429
  echo 'ok';
430
  die();
431
  }
@@ -433,7 +433,7 @@ class Newsletter extends NewsletterModule {
433
 
434
  function hook_wp_enqueue_scripts() {
435
  if (empty($this->options['css_disabled']) && apply_filters('newsletter_enqueue_style', true)) {
436
- wp_enqueue_style('newsletter-subscription', plugins_url('newsletter') . '/style.css', array(), NEWSLETTER_VERSION);
437
  if (!empty($this->options['css'])) {
438
  wp_add_inline_style('newsletter', $this->options['css']);
439
  }
@@ -446,11 +446,6 @@ class Newsletter extends NewsletterModule {
446
  return $content;
447
  }
448
 
449
- function shortcode_newsletter_action($attrs, $content) {
450
- $content = apply_filters('newsletter_action_shortcode', '', $attrs, $content, $this->get_user_from_request(), $this->get_email_from_request());
451
- return $content;
452
- }
453
-
454
  function is_admin_page() {
455
  if (!isset($_GET['page'])) {
456
  return false;
@@ -1034,33 +1029,6 @@ class Newsletter extends NewsletterModule {
1034
  return $file2;
1035
  }
1036
 
1037
- /**
1038
- * Return a user if there are request parameters or cookie with identification data otherwise null.
1039
- *
1040
- * @return TNP_User The user identified or null
1041
- */
1042
- function check_user() {
1043
- global $wpdb, $current_user;
1044
-
1045
- if (isset($_REQUEST['nk'])) {
1046
- list($id, $token) = @explode('-', $_REQUEST['nk'], 2);
1047
- } if (isset($_COOKIE['newsletter'])) {
1048
- list ($id, $token) = @explode('-', $_COOKIE['newsletter'], 2);
1049
- }
1050
-
1051
- if (!empty($id) && !empty($token)) {
1052
- return $wpdb->get_row($wpdb->prepare("select * from " . NEWSLETTER_USERS_TABLE . " where id=%d and token=%s limit 1", $id, $token));
1053
- }
1054
-
1055
- $wp_user_id = get_current_user_id();
1056
- if (empty($wp_user_id)) {
1057
- return null;
1058
- }
1059
-
1060
- $user = $this->get_user_by_wp_user_id($wp_user_id);
1061
- return $user;
1062
- }
1063
-
1064
  function hook_shutdown() {
1065
  if ($this->mailer != null)
1066
  $this->mailer->SmtpClose();
@@ -1214,7 +1182,14 @@ class Newsletter extends NewsletterModule {
1214
  return !empty($this->options['contract_key']);
1215
  }
1216
 
1217
- function get_newsletter_page_url($message_key, $user = false, $email = false, $alert = '') {
 
 
 
 
 
 
 
1218
  static $url = false;
1219
 
1220
  if (!$url) {
@@ -1225,21 +1200,7 @@ class Newsletter extends NewsletterModule {
1225
  $url = self::get_home_url() . '?na=m';
1226
  }
1227
  }
1228
- $params = 'nm=' . urlencode($message_key);
1229
-
1230
- if ($user) {
1231
- $params .= '&nk=' . urlencode($this->get_user_key($user));
1232
- }
1233
-
1234
- if ($email) {
1235
- $params .= '&nek=' . urlencode($email->id . '-' . $email->token);
1236
- }
1237
-
1238
- if ($alert) {
1239
- $params .= '&alert=' . urlencode($alert);
1240
- }
1241
-
1242
- return self::add_qs($url, $params, false);
1243
  }
1244
 
1245
  }
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.4.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
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '5.4.6');
18
 
19
  global $wpdb, $newsletter;
20
 
126
 
127
  // Here because the upgrade is called by the parent constructor and uses the scheduler
128
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
129
+ parent::__construct('main', '1.4.7', null, array('info', 'smtp'));
130
 
131
  $max = $this->options['scheduler_max'];
132
  if (!is_numeric($max)) {
308
  $this->options['css'] = $subscription_options['css'];
309
  $this->save_options($this->options);
310
  }
311
+
312
+ // Migration of "info" options
313
+ $info_options = $this->get_options('info');
314
+ if (!empty($this->options['header_logo']) && empty($info_options['header_logo'])) {
315
+ $info_options = $this->options;
316
+ $this->save_options($info_options, 'info');
317
+ }
318
 
319
  return true;
320
  }
373
  }
374
 
375
  add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
 
376
 
377
  if (is_admin()) {
378
  if ($this->is_admin_page()) {
406
  add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
407
  }
408
 
409
+ if (empty($this->action)) {
 
410
  return;
411
  }
412
 
414
  $cache_stop = true;
415
  $hyper_cache_stop = true;
416
 
417
+ if ($this->action == 'fu') {
 
 
 
 
 
418
  $user = $this->check_user();
419
  if ($user == null) {
420
  die('No user');
425
  return;
426
  }
427
 
428
+ if ($this->action == 'test') {
429
  echo 'ok';
430
  die();
431
  }
433
 
434
  function hook_wp_enqueue_scripts() {
435
  if (empty($this->options['css_disabled']) && apply_filters('newsletter_enqueue_style', true)) {
436
+ wp_enqueue_style('newsletter', plugins_url('newsletter') . '/style.css', array(), NEWSLETTER_VERSION);
437
  if (!empty($this->options['css'])) {
438
  wp_add_inline_style('newsletter', $this->options['css']);
439
  }
446
  return $content;
447
  }
448
 
 
 
 
 
 
449
  function is_admin_page() {
450
  if (!isset($_GET['page'])) {
451
  return false;
1029
  return $file2;
1030
  }
1031
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1032
  function hook_shutdown() {
1033
  if ($this->mailer != null)
1034
  $this->mailer->SmtpClose();
1182
  return !empty($this->options['contract_key']);
1183
  }
1184
 
1185
+ /**
1186
+ * Returns the Newsletter dedicated page URL or an alternative URL if that page if not
1187
+ * configured or not available.
1188
+ *
1189
+ * @staticvar string $url
1190
+ * @return string
1191
+ */
1192
+ function get_newsletter_page_url() {
1193
  static $url = false;
1194
 
1195
  if (!$url) {
1200
  $url = self::get_home_url() . '?na=m';
1201
  }
1202
  }
1203
+ return $url;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1204
  }
1205
 
1206
  }
profile/index.php CHANGED
@@ -29,10 +29,11 @@ if ($controls->is_action()) {
29
  <div id="tnp-heading">
30
 
31
  <h2><?php _e('The subscriber profile page', 'newsletter') ?></h2>
32
-
33
  </div>
34
 
35
  <div id="tnp-body">
 
36
 
37
  <form id="channel" method="post" action="">
38
  <?php $controls->init(); ?>
@@ -68,7 +69,7 @@ if ($controls->is_action()) {
68
  <h3><?php _e('Messages', 'newsletter')?></h3>
69
  <table class="form-table">
70
  <tr>
71
- <th>Profile saved</th>
72
  <td>
73
  <?php $controls->text('saved', 80); ?>
74
  </td>
@@ -89,15 +90,12 @@ if ($controls->is_action()) {
89
  <th><?php _e('General error', 'newsletter')?></th>
90
  <td>
91
  <?php $controls->text('error', 80); ?>
92
- <p class="description">
93
- Email not valid or already used.
94
- </p>
95
  </td>
96
  </tr>
97
 
98
  </table>
99
 
100
- <h3>Labels</h3>
101
  <table class="form-table">
102
  <tr>
103
  <th><?php _e('"Save" label', 'newsletter')?></th>
29
  <div id="tnp-heading">
30
 
31
  <h2><?php _e('The subscriber profile page', 'newsletter') ?></h2>
32
+ <?php $controls->page_help('https://www.thenewsletterplugin.com/documentation/profile-page')?>
33
  </div>
34
 
35
  <div id="tnp-body">
36
+
37
 
38
  <form id="channel" method="post" action="">
39
  <?php $controls->init(); ?>
69
  <h3><?php _e('Messages', 'newsletter')?></h3>
70
  <table class="form-table">
71
  <tr>
72
+ <th><?php _e('Profile saved', 'newsletter')?></th>
73
  <td>
74
  <?php $controls->text('saved', 80); ?>
75
  </td>
90
  <th><?php _e('General error', 'newsletter')?></th>
91
  <td>
92
  <?php $controls->text('error', 80); ?>
 
 
 
93
  </td>
94
  </tr>
95
 
96
  </table>
97
 
98
+ <h3><?php _e('Labels', 'newsletter')?></h3>
99
  <table class="form-table">
100
  <tr>
101
  <th><?php _e('"Save" label', 'newsletter')?></th>
profile/profile.php CHANGED
@@ -44,8 +44,10 @@ class NewsletterProfile extends NewsletterModule {
44
  if ($user == null) {
45
  die('No subscriber found.');
46
  }
 
 
47
 
48
- wp_redirect(Newsletter::instance()->get_newsletter_page_url('profile', $user));
49
  die();
50
 
51
  break;
@@ -54,7 +56,7 @@ class NewsletterProfile extends NewsletterModule {
54
  case 'ps':
55
  $user = $this->save_profile();
56
  // $user->alert is a temporary field
57
- wp_redirect(Newsletter::instance()->get_newsletter_page_url('profile', $user, null, $user->alert));
58
  die();
59
  break;
60
 
@@ -71,7 +73,7 @@ class NewsletterProfile extends NewsletterModule {
71
  * @param stdClass $user
72
  */
73
  function get_profile_export_url($user) {
74
- return $this->get_home_url() . '?na=profile_export&nk=' . $this->get_user_key($user);
75
  }
76
 
77
  /**
@@ -79,14 +81,7 @@ class NewsletterProfile extends NewsletterModule {
79
  * @param stdClass $user
80
  */
81
  function get_profile_url($user) {
82
- if (empty($this->options['url'])) {
83
- $profile_url = $this->get_home_url() . '?na=profile&nk=' . $this->get_user_key($user);
84
- } else {
85
- $profile_url = self::add_qs($this->options['url'], 'nk=' . $this->get_user_key($user));
86
- }
87
-
88
- $profile_url = apply_filters('newsletter_profile_url', $profile_url, $user);
89
- return $profile_url;
90
  }
91
 
92
  function hook_newsletter_replace($text, $user, $email) {
@@ -94,16 +89,12 @@ class NewsletterProfile extends NewsletterModule {
94
  return $text;
95
  }
96
 
97
- $profile_options = NewsletterSubscription::instance()->get_options('profile');
98
-
99
  // Profile edit page URL and link
100
  $url = $this->get_profile_url($user);
101
  $text = $this->replace_url($text, 'PROFILE_URL', $url);
102
- // $text = str_replace('{profile_link}', '<a class="tnp-profile-link" href="' . $url . '">' . $this->options['edit_label'] . '</a>', $text);
103
  // Profile export URL and link
104
  $url = $this->get_profile_export_url($user);
105
  $text = $this->replace_url($text, 'PROFILE_EXPORT_URL', $url);
106
- // $text = str_replace('{profile_export_link}', '<a class="tnp-profile-export-link" href="' . $url . '">' . $this->options['export_label'] . '</a>', $text);
107
 
108
  if (strpos($text, '{profile_form}') !== false) {
109
  $text = str_replace('{profile_form}', $this->get_profile_form($user), $text);
@@ -123,13 +114,13 @@ class NewsletterProfile extends NewsletterModule {
123
 
124
  if (empty($user)) {
125
  if (empty($content)) {
126
- return __('Subscriber profile not found.', 'newsletter');
127
  } else {
128
  return $content;
129
  }
130
  }
131
 
132
- return NewsletterSubscription::instance()->get_profile_form($user);
133
  }
134
 
135
  function to_json($user) {
@@ -399,6 +390,10 @@ class NewsletterProfile extends NewsletterModule {
399
 
400
  // Feed by Mail service is saved here
401
  $data = apply_filters('newsletter_profile_save', $data);
 
 
 
 
402
 
403
  $user = $this->save_user($data);
404
  $this->add_user_log($user, 'profile');
44
  if ($user == null) {
45
  die('No subscriber found.');
46
  }
47
+ $profile_url = $this->build_message_url($this->options['url'], 'profile', $user);
48
+ $profile_url = apply_filters('newsletter_profile_url', $profile_url, $user);
49
 
50
+ wp_redirect($profile_url);
51
  die();
52
 
53
  break;
56
  case 'ps':
57
  $user = $this->save_profile();
58
  // $user->alert is a temporary field
59
+ wp_redirect($this->build_message_url($this->options['url'], 'profile', $user, null, $user->alert));
60
  die();
61
  break;
62
 
73
  * @param stdClass $user
74
  */
75
  function get_profile_export_url($user) {
76
+ return $this->build_action_url('profile_export', $user);
77
  }
78
 
79
  /**
81
  * @param stdClass $user
82
  */
83
  function get_profile_url($user) {
84
+ return $this->build_action_url('profile', $user);
 
 
 
 
 
 
 
85
  }
86
 
87
  function hook_newsletter_replace($text, $user, $email) {
89
  return $text;
90
  }
91
 
 
 
92
  // Profile edit page URL and link
93
  $url = $this->get_profile_url($user);
94
  $text = $this->replace_url($text, 'PROFILE_URL', $url);
 
95
  // Profile export URL and link
96
  $url = $this->get_profile_export_url($user);
97
  $text = $this->replace_url($text, 'PROFILE_EXPORT_URL', $url);
 
98
 
99
  if (strpos($text, '{profile_form}') !== false) {
100
  $text = str_replace('{profile_form}', $this->get_profile_form($user), $text);
114
 
115
  if (empty($user)) {
116
  if (empty($content)) {
117
+ return __('Subscriber not found.', 'newsletter');
118
  } else {
119
  return $content;
120
  }
121
  }
122
 
123
+ return $this->get_profile_form($user);
124
  }
125
 
126
  function to_json($user) {
390
 
391
  // Feed by Mail service is saved here
392
  $data = apply_filters('newsletter_profile_save', $data);
393
+
394
+ if ($user->status == TNP_User::STAUTS_NOT_CONFIRMED) {
395
+ $data['status'] = TNP_User::STAUTS_CONFIRMED;
396
+ }
397
 
398
  $user = $this->save_user($data);
399
  $this->add_user_log($user, 'profile');
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.6
5
- Stable tag: 5.4.5
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -102,6 +102,15 @@ Thank you, The Newsletter Team
102
 
103
  == Changelog ==
104
 
 
 
 
 
 
 
 
 
 
105
  = 5.4.5 =
106
 
107
  * Fixed tested up version value in readme.txt
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.6
5
+ Stable tag: 5.4.6
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
102
 
103
  == Changelog ==
104
 
105
+ = 5.4.6 =
106
+
107
+ * Fixed few debug notices
108
+ * Added more translatable texts
109
+ * Improved performances
110
+ * Profile saving used as confirmation
111
+ * Fixed the captcha layout and style
112
+ * Fix initialization default messages template on first install
113
+
114
  = 5.4.5 =
115
 
116
  * Fixed tested up version value in readme.txt
subscription/defaults-profile.php CHANGED
@@ -19,6 +19,7 @@ $options['privacy'] = __('By continuing, you accept the privacy policy', 'newsle
19
  $options['privacy_error'] = 'You must accept the privacy policy';
20
  $options['privacy_status'] = 0;
21
  $options['privacy_url'] = '';
 
22
 
23
  $options['subscribe'] = __('Subscribe', 'newsletter');
24
 
19
  $options['privacy_error'] = 'You must accept the privacy policy';
20
  $options['privacy_status'] = 0;
21
  $options['privacy_url'] = '';
22
+ $options['privacy_use_wp_url'] = 0;
23
 
24
  $options['subscribe'] = __('Subscribe', 'newsletter');
25
 
subscription/defaults-template.php CHANGED
@@ -3,4 +3,4 @@
3
  // This file is used only on first installation!
4
 
5
  $options = array();
6
- $options['template'] = @file_get_contents(__DIR__ . '/../email.html');
3
  // This file is used only on first installation!
4
 
5
  $options = array();
6
+ $options['template'] = @file_get_contents(__DIR__ . '/email.html');
subscription/defaults.php CHANGED
@@ -21,6 +21,7 @@ $options['akismet'] = 0;
21
  $options['captcha'] = 0;
22
  $options['notify_email'] = get_option('admin_email');
23
  $options['multiple'] = 1;
 
24
 
25
  $options['error_text'] = '<p>' . __('You cannot subscribe with the email address you entered, please contact the site administrator.', 'newsletter') . '</p>';
26
 
21
  $options['captcha'] = 0;
22
  $options['notify_email'] = get_option('admin_email');
23
  $options['multiple'] = 1;
24
+ $options['notify'] = 0;
25
 
26
  $options['error_text'] = '<p>' . __('You cannot subscribe with the email address you entered, please contact the site administrator.', 'newsletter') . '</p>';
27
 
subscription/email.html CHANGED
@@ -7,6 +7,9 @@
7
  text-decoration: none;
8
  color: #0088cc;
9
  }
 
 
 
10
  </style>
11
  </head>
12
 
@@ -37,6 +40,7 @@
37
  {message}
38
 
39
  <hr>
 
40
  <p>
41
  <small>
42
  <a href="{blog_url}">{blog_url}</a><br>
@@ -44,7 +48,7 @@
44
  {company_address}
45
  </small>
46
  </p>
47
- <!-- Signature if not already added to single messages (surround with <p>) -->
48
 
49
  </td>
50
  </tr>
7
  text-decoration: none;
8
  color: #0088cc;
9
  }
10
+ hr {
11
+ border-top: 1px solid #999;
12
+ }
13
  </style>
14
  </head>
15
 
40
  {message}
41
 
42
  <hr>
43
+ <!-- Signature if not already added to single messages (surround with <p>) -->
44
  <p>
45
  <small>
46
  <a href="{blog_url}">{blog_url}</a><br>
48
  {company_address}
49
  </small>
50
  </p>
51
+
52
 
53
  </td>
54
  </tr>
subscription/options.php CHANGED
@@ -67,7 +67,7 @@ if ($controls->is_action()) {
67
  $addresses = array();
68
  foreach ($users as &$user) {
69
  $addresses[] = $user->email;
70
- $res = $module->mail($user->email, $newsletter->replace($module->options['confirmation_subject']), $newsletter->replace($module->options['confirmation_message'], $user));
71
  if (!$res) {
72
  $controls->errors = 'The email address ' . $user->email . ' failed.';
73
  break;
@@ -88,7 +88,7 @@ if ($controls->is_action()) {
88
  $addresses = array();
89
  foreach ($users as &$user) {
90
  $addresses[] = $user->email;
91
- $res = $module->mail($user->email, $newsletter->replace($module->options['confirmed_subject']), $newsletter->replace($module->options['confirmed_message'], $user));
92
  if (!$res) {
93
  $controls->errors = 'The email address ' . $user->email . ' failed.';
94
  break;
67
  $addresses = array();
68
  foreach ($users as &$user) {
69
  $addresses[] = $user->email;
70
+ $res = $module->mail($user->email, $module->replace($module->options['confirmation_subject']), $module->replace($module->options['confirmation_message'], $user));
71
  if (!$res) {
72
  $controls->errors = 'The email address ' . $user->email . ' failed.';
73
  break;
88
  $addresses = array();
89
  foreach ($users as &$user) {
90
  $addresses[] = $user->email;
91
+ $res = $module->mail($user->email, $module->replace($module->options['confirmed_subject']), $module->replace($module->options['confirmed_message'], $user));
92
  if (!$res) {
93
  $controls->errors = 'The email address ' . $user->email . ' failed.';
94
  break;
subscription/page.php CHANGED
@@ -17,7 +17,12 @@ if (!defined('ABSPATH')) exit;
17
  $module = NewsletterSubscription::instance();
18
  $user = $module->get_user_from_request(true);
19
  $message_key = $module->get_message_key_from_request();
20
- $message = $newsletter->replace($module->options[$message_key . '_text'], $user);
 
 
 
 
 
21
  if (isset($module->options[$message_key . '_tracking'])) {
22
  $message .= $module->options[$message_key . '_tracking'];
23
  }
17
  $module = NewsletterSubscription::instance();
18
  $user = $module->get_user_from_request(true);
19
  $message_key = $module->get_message_key_from_request();
20
+ $message = apply_filters('newsletter_page_text', '', $message_key);
21
+ if (!$message) {
22
+ $message = $module->options[$message_key . '_text'];
23
+ }
24
+ $message = $module->replace($message, $user);
25
+
26
  if (isset($module->options[$message_key . '_tracking'])) {
27
  $message .= $module->options[$message_key . '_tracking'];
28
  }
subscription/subscription.php CHANGED
@@ -980,46 +980,19 @@ class NewsletterSubscription extends NewsletterModule {
980
  * WordPress page or loading the configured url or activating the standard page.
981
  */
982
  function show_message($key, $user, $alert = '', $email = null) {
983
- $newsletter = Newsletter::instance();
984
-
985
- if (!is_object($user)) {
986
- if (is_array($user))
987
- $user = (object) $user;
988
- else {
989
- $user = $newsletter->get_user($user);
990
- }
991
- }
992
-
993
- $params = '';
994
-
995
- if (!empty($alert)) {
996
- $params .= '&alert=' . urlencode($alert);
997
- }
998
-
999
  if (isset($_REQUEST['ncu'])) {
1000
- $this->options['confirmation_url'] = esc_url($_REQUEST['ncu']);
1001
- $this->options['confirmed_url'] = esc_url($_REQUEST['ncu']);
1002
- }
1003
-
1004
- if ($email) {
1005
- $params .= '&nek=' . $email->id . '-' . $email->token;
1006
- }
1007
-
1008
- $url = apply_filters('newsletter_page_url', '', $key);
1009
-
1010
- if (empty($url)) {
1011
  if (!empty($this->options[$key . '_url'])) {
1012
  $url = $this->options[$key . '_url'];
1013
- } else if (!empty($this->options['page'])) {
1014
- $url = get_permalink($this->options['page']);
1015
- } else if (!empty($this->options['url'])) {
1016
- $url = $this->options['url'];
1017
- } else {
1018
- $url = home_url('/') . '?na=m';
1019
  }
1020
  }
1021
 
1022
- header('Location: ' . self::add_qs($url, 'nm=' . $key . '&nk=' . $this->get_user_key($user), false) . $params);
 
 
1023
  die();
1024
  }
1025
 
@@ -1632,7 +1605,7 @@ class NewsletterSubscription extends NewsletterModule {
1632
 
1633
  function notify_admin($user, $subject) {
1634
 
1635
- if ($this->options['notify'] != 1) {
1636
  return;
1637
  }
1638
 
980
  * WordPress page or loading the configured url or activating the standard page.
981
  */
982
  function show_message($key, $user, $alert = '', $email = null) {
983
+ $url = '';
984
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
985
  if (isset($_REQUEST['ncu'])) {
986
+ $url = $_REQUEST['ncu'];
987
+ } else {
 
 
 
 
 
 
 
 
 
988
  if (!empty($this->options[$key . '_url'])) {
989
  $url = $this->options[$key . '_url'];
 
 
 
 
 
 
990
  }
991
  }
992
 
993
+ $url = Newsletter::instance()->build_message_url($url, $key, $user, $email, $alert);
994
+ wp_redirect($url);
995
+
996
  die();
997
  }
998
 
1605
 
1606
  function notify_admin($user, $subject) {
1607
 
1608
+ if (empty($this->options['notify'])) {
1609
  return;
1610
  }
1611
 
users/index.php CHANGED
@@ -27,14 +27,14 @@ if ($controls->is_action()) {
27
  if ($controls->is_action('resend')) {
28
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
29
  $opts = get_option('newsletter');
30
- NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
31
  $controls->messages = 'Activation email resent to ' . $user->email;
32
  }
33
 
34
  if ($controls->is_action('resend_welcome')) {
35
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
36
  $opts = get_option('newsletter');
37
- NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmed_subject'], $user), $newsletter->replace($opts['confirmed_message'], $user));
38
  $controls->messages = 'Welcome email resent.';
39
  }
40
 
27
  if ($controls->is_action('resend')) {
28
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
29
  $opts = get_option('newsletter');
30
+ NewsletterSubscription::instance()->mail($user->email, $module->replace($opts['confirmation_subject'], $user), $module->replace($opts['confirmation_message'], $user));
31
  $controls->messages = 'Activation email resent to ' . $user->email;
32
  }
33
 
34
  if ($controls->is_action('resend_welcome')) {
35
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
36
  $opts = get_option('newsletter');
37
+ NewsletterSubscription::instance()->mail($user->email, $module->replace($opts['confirmed_subject'], $user), $module->replace($opts['confirmed_message'], $user));
38
  $controls->messages = 'Welcome email resent.';
39
  }
40