Newsletter - Version 4.7.2

Version Description

  • Fixed a debug notice
Download this release

Release Info

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

Code changes from version 4.7.1 to 4.7.2

main/diagnostic.php CHANGED
@@ -184,6 +184,8 @@ if (count($send_calls)) {
184
  $send_total_emails = 0;
185
  $send_completed = 0;
186
  for ($i = 0; $i < count($send_calls); $i++) {
 
 
187
  $delta = $send_calls[$i][1] - $send_calls[$i][0];
188
  $send_total_time += $delta;
189
  $send_total_emails += $send_calls[$i][2];
184
  $send_total_emails = 0;
185
  $send_completed = 0;
186
  for ($i = 0; $i < count($send_calls); $i++) {
187
+ if (empty($send_calls[$i][2])) continue;
188
+
189
  $delta = $send_calls[$i][1] - $send_calls[$i][0];
190
  $send_total_time += $delta;
191
  $send_total_emails += $send_calls[$i][2];
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://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="http://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 4.7.1
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://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.7.1');
18
 
19
  global $wpdb, $newsletter;
20
 
@@ -550,7 +550,7 @@ class Newsletter extends NewsletterModule {
550
  }
551
  }
552
 
553
- $start_time = time();
554
  $count = 0;
555
  $result = true;
556
 
@@ -602,15 +602,16 @@ class Newsletter extends NewsletterModule {
602
  $this->email_limit--;
603
  $count++;
604
  }
605
- $end_time = time();
606
 
607
- $send_calls = get_option('newsletter_diagnostic_send_calls', array());
608
- $send_calls[] = array($start_time, $end_time, $count, $result);
609
-
610
- if (count($send_calls) > self::MAX_CRON_SAMPLES) array_shift($send_calls);
611
-
612
- update_option('newsletter_diagnostic_send_calls', $send_calls, false);
613
 
 
 
 
 
614
  return $result;
615
  }
616
 
4
  Plugin Name: Newsletter
5
  Plugin URI: http://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="http://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 4.7.2
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://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.7.2');
18
 
19
  global $wpdb, $newsletter;
20
 
550
  }
551
  }
552
 
553
+ $start_time = microtime(true);
554
  $count = 0;
555
  $result = true;
556
 
602
  $this->email_limit--;
603
  $count++;
604
  }
605
+ $end_time = microtime(true);
606
 
607
+ if ($count > 0) {
608
+ $send_calls = get_option('newsletter_diagnostic_send_calls', array());
609
+ $send_calls[] = array($start_time, $end_time, $count, $result);
 
 
 
610
 
611
+ if (count($send_calls) > self::MAX_CRON_SAMPLES) array_shift($send_calls);
612
+
613
+ update_option('newsletter_diagnostic_send_calls', $send_calls, false);
614
+ }
615
  return $result;
616
  }
617
 
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.6.1
5
- Stable tag: 4.7.1
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -77,6 +77,22 @@ Thank you, The Newsletter Team
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  = 4.7.1 =
81
 
82
  * Fixed missing files in the package
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.6.1
5
+ Stable tag: 4.7.2
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
77
 
78
  == Changelog ==
79
 
80
+ = 4.7.3 =
81
+
82
+ * Added custom CSS field to customize the forms appearance
83
+ * Added codemirror for CSS edit
84
+ * Added plugin version to style link
85
+ * Added plugin version to script link
86
+ * Corrected a tag in newsletter widget minimal
87
+ * Added line height on form fields
88
+ * Changed CSS class prefixes to tnp
89
+ * Fixed a divide by zero on diagnostic panel
90
+ * Improved the collection of emails sending speed data
91
+
92
+ = 4.7.2 =
93
+
94
+ * Fixed a debug notice
95
+
96
  = 4.7.1 =
97
 
98
  * Fixed missing files in the package
subscription/options.php CHANGED
@@ -144,6 +144,27 @@ if (empty($controls->data['page'])) {
144
 
145
  ?>
146
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
147
  <div class="wrap" id="tnp-wrap">
148
 
149
  <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
@@ -218,6 +239,15 @@ if (empty($controls->data['page'])) {
218
  </p>
219
  </td>
220
  </tr>
 
 
 
 
 
 
 
 
 
221
  </table>
222
  </div>
223
 
144
 
145
  ?>
146
 
147
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.css" type="text/css">
148
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.css">
149
+ <style>
150
+ .CodeMirror {
151
+ border: 1px solid #ddd;
152
+ }
153
+ </style>
154
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.js"></script>
155
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/css/css.js"></script>
156
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.js"></script>
157
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/css-hint.js"></script>
158
+ <script>
159
+ jQuery(function () {
160
+ var editor = CodeMirror.fromTextArea(document.getElementById("options-css"), {
161
+ lineNumbers: true,
162
+ mode: 'css',
163
+ extraKeys: {"Ctrl-Space": "autocomplete"}
164
+ });
165
+ });
166
+ </script>
167
+
168
  <div class="wrap" id="tnp-wrap">
169
 
170
  <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
239
  </p>
240
  </td>
241
  </tr>
242
+ <tr valign="top">
243
+ <th><?php _e('Custom styles', 'newsletter')?></th>
244
+ <td>
245
+ <?php if (apply_filters('newsletter_enqueue_style', true) === false) { ?>
246
+ <p><strong>Warning: Newsletter styles and custom styles are disable by your theme or a plugin.</strong></p>
247
+ <?php } ?>
248
+ <?php $controls->textarea('css'); ?>
249
+ </td>
250
+ </tr>
251
  </table>
252
  </div>
253
 
subscription/style.css CHANGED
@@ -1,4 +1,4 @@
1
- .newsletter-subscription {
2
  font-size: 13px;
3
  display: block;
4
  margin: 15px auto;
@@ -7,23 +7,23 @@
7
  }
8
 
9
  /* Generic field wrapper */
10
- .newsletter-subscription div.newsletter-field {
11
  margin-bottom: 10px;
12
  border: 0!important;
13
  padding: 0!important;
14
  }
15
 
16
- .newsletter-subscription label {
17
  display: block;
18
  color: inherit;
19
  font-size: 14px!important;
20
  font-weight: 700;
21
  line-height: normal;
22
- padding: 5px;;
23
  margin: 0;
24
  }
25
 
26
- .newsletter-subscription input[type=text], .newsletter-subscription input[type=email], .newsletter-subscription input[type=submit], .newsletter-subscription select {
27
  width: 100%;
28
  padding: 10px!important;
29
  display: block;
@@ -33,26 +33,27 @@
33
  color: #444;
34
  font-size: 14px;
35
  margin: 0!important;
 
36
  }
37
 
38
- .newsletter-subscription input[type=checkbox], .newsletter-widget input[type=radio] {
39
  width: auto;
40
  display: inline;
41
  }
42
 
43
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
44
- .newsletter-subscription select option {
45
  margin-right: 10px!important;
46
  }
47
 
48
- .newsletter-subscription input[type=submit] {
49
  background-color: #444!important;
50
  color: #fff!important;
51
  width: auto;
52
  }
53
 
54
  @media all and (max-width: 480px) {
55
- .newsletter-subscription input[type=submit] {
56
  width: 100%;
57
  }
58
  }
@@ -60,23 +61,23 @@
60
 
61
  /* Profile form */
62
 
63
- .newsletter-profile {
64
  font-size: 13px;
65
  }
66
 
67
- .newsletter-profile .newsletter-field {
68
  margin-bottom: 10px;
69
  border: 0!important;
70
  padding: 0!important;
71
  }
72
 
73
- .newsletter-profile label {
74
  display: block;
75
  color: #333;
76
  font-size: 14px!important;
77
  }
78
 
79
- .newsletter-profile input[type=text], .newsletter-profile input[type=email], .newsletter-profile input[type=submit], .newsletter-profile select {
80
  width: 100%!important;
81
  padding: 10px!important;
82
  display: block;
@@ -86,93 +87,95 @@
86
  color: #444;
87
  font-size: 14px;
88
  margin: 0!important;
 
89
  }
90
 
91
- .newsletter-profile input[type=checkbox], .newsletter-widget input[type=radio] {
92
  width: auto;
93
  display: inline;
94
  }
95
 
96
- .newsletter-profile .newsletter-list-label {
97
  margin-left: 15px;
98
  }
99
 
100
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
101
- .newsletter-profile select option {
102
  margin-right: 10px!important;
103
  }
104
 
105
- .newsletter-profile input[type=submit] {
106
  background-color: #444!important;
107
  color: #fff!important;
108
  }
109
 
110
 
111
 
112
- .newsletter-widget {
113
  width: 100%;
114
  display: block;
115
  }
116
 
117
- .newsletter-widget .newsletter-field {
118
  margin-bottom: 10px;
119
  border: 0!important;
120
  padding: 0!important;
121
  }
122
 
123
- .newsletter-widget label {
124
  display: block;
125
  color: inherit;
126
  font-size: 14px!important;
127
  }
128
 
129
- .newsletter-widget input[type=text], .newsletter-widget input[type=email], .newsletter-widget input[type=submit], .newsletter-widget select {
130
  width: 100%!important;
131
  padding: 10px!important;
132
  display: block;
133
- border: 1px!important;
134
- border-color: #ddd;
135
  background-color: #f4f4f4!important;
136
  color: #444;
137
  font-size: 14px;
 
138
  }
139
 
140
- .newsletter-widget input[type=checkbox], .newsletter-widget input[type=radio] {
141
  width: auto;
142
  display: inline;
143
  }
144
 
145
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
146
- .newsletter-widget select option {
147
  margin-right: 10px!important;
148
  }
149
 
150
- .newsletter-widget input[type=submit] {
151
  background-color: #444!important;
152
  color: #fff!important;
153
  }
154
 
155
- .newsletter-field input[type="submit"] {
156
  position: inherit!important;
157
  }
158
 
159
- .newsletter-field label {
160
 
161
  }
162
 
163
  /* Newsletter Widget Minimal */
164
 
165
- .newsletter-widget-minimal {
166
  width: 100%;
167
  }
168
 
169
- .newsletter-widget-minimal form {
170
  margin: 0!important;
171
  padding: 0!important;
172
  border: 0!important;
173
  }
174
 
175
- .newsletter-widget-minimal input.newsletter-email {
176
  width: 70%!important;
177
  box-sizing: border-box!important;
178
  padding: 10px!important;
@@ -184,7 +187,7 @@
184
  font-size: 14px;
185
  }
186
 
187
- .newsletter-widget-minimal input.newsletter-submit {
188
  width: 30%!important;
189
  box-sizing: border-box!important;
190
  padding: 10px!important;
@@ -194,22 +197,22 @@
194
  background-color: #444!important;
195
  color: #fff!important;
196
  font-size: 14px;
197
- line-height: 22px;
198
  border-radius: 0px!important;
199
  }
200
 
201
 
202
- .newsletter-subscription-minimal {
203
  width: 100%;
204
  }
205
 
206
- .newsletter-subscription-minimal form {
207
  margin: 0!important;
208
  padding: 0!important;
209
  border: 0!important;
210
  }
211
 
212
- .newsletter-subscription-minimal input.newsletter-email {
213
  width: 70%!important;
214
  max-width: 300px;
215
  box-sizing: border-box!important;
@@ -222,7 +225,7 @@
222
  font-size: 14px;
223
  }
224
 
225
- .newsletter-subscription-minimal input.newsletter-submit {
226
  width: 29%!important;
227
  box-sizing: border-box!important;
228
  padding: 10px!important;
1
+ .tnp-subscription {
2
  font-size: 13px;
3
  display: block;
4
  margin: 15px auto;
7
  }
8
 
9
  /* Generic field wrapper */
10
+ .tnp-subscription div.tnp-field {
11
  margin-bottom: 10px;
12
  border: 0!important;
13
  padding: 0!important;
14
  }
15
 
16
+ .tnp-subscription label {
17
  display: block;
18
  color: inherit;
19
  font-size: 14px!important;
20
  font-weight: 700;
21
  line-height: normal;
22
+ padding: 5px;
23
  margin: 0;
24
  }
25
 
26
+ .tnp-subscription input[type=text], .tnp-subscription input[type=email], .tnp-subscription input[type=submit], .tnp-subscription select {
27
  width: 100%;
28
  padding: 10px!important;
29
  display: block;
33
  color: #444;
34
  font-size: 14px;
35
  margin: 0!important;
36
+ line-height: normal!important;
37
  }
38
 
39
+ .tnp-subscription input[type=checkbox], .tnp-widget input[type=radio] {
40
  width: auto;
41
  display: inline;
42
  }
43
 
44
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
45
+ .tnp-subscription select option {
46
  margin-right: 10px!important;
47
  }
48
 
49
+ .tnp-subscription input.tnp-submit {
50
  background-color: #444!important;
51
  color: #fff!important;
52
  width: auto;
53
  }
54
 
55
  @media all and (max-width: 480px) {
56
+ .tnp-subscription input[type=submit] {
57
  width: 100%;
58
  }
59
  }
61
 
62
  /* Profile form */
63
 
64
+ .tnp-profile {
65
  font-size: 13px;
66
  }
67
 
68
+ .tnp-profile .tnp-field {
69
  margin-bottom: 10px;
70
  border: 0!important;
71
  padding: 0!important;
72
  }
73
 
74
+ .tnp-profile label {
75
  display: block;
76
  color: #333;
77
  font-size: 14px!important;
78
  }
79
 
80
+ .tnp-profile input[type=text], .tnp-profile input[type=email], .tnp-profile input[type=submit], .tnp-profile select {
81
  width: 100%!important;
82
  padding: 10px!important;
83
  display: block;
87
  color: #444;
88
  font-size: 14px;
89
  margin: 0!important;
90
+ line-height: normal;
91
  }
92
 
93
+ .tnp-profile input[type=checkbox], .tnp-profile input[type=radio] {
94
  width: auto;
95
  display: inline;
96
  }
97
 
98
+ .tnp-profile .tnp-list-label {
99
  margin-left: 15px;
100
  }
101
 
102
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
103
+ .tnp-profile select option {
104
  margin-right: 10px!important;
105
  }
106
 
107
+ .tnp-profile input[type=submit] {
108
  background-color: #444!important;
109
  color: #fff!important;
110
  }
111
 
112
 
113
 
114
+ .tnp-widget {
115
  width: 100%;
116
  display: block;
117
  }
118
 
119
+ .tnp-widget .tnp-field {
120
  margin-bottom: 10px;
121
  border: 0!important;
122
  padding: 0!important;
123
  }
124
 
125
+ .tnp-widget label {
126
  display: block;
127
  color: inherit;
128
  font-size: 14px!important;
129
  }
130
 
131
+ .tnp-widget input[type=text], .tnp-widget input[type=email], .tnp-widget input[type=submit], .tnp-widget select {
132
  width: 100%!important;
133
  padding: 10px!important;
134
  display: block;
135
+ border: 1px solid #ddd !important;
136
+ border-color: #ddd!important;
137
  background-color: #f4f4f4!important;
138
  color: #444;
139
  font-size: 14px;
140
+ line-height: normal;
141
  }
142
 
143
+ .tnp-widget input[type=checkbox], .tnp-widget input[type=radio] {
144
  width: auto;
145
  display: inline;
146
  }
147
 
148
  /* Antireset - http://www.satollo.net/css-and-select-space-between-the-options-and-the-arrow */
149
+ .tnp-widget select option {
150
  margin-right: 10px!important;
151
  }
152
 
153
+ .tnp-widget input.tnp-submit {
154
  background-color: #444!important;
155
  color: #fff!important;
156
  }
157
 
158
+ .tnp-field input[type="submit"] {
159
  position: inherit!important;
160
  }
161
 
162
+ .tnp-field label {
163
 
164
  }
165
 
166
  /* Newsletter Widget Minimal */
167
 
168
+ .tnp-widget-minimal {
169
  width: 100%;
170
  }
171
 
172
+ .tnp-widget-minimal form {
173
  margin: 0!important;
174
  padding: 0!important;
175
  border: 0!important;
176
  }
177
 
178
+ .tnp-widget-minimal input.tnp-email {
179
  width: 70%!important;
180
  box-sizing: border-box!important;
181
  padding: 10px!important;
187
  font-size: 14px;
188
  }
189
 
190
+ .tnp-widget-minimal input.tnp-submit {
191
  width: 30%!important;
192
  box-sizing: border-box!important;
193
  padding: 10px!important;
197
  background-color: #444!important;
198
  color: #fff!important;
199
  font-size: 14px;
200
+ line-height: normal;
201
  border-radius: 0px!important;
202
  }
203
 
204
 
205
+ .tnp-subscription-minimal {
206
  width: 100%;
207
  }
208
 
209
+ .tnp-subscription-minimal form {
210
  margin: 0!important;
211
  padding: 0!important;
212
  border: 0!important;
213
  }
214
 
215
+ .tnp-subscription-minimal input.tnp-email {
216
  width: 70%!important;
217
  max-width: 300px;
218
  box-sizing: border-box!important;
225
  font-size: 14px;
226
  }
227
 
228
+ .tnp-subscription-minimal input.tnp-submit {
229
  width: 29%!important;
230
  box-sizing: border-box!important;
231
  padding: 10px!important;
subscription/subscription.php CHANGED
@@ -36,7 +36,7 @@ class NewsletterSubscription extends NewsletterModule {
36
  // Something
37
  } else {
38
  add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
39
- add_action('wp_head', array($this, 'hook_wp_head'));
40
  add_action('wp_footer', array($this, 'hook_wp_footer'));
41
  add_shortcode('newsletter', array($this, 'shortcode_newsletter'));
42
  add_shortcode('newsletter_form', array($this, 'shortcode_newsletter_form'));
@@ -47,18 +47,31 @@ class NewsletterSubscription extends NewsletterModule {
47
 
48
  function hook_wp_enqueue_scripts() {
49
  if (apply_filters('newsletter_enqueue_style', true)) {
50
- wp_enqueue_style('newsletter-subscription', plugins_url('newsletter') . '/subscription/style.css');
 
 
 
51
  }
52
 
53
- wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), null, true);
54
  $options = $this->get_options('profile');
55
  $data = array();
56
  $data['messages'] = array();
57
- $data['messages']['email_error'] = $options['email_error'];
58
- $data['messages']['name_error'] = $options['name_error'];
59
- $data['messages']['surname_error'] = $options['surname_error'];
60
- $data['messages']['profile_error'] = $options['profile_error'];
61
- $data['messages']['privacy_error'] = $options['privacy_error'];
 
 
 
 
 
 
 
 
 
 
62
  $data['profile_max'] = NEWSLETTER_PROFILE_MAX;
63
  wp_localize_script('newsletter-subscription', 'newsletter', $data);
64
  }
@@ -73,6 +86,7 @@ class NewsletterSubscription extends NewsletterModule {
73
 
74
  // normal subscription
75
  case 's':
 
76
  if (isset($this->options['antibot_disable']) || $this->antibot_form_check()) {
77
 
78
  $user = $this->subscribe();
@@ -151,6 +165,7 @@ class NewsletterSubscription extends NewsletterModule {
151
  break;
152
 
153
  case 'c':
 
154
  if ($this->antibot_form_check()) {
155
  $user = $this->confirm();
156
  if ($user->status == 'E') {
@@ -171,7 +186,6 @@ class NewsletterSubscription extends NewsletterModule {
171
  }
172
 
173
  function hook_wp_head() {
174
-
175
  }
176
 
177
  function hook_wp_footer() {
@@ -224,7 +238,7 @@ class NewsletterSubscription extends NewsletterModule {
224
  $options_template['template'] = $this->options['template'];
225
  add_option('newsletter_subscription_template', $options_template, null, 'no');
226
  }
227
-
228
  if (isset($this->options['template'])) {
229
  unset($this->options['template']);
230
  unset($this->options['template_enabled']);
@@ -755,11 +769,11 @@ class NewsletterSubscription extends NewsletterModule {
755
  }
756
 
757
  // Old URL
758
- if (!$url && !empty($this->options['url'])) {
759
  $url = $this->options['url'];
760
  }
761
 
762
- if (!$url) {
763
  $url = home_url('/') . '?na=m';
764
  }
765
 
@@ -911,11 +925,11 @@ class NewsletterSubscription extends NewsletterModule {
911
  }
912
 
913
  if (!empty($label)) {
914
- $buffer .= '<div class="newsletter-field newsletter-field-button">';
915
  if (strpos($label, 'http') === 0) {
916
- $buffer .= '<input class="newsletter-button-image" type="image" src="' . $label . '">';
917
  } else {
918
- $buffer .= '<input class="newsletter-button" type="submit" value="' . $label . '">';
919
  }
920
  $buffer .= '</div>';
921
  }
@@ -930,7 +944,7 @@ class NewsletterSubscription extends NewsletterModule {
930
  $suffix = $name;
931
  }
932
  $options_profile = get_option('newsletter_profile');
933
- $buffer = '<label for="newsletter-' . $suffix . '">';
934
  if (isset($attrs['label'])) {
935
  if (empty($attrs['label'])) {
936
  return;
@@ -951,19 +965,19 @@ class NewsletterSubscription extends NewsletterModule {
951
  $buffer = '';
952
 
953
  if ($name == 'email') {
954
- $buffer .= '<div class="newsletter-field newsletter-field-email">';
955
  $buffer .= $this->_shortcode_label('email', $attrs);
956
 
957
- $buffer .= '<input class="newsletter-email" type="email" name="ne" value=""';
958
  if (isset($attrs['placeholder']))
959
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
960
  $buffer .= 'required>';
961
  if (isset($attrs['button_label'])) {
962
  $label = $attrs['button_label'];
963
  if (strpos($label, 'http') === 0) {
964
- $buffer .= ' <input class="newsletter-button-image" type="image" src="' . esc_attr(esc_url_raw($label)) . '">';
965
  } else {
966
- $buffer .= ' <input class="newsletter-button" type="submit" value="' . esc_attr($label) . '" style="width: 29%">';
967
  }
968
  }
969
  $buffer .= "</div>\n";
@@ -971,10 +985,10 @@ class NewsletterSubscription extends NewsletterModule {
971
  }
972
 
973
  if ($name == 'first_name' || $name == 'name') {
974
- $buffer .= '<div class="newsletter-field newsletter-field-firstname">';
975
  $buffer .= $this->_shortcode_label('name', $attrs);
976
 
977
- $buffer .= '<input class="newsletter-name" type="text" name="nn" value=""';
978
  if (isset($attrs['placeholder']))
979
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
980
  if ($options_profile['name_rules'] == 1) {
@@ -986,10 +1000,10 @@ class NewsletterSubscription extends NewsletterModule {
986
  }
987
 
988
  if ($name == 'last_name' || $name == 'surname') {
989
- $buffer .= '<div class="newsletter-field newsletter-field-surname">';
990
  $buffer .= $this->_shortcode_label('surname', $attrs);
991
 
992
- $buffer .= '<input class="newsletter-surname" type="text" name="ns" value=""';
993
  if (isset($attrs['placeholder']))
994
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
995
  if ($options_profile['surname_rules'] == 1) {
@@ -1005,7 +1019,7 @@ class NewsletterSubscription extends NewsletterModule {
1005
  if (isset($attrs['hidden'])) {
1006
  return '<input type="hidden" name="nl[]" value="' . esc_attr($list) . '">';
1007
  }
1008
- $buffer .= '<div class="newsletter-field newsletter-field-checkbox newsletter-field-list">';
1009
  $buffer .= '<input type="checkbox" id="nl' . esc_attr($list) . '" name="nl[]" value="' . esc_attr($list) . '"';
1010
  if (isset($attrs['checked'])) {
1011
  $buffer .= ' checked';
@@ -1029,7 +1043,7 @@ class NewsletterSubscription extends NewsletterModule {
1029
  if ($options_profile['list_' . $i . '_status'] != 2) {
1030
  continue;
1031
  }
1032
- $lists .= '<div class="newsletter-field newsletter-field-checkbox newsletter-field-list">';
1033
  $lists .= '<input type="checkbox" id="nl' . $i . '" name="nl[]" value="' . $i . '"';
1034
  if ($options_profile['list_' . $i . '_checked'] == 1)
1035
  $lists .= ' checked';
@@ -1041,7 +1055,7 @@ class NewsletterSubscription extends NewsletterModule {
1041
 
1042
  // TODO: add the "not specified"
1043
  if ($name == 'sex' || $name == 'gender') {
1044
- $buffer .= '<div class="newsletter-field newsletter-field-gender">';
1045
  if (isset($attrs['label'])) {
1046
  if ($attrs['label'] != '')
1047
  $buffer .= '<label for="">' . esc_html($attrs['label']) . '</label>';
@@ -1049,7 +1063,7 @@ class NewsletterSubscription extends NewsletterModule {
1049
  $buffer .= '<label for="">' . esc_html($options_profile['sex']) . '</label>';
1050
  }
1051
 
1052
- $buffer .= '<select name="nx" class="newsletter-gender">';
1053
  $buffer .= '<option value="m">' . esc_html($options_profile['sex_male']) . '</option>';
1054
  $buffer .= '<option value="f">' . esc_html($options_profile['sex_female']) . '</option>';
1055
  $buffer .= '</select>';
@@ -1061,7 +1075,7 @@ class NewsletterSubscription extends NewsletterModule {
1061
  $number = (int) $attrs['number'];
1062
  $type = $options_profile['profile_' . $number . '_type'];
1063
  $size = isset($attrs['size']) ? $attrs['size'] : '';
1064
- $buffer .= '<div class="newsletter-field newsletter-field-profile">';
1065
  if (isset($attrs['label'])) {
1066
  if ($attrs['label'] != '') {
1067
  $buffer .= '<label>' . esc_html($attrs['label']) . '</label>';
@@ -1075,7 +1089,7 @@ class NewsletterSubscription extends NewsletterModule {
1075
 
1076
  // Text field
1077
  if ($type == 'text') {
1078
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $number . '" type="text" size="' . esc_attr($size) . '" name="np' . $number . '" placeholder="' . esc_attr($placeholder) . '"';
1079
  if ($required) {
1080
  $buffer .= ' required';
1081
  }
@@ -1084,7 +1098,7 @@ class NewsletterSubscription extends NewsletterModule {
1084
 
1085
  // Select field
1086
  if ($type == 'select') {
1087
- $buffer .= '<select class="newsletter-profile newsletter-profile-' . $number . '" name="np' . $number . '"';
1088
  if ($required) {
1089
  $buffer .= ' required';
1090
  }
@@ -1114,10 +1128,10 @@ class NewsletterSubscription extends NewsletterModule {
1114
  $attrs['label'] = $options_profile['list_' . $i];
1115
  }
1116
 
1117
- $buffer .= '<div class="newsletter-field newsletter-field-checkbox newsletter-field-privacy">';
1118
 
1119
- $buffer .= '<input type="checkbox" name="ny" required class="newsletter-privacy" id="newsletter-privacy"> ';
1120
- $buffer .= '<label for="newsletter-privacy">';
1121
  if (!empty($attrs['url'])) {
1122
  $buffer .= '<a target="_blank" href="' . esc_attr($options_profile['privacy_url']) . '">';
1123
  }
@@ -1154,7 +1168,7 @@ class NewsletterSubscription extends NewsletterModule {
1154
 
1155
  $buffer = $this->get_form_javascript();
1156
 
1157
- $buffer .= '<div class="newsletter newsletter-subscription">' . "\n";
1158
  $buffer .= '<form method="post" action="' . $action . '" onsubmit="return newsletter_check(this)">' . "\n\n";
1159
 
1160
  if (isset($attrs['confirmation_url'])) {
@@ -1174,21 +1188,21 @@ class NewsletterSubscription extends NewsletterModule {
1174
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">' . "\n\n";
1175
  if ($options_profile['name_status'] == 2) {
1176
  $buffer .= "<!-- first name -->\n";
1177
- $buffer .= "<tr>\n\t" . '<th>' . $options_profile['name'] . '</th>' . "\n\t" . '<td><input class="newsletter-firstname" type="text" name="nn" size="30"' . ($options_profile['name_rules'] == 1 ? 'required' : '') . '></td>' . "\n" . '</tr>' . "\n\n";
1178
  }
1179
 
1180
  if ($options_profile['surname_status'] == 2) {
1181
  $buffer .= "<!-- last name -->\n";
1182
- $buffer .= "<tr>\n\t" . '<th>' . $options_profile['surname'] . '</th>' . "\n\t" . '<td><input class="newsletter-lastname" type="text" name="ns" size="30"' . ($options_profile['surname_rules'] == 1 ? 'required' : '') . '></td>' . "\n" . '</tr>' . "\n\n";
1183
  }
1184
 
1185
  $buffer .= "<!-- email -->\n";
1186
- $buffer .= "<tr>\n\t" . '<th>' . $options_profile['email'] . '</th>' . "\n\t" . '<td align="left"><input class="newsletter-email" type="email" name="ne" size="30" required></td>' . "\n" . '</tr>' . "\n\n";
1187
 
1188
  if ($options_profile['sex_status'] == 2) {
1189
  $buffer .= "<!-- sex -->\n";
1190
  $buffer .= "<tr>\n\t<th>" . $options_profile['sex'] . "</th>\n";
1191
- $buffer .= "\t<td>\n\t" . '<select name="nx" class="newsletter-sex">' . "\n";
1192
  $buffer .= "\t\t" . '<option value="m">' . $options_profile['sex_male'] . '</option>' . "\n";
1193
  $buffer .= "\t\t" . '<option value="f">' . $options_profile['sex_female'] . '</option>' . "\n";
1194
  $buffer .= "\t</select>\n\t</td></tr>\n";
@@ -1229,7 +1243,7 @@ class NewsletterSubscription extends NewsletterModule {
1229
  // Text field
1230
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
1231
  $buffer .= "<tr>\n\t<th>" . $options_profile['profile_' . $i] . "</th>\n\t<td>\n\t\t";
1232
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text" size="30" name="np' . $i . '"';
1233
  $buffer .= ' placeholder="' . esc_attr($options_profile['profile_' . $i . '_placeholder']) . '"';
1234
  if (!empty($options_profile['profile_' . $i . '_rules'])) {
1235
  $buffer .= ' required';
@@ -1239,7 +1253,7 @@ class NewsletterSubscription extends NewsletterModule {
1239
 
1240
  // Select field
1241
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
1242
- $buffer .= "<tr>\n\t<th>" . $options_profile['profile_' . $i] . "</th>\n\t<td>\n\t\t" . '<select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '"';
1243
  if (!empty($options_profile['profile_' . $i . '_rules'])) {
1244
  $buffer .= ' required';
1245
  }
@@ -1262,7 +1276,7 @@ class NewsletterSubscription extends NewsletterModule {
1262
  }
1263
 
1264
  if ($options_profile['privacy_status'] == 1) {
1265
- $buffer .= "<tr>\n\t" . '<td colspan="2" class="newsletter-td-privacy">' . "\n";
1266
  $buffer .= "\t\t" . '<input type="checkbox" name="ny" required>&nbsp;';
1267
  if (!empty($options_profile['privacy_url'])) {
1268
  $buffer .= '<a target="_blank" href="' . $options_profile['privacy_url'] . '">';
@@ -1273,12 +1287,12 @@ class NewsletterSubscription extends NewsletterModule {
1273
  $buffer .= "\n\t</td>\n</tr>\n\n";
1274
  }
1275
 
1276
- $buffer .= "<tr>\n\t" . '<td colspan="2" class="newsletter-td-submit">' . "\n";
1277
 
1278
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
1279
- $buffer .= "\t\t" . '<input class="newsletter-submit-image" type="image" src="' . $options_profile['subscribe'] . '"/>' . "\n\t</td>\n</tr>\n\n";
1280
  } else {
1281
- $buffer .= "\t\t" . '<input class="newsletter-submit" type="submit" value="' . $options_profile['subscribe'] . '"/>' . "\n\t</td>\n</tr>\n\n";
1282
  }
1283
 
1284
  $buffer .= "</table>\n</form>\n</div>";
@@ -1303,14 +1317,15 @@ class NewsletterSubscription extends NewsletterModule {
1303
  $options_profile = get_option('newsletter_profile');
1304
  $options = get_option('newsletter');
1305
 
1306
- $buffer = $this->get_form_javascript();
1307
 
1308
  if (empty($action)) {
1309
  $action = home_url('/') . '?na=s';
1310
  }
1311
 
1312
- $buffer .= '<div class="newsletter-subscription">' . "\n";
1313
-
 
1314
  $buffer .= '<form method="post" action="' . esc_attr($action) . '" onsubmit="return newsletter_check(this)">' . "\n\n";
1315
 
1316
  if (!empty($referrer)) {
@@ -1328,24 +1343,24 @@ class NewsletterSubscription extends NewsletterModule {
1328
  }
1329
 
1330
  if ($options_profile['name_status'] == 2) {
1331
- $buffer .= '<div class="newsletter-field newsletter-field-firstname"><label>' . esc_html($options_profile['name']) . '</label>';
1332
- $buffer .= '<input class="newsletter-name" type="text" name="nn" ' . ($options_profile['name_rules'] == 1 ? 'required' : '') . '></div>';
1333
  $buffer .= "\n";
1334
  }
1335
 
1336
  if ($options_profile['surname_status'] == 2) {
1337
- $buffer .= '<div class="newsletter-field newsletter-field-lastname"><label>' . esc_html($options_profile['surname']) . '</label>';
1338
- $buffer .= '<input class="newsletter-lastname" type="text" name="ns" ' . ($options_profile['surname_rules'] == 1 ? 'required' : '') . '></div>';
1339
  $buffer .= "\n";
1340
  }
1341
 
1342
- $buffer .= '<div class="newsletter-field newsletter-field-email"><label>' . esc_html($options_profile['email']) . '</label>';
1343
- $buffer .= '<input class="newsletter-email" type="email" name="ne" required></div>';
1344
  $buffer .= "\n";
1345
 
1346
- if ($options_profile['sex_status'] == 2) {
1347
- $buffer .= '<div class="newsletter-field newsletter-field-gender"><label>' . esc_html($options_profile['sex']) . '</label>';
1348
- $buffer .= '<select name="nx" class="newsletter-sex"';
1349
  if ($options_profile['sex_rules'] == 1) {
1350
  $buffer .= ' required><option value=""></option>';
1351
  } else {
@@ -1362,14 +1377,14 @@ class NewsletterSubscription extends NewsletterModule {
1362
  if ($options_profile['list_' . $i . '_status'] != 2) {
1363
  continue;
1364
  }
1365
- $lists .= '<div class="newsletter-field newsletter-field-list"><label><input class="newsletter-preference" type="checkbox" name="nl[]" value="' . $i . '"';
1366
  if ($options_profile['list_' . $i . '_checked'] == 1) {
1367
  $lists .= ' checked';
1368
  }
1369
  $lists .= '/>&nbsp;' . esc_html($options_profile['list_' . $i]) . '</label></div>';
1370
  }
1371
  if (!empty($lists)) {
1372
- $buffer .= '<div class="newsletter-lists">' . $lists . '</div>';
1373
  }
1374
 
1375
  // Extra profile fields
@@ -1380,17 +1395,17 @@ class NewsletterSubscription extends NewsletterModule {
1380
  }
1381
 
1382
 
1383
- $buffer .= '<div class="newsletter-field newsletter-field-profile"><label>' .
1384
  esc_html($options_profile['profile_' . $i]) . '</label>';
1385
 
1386
  // Text field
1387
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
1388
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text"' . ($options_profile['profile_' . $i . '_rules'] == 1 ? ' required' : '') . ' name="np' . $i . '">';
1389
  }
1390
 
1391
  // Select field
1392
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
1393
- $buffer .= '<select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '" required>' . "\n";
1394
  $buffer .= "<option></option>\n";
1395
  $opts = explode(',', $options_profile['profile_' . $i . '_options']);
1396
  for ($j = 0; $j < count($opts); $j++) {
@@ -1411,13 +1426,13 @@ class NewsletterSubscription extends NewsletterModule {
1411
  if (!empty($x['name'])) {
1412
  $name = $x['name'];
1413
  }
1414
- $buffer .= '<div class="newsletter-field newsletter-field-' . $name . '"><label>' . $label . "</label>";
1415
  $buffer .= $x['field'] . "</div>\n";
1416
  }
1417
 
1418
  if ($options_profile['privacy_status'] == 1) {
1419
- $buffer .= '<div class="newsletter-field newsletter-field-privacy">';
1420
- $buffer .= '<label><input type="checkbox" name="ny" required class="newsletter-privacy">&nbsp;';
1421
  if (!empty($options_profile['privacy_url'])) {
1422
  $buffer .= '<a target="_blank" href="' . esc_attr($options_profile['privacy_url']) . '"></label>';
1423
  $buffer .= esc_attr($options_profile['privacy']) . '</a>';
@@ -1428,15 +1443,18 @@ class NewsletterSubscription extends NewsletterModule {
1428
  $buffer .= "</label></div>\n";
1429
  }
1430
 
1431
- $buffer .= '<div class="newsletter-field newsletter-field-button">';
1432
 
1433
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
1434
- $buffer .= '<input class="newsletter-submit-image" type="image" src="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1435
  } else {
1436
- $buffer .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1437
  }
1438
 
1439
- $buffer .= "</div>\n</form>\n</div>";
 
 
 
1440
  return $buffer;
1441
  }
1442
 
@@ -1464,20 +1482,20 @@ class NewsletterSubscription extends NewsletterModule {
1464
  function get_profile_form($user) {
1465
  $options = get_option('newsletter_profile');
1466
 
1467
- $buffer .= '<div class="newsletter newsletter-profile">';
1468
  $buffer .= '<form action="' . esc_attr(home_url('/') . '?na=ps') . '" method="post">';
1469
  // TODO: use nk
1470
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
1471
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">';
1472
- $buffer .= '<tr><th align="right">' . esc_html($options['email']) . '</th><td><input class="newsletter-email" type="text" size="30" name="ne" required value="' . esc_attr($user->email) . '"></td></tr>';
1473
  if ($options['name_status'] >= 1) {
1474
- $buffer .= '<tr><th align="right">' . esc_html($options['name']) . '</th><td><input class="newsletter-firstname" type="text" size="30" name="nn" value="' . esc_attr($user->name) . '"></td></tr>';
1475
  }
1476
  if ($options['surname_status'] >= 1) {
1477
- $buffer .= '<tr><th align="right">' . esc_html($options['surname']) . '</th><td><input class="newsletter-lastname" type="text" size="30" name="ns" value="' . esc_attr($user->surname) . '"></td></tr>';
1478
  }
1479
  if ($options['sex_status'] >= 1) {
1480
- $buffer .= '<tr><th align="right">' . esc_html($options['sex']) . '</th><td><select name="nx" class="newsletter-sex">';
1481
  $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . esc_html($options['sex_female']) . '</option>';
1482
  $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . esc_html($options['sex_male']) . '</option>';
1483
  $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . esc_html($options['sex_none']) . '</option>';
@@ -1494,11 +1512,11 @@ class NewsletterSubscription extends NewsletterModule {
1494
  $field = 'profile_' . $i;
1495
 
1496
  if ($options['profile_' . $i . '_type'] == 'text') {
1497
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text" size="50" name="np' . $i . '" value="' . esc_attr($user->$field) . '"/>';
1498
  }
1499
 
1500
  if ($options['profile_' . $i . '_type'] == 'select') {
1501
- $buffer .= '<select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
1502
  $opts = explode(',', $options['profile_' . $i . '_options']);
1503
  for ($j = 0; $j < count($opts); $j++) {
1504
  $opts[$j] = trim($opts[$j]);
@@ -1514,17 +1532,17 @@ class NewsletterSubscription extends NewsletterModule {
1514
  }
1515
 
1516
  // Lists
1517
- $buffer .= '<tr><th>&nbsp;</th><td style="text-align: left"><div class="newsletter-preferences">';
1518
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1519
  if ($options['list_' . $i . '_status'] == 0) {
1520
  continue;
1521
  }
1522
- $buffer .= '<input class="newsletter-preference" type="checkbox" name="nl[]" value="' . $i . '"';
1523
  $list = 'list_' . $i;
1524
  if ($user->$list == 1) {
1525
  $buffer .= ' checked';
1526
  }
1527
- $buffer .= '/>&nbsp;<span class="newsletter-preference-label">' . esc_html($options['list_' . $i]) . '</span><br />';
1528
  }
1529
  $buffer .= '</div></td></tr>';
1530
 
@@ -1534,12 +1552,12 @@ class NewsletterSubscription extends NewsletterModule {
1534
  $buffer .= $x['field'] . "\n\t</td>\n</tr>\n\n";
1535
  }
1536
 
1537
- $buffer .= '<tr><td colspan="2" class="newsletter-td-submit">';
1538
 
1539
  if (strpos($options['save'], 'http://') !== false) {
1540
- $buffer .= '<input class="newsletter-submit" type="image" src="' . esc_attr($options['save']) . '"></td></tr>';
1541
  } else {
1542
- $buffer .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($options['save']) . '"/></td></tr>';
1543
  }
1544
 
1545
  $buffer .= '</table></form></div>';
@@ -1550,34 +1568,34 @@ class NewsletterSubscription extends NewsletterModule {
1550
  function get_profile_form_html5($user) {
1551
  $options = get_option('newsletter_profile');
1552
 
1553
- $buffer .= '<div class="newsletter newsletter-profile">';
1554
  $buffer .= '<form action="' . esc_attr(home_url('/') . '?na=ps') . '" method="post">';
1555
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
1556
 
1557
- $buffer .= '<div class="newsletter-field newsletter-field-firstname">';
1558
  $buffer .= '<label>' . esc_html($options['email']) . '</label>';
1559
- $buffer .= '<input class="newsletter-email" type="text" name="ne" required value="' . esc_attr($user->email) . '">';
1560
  $buffer .= "</div>\n";
1561
 
1562
 
1563
  if ($options['name_status'] >= 1) {
1564
- $buffer .= '<div class="newsletter-field newsletter-field-firstname">';
1565
  $buffer .= '<label>' . esc_html($options['name']) . '</label>';
1566
- $buffer .= '<input class="newsletter-firstname" type="text" name="nn" value="' . esc_attr($user->name) . '">';
1567
  $buffer .= "</div>\n";
1568
  }
1569
 
1570
  if ($options['surname_status'] >= 1) {
1571
- $buffer .= '<div class="newsletter-field newsletter-field-lastname">';
1572
  $buffer .= '<label>' . esc_html($options['surname']) . '</label>';
1573
- $buffer .= '<input class="newsletter-lastname" type="text" name="ns" value="' . esc_attr($user->surname) . '">';
1574
  $buffer .= "</div>\n";
1575
  }
1576
 
1577
  if ($options['sex_status'] >= 1) {
1578
- $buffer .= '<div class="newsletter-field newsletter-field-gender">';
1579
  $buffer .= '<label>' . esc_html($options['sex']) . '</label>';
1580
- $buffer .= '<select name="nx" class="newsletter-gender">';
1581
  $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . esc_html($options['sex_female']) . '</option>';
1582
  $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . esc_html($options['sex_male']) . '</option>';
1583
  $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . esc_html($options['sex_none']) . '</option>';
@@ -1591,17 +1609,17 @@ class NewsletterSubscription extends NewsletterModule {
1591
  continue;
1592
  }
1593
 
1594
- $buffer .= '<div class="newsletter-field newsletter-field-profile">';
1595
  $buffer .= '<label>' . esc_html($options['profile_' . $i]) . '</label>';
1596
 
1597
  $field = 'profile_' . $i;
1598
 
1599
  if ($options['profile_' . $i . '_type'] == 'text') {
1600
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text" name="np' . $i . '" value="' . esc_attr($user->$field) . '">';
1601
  }
1602
 
1603
  if ($options['profile_' . $i . '_type'] == 'select') {
1604
- $buffer .= '<select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
1605
  $opts = explode(',', $options['profile_' . $i . '_options']);
1606
  for ($j = 0; $j < count($opts); $j++) {
1607
  $opts[$j] = trim($opts[$j]);
@@ -1623,30 +1641,30 @@ class NewsletterSubscription extends NewsletterModule {
1623
  continue;
1624
  }
1625
 
1626
- $lists .= '<div class="newsletter-field newsletter-field-list">';
1627
- $lists .= '<label><input class="newsletter-list newsletter-list-' . $i . '" type="checkbox" name="nl[]" value="' . $i . '"';
1628
  $field = 'list_' . $i;
1629
  if ($user->$field == 1) {
1630
  $lists .= ' checked';
1631
  }
1632
- $lists .= '><span class="newsletter-list-label">' . esc_html($options['list_' . $i]) . '</span></label>';
1633
  $lists .= "</div>\n";
1634
  }
1635
 
1636
  if (!empty($lists)) {
1637
- $buffer .= '<div class="newsletter-lists">' . "\n" . $lists . "\n" . '</div>';
1638
  }
1639
 
1640
  $extra = apply_filters('newsletter_profile_extra', array(), $user);
1641
  foreach ($extra as $x) {
1642
- $buffer .= '<div class="newsletter-field">';
1643
  $buffer .= '<label>' . $x['label'] . "</label>";
1644
  $buffer .= $x['field'];
1645
  $buffer .= "</div>\n";
1646
  }
1647
 
1648
- $buffer .= '<div class="newsletter-field newsletter-field-button">';
1649
- $buffer .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($options['save']) . '">';
1650
  $buffer .= "</div>\n";
1651
 
1652
  $buffer .= "</form>\n</div>\n";
@@ -1743,11 +1761,11 @@ class NewsletterSubscription extends NewsletterModule {
1743
  $attrs = array_merge(array('referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1744
 
1745
  $form = '';
1746
- $form .= '<div class="newsletter-subscription-minimal">';
1747
  $form .= '<form action="' . esc_attr(home_url('/')) . '?na=s" method="post">';
1748
  $form .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">';
1749
- $form .= '<input class="newsletter-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1750
- $form .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($attrs['button']) . '">';
1751
  $form .= "</form></div>\n";
1752
 
1753
  return $form;
36
  // Something
37
  } else {
38
  add_action('wp_enqueue_scripts', array($this, 'hook_wp_enqueue_scripts'));
39
+ add_action('wp_head', array($this, 'hook_wp_head'), 100);
40
  add_action('wp_footer', array($this, 'hook_wp_footer'));
41
  add_shortcode('newsletter', array($this, 'shortcode_newsletter'));
42
  add_shortcode('newsletter_form', array($this, 'shortcode_newsletter_form'));
47
 
48
  function hook_wp_enqueue_scripts() {
49
  if (apply_filters('newsletter_enqueue_style', true)) {
50
+ wp_enqueue_style('newsletter-subscription', plugins_url('newsletter') . '/subscription/style.css', array(), NEWSLETTER_VERSION);
51
+ if (!empty($this->options['css'])) {
52
+ wp_add_inline_style('newsletter-subscription', $this->options['css']);
53
+ }
54
  }
55
 
56
+ wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), NEWSLETTER_VERSION, true);
57
  $options = $this->get_options('profile');
58
  $data = array();
59
  $data['messages'] = array();
60
+ if (isset($options['email_error'])) {
61
+ $data['messages']['email_error'] = $options['email_error'];
62
+ }
63
+ if (isset($options['name_error'])) {
64
+ $data['messages']['name_error'] = $options['name_error'];
65
+ }
66
+ if (isset($options['surname_error'])) {
67
+ $data['messages']['surname_error'] = $options['surname_error'];
68
+ }
69
+ if (isset($options['profile_error'])) {
70
+ $data['messages']['profile_error'] = $options['profile_error'];
71
+ }
72
+ if (isset($options['privacy_error'])) {
73
+ $data['messages']['privacy_error'] = $options['privacy_error'];
74
+ }
75
  $data['profile_max'] = NEWSLETTER_PROFILE_MAX;
76
  wp_localize_script('newsletter-subscription', 'newsletter', $data);
77
  }
86
 
87
  // normal subscription
88
  case 's':
89
+ case 'subscribe':
90
  if (isset($this->options['antibot_disable']) || $this->antibot_form_check()) {
91
 
92
  $user = $this->subscribe();
165
  break;
166
 
167
  case 'c':
168
+ case 'confirm':
169
  if ($this->antibot_form_check()) {
170
  $user = $this->confirm();
171
  if ($user->status == 'E') {
186
  }
187
 
188
  function hook_wp_head() {
 
189
  }
190
 
191
  function hook_wp_footer() {
238
  $options_template['template'] = $this->options['template'];
239
  add_option('newsletter_subscription_template', $options_template, null, 'no');
240
  }
241
+
242
  if (isset($this->options['template'])) {
243
  unset($this->options['template']);
244
  unset($this->options['template_enabled']);
769
  }
770
 
771
  // Old URL
772
+ if (empty($url) && !empty($this->options['url'])) {
773
  $url = $this->options['url'];
774
  }
775
 
776
+ if (empty($url)) {
777
  $url = home_url('/') . '?na=m';
778
  }
779
 
925
  }
926
 
927
  if (!empty($label)) {
928
+ $buffer .= '<div class="tnp-field tnp-field-button">';
929
  if (strpos($label, 'http') === 0) {
930
+ $buffer .= '<input class="tnp-button-image" type="image" src="' . $label . '">';
931
  } else {
932
+ $buffer .= '<input class="tnp-button" type="submit" value="' . $label . '">';
933
  }
934
  $buffer .= '</div>';
935
  }
944
  $suffix = $name;
945
  }
946
  $options_profile = get_option('newsletter_profile');
947
+ $buffer = '<label for="tnp-' . $suffix . '">';
948
  if (isset($attrs['label'])) {
949
  if (empty($attrs['label'])) {
950
  return;
965
  $buffer = '';
966
 
967
  if ($name == 'email') {
968
+ $buffer .= '<div class="tnp-field tnp-field-email">';
969
  $buffer .= $this->_shortcode_label('email', $attrs);
970
 
971
+ $buffer .= '<input class="tnp-email" type="email" name="ne" value=""';
972
  if (isset($attrs['placeholder']))
973
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
974
  $buffer .= 'required>';
975
  if (isset($attrs['button_label'])) {
976
  $label = $attrs['button_label'];
977
  if (strpos($label, 'http') === 0) {
978
+ $buffer .= ' <input class="tnp-submit-image" type="image" src="' . esc_attr(esc_url_raw($label)) . '">';
979
  } else {
980
+ $buffer .= ' <input class="tnp-submit" type="submit" value="' . esc_attr($label) . '" style="width: 29%">';
981
  }
982
  }
983
  $buffer .= "</div>\n";
985
  }
986
 
987
  if ($name == 'first_name' || $name == 'name') {
988
+ $buffer .= '<div class="tnp-field tnp-field-firstname">';
989
  $buffer .= $this->_shortcode_label('name', $attrs);
990
 
991
+ $buffer .= '<input class="tnp-name" type="text" name="nn" value=""';
992
  if (isset($attrs['placeholder']))
993
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
994
  if ($options_profile['name_rules'] == 1) {
1000
  }
1001
 
1002
  if ($name == 'last_name' || $name == 'surname') {
1003
+ $buffer .= '<div class="tnp-field tnp-field-surname">';
1004
  $buffer .= $this->_shortcode_label('surname', $attrs);
1005
 
1006
+ $buffer .= '<input class="tnp-surname" type="text" name="ns" value=""';
1007
  if (isset($attrs['placeholder']))
1008
  $buffer .= ' placeholder="' . esc_attr($attrs['placeholder']) . '"';
1009
  if ($options_profile['surname_rules'] == 1) {
1019
  if (isset($attrs['hidden'])) {
1020
  return '<input type="hidden" name="nl[]" value="' . esc_attr($list) . '">';
1021
  }
1022
+ $buffer .= '<div class="tnp-field tnp-field-checkbox tnp-field-list">';
1023
  $buffer .= '<input type="checkbox" id="nl' . esc_attr($list) . '" name="nl[]" value="' . esc_attr($list) . '"';
1024
  if (isset($attrs['checked'])) {
1025
  $buffer .= ' checked';
1043
  if ($options_profile['list_' . $i . '_status'] != 2) {
1044
  continue;
1045
  }
1046
+ $lists .= '<div class="tnp-field tnp-field-checkbox tnp-field-list">';
1047
  $lists .= '<input type="checkbox" id="nl' . $i . '" name="nl[]" value="' . $i . '"';
1048
  if ($options_profile['list_' . $i . '_checked'] == 1)
1049
  $lists .= ' checked';
1055
 
1056
  // TODO: add the "not specified"
1057
  if ($name == 'sex' || $name == 'gender') {
1058
+ $buffer .= '<div class="tnp-field tnp-field-gender">';
1059
  if (isset($attrs['label'])) {
1060
  if ($attrs['label'] != '')
1061
  $buffer .= '<label for="">' . esc_html($attrs['label']) . '</label>';
1063
  $buffer .= '<label for="">' . esc_html($options_profile['sex']) . '</label>';
1064
  }
1065
 
1066
+ $buffer .= '<select name="nx" class="tnp-gender">';
1067
  $buffer .= '<option value="m">' . esc_html($options_profile['sex_male']) . '</option>';
1068
  $buffer .= '<option value="f">' . esc_html($options_profile['sex_female']) . '</option>';
1069
  $buffer .= '</select>';
1075
  $number = (int) $attrs['number'];
1076
  $type = $options_profile['profile_' . $number . '_type'];
1077
  $size = isset($attrs['size']) ? $attrs['size'] : '';
1078
+ $buffer .= '<div class="tnp-field tnp-field-profile">';
1079
  if (isset($attrs['label'])) {
1080
  if ($attrs['label'] != '') {
1081
  $buffer .= '<label>' . esc_html($attrs['label']) . '</label>';
1089
 
1090
  // Text field
1091
  if ($type == 'text') {
1092
+ $buffer .= '<input class="tnp-profile tnp-profile-' . $number . '" type="text" size="' . esc_attr($size) . '" name="np' . $number . '" placeholder="' . esc_attr($placeholder) . '"';
1093
  if ($required) {
1094
  $buffer .= ' required';
1095
  }
1098
 
1099
  // Select field
1100
  if ($type == 'select') {
1101
+ $buffer .= '<select class="tnp-profile tnp-profile-' . $number . '" name="np' . $number . '"';
1102
  if ($required) {
1103
  $buffer .= ' required';
1104
  }
1128
  $attrs['label'] = $options_profile['list_' . $i];
1129
  }
1130
 
1131
+ $buffer .= '<div class="tnp-field tnp-field-checkbox tnp-field-privacy">';
1132
 
1133
+ $buffer .= '<input type="checkbox" name="ny" required class="tnp-privacy" id="tnp-privacy"> ';
1134
+ $buffer .= '<label for="tnp-privacy">';
1135
  if (!empty($attrs['url'])) {
1136
  $buffer .= '<a target="_blank" href="' . esc_attr($options_profile['privacy_url']) . '">';
1137
  }
1168
 
1169
  $buffer = $this->get_form_javascript();
1170
 
1171
+ $buffer .= '<div class="tnp tnp-subscription">' . "\n";
1172
  $buffer .= '<form method="post" action="' . $action . '" onsubmit="return newsletter_check(this)">' . "\n\n";
1173
 
1174
  if (isset($attrs['confirmation_url'])) {
1188
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">' . "\n\n";
1189
  if ($options_profile['name_status'] == 2) {
1190
  $buffer .= "<!-- first name -->\n";
1191
+ $buffer .= "<tr>\n\t" . '<th>' . $options_profile['name'] . '</th>' . "\n\t" . '<td><input class="tnp-firstname" type="text" name="nn" size="30"' . ($options_profile['name_rules'] == 1 ? 'required' : '') . '></td>' . "\n" . '</tr>' . "\n\n";
1192
  }
1193
 
1194
  if ($options_profile['surname_status'] == 2) {
1195
  $buffer .= "<!-- last name -->\n";
1196
+ $buffer .= "<tr>\n\t" . '<th>' . $options_profile['surname'] . '</th>' . "\n\t" . '<td><input class="tnp-lastname" type="text" name="ns" size="30"' . ($options_profile['surname_rules'] == 1 ? 'required' : '') . '></td>' . "\n" . '</tr>' . "\n\n";
1197
  }
1198
 
1199
  $buffer .= "<!-- email -->\n";
1200
+ $buffer .= "<tr>\n\t" . '<th>' . $options_profile['email'] . '</th>' . "\n\t" . '<td align="left"><input class="tnp-email" type="email" name="ne" size="30" required></td>' . "\n" . '</tr>' . "\n\n";
1201
 
1202
  if ($options_profile['sex_status'] == 2) {
1203
  $buffer .= "<!-- sex -->\n";
1204
  $buffer .= "<tr>\n\t<th>" . $options_profile['sex'] . "</th>\n";
1205
+ $buffer .= "\t<td>\n\t" . '<select name="nx" class="tnp-gender">' . "\n";
1206
  $buffer .= "\t\t" . '<option value="m">' . $options_profile['sex_male'] . '</option>' . "\n";
1207
  $buffer .= "\t\t" . '<option value="f">' . $options_profile['sex_female'] . '</option>' . "\n";
1208
  $buffer .= "\t</select>\n\t</td></tr>\n";
1243
  // Text field
1244
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
1245
  $buffer .= "<tr>\n\t<th>" . $options_profile['profile_' . $i] . "</th>\n\t<td>\n\t\t";
1246
+ $buffer .= '<input class="tnp-profile tnp-profile-' . $i . '" type="text" size="30" name="np' . $i . '"';
1247
  $buffer .= ' placeholder="' . esc_attr($options_profile['profile_' . $i . '_placeholder']) . '"';
1248
  if (!empty($options_profile['profile_' . $i . '_rules'])) {
1249
  $buffer .= ' required';
1253
 
1254
  // Select field
1255
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
1256
+ $buffer .= "<tr>\n\t<th>" . $options_profile['profile_' . $i] . "</th>\n\t<td>\n\t\t" . '<select class="tnp-profile tnp-profile-' . $i . '" name="np' . $i . '"';
1257
  if (!empty($options_profile['profile_' . $i . '_rules'])) {
1258
  $buffer .= ' required';
1259
  }
1276
  }
1277
 
1278
  if ($options_profile['privacy_status'] == 1) {
1279
+ $buffer .= "<tr>\n\t" . '<td colspan="2" class="tnp-td-privacy">' . "\n";
1280
  $buffer .= "\t\t" . '<input type="checkbox" name="ny" required>&nbsp;';
1281
  if (!empty($options_profile['privacy_url'])) {
1282
  $buffer .= '<a target="_blank" href="' . $options_profile['privacy_url'] . '">';
1287
  $buffer .= "\n\t</td>\n</tr>\n\n";
1288
  }
1289
 
1290
+ $buffer .= "<tr>\n\t" . '<td colspan="2" class="tnp-td-submit">' . "\n";
1291
 
1292
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
1293
+ $buffer .= "\t\t" . '<input class="tnp-submit-image" type="image" src="' . $options_profile['subscribe'] . '"/>' . "\n\t</td>\n</tr>\n\n";
1294
  } else {
1295
+ $buffer .= "\t\t" . '<input class="tnp-submit" type="submit" value="' . $options_profile['subscribe'] . '"/>' . "\n\t</td>\n</tr>\n\n";
1296
  }
1297
 
1298
  $buffer .= "</table>\n</form>\n</div>";
1317
  $options_profile = get_option('newsletter_profile');
1318
  $options = get_option('newsletter');
1319
 
1320
+ $buffer = '';
1321
 
1322
  if (empty($action)) {
1323
  $action = home_url('/') . '?na=s';
1324
  }
1325
 
1326
+ if ($referrer != 'widget') {
1327
+ $buffer .= '<div class="tnp tnp-subscription">' . "\n";
1328
+ }
1329
  $buffer .= '<form method="post" action="' . esc_attr($action) . '" onsubmit="return newsletter_check(this)">' . "\n\n";
1330
 
1331
  if (!empty($referrer)) {
1343
  }
1344
 
1345
  if ($options_profile['name_status'] == 2) {
1346
+ $buffer .= '<div class="tnp-field tnp-field-firstname"><label>' . esc_html($options_profile['name']) . '</label>';
1347
+ $buffer .= '<input class="tnp-firstname" type="text" name="nn" ' . ($options_profile['name_rules'] == 1 ? 'required' : '') . '></div>';
1348
  $buffer .= "\n";
1349
  }
1350
 
1351
  if ($options_profile['surname_status'] == 2) {
1352
+ $buffer .= '<div class="tnp-field tnp-field-lastname"><label>' . esc_html($options_profile['surname']) . '</label>';
1353
+ $buffer .= '<input class="tnp-lastname" type="text" name="ns" ' . ($options_profile['surname_rules'] == 1 ? 'required' : '') . '></div>';
1354
  $buffer .= "\n";
1355
  }
1356
 
1357
+ $buffer .= '<div class="tnp-field tnp-field-email"><label>' . esc_html($options_profile['email']) . '</label>';
1358
+ $buffer .= '<input class="tnp-email" type="email" name="ne" required></div>';
1359
  $buffer .= "\n";
1360
 
1361
+ if (isset($options_profile['sex_status']) && $options_profile['sex_status'] == 2) {
1362
+ $buffer .= '<div class="tnp-field tnp-field-gender"><label>' . esc_html($options_profile['sex']) . '</label>';
1363
+ $buffer .= '<select name="nx" class="tnp-gender"';
1364
  if ($options_profile['sex_rules'] == 1) {
1365
  $buffer .= ' required><option value=""></option>';
1366
  } else {
1377
  if ($options_profile['list_' . $i . '_status'] != 2) {
1378
  continue;
1379
  }
1380
+ $lists .= '<div class="tnp-field tnp-field-list"><label><input class="tnp-preference" type="checkbox" name="nl[]" value="' . $i . '"';
1381
  if ($options_profile['list_' . $i . '_checked'] == 1) {
1382
  $lists .= ' checked';
1383
  }
1384
  $lists .= '/>&nbsp;' . esc_html($options_profile['list_' . $i]) . '</label></div>';
1385
  }
1386
  if (!empty($lists)) {
1387
+ $buffer .= '<div class="tnp-lists">' . $lists . '</div>';
1388
  }
1389
 
1390
  // Extra profile fields
1395
  }
1396
 
1397
 
1398
+ $buffer .= '<div class="tnp-field tnp-field-profile"><label>' .
1399
  esc_html($options_profile['profile_' . $i]) . '</label>';
1400
 
1401
  // Text field
1402
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
1403
+ $buffer .= '<input class="tnp-profile tnp-profile-' . $i . '" type="text"' . ($options_profile['profile_' . $i . '_rules'] == 1 ? ' required' : '') . ' name="np' . $i . '">';
1404
  }
1405
 
1406
  // Select field
1407
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
1408
+ $buffer .= '<select class="tnp-profile tnp-profile-' . $i . '" name="np' . $i . '" required>' . "\n";
1409
  $buffer .= "<option></option>\n";
1410
  $opts = explode(',', $options_profile['profile_' . $i . '_options']);
1411
  for ($j = 0; $j < count($opts); $j++) {
1426
  if (!empty($x['name'])) {
1427
  $name = $x['name'];
1428
  }
1429
+ $buffer .= '<div class="tnp-field tnp-field-' . $name . '"><label>' . $label . "</label>";
1430
  $buffer .= $x['field'] . "</div>\n";
1431
  }
1432
 
1433
  if ($options_profile['privacy_status'] == 1) {
1434
+ $buffer .= '<div class="tnp-field tnp-field-privacy">';
1435
+ $buffer .= '<label><input type="checkbox" name="ny" required class="tnp-privacy">&nbsp;';
1436
  if (!empty($options_profile['privacy_url'])) {
1437
  $buffer .= '<a target="_blank" href="' . esc_attr($options_profile['privacy_url']) . '"></label>';
1438
  $buffer .= esc_attr($options_profile['privacy']) . '</a>';
1443
  $buffer .= "</label></div>\n";
1444
  }
1445
 
1446
+ $buffer .= '<div class="tnp-field tnp-field-button">';
1447
 
1448
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
1449
+ $buffer .= '<input class="tnp-submit-image" type="image" src="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1450
  } else {
1451
+ $buffer .= '<input class="tnp-submit" type="submit" value="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1452
  }
1453
 
1454
+ $buffer .= "</div>\n</form>\n";
1455
+ if ($referrer != 'widget') {
1456
+ $buffer .= "</div>\n";
1457
+ }
1458
  return $buffer;
1459
  }
1460
 
1482
  function get_profile_form($user) {
1483
  $options = get_option('newsletter_profile');
1484
 
1485
+ $buffer .= '<div class="tnp-profile">';
1486
  $buffer .= '<form action="' . esc_attr(home_url('/') . '?na=ps') . '" method="post">';
1487
  // TODO: use nk
1488
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
1489
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">';
1490
+ $buffer .= '<tr><th align="right">' . esc_html($options['email']) . '</th><td><input class="tnp-email" type="text" size="30" name="ne" required value="' . esc_attr($user->email) . '"></td></tr>';
1491
  if ($options['name_status'] >= 1) {
1492
+ $buffer .= '<tr><th align="right">' . esc_html($options['name']) . '</th><td><input class="tnp-firstname" type="text" size="30" name="nn" value="' . esc_attr($user->name) . '"></td></tr>';
1493
  }
1494
  if ($options['surname_status'] >= 1) {
1495
+ $buffer .= '<tr><th align="right">' . esc_html($options['surname']) . '</th><td><input class="tnp-lastname" type="text" size="30" name="ns" value="' . esc_attr($user->surname) . '"></td></tr>';
1496
  }
1497
  if ($options['sex_status'] >= 1) {
1498
+ $buffer .= '<tr><th align="right">' . esc_html($options['sex']) . '</th><td><select name="nx" class="tnp-gender">';
1499
  $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . esc_html($options['sex_female']) . '</option>';
1500
  $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . esc_html($options['sex_male']) . '</option>';
1501
  $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . esc_html($options['sex_none']) . '</option>';
1512
  $field = 'profile_' . $i;
1513
 
1514
  if ($options['profile_' . $i . '_type'] == 'text') {
1515
+ $buffer .= '<input class="tnp-profile tnp-profile-' . $i . '" type="text" size="50" name="np' . $i . '" value="' . esc_attr($user->$field) . '"/>';
1516
  }
1517
 
1518
  if ($options['profile_' . $i . '_type'] == 'select') {
1519
+ $buffer .= '<select class="tnp-profile tnp-profile-' . $i . '" name="np' . $i . '">';
1520
  $opts = explode(',', $options['profile_' . $i . '_options']);
1521
  for ($j = 0; $j < count($opts); $j++) {
1522
  $opts[$j] = trim($opts[$j]);
1532
  }
1533
 
1534
  // Lists
1535
+ $buffer .= '<tr><th>&nbsp;</th><td style="text-align: left"><div class="tnp-lists">';
1536
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
1537
  if ($options['list_' . $i . '_status'] == 0) {
1538
  continue;
1539
  }
1540
+ $buffer .= '<input class="tnp-list" type="checkbox" name="nl[]" value="' . $i . '"';
1541
  $list = 'list_' . $i;
1542
  if ($user->$list == 1) {
1543
  $buffer .= ' checked';
1544
  }
1545
+ $buffer .= '/>&nbsp;<span class="tnp-list-label">' . esc_html($options['list_' . $i]) . '</span><br />';
1546
  }
1547
  $buffer .= '</div></td></tr>';
1548
 
1552
  $buffer .= $x['field'] . "\n\t</td>\n</tr>\n\n";
1553
  }
1554
 
1555
+ $buffer .= '<tr><td colspan="2" class="tnp-td-submit">';
1556
 
1557
  if (strpos($options['save'], 'http://') !== false) {
1558
+ $buffer .= '<input class="tnp-submit-image" type="image" src="' . esc_attr($options['save']) . '"></td></tr>';
1559
  } else {
1560
+ $buffer .= '<input class="tnp-submit" type="submit" value="' . esc_attr($options['save']) . '"/></td></tr>';
1561
  }
1562
 
1563
  $buffer .= '</table></form></div>';
1568
  function get_profile_form_html5($user) {
1569
  $options = get_option('newsletter_profile');
1570
 
1571
+ $buffer .= '<div class="tnp tnp-profile">';
1572
  $buffer .= '<form action="' . esc_attr(home_url('/') . '?na=ps') . '" method="post">';
1573
  $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
1574
 
1575
+ $buffer .= '<div class="newsletter-field tnp-field-email">';
1576
  $buffer .= '<label>' . esc_html($options['email']) . '</label>';
1577
+ $buffer .= '<input class="tnp-email" type="text" name="ne" required value="' . esc_attr($user->email) . '">';
1578
  $buffer .= "</div>\n";
1579
 
1580
 
1581
  if ($options['name_status'] >= 1) {
1582
+ $buffer .= '<div class="tnp-field tnp-field-firstname">';
1583
  $buffer .= '<label>' . esc_html($options['name']) . '</label>';
1584
+ $buffer .= '<input class="tnp-firstname" type="text" name="nn" value="' . esc_attr($user->name) . '">';
1585
  $buffer .= "</div>\n";
1586
  }
1587
 
1588
  if ($options['surname_status'] >= 1) {
1589
+ $buffer .= '<div class="tnp-field tnp-field-lastname">';
1590
  $buffer .= '<label>' . esc_html($options['surname']) . '</label>';
1591
+ $buffer .= '<input class="tnp-lastname" type="text" name="ns" value="' . esc_attr($user->surname) . '">';
1592
  $buffer .= "</div>\n";
1593
  }
1594
 
1595
  if ($options['sex_status'] >= 1) {
1596
+ $buffer .= '<div class="tnp-field tnp-field-gender">';
1597
  $buffer .= '<label>' . esc_html($options['sex']) . '</label>';
1598
+ $buffer .= '<select name="nx" class="tnp-gender">';
1599
  $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . esc_html($options['sex_female']) . '</option>';
1600
  $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . esc_html($options['sex_male']) . '</option>';
1601
  $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . esc_html($options['sex_none']) . '</option>';
1609
  continue;
1610
  }
1611
 
1612
+ $buffer .= '<div class="tnp-field tnp-field-profile">';
1613
  $buffer .= '<label>' . esc_html($options['profile_' . $i]) . '</label>';
1614
 
1615
  $field = 'profile_' . $i;
1616
 
1617
  if ($options['profile_' . $i . '_type'] == 'text') {
1618
+ $buffer .= '<input class="tnp-profile tnp-profile-' . $i . '" type="text" name="np' . $i . '" value="' . esc_attr($user->$field) . '">';
1619
  }
1620
 
1621
  if ($options['profile_' . $i . '_type'] == 'select') {
1622
+ $buffer .= '<select class="tnp-profile tnp-profile-' . $i . '" name="np' . $i . '">';
1623
  $opts = explode(',', $options['profile_' . $i . '_options']);
1624
  for ($j = 0; $j < count($opts); $j++) {
1625
  $opts[$j] = trim($opts[$j]);
1641
  continue;
1642
  }
1643
 
1644
+ $lists .= '<div class="tnp-field tnp-field-list">';
1645
+ $lists .= '<label><input class="tnp-list tnp-list-' . $i . '" type="checkbox" name="nl[]" value="' . $i . '"';
1646
  $field = 'list_' . $i;
1647
  if ($user->$field == 1) {
1648
  $lists .= ' checked';
1649
  }
1650
+ $lists .= '><span class="tnp-list-label">' . esc_html($options['list_' . $i]) . '</span></label>';
1651
  $lists .= "</div>\n";
1652
  }
1653
 
1654
  if (!empty($lists)) {
1655
+ $buffer .= '<div class="tnp-lists">' . "\n" . $lists . "\n" . '</div>';
1656
  }
1657
 
1658
  $extra = apply_filters('newsletter_profile_extra', array(), $user);
1659
  foreach ($extra as $x) {
1660
+ $buffer .= '<div class="tnp-field">';
1661
  $buffer .= '<label>' . $x['label'] . "</label>";
1662
  $buffer .= $x['field'];
1663
  $buffer .= "</div>\n";
1664
  }
1665
 
1666
+ $buffer .= '<div class="tnp-field tnp-field-button">';
1667
+ $buffer .= '<input class="tnp-submit" type="submit" value="' . esc_attr($options['save']) . '">';
1668
  $buffer .= "</div>\n";
1669
 
1670
  $buffer .= "</form>\n</div>\n";
1761
  $attrs = array_merge(array('referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1762
 
1763
  $form = '';
1764
+ $form .= '<div class="tnp tnp-subscription-minimal">';
1765
  $form .= '<form action="' . esc_attr(home_url('/')) . '?na=s" method="post">';
1766
  $form .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">';
1767
+ $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1768
+ $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($attrs['button']) . '">';
1769
  $form .= "</form></div>\n";
1770
 
1771
  return $form;
users/export.php CHANGED
@@ -22,7 +22,7 @@ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
22
 
23
  <h2><?php _e('Export', 'newsletter') ?></h2>
24
  <p>
25
- The import and export functions <strong>ARE NOT</strong> for backup.
26
  If you want to backup you should consider to backup the <code><?php echo $wpdb->prefix ?>newsletter*</code> tables.
27
  </p>
28
 
22
 
23
  <h2><?php _e('Export', 'newsletter') ?></h2>
24
  <p>
25
+ <strong>The import and export functions ARE NOT for backup</strong>.
26
  If you want to backup you should consider to backup the <code><?php echo $wpdb->prefix ?>newsletter*</code> tables.
27
  </p>
28
 
widget/minimal.php CHANGED
@@ -27,21 +27,18 @@ class NewsletterWidgetMinimal extends WP_Widget {
27
 
28
  $options_profile = get_option('newsletter_profile');
29
 
30
- $form = '';
31
- $form .= '<div class="newsletter-widget-minimal">';
32
  $form .= '<form action="' . esc_attr(home_url('/')) . '?na=s" method="post">';
33
  // Referrer
34
  $form .= '<input type="hidden" name="nr" value="widget-minimal"/>';
35
 
36
- $form .= '<input class="newsletter-email" type="email" required name="ne" value="" placeholder="' . esc_attr($options_profile['email']) . '">';
37
 
38
- $form .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($instance['button']) . '">';
39
 
40
- $form .= '</form>';
41
 
42
- $buffer .= $form;
43
-
44
- echo $buffer;
45
  echo $after_widget;
46
  }
47
 
27
 
28
  $options_profile = get_option('newsletter_profile');
29
 
30
+ $form = '<div class="tnp tnp-widget-minimal">';
 
31
  $form .= '<form action="' . esc_attr(home_url('/')) . '?na=s" method="post">';
32
  // Referrer
33
  $form .= '<input type="hidden" name="nr" value="widget-minimal"/>';
34
 
35
+ $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($options_profile['email']) . '">';
36
 
37
+ $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($instance['button']) . '">';
38
 
39
+ $form .= '</form></div>';
40
 
41
+ echo $form;
 
 
42
  echo $after_widget;
43
  }
44
 
widget/standard.php CHANGED
@@ -18,7 +18,7 @@ class NewsletterWidget extends WP_Widget {
18
  //$form = NewsletterSubscription::instance()->get_form_javascript();
19
  $form = '';
20
 
21
- $form .= '<div class="newsletter-widget">';
22
  $form .= NewsletterSubscription::instance()->get_subscription_form_html5('widget');
23
  $form .= "</div>\n";
24
 
@@ -29,21 +29,23 @@ class NewsletterWidget extends WP_Widget {
29
  $options_profile = get_option('newsletter_profile');
30
  $form = NewsletterSubscription::instance()->get_form_javascript();
31
 
32
- $form .= '<div class="newsletter newsletter-widget">';
33
  $form .= '<form action="' . home_url('/') . '?na=s" onsubmit="return newsletter_check(this)" method="post">';
34
  // Referrer
35
  $form .= '<input type="hidden" name="nr" value="widget"/>';
36
 
37
- if ($options_profile['name_status'] == 2)
38
- $form .= '<p><input class="newsletter-firstname" type="text" name="nn" value="' . esc_attr($options_profile['name']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
 
39
 
40
- if ($options_profile['surname_status'] == 2)
41
- $form .= '<p><input class="newsletter-lastname" type="text" name="ns" value="' . esc_attr($options_profile['surname']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
 
42
 
43
- $form .= '<p><input class="newsletter-email" type="email" required name="ne" value="' . esc_attr($options_profile['email']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
44
 
45
  if (isset($options_profile['sex_status']) && $options_profile['sex_status'] == 2) {
46
- $form .= '<p><select name="nx" class="newsletter-sex">';
47
  $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
48
  $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
49
  $form .= '</select></p>';
@@ -54,10 +56,10 @@ class NewsletterWidget extends WP_Widget {
54
  if ($options_profile['profile_' . $i . '_status'] != 2)
55
  continue;
56
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
57
- $form .= '<p><input class="newsletter-profile newsletter-profile-' . $i . '" type="text" name="np' . $i . '" value="' . $options_profile['profile_' . $i] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
58
  }
59
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
60
- $form .= '<p>' . $options_profile['profile_' . $i] . '<br /><select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
61
  $opts = explode(',', $options_profile['profile_' . $i . '_options']);
62
  for ($t = 0; $t < count($opts); $t++) {
63
  $form .= '<option>' . trim($opts[$t]) . '</option>';
@@ -95,9 +97,9 @@ class NewsletterWidget extends WP_Widget {
95
  }
96
 
97
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
98
- $form .= '<p><input class="newsletter-submit" type="image" src="' . $options_profile['subscribe'] . '"/></p>';
99
  } else {
100
- $form .= '<p><input class="newsletter-submit" type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
101
  }
102
 
103
  $form .= '</form>';
18
  //$form = NewsletterSubscription::instance()->get_form_javascript();
19
  $form = '';
20
 
21
+ $form .= '<div class="tnp tnp-widget">';
22
  $form .= NewsletterSubscription::instance()->get_subscription_form_html5('widget');
23
  $form .= "</div>\n";
24
 
29
  $options_profile = get_option('newsletter_profile');
30
  $form = NewsletterSubscription::instance()->get_form_javascript();
31
 
32
+ $form .= '<div class="tnp tnp-widget">';
33
  $form .= '<form action="' . home_url('/') . '?na=s" onsubmit="return newsletter_check(this)" method="post">';
34
  // Referrer
35
  $form .= '<input type="hidden" name="nr" value="widget"/>';
36
 
37
+ if ($options_profile['name_status'] == 2) {
38
+ $form .= '<p><input class="tnp-firstname" type="text" name="nn" value="' . esc_attr($options_profile['name']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
39
+ }
40
 
41
+ if ($options_profile['surname_status'] == 2) {
42
+ $form .= '<p><input class="tnp-lastname" type="text" name="ns" value="' . esc_attr($options_profile['surname']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
43
+ }
44
 
45
+ $form .= '<p><input class="tnp-email" type="email" required name="ne" value="' . esc_attr($options_profile['email']) . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
46
 
47
  if (isset($options_profile['sex_status']) && $options_profile['sex_status'] == 2) {
48
+ $form .= '<p><select name="nx" class="tnp-gender">';
49
  $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
50
  $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
51
  $form .= '</select></p>';
56
  if ($options_profile['profile_' . $i . '_status'] != 2)
57
  continue;
58
  if ($options_profile['profile_' . $i . '_type'] == 'text') {
59
+ $form .= '<p><input class="tnp-profile tnp-profile-' . $i . '" type="text" name="np' . $i . '" value="' . $options_profile['profile_' . $i] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
60
  }
61
  if ($options_profile['profile_' . $i . '_type'] == 'select') {
62
+ $form .= '<p>' . $options_profile['profile_' . $i] . '<br /><select class="tnp-profile tnp-profile-' . $i . '" name="np' . $i . '">';
63
  $opts = explode(',', $options_profile['profile_' . $i . '_options']);
64
  for ($t = 0; $t < count($opts); $t++) {
65
  $form .= '<option>' . trim($opts[$t]) . '</option>';
97
  }
98
 
99
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
100
+ $form .= '<p><input class="tnp-submit" type="image" src="' . $options_profile['subscribe'] . '"/></p>';
101
  } else {
102
+ $form .= '<p><input class="tnp-submit" type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
103
  }
104
 
105
  $form .= '</form>';