Newsletter - Version 2.5.1.7

Version Description

  • fixed the widget which was no showing the lists and extra fields
Download this release

Release Info

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

Code changes from version 2.5.0 to 2.5.1.7

commons.php CHANGED
@@ -283,7 +283,7 @@ function newsletter_search($text, $status='', $order='email', $list = null, $lin
283
 
284
  $query .= ' order by ' . $order;
285
 
286
- if (empty($link)) $query .= ' limit 100';
287
 
288
  $recipients = $wpdb->get_results($query);
289
 
@@ -328,6 +328,12 @@ function newsletter_set_status_all($status) {
328
  $wpdb->query("update " . $wpdb->prefix . "newsletter set status='" . $status . "'");
329
  }
330
 
 
 
 
 
 
 
331
  function newsletter_date($time=null, $now=false, $left=false) {
332
  if (is_null($time)) $time = time();
333
  if ($time === false) $buffer = 'none';
283
 
284
  $query .= ' order by ' . $order;
285
 
286
+ //if (empty($link)) $query .= ' limit 100';
287
 
288
  $recipients = $wpdb->get_results($query);
289
 
328
  $wpdb->query("update " . $wpdb->prefix . "newsletter set status='" . $status . "'");
329
  }
330
 
331
+ function newsletter_set_status($id, $status) {
332
+ global $wpdb;
333
+
334
+ $wpdb->query($wpdb->prepare("update " . $wpdb->prefix . "newsletter set status=%s where id=%d", $status, $id));
335
+ }
336
+
337
  function newsletter_date($time=null, $now=false, $left=false) {
338
  if (is_null($time)) $time = time();
339
  if ($time === false) $buffer = 'none';
emails-edit.php CHANGED
@@ -8,7 +8,7 @@ if (isset($_GET['id'])) {
8
  $nc->data['status'] = 'new';
9
  $nc->data['subject'] = 'Here the email subject';
10
  $nc->data['message'] = '<p>An empty email to start.</p>';
11
- $nc->data['track'] = 1;
12
  }
13
  }
14
  else {
@@ -63,9 +63,9 @@ else {
63
  }
64
 
65
  if ($nc->is_action('compose')) {
66
- if ($nc->data['_theme'][0] == '*') $file = ABSPATH . 'wp-content/plugins/newsletter-custom/themes/' . substr($nc->data['_theme'], 1) .
67
  '/theme.php';
68
- else $file = dirname(__FILE__) . '/themes/' . $nc->data['_theme'] . '/theme.php';
69
 
70
  ob_start();
71
  @include($file);
@@ -99,10 +99,23 @@ $themes[''] = 'Packaged themes';
99
  $themes['blank'] = 'Empty email';
100
  $themes['theme-1'] = 'Newsletter theme 1';
101
  //$themes['theme-2'] = 'Newsletter theme 2';
102
- //$themes['theme-3'] = 'Newsletter theme 3';
103
 
104
  $nc->errors($errors);
105
  $nc->messages($messages);
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  ?>
107
 
108
  <script type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
@@ -118,7 +131,8 @@ $nc->messages($messages);
118
  relative_urls : false,
119
  remove_script_host : false,
120
  theme_advanced_toolbar_location : "top",
121
- document_base_url : "<?php echo get_option('home'); ?>/"
 
122
  });
123
  </script>
124
 
@@ -135,16 +149,19 @@ $nc->messages($messages);
135
  <table class="form-table">
136
 
137
  <tr valign="top">
138
- <th>Auto compose</th>
139
  <td>
140
- <?php $nc->select_grouped('_theme', array(
141
  array_merge(array(''=>'Custom themes'), newsletter_get_themes()),
142
- $themes
 
143
  ));
144
  ?>
145
- <?php $nc->button('compose', 'Auto compose'); ?>
146
  <div class="hints">
147
- Auto composition does not save this email, remember to press save if you are satisfied of the result.
 
 
148
  </div>
149
  </td>
150
  </tr>
@@ -211,7 +228,10 @@ $nc->messages($messages);
211
  <?php if ($nc->data['status'] != 'sending') $nc->button('save', 'Save'); ?>
212
  <?php if ($nc->data['status'] != 'sending') $nc->button_confirm('test', 'Save and test', 'Save and send test emails to test addresses?'); ?>
213
 
214
- <?php if ($nc->data['status'] == 'new') $nc->button_confirm('send', 'Send', 'Start a real delivery?'); ?>
 
 
 
215
  <?php if ($nc->data['status'] == 'sending') $nc->button_confirm('pause', 'Pause', 'Pause the delivery?'); ?>
216
  <?php if ($nc->data['status'] == 'paused') $nc->button_confirm('continue', 'Continue', 'Continue the delivery?'); ?>
217
  <?php if ($nc->data['status'] != 'new') $nc->button_confirm('abort', 'Abort', 'Abort the delivery?'); ?>
8
  $nc->data['status'] = 'new';
9
  $nc->data['subject'] = 'Here the email subject';
10
  $nc->data['message'] = '<p>An empty email to start.</p>';
11
+ $nc->data['theme'] = 'blank';
12
  }
13
  }
14
  else {
63
  }
64
 
65
  if ($nc->is_action('compose')) {
66
+ if ($nc->data['theme'][0] == '*') $file = ABSPATH . 'wp-content/plugins/newsletter-custom/themes/' . substr($nc->data['theme'], 1) .
67
  '/theme.php';
68
+ else $file = dirname(__FILE__) . '/themes/' . $nc->data['theme'] . '/theme.php';
69
 
70
  ob_start();
71
  @include($file);
99
  $themes['blank'] = 'Empty email';
100
  $themes['theme-1'] = 'Newsletter theme 1';
101
  //$themes['theme-2'] = 'Newsletter theme 2';
102
+ $themes['theme-3'] = 'Newsletter theme 3';
103
 
104
  $nc->errors($errors);
105
  $nc->messages($messages);
106
+
107
+ function newsletter_get_theme_file($theme) {
108
+ if ($theme[0] == '*') $file = ABSPATH . 'wp-content/plugins/newsletter-custom/themes/' . substr($theme, 1) . '/theme.php';
109
+ else $file = dirname(__FILE__) . '/themes/' . $theme . '/theme.php';
110
+ }
111
+
112
+ function newsletter_get_theme_css_url($theme) {
113
+ if ($theme[0] == '*') $file = 'newsletter-custom/themes/' . substr($theme, 1) . '/style.css';
114
+ else $file = 'newsletter/themes/' . $theme . '/style.css';
115
+ if (!file_exists(ABSPATH . 'wp-content/plugins/' . $file)) return get_option('siteurl') . '/wp-content/plugins/newsletter/themes/empty.css';
116
+ return get_option('siteurl') . '/wp-content/plugins/' . $file;
117
+ }
118
+
119
  ?>
120
 
121
  <script type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
131
  relative_urls : false,
132
  remove_script_host : false,
133
  theme_advanced_toolbar_location : "top",
134
+ document_base_url : "<?php echo get_option('home'); ?>/",
135
+ content_css: "<?php echo newsletter_get_theme_css_url($nc->data['theme']) . '?' . time(); ?>"
136
  });
137
  </script>
138
 
149
  <table class="form-table">
150
 
151
  <tr valign="top">
152
+ <th>Theme</th>
153
  <td>
154
+ <?php $nc->select_grouped('theme', array(
155
  array_merge(array(''=>'Custom themes'), newsletter_get_themes()),
156
+ $themes,
157
+ $themes_panel
158
  ));
159
  ?>
160
+ <?php $nc->button('compose', 'Change'); ?> (email content below will be regenerated)
161
  <div class="hints">
162
+ Theme changing does not save this email, remember to press save if you are satisfied of the result. A theme can have a style file
163
+ (style.css in theme folder): that style will be added to your emails, so when you change the theme you MUST press "change" to have
164
+ in the editor the right content for the current theme style. No easy to explain. No all email readers respect the theme graphics!
165
  </div>
166
  </td>
167
  </tr>
228
  <?php if ($nc->data['status'] != 'sending') $nc->button('save', 'Save'); ?>
229
  <?php if ($nc->data['status'] != 'sending') $nc->button_confirm('test', 'Save and test', 'Save and send test emails to test addresses?'); ?>
230
 
231
+ <?php if ($nc->data['status'] == 'new') {
232
+ $nc->button_confirm('send', 'Send', 'Start a real delivery?');
233
+ $nc->button_confirm('send-now', 'Instant send', 'Start a real delivery?');
234
+ } ?>
235
  <?php if ($nc->data['status'] == 'sending') $nc->button_confirm('pause', 'Pause', 'Pause the delivery?'); ?>
236
  <?php if ($nc->data['status'] == 'paused') $nc->button_confirm('continue', 'Continue', 'Continue the delivery?'); ?>
237
  <?php if ($nc->data['status'] != 'new') $nc->button_confirm('abort', 'Abort', 'Abort the delivery?'); ?>
emails.php CHANGED
@@ -1,18 +1,28 @@
1
  <?php
2
  @include_once 'commons.php';
 
 
3
  $emails = $wpdb->get_results("select * from " . $wpdb->prefix . "newsletter_emails where type='email' order by id desc");
4
 
5
- if ($_GET['pippo']) {
6
  $newsletter->hook_newsletter();
7
  }
8
  ?>
9
 
10
  <div class="wrap">
11
 
12
- <h2>Messages</h2>
 
 
 
 
 
13
 
14
  <p><a href="admin.php?page=newsletter/emails-edit.php&amp;id=0" class="button">New message</a></p>
15
- <p>Delivery engine next run: <?php echo wp_next_scheduled('newsletter')-time(); ?> seconds</p>
 
 
 
16
 
17
  <table class="widefat">
18
  <thead>
@@ -39,4 +49,5 @@ if ($_GET['pippo']) {
39
  <?php } ?>
40
  </tbody>
41
  </table>
 
42
  </div>
1
  <?php
2
  @include_once 'commons.php';
3
+ $nc = new NewsletterControls();
4
+
5
  $emails = $wpdb->get_results("select * from " . $wpdb->prefix . "newsletter_emails where type='email' order by id desc");
6
 
7
+ if ($nc->is_action('send')) {
8
  $newsletter->hook_newsletter();
9
  }
10
  ?>
11
 
12
  <div class="wrap">
13
 
14
+ <h2>Messages</h2>
15
+
16
+ <?php include dirname(__FILE__) . '/header.php'; ?>
17
+
18
+ <form method="post" action="admin.php?page=newsletter/emails.php">
19
+ <?php $nc->init(); ?>
20
 
21
  <p><a href="admin.php?page=newsletter/emails-edit.php&amp;id=0" class="button">New message</a></p>
22
+ <p>
23
+ Delivery engine next run: <?php echo wp_next_scheduled('newsletter')-time(); ?> seconds
24
+ <?php $nc->button('send', 'Trigger now'); ?>
25
+ </p>
26
 
27
  <table class="widefat">
28
  <thead>
49
  <?php } ?>
50
  </tbody>
51
  </table>
52
+ </form>
53
  </div>
header.php CHANGED
@@ -1 +1,2 @@
1
- <!-- -->
 
1
+ <iframe src="http://frames.satollo.net/newsletter.php" frameborder="0" width="100%" height="80" style="border: 0"></iframe>
2
+ <span style="font-size: 10px">This frame is loaded from satollo.net</span>
import.php CHANGED
@@ -105,8 +105,8 @@ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
105
  </p>
106
  <p>
107
  Import list format is:<br /><br />
108
- <b>email</b><i>[separator]</i><b>name</b><i>[new line]</i><br />
109
- <b>email</b><i>[separator]</i><b>name</b><i>[new line]</i><br />
110
  <br />
111
  where the [separator] must be selected from the available ones. The "name" field is optional, while the "email" field is
112
  mandatory. Empty lines and lines starting with "#" will be skipped.
105
  </p>
106
  <p>
107
  Import list format is:<br /><br />
108
+ <b>email 1</b><i>[separator]</i><b>first name 1</b><i>[separator]</i><b>last name 1</b><i>[new line]</i><br />
109
+ <b>email 2</b><i>[separator]</i><b>first name 2</b><i>[separator]</i><b>last name 2</b><i>[new line]</i><br />
110
  <br />
111
  where the [separator] must be selected from the available ones. The "name" field is optional, while the "email" field is
112
  mandatory. Empty lines and lines starting with "#" will be skipped.
intro.php CHANGED
@@ -1,18 +1,8 @@
1
- <script>
2
- jQuery(document).ready(function () {
3
-
4
- jQuery(".wrap h3").each(function () {
5
- jQuery(this).nextUntil('h3').hide();
6
- });
7
-
8
- jQuery(".wrap h3").click(function () {
9
- jQuery(this).nextUntil('h3').toggle();
10
- });
11
- });
12
- </script>
13
  <div class="wrap">
14
  <h2>Newsletter/Newsletter Pro User Guide</h2>
15
 
 
 
16
  <p>Welcome to Newsletter/Neswletter Pro from Stefano Lissa.</p>
17
  <p>
18
  I hope Newsletter/Neswletter Pro will be a powerful tool for your business. I made the whole configuration
@@ -48,6 +38,30 @@
48
  stefano@satollo.net so I can complete it and clear any doubt</strong>.
49
  </p>
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  <h3>Newsletter configuration structure</h3>
53
 
@@ -67,7 +81,7 @@
67
  </ul>
68
  </li>
69
 
70
- <li><strong>User Profile.</strong> Really important. It's where you set what user's data you want to collect on subscription. There
71
  you can translate almost every thing of Newsletter.</li>
72
  <li><strong>Subscription Process.</strong> Really important. It's where you decide how the subscription process works. There you
73
  can set double or single opt in, emails and messages that are involved on subscription and cancellation.</li>
@@ -170,7 +184,7 @@
170
 
171
 
172
 
173
- <h3>User profile</h3>
174
 
175
  <p>
176
  User profile is the set of data you can collect about subscribers during the subscription or on their profile panel:
@@ -205,6 +219,40 @@
205
  Check the hints in the panel for detailed explanation of every single field.
206
  </p>
207
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
208
 
209
  <h3>Custom forms</h3>
210
  <p>
@@ -235,13 +283,14 @@
235
  The field names you can add to a custom form are:
236
  </p>
237
  <ul>
238
- <li>ne - is the user email</li>
239
- <li>nn - is the user name (first name or complete name)</li>
240
- <li>ns - is the user surname/last name</li>
241
- <li>npN - where N go from 1 to 19, are the custom profile fields (be aware they
 
242
  are not the same thing of profile fields in Newsletter Pro 2.1)</li>
243
- <li>nl[] - must be checkbox fields name when they represent a list/option/topic and the list/option/topic number (1 to 9)
244
- must be the field value (see below).</li>
245
  </ul>
246
  <p>
247
  For lists on a custom form you can ask the user to check what lists he want to subscribe or
@@ -281,11 +330,11 @@
281
  When you abort an email sending, the email return to the "new" status and every sending progress information is reset.
282
  </p>
283
 
284
- <h3>Email autocomposer and themes</h3>
285
  <p>
286
- When a new email is create, it can composed starting from a blank sheet or can be auto composed with
287
- a theme. I call it auto compose, because a theme can generate actual content getting it from the blog
288
- (a list of latest posts, tag cloud and so on).
289
  </p>
290
  <p>
291
  Themes are PHP file stored under "themes" folder. There are some pre packaged themes that can be used as
@@ -307,8 +356,19 @@
307
  To start with an already working theme, start with "theme.php" file of "themes/theme-1" folder.
308
  </p>
309
 
 
 
 
 
 
 
 
 
 
 
310
 
311
- <h3>Follow up or autoresponder</h3>
 
312
  <p>
313
  Follow up or auto-responder is when you send a sequence of emails to new subscribers. A follow up can be a series
314
  of lessons on a topic, a product/service presentation broken up on small parts or anything else.
@@ -353,7 +413,7 @@
353
  </p>
354
 
355
 
356
- <h3>Feed by mail</h3>
357
 
358
  <p>
359
  Feed by mail is a Newsletter Pro service that sends an excerpt of last posts
@@ -401,6 +461,24 @@
401
  folder, because they do not work!
402
  </p>
403
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
404
  <h3>Themes tech details</h3>
405
  <p>
406
  Themes for feed by mail and follow up e-mails are "executed" for each user when it's time to generate
@@ -422,6 +500,5 @@
422
  <tr><td>followup</td><td>follow up subscription status: 1 means he's subscribed</td></tr>
423
  <tr><td>feed</td><td>feed by mail subscription status: 1 means he's subscribed</td></tr>
424
  </table>
425
-
426
 
427
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
1
  <div class="wrap">
2
  <h2>Newsletter/Newsletter Pro User Guide</h2>
3
 
4
+ <?php include dirname(__FILE__) . '/header.php'; ?>
5
+
6
  <p>Welcome to Newsletter/Neswletter Pro from Stefano Lissa.</p>
7
  <p>
8
  I hope Newsletter/Neswletter Pro will be a powerful tool for your business. I made the whole configuration
38
  stefano@satollo.net so I can complete it and clear any doubt</strong>.
39
  </p>
40
 
41
+ <h3>F.A.Q.</h3>
42
+ <p><strong>Nothing is working!</strong></p>
43
+ <p>
44
+ The plugin is working on my main site (<a href="http://www.satollo.net" target="_blank">www.satollo.net</a>),
45
+ I use there the <strong>free version</strong> just to be sure it
46
+ works for all. So, have you DEACTIVATED and REACTIVATED it after a manual update (with
47
+ WordPress automatic upgrade, WordPress takes care of it for you - but you can try that manually).
48
+ </p>
49
+
50
+ <p><strong>Where is the version history?</strong></p>
51
+ <p>On readme.txt file.</p>
52
+
53
+ <p><strong>Email are not sent (but test emails are).</strong></p>
54
+ <p>
55
+ On email list panel there is a delivery engine next run. If it is negative or empty or zero (always)
56
+ the WordPress cron system is not working. Read below about delivery engine and the WordPress
57
+ cron system.
58
+ </p>
59
+
60
+ <p><strong>Multisite WordPress, nothing work.</strong></p>
61
+ <p>
62
+ It's a bit tricky: you must activate the plugin with your super admin account, then enter every blog dashboard,
63
+ and deactivate and reactivate the plugin.
64
+ </p>
65
 
66
  <h3>Newsletter configuration structure</h3>
67
 
81
  </ul>
82
  </li>
83
 
84
+ <li><strong>User Profile/Subscription Form.</strong> Really important. It's where you set what user's data you want to collect on subscription. There
85
  you can translate almost every thing of Newsletter.</li>
86
  <li><strong>Subscription Process.</strong> Really important. It's where you decide how the subscription process works. There you
87
  can set double or single opt in, emails and messages that are involved on subscription and cancellation.</li>
184
 
185
 
186
 
187
+ <h3>User profile/Subscription Form</h3>
188
 
189
  <p>
190
  User profile is the set of data you can collect about subscribers during the subscription or on their profile panel:
219
  Check the hints in the panel for detailed explanation of every single field.
220
  </p>
221
 
222
+ <h3>Tags</h3>
223
+ <p>
224
+ Subscritpion texts, email bodies, email subjects and so on accept (usually) a set of tag that will be replaced
225
+ with user specific content (like her name).
226
+ </p>
227
+ <ul>
228
+ <li><strong>{name}</strong> The user name</li>
229
+ <li><strong>{surname}</strong> The user surname</li>
230
+ <li><strong>{email}</strong> The user email</li>
231
+ <li><strong>{ip}</strong> The IP address from where the subscription started</li>
232
+ <li><strong>{id}</strong> The user id</li>
233
+ <li><strong>{token}</strong> The user secret token</li>
234
+ <li><strong>{profile_N}</strong> The user profile field number N (from 1 to 19)</li>
235
+ <li><strong>{date}</strong> the current date formatted as specified on WordPress general options</li>
236
+ <li><strong>{date_'format'}</strong> the current date formatted with 'format' format compatible with PHP date formatting specifications.
237
+ </ul>
238
+
239
+ <h4>Action URLs and forms</h4>
240
+ <p>
241
+ <strong>{subscription_confirm_url}</strong>
242
+ URL to build a link to confirmation of subscription when double opt-in is used. To be used on confirmation email.<br />
243
+ <strong>{unsubscription_url}</strong>
244
+ URL to build a link to start the cancellation process. To be used on every newsletter to let the user to cancel.<br />
245
+ <strong>{unsubscription_confirm_url}</strong>
246
+ URL to build a link to an immediate cancellation action. Can be used on newsletters if you want an immediate cancellation or
247
+ on cancellation page (displayed on {unsubscription_url}) to ask a cancellation confirmation.<br />
248
+ <strong>{profile_url}</strong>
249
+ URL to build a link to user's profile page (see the User Profile panel)<br />
250
+ <strong>{unlock_url}</strong>
251
+ Special URL to build a link that on click unlocks protected contents. See Main Configuration panel.<br />
252
+ <strong>{profile_form}</strong>
253
+ Insert the profile form with user's data. Usually it make sense only on welcome page.<br />
254
+ </p>
255
+
256
 
257
  <h3>Custom forms</h3>
258
  <p>
283
  The field names you can add to a custom form are:
284
  </p>
285
  <ul>
286
+ <li><strong>ne</strong> is the user email</li>
287
+ <li><strong>nn</strong> is the user name (first name or complete name)</li>
288
+ <li><strong>ns</strong> is the user surname/last name</li>
289
+ <li><strong>nx</strong> is the user sex (can assume f, m, n values) and usually it should be a "select"
290
+ <li><strong>npN</strong> where N go from 1 to 19, are the custom profile fields (be aware they
291
  are not the same thing of profile fields in Newsletter Pro 2.1)</li>
292
+ <li><strong>nl[]</strong> (as written!)) must be check box field name when they represent a list/option/topic; the field value must be a number from
293
+ 1 to 9 (the lists)</li>
294
  </ul>
295
  <p>
296
  For lists on a custom form you can ask the user to check what lists he want to subscribe or
330
  When you abort an email sending, the email return to the "new" status and every sending progress information is reset.
331
  </p>
332
 
333
+ <h3>Email auto composer and themes</h3>
334
  <p>
335
+ When a new email is create, it can be composed starting from a blank sheet or can be auto composed with
336
+ a theme. I call it auto compose because a theme can generate actual content getting it from the blog
337
+ (a list of latest posts, tag cloud and so on) or simply prepare an already structured content.
338
  </p>
339
  <p>
340
  Themes are PHP file stored under "themes" folder. There are some pre packaged themes that can be used as
356
  To start with an already working theme, start with "theme.php" file of "themes/theme-1" folder.
357
  </p>
358
 
359
+ <h4>Theme style file (style.css)</h4>
360
+ <p>
361
+ Theme used to compose an email is store with the email data. If a theme has a style.css file in
362
+ its folder, the <strong>content</strong> of this file is added to outgoing emails. Not all email readers
363
+ respect the style added in this way... GMail is an example of them.
364
+ </p>
365
+ <p>
366
+ The style.css file is used while editing the email too to make the visual editor show the content as looking
367
+ like the resulting email opened in a mail reader.
368
+ </p>
369
 
370
+
371
+ <h3>Follow up or auto responder (only Pro version)</h3>
372
  <p>
373
  Follow up or auto-responder is when you send a sequence of emails to new subscribers. A follow up can be a series
374
  of lessons on a topic, a product/service presentation broken up on small parts or anything else.
413
  </p>
414
 
415
 
416
+ <h3>Feed by mail (only Pro version)</h3>
417
 
418
  <p>
419
  Feed by mail is a Newsletter Pro service that sends an excerpt of last posts
461
  folder, because they do not work!
462
  </p>
463
 
464
+
465
+ <h3>Delivery engine and WordPress cron system</h3>
466
+ <p>
467
+ Newsletter relies on WordPress cron service to automatically send emails respecting the
468
+ emails per hour value you set on main configuration panel.
469
+ </p>
470
+ <p>
471
+ That WordPress service works only if your blog has traffic, if not it usually works bad. To make
472
+ it running as required, you must trigger it with a regular external call (very five minutes) to:</p>
473
+ <p>
474
+ <?php echo get_option('siteurl'); ?>/wp-cron.php
475
+ </p>
476
+ <p>
477
+ Any decent provider can setup that call or has a configurable cron service on it's panel, refer to your provider
478
+ support.
479
+ </p>
480
+
481
+
482
  <h3>Themes tech details</h3>
483
  <p>
484
  Themes for feed by mail and follow up e-mails are "executed" for each user when it's time to generate
500
  <tr><td>followup</td><td>follow up subscription status: 1 means he's subscribed</td></tr>
501
  <tr><td>feed</td><td>feed by mail subscription status: 1 means he's subscribed</td></tr>
502
  </table>
 
503
 
504
  </div>
languages/cs_CZ.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // Those default options are used ONLY on FIRST setup and on plugin updates but limited to
3
+ // new options that may have been added between your and new version.
4
+ //
5
+ // This is the main language file, too, which is always loaded by Newsletter. Other language
6
+ // files are loaded according the WPLANG constant defined in wp-config.php file. Those language
7
+ // specific files are "merged" with this one and the language specific configuration
8
+ // keys override the ones in this file.
9
+ //
10
+ // Language specific files only need to override configurations containing texts
11
+ // language dependant.
12
+ //
13
+ // All language file are UTF-8 encoded!
14
+
15
+ $defaults_profile['profile_text'] = '{profile_form}<p>Pokud už si neprejete odebírat informace ze sveta forexu, <a href="{unsubscription_confirm_url}">kliknete zde.</a></p>';
16
+ $defaults_profile['email'] = 'Email'; // Email field label
17
+ $defaults_profile['email_error'] = 'Špatne napsaný email, prosím zkontrolujte ho.';
18
+ $defaults_profile['name_status'] = 1;
19
+ $defaults_profile['name'] = 'Jméno';
20
+ $defaults_profile['name_error'] = 'Vaše jméno nemuže zustat prázdné';
21
+ $defaults_profile['surname'] = 'Príjmení';
22
+ $defaults_profile['surname_status'] = 0;
23
+ $defaults_profile['sex_status'] = 0;
24
+ $defaults_profile['sex'] = 'I\'m';
25
+ $defaults_profile['sex_male'] = 'Muž';
26
+ $defaults_profile['sex_female'] = 'Žena';
27
+ $defaults_profile['privacy_status'] = 0;
28
+ $defaults_profile['privacy'] = 'Prihlášením k odberu informací souhlasíte se zpracováním osobních informací.';
29
+ $defaults_profile['privacy_error'] = 'K prihlásení k odberu informací musíte souhlasit se zpracováním osobních informací.';
30
+ $defaults_profile['subscribe'] = 'Prihlásit k odberu!';
31
+ $defaults_profile['save'] = 'Uložit'; // Profile "save" button
32
+
33
+
34
+ $defaults_main['lock_message'] = '<div style="margin: 15px; padding: 15px; background-color: #ff9; border-color: 1px solid #000">
35
+ Tento obsah je chránený, pouze lidé prihlášení k odberu newsletteru mohou vstoupit. Prihlašte se nyní!
36
+ [newsletter_form]
37
+ </div>';
38
+
39
+
40
+ // Subscription page introductory text (befor the subscription form)
41
+ $defaults['subscription_text'] =
42
+ "<p>Zde se mužete prihlásit k odberu novinek.</p>
43
+ <p>Bude vám odeslán konfirmacní email, prosím o jeho potvrzení.</p>";
44
+
45
+ // Message show after a subbscription request has made.
46
+ $defaults['subscribed_text'] =
47
+ "<p>Úspešne jste se prihlásili k odberu newsletteru. Behem pár minut obdržíte confirmacní email. Klidnete na link pro potvrzení emailu. Pokud vám confirmacní email neprijde do 15 minut, zkontrolujte si složku se spamem.
48
+ </p>";
49
+
50
+ // Confirmation email subject (double opt-in)
51
+ $defaults['confirmation_subject'] =
52
+ "Potvrzení zájmu o odber novinek z {blog_title}";
53
+
54
+ // Confirmation email body (double opt-in)
55
+ $defaults['confirmation_message'] =
56
+ "<p>Dobrý den {name},</p>
57
+ <p>Obrželi jsem žádost o zasílání novinek pro tento email. Mužete jí potvrdit kliknutím
58
+ <a href=\"{subscription_confirm_url}\"><strong>zde</strong></a>.
59
+ Pokud se vám nedarí klinout na link, použijte následující odkaz:</p>
60
+ <p>{subscription_confirm_url}</p>
61
+ <p>Pokud žádost o zasílání novinek nevyšla od vás, stací jenom ignorovat tento email.</p>
62
+ <p>Predem moc dekujeme.</p>";
63
+
64
+
65
+ // Subscription confirmed text (after a user clicked the confirmation link
66
+ // on the email he received
67
+ $defaults['confirmed_text'] =
68
+ "<p>Vaše žádost byla potvrzena!
69
+ Dekujeme {name}!</p>";
70
+
71
+ $defaults['confirmed_subject'] =
72
+ "Vítejte {name},";
73
+
74
+ $defaults['confirmed_message'] =
75
+ "<p>Tato zpráva potvrzuje vyhovení vaší žádosti o {blog_title} newsletter.</p>
76
+ <p>Díky!</p>
77
+ <p>Pokud si už nadále neprejete dostávat novinky, <a href=\"{unsubscription_url}\">kliknete zde</a>, pokud si prejete zmenit své vstupní data, <a href=\"{profile_url}\">kliknete zde</a>.</p>";
78
+
79
+ // Unsubscription request introductory text
80
+ $defaults['unsubscription_text'] =
81
+ "<p>Prosím potvrtte, že se chcete odhlásit z odebírání novinek
82
+ <a href=\"{unsubscription_confirm_url}\">zde</a>.";
83
+
84
+ // When you finally loosed your subscriber
85
+ $defaults['unsubscribed_text'] =
86
+ "<p>Velice nás to mrzí, ale byl jste práve odebrán z odberu novinek.</p>";
87
+
88
+ $defaults['unsubscribed_subject'] =
89
+ "Nashledanou {name},";
90
+
91
+ $defaults['unsubscribed_message'] =
92
+ "<p>Tento email potvrzuje vaše odhlášení z {blog_title} newslettru.</p>
93
+ <p>Nashledanou!</p>";
94
+
95
+
96
+
97
+
main.php CHANGED
@@ -70,22 +70,13 @@ else {
70
  $nc->errors($errors);
71
  $nc->messages($messages);
72
  ?>
73
- <script>
74
- jQuery(document).ready(function () {
75
-
76
- jQuery(".wrap h3").each(function () {
77
- jQuery(this).nextUntil('h3').hide();
78
- });
79
-
80
- jQuery(".wrap h3").click(function () {
81
- jQuery(this).nextUntil('h3').toggle();
82
- });
83
- });
84
- </script>
85
  <div class="wrap">
86
 
87
  <h2>Newsletter Main Configuration</h2>
88
 
 
 
89
  <p><a href="javascript:void(jQuery('.hints').toggle())">Show/hide detailed documentation</a></p>
90
 
91
  <form method="post" action="">
70
  $nc->errors($errors);
71
  $nc->messages($messages);
72
  ?>
73
+
 
 
 
 
 
 
 
 
 
 
 
74
  <div class="wrap">
75
 
76
  <h2>Newsletter Main Configuration</h2>
77
 
78
+ <?php include dirname(__FILE__) . '/header.php'; ?>
79
+
80
  <p><a href="javascript:void(jQuery('.hints').toggle())">Show/hide detailed documentation</a></p>
81
 
82
  <form method="post" action="">
plugin-head.inc.php CHANGED
@@ -1,5 +1,6 @@
1
  <?php $options = get_option('newsletter_profile'); ?>
2
  <script type="text/javascript">
 
3
  function newsletter_check(f) {
4
  var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
5
  if (!re.test(f.elements["ne"].value)) {
@@ -12,7 +13,7 @@ function newsletter_check(f) {
12
  }
13
  return true;
14
  }
15
- </script>
16
  <style type="text/css">
17
  <?php echo $this->options_main['css']; ?>
18
  </style>
1
  <?php $options = get_option('newsletter_profile'); ?>
2
  <script type="text/javascript">
3
+ //<![CDATA[
4
  function newsletter_check(f) {
5
  var re = /^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
6
  if (!re.test(f.elements["ne"].value)) {
13
  }
14
  return true;
15
  }
16
+ //]]></script>
17
  <style type="text/css">
18
  <?php echo $this->options_main['css']; ?>
19
  </style>
plugin-menu.inc.php CHANGED
@@ -7,7 +7,7 @@ add_submenu_page('newsletter/intro.php', 'User Guide', 'User Guide', $level, 'ne
7
 
8
  add_submenu_page('newsletter/intro.php', 'Main Configuration', 'Main Configuration', $level, 'newsletter/main.php');
9
  add_submenu_page('newsletter/intro.php', 'Subscription Process', 'Subscription Process', $level, 'newsletter/options.php');
10
- add_submenu_page('newsletter/intro.php', 'User Profile', 'User Profile', $level, 'newsletter/profile.php');
11
 
12
  add_submenu_page('newsletter/intro.php', 'Emails', 'Emails', $level, 'newsletter/emails.php');
13
  add_submenu_page('newsletter/emails.php', 'Email Edit', 'Email Edit', $level, 'newsletter/emails-edit.php');
7
 
8
  add_submenu_page('newsletter/intro.php', 'Main Configuration', 'Main Configuration', $level, 'newsletter/main.php');
9
  add_submenu_page('newsletter/intro.php', 'Subscription Process', 'Subscription Process', $level, 'newsletter/options.php');
10
+ add_submenu_page('newsletter/intro.php', 'Subscription Form', 'Subscription Form', $level, 'newsletter/profile.php');
11
 
12
  add_submenu_page('newsletter/intro.php', 'Emails', 'Emails', $level, 'newsletter/emails.php');
13
  add_submenu_page('newsletter/emails.php', 'Email Edit', 'Email Edit', $level, 'newsletter/emails-edit.php');
plugin.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Newsletter
4
  Plugin URI: http://www.satollo.net/plugins/newsletter
5
  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.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
6
- Version: 2.5.0
7
  Author: Satollo
8
  Author URI: http://www.satollo.net
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -49,7 +49,6 @@ class Newsletter {
49
  add_action('newsletter', array(&$this, 'hook_newsletter'), 1);
50
 
51
  // This specific event is created by "Feed by mail" panel on configuration
52
- add_action('newsletter_feed', array(&$this, 'hook_newsletter_feed'));
53
  add_action('template_redirect', array(&$this, 'hook_template_redirect'));
54
  add_action('wp_head', array(&$this, 'hook_wp_head'));
55
  add_shortcode('newsletter', array(&$this, 'shortcode_newsletter'));
@@ -95,7 +94,7 @@ class Newsletter {
95
  function hook_newsletter() {
96
  global $wpdb;
97
 
98
- $this->log();
99
  if (!$this->check_transient('newsletter', 60)) return;
100
 
101
  $max = $this->options_main['scheduler_max'];
@@ -115,6 +114,8 @@ class Newsletter {
115
  global $wpdb;
116
 
117
  $this->log();
 
 
118
 
119
  if ($users == null) {
120
  // Fake value representing the WordPress users target
@@ -161,6 +162,14 @@ class Newsletter {
161
 
162
  if ($email->track == 1) $m = $this->relink($m, $email->id, $user->id);
163
 
 
 
 
 
 
 
 
 
164
  $s = $this->replace($email->subject, $user);
165
  $x = $this->mail($user->email, $s, $m, true, $headers, 2);
166
 
@@ -369,7 +378,7 @@ class Newsletter {
369
  $buffer .= '<tr><th>' . $options_profile['name'] . '</th><td><input type="text" name="nn" size="30"/></td></tr>';
370
  }
371
  if ($options_profile['surname_status'] == 2) {
372
- $buffer .= '<tr><th>' . $options_profile['surname'] . '</td><th><input type="text" name="ns" size="30"/></td></tr>';
373
  }
374
 
375
  $buffer .= '<tr><th>' . $options_profile['email'] . '</th><td align="left"><input type="text" name="ne" size="30"/></td></tr>';
@@ -471,12 +480,13 @@ class Newsletter {
471
  }
472
 
473
  function hook_init() {
474
- global $hyper_cache_stop, $wpdb;
475
 
476
  $action = $_REQUEST['na'];
477
  if (empty($action) || is_admin()) return;
478
 
479
  $hyper_cache_stop = true;
 
480
 
481
  $this->log($action);
482
 
@@ -497,6 +507,8 @@ class Newsletter {
497
  if (!empty($_REQUEST['nx'])) $user['sex'] = $_REQUEST['nx'][0];
498
  $user['referrer'] = $_REQUEST['nr'];
499
 
 
 
500
  // New profiles
501
  for ($i = 1; $i <= 19; $i++) {
502
  if ($options_profile['profile_' . $i . '_status'] == 0) continue;
@@ -505,7 +517,6 @@ class Newsletter {
505
 
506
  // Lists (field names are nl[] and values the list number so special forms with radio button can work)
507
  if (is_array($_REQUEST['nl'])) {
508
- $options_profile = get_option('newsletter_profile');
509
  for ($i = 1; $i <= 9; $i++) {
510
  if ($options_profile['list_' . $i . '_status'] != 2) continue;
511
  if (in_array($i, $_REQUEST['nl'])) $user['list_' . $i] = 1;
@@ -519,22 +530,8 @@ class Newsletter {
519
  $wpdb->insert($wpdb->prefix . 'newsletter', $user);
520
  $user = $this->get_user($wpdb->insert_id); // back to an object
521
  // Notification to admin (only for new subscriptions)
522
- if ($this->options_main['notify'] == 1 && $user->status == 'C') {
523
- $this->log('Notification');
524
- $message = "Subscriber details:\n\n" .
525
- "name: " . $user->name . "\n" .
526
- "surname: " . $user->surname . "\n" .
527
- "sex: " . $user->sex . "\n" .
528
- "email: " . $user->email . "\n" .
529
- "id: " . $user->id . "\n" .
530
- "token: " . $user->token . "\n" .
531
- "status: " . $user->status . "\n" .
532
- "\nYours, Newsletter Pro.";
533
-
534
- $r = wp_mail(get_option('admin_email'), '[' . get_option('blogname') . '] Newsletter subscription', $message, "Content-type: text/plain; charset=UTF-8\n");
535
- if ($r == false) {
536
- $this->log('Notification error');
537
- }
538
  }
539
  }
540
 
@@ -560,33 +557,6 @@ class Newsletter {
560
  return;
561
  }
562
 
563
- if ($action == 'api-add') {
564
- $key = stripslashes($_REQUEST['nk']);
565
- if (empty($newsletter->options_main['api_key']) || $key != $newsletter->options_main['api_key']) die('Wrong API key');
566
-
567
- if (!is_email($_REQUEST['ne'])) die('Wrong email');
568
- $subscriber = array();
569
- $subscriber['name'] = stripslashes($_REQUEST['nn']);
570
- $subscriber['surname'] = stripslashes($_REQUEST['ns']);
571
- $subscriber['email'] = stripslashes($_REQUEST['ne']);
572
-
573
- // Only one list
574
- if (!empty($_REQUEST['nl'])) $subscriber['list_' . $_REQUEST['nl']] = 1;
575
- $subscriber['status'] = 'C';
576
- $subscriber['token'] = md5(rand());
577
- $wpdb->insert($wpdb->prefix . 'newsletter', $user);
578
- die('ok');
579
- }
580
-
581
- if ($action == 'api-delete') {
582
- $key = stripslashes($_REQUEST['nk']);
583
- if (empty($newsletter->options_main['api_key']) || $key != $newsletter->options_main['api_key']) die('Wrong API key');
584
-
585
- $email = $this->normalize_email(stripslashes($_REQUEST['ne']));
586
- $r = $wpdb->query($wpdb->prepare("delete from " . $wpdb->prefix . "newsletter where email=%s", $email));
587
- die($r = 0 ? 'ko' : 'ok');
588
- }
589
-
590
  // Actions below need a user. This code loads the user checking parameter or cookies.
591
  $user = $this->check_user();
592
  if ($user == null) die('No user');
@@ -597,23 +567,8 @@ class Newsletter {
597
 
598
  $this->mail($user->email, $this->replace($options['confirmed_subject'], $user), $this->replace($options['confirmed_message'], $user));
599
 
600
- if ($this->options_main['notify'] == 1) {
601
- $this->log('Notification');
602
- $message = "Subscriber details:\n\n" .
603
- "name: " . $user->name . "\n" .
604
- "surname: " . $user->surname . "\n" .
605
- "sex: " . $user->sex . "\n" .
606
- "email: " . $user->email . "\n" .
607
- "id: " . $user->id . "\n" .
608
- "token: " . $user->token . "\n" .
609
- "status: " . $user->status . "\n" .
610
- "\nYours, Newsletter.";
611
-
612
- $r = wp_mail(get_option('admin_email'), '[' . get_option('blogname') . '] Newsletter subscription', $message, "Content-type: text/plain; charset=UTF-8\n");
613
- if ($r == false) {
614
- $this->log('Notification error');
615
- }
616
- }
617
  if (!empty($options['confirmed_url'])) {
618
  header('Location: ' . $options['confirmed_url']);
619
  die();
@@ -634,21 +589,7 @@ class Newsletter {
634
  $wpdb->query($wpdb->prepare("delete from " . $wpdb->prefix . "newsletter where id=%d" . " and token=%s", $user->id, $user->token));
635
  $this->message = $this->replace($options['unsubscribed_text'], $user);
636
  $this->mail($user->email, $this->replace($options['unsubscribed_subject'], $user), $this->replace($options['unsubscribed_message'], $user));
637
-
638
- if ($newsletter->options_main['notify'] == 1) {
639
- $message = "Subscriber details:\n\n" .
640
- "name: " . $user->name . "\n" .
641
- "surname: " . $user->surname . "\n" .
642
- "sex: " . $user->sex . "\n" .
643
- "email: " . $user->email . "\n" .
644
- "id: " . $user->id . "\n" .
645
- "token: " . $user->token . "\n" .
646
- "status: " . $user->status . "\n" .
647
- "\nYours, Newsletter.";
648
-
649
- wp_mail(get_option('admin_email'), '[' . get_option('blogname') . '] Newsletter cancellation', $message, "Content-type: text/plain; charset=UTF-8\n");
650
- }
651
-
652
  return;
653
  }
654
 
@@ -745,6 +686,18 @@ class Newsletter {
745
  if (is_array($user)) $user = $this->get_user($user['id']);
746
  $text = str_replace('{home_url}', get_option('home'), $text);
747
  $text = str_replace('{blog_title}', get_option('blogname'), $text);
 
 
 
 
 
 
 
 
 
 
 
 
748
  if ($user != null) {
749
  $text = str_replace('{email}', $user->email, $text);
750
  $text = str_replace('{name}', $user->name, $text);
@@ -777,7 +730,7 @@ class Newsletter {
777
  $text = $this->replace_url($text, 'UNSUBSCRIPTION_URL', $this->add_qs($base, 'na=u' . $id_token));
778
  $text = $this->replace_url($text, 'UNSUBSCRIPTION_CONFIRM_URL', $this->add_qs($base, 'na=uc' . $id_token));
779
  $text = $this->replace_url($text, 'PROFILE_URL', $this->add_qs($base, 'na=pe' . $id_token));
780
- $text = $this->replace_url($text, 'UNLOCK_URL', $this->add_qs($base, 'na=m' . $id_token));
781
 
782
  for ($i = 1; $i <= 9; $i++) {
783
  $text = $this->replace_url($text, 'LIST_' . $i . '_SUBSCRIPTION_URL', $this->add_qs($base, 'na=ls&amp;nl=' . $i . $id_token));
@@ -816,11 +769,13 @@ class Newsletter {
816
  }
817
 
818
  function shortcode_newsletter_lock($attrs, $content=null) {
819
- global $hyper_cache_stop;
 
 
 
820
 
821
  $user = $this->check_user();
822
  if ($user != null && $user->status == 'C') {
823
- $hyper_cache_stop = true;
824
  return do_shortcode($content);
825
  }
826
 
@@ -870,6 +825,29 @@ class Newsletter {
870
  return $wpdb->query($query);
871
  }
872
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
873
  }
874
 
875
  require_once(dirname(__FILE__) . '/widget.php');
3
  Plugin Name: Newsletter
4
  Plugin URI: http://www.satollo.net/plugins/newsletter
5
  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.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
6
+ Version: 2.5.1.7
7
  Author: Satollo
8
  Author URI: http://www.satollo.net
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
49
  add_action('newsletter', array(&$this, 'hook_newsletter'), 1);
50
 
51
  // This specific event is created by "Feed by mail" panel on configuration
 
52
  add_action('template_redirect', array(&$this, 'hook_template_redirect'));
53
  add_action('wp_head', array(&$this, 'hook_wp_head'));
54
  add_shortcode('newsletter', array(&$this, 'shortcode_newsletter'));
94
  function hook_newsletter() {
95
  global $wpdb;
96
 
97
+ //$this->log();
98
  if (!$this->check_transient('newsletter', 60)) return;
99
 
100
  $max = $this->options_main['scheduler_max'];
114
  global $wpdb;
115
 
116
  $this->log();
117
+
118
+ if ($this->limits_exceeded()) return false;
119
 
120
  if ($users == null) {
121
  // Fake value representing the WordPress users target
162
 
163
  if ($email->track == 1) $m = $this->relink($m, $email->id, $user->id);
164
 
165
+ // Add CSS
166
+ if ($email->theme[0] == '*') $file = 'newsletter-custom/themes/' . substr($email->theme, 1) . '/style.css';
167
+ else $file = 'newsletter/themes/' . $email->theme . '/style.css';
168
+ $css = @file_get_contents(ABSPATH . 'wp-content/plugins/' . $file);
169
+
170
+ $m = '<html><head><style type="text/css">' . $css .
171
+ '</style></head><body>' . $m . '</body></html>';
172
+
173
  $s = $this->replace($email->subject, $user);
174
  $x = $this->mail($user->email, $s, $m, true, $headers, 2);
175
 
378
  $buffer .= '<tr><th>' . $options_profile['name'] . '</th><td><input type="text" name="nn" size="30"/></td></tr>';
379
  }
380
  if ($options_profile['surname_status'] == 2) {
381
+ $buffer .= '<tr><th>' . $options_profile['surname'] . '</th><td><input type="text" name="ns" size="30"/></td></tr>';
382
  }
383
 
384
  $buffer .= '<tr><th>' . $options_profile['email'] . '</th><td align="left"><input type="text" name="ne" size="30"/></td></tr>';
480
  }
481
 
482
  function hook_init() {
483
+ global $cache_stop, $hyper_cache_stop, $wpdb;
484
 
485
  $action = $_REQUEST['na'];
486
  if (empty($action) || is_admin()) return;
487
 
488
  $hyper_cache_stop = true;
489
+ $cache_stop = true;
490
 
491
  $this->log($action);
492
 
507
  if (!empty($_REQUEST['nx'])) $user['sex'] = $_REQUEST['nx'][0];
508
  $user['referrer'] = $_REQUEST['nr'];
509
 
510
+ $options_profile = get_option('newsletter_profile');
511
+
512
  // New profiles
513
  for ($i = 1; $i <= 19; $i++) {
514
  if ($options_profile['profile_' . $i . '_status'] == 0) continue;
517
 
518
  // Lists (field names are nl[] and values the list number so special forms with radio button can work)
519
  if (is_array($_REQUEST['nl'])) {
 
520
  for ($i = 1; $i <= 9; $i++) {
521
  if ($options_profile['list_' . $i . '_status'] != 2) continue;
522
  if (in_array($i, $_REQUEST['nl'])) $user['list_' . $i] = 1;
530
  $wpdb->insert($wpdb->prefix . 'newsletter', $user);
531
  $user = $this->get_user($wpdb->insert_id); // back to an object
532
  // Notification to admin (only for new subscriptions)
533
+ if ($user->status == 'C') {
534
+ $this->notify_admin($user, 'Newsletter subscription');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
535
  }
536
  }
537
 
557
  return;
558
  }
559
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
560
  // Actions below need a user. This code loads the user checking parameter or cookies.
561
  $user = $this->check_user();
562
  if ($user == null) die('No user');
567
 
568
  $this->mail($user->email, $this->replace($options['confirmed_subject'], $user), $this->replace($options['confirmed_message'], $user));
569
 
570
+ $this->notify_admin($user, 'Newsletter subscription');
571
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  if (!empty($options['confirmed_url'])) {
573
  header('Location: ' . $options['confirmed_url']);
574
  die();
589
  $wpdb->query($wpdb->prepare("delete from " . $wpdb->prefix . "newsletter where id=%d" . " and token=%s", $user->id, $user->token));
590
  $this->message = $this->replace($options['unsubscribed_text'], $user);
591
  $this->mail($user->email, $this->replace($options['unsubscribed_subject'], $user), $this->replace($options['unsubscribed_message'], $user));
592
+ $this->notify_admin($user, 'Newsletter cancellation');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
593
  return;
594
  }
595
 
686
  if (is_array($user)) $user = $this->get_user($user['id']);
687
  $text = str_replace('{home_url}', get_option('home'), $text);
688
  $text = str_replace('{blog_title}', get_option('blogname'), $text);
689
+ $text = str_replace('{date}', date_i18n(get_option('date_format')), $text);
690
+ $text = str_replace('{blog_description}', get_option('blogdescription'), $text);
691
+
692
+ // Date processing
693
+ $x = 0;
694
+ while (($x = strpos($text, '{date_', $x)) !== false) {
695
+ $y = strpos($text, '}', $x);
696
+ if ($y === false) continue;
697
+ $f = substr($text, $x+6, $y-$x-6);
698
+ $text = substr($text, 0, $x) . date($f) . substr($text, $y+1);
699
+ }
700
+
701
  if ($user != null) {
702
  $text = str_replace('{email}', $user->email, $text);
703
  $text = str_replace('{name}', $user->name, $text);
730
  $text = $this->replace_url($text, 'UNSUBSCRIPTION_URL', $this->add_qs($base, 'na=u' . $id_token));
731
  $text = $this->replace_url($text, 'UNSUBSCRIPTION_CONFIRM_URL', $this->add_qs($base, 'na=uc' . $id_token));
732
  $text = $this->replace_url($text, 'PROFILE_URL', $this->add_qs($base, 'na=pe' . $id_token));
733
+ $text = $this->replace_url($text, 'UNLOCK_URL', $this->add_qs($this->options_main['url'], 'na=m' . $id_token));
734
 
735
  for ($i = 1; $i <= 9; $i++) {
736
  $text = $this->replace_url($text, 'LIST_' . $i . '_SUBSCRIPTION_URL', $this->add_qs($base, 'na=ls&amp;nl=' . $i . $id_token));
769
  }
770
 
771
  function shortcode_newsletter_lock($attrs, $content=null) {
772
+ global $hyper_cache_stop, $lite_cache_stop;
773
+
774
+ $hyper_cache_stop = true;
775
+ $lite_cache_stop = true;
776
 
777
  $user = $this->check_user();
778
  if ($user != null && $user->status == 'C') {
 
779
  return do_shortcode($content);
780
  }
781
 
825
  return $wpdb->query($query);
826
  }
827
 
828
+ function notify_admin($user, $subject) {
829
+ if ($this->options_main['notify'] != 1) return;
830
+ $message = "Subscriber details:\n\n" .
831
+ "email: " . $user->email . "\n" .
832
+ "first name: " . $user->name . "\n" .
833
+ "last name: " . $user->surname . "\n" .
834
+ "gender: " . $user->sex . "\n";
835
+
836
+ $options_profile = get_option('newsletter_profile');
837
+
838
+ for ($i=0; $i<NEWSLETTER_PROFILE_MAX; $i++) {
839
+ if ($options_profile['profile_' . $i] == '') continue;
840
+ $field = 'profile_' . $i;
841
+ $message .= $options_profile['profile_' . $i] . ': ' . $user->$field . "\n";
842
+ }
843
+
844
+ $message .= "token: " . $user->token . "\n" .
845
+ "status: " . $user->status . "\n" .
846
+ "\nYours, Newsletter Pro.";
847
+
848
+ wp_mail(get_option('admin_email'), '[' . get_option('blogname') . '] ' . $subject, $message, "Content-type: text/plain; charset=UTF-8\n");
849
+ }
850
+
851
  }
852
 
853
  require_once(dirname(__FILE__) . '/widget.php');
profile.php CHANGED
@@ -44,6 +44,9 @@ $status = array(0=>'Disabled', 1=>'Only on profile page', 2=>'Even on subscripti
44
  <div class="wrap">
45
 
46
  <h2>Newsletter Profile</h2>
 
 
 
47
  <p>
48
  User profile is the whole set of user data that he can edit accessing the profile page (usually via the {profile_url} link you
49
  should add in any newsletter or welcome message.<br />
44
  <div class="wrap">
45
 
46
  <h2>Newsletter Profile</h2>
47
+
48
+ <?php include dirname(__FILE__) . '/header.php'; ?>
49
+
50
  <p>
51
  User profile is the whole set of user data that he can edit accessing the profile page (usually via the {profile_url} link you
52
  should add in any newsletter or welcome message.<br />
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  === Newsletter ===
3
  Tags: newsletter,email,subscription,mass mail
4
  Requires at least: 2.7
5
- Tested up to: 3.1.2
6
  Stable tag: trunk
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483
8
  Contributors: satollo
@@ -15,6 +15,24 @@ This plug-in lets you collect subscribers on your blog with a single or double o
15
  subscription process. Double opt-in is law compliant and it means the user has to confirm the subscription
16
  following simple standard instructions sent to him via email.
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  Each step of subscribe and cancel process is fully configurable and translatable.
19
 
20
  Subscription form and profile form are easily configurable from administrative panels and you
@@ -43,10 +61,67 @@ More about Newsletter plug-in official page (http://www.satollo.net/plugins/news
43
 
44
  == Frequently Asked Questions ==
45
 
46
- **How can I submit a bug?**
47
-
48
- This is your page: (http://www.satollo.net/newsletter-help)
49
 
50
  == Screen shots ==
51
 
52
  No screen shots are available at this time.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  === Newsletter ===
3
  Tags: newsletter,email,subscription,mass mail
4
  Requires at least: 2.7
5
+ Tested up to: 3.2.1
6
  Stable tag: trunk
7
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2545483
8
  Contributors: satollo
15
  subscription process. Double opt-in is law compliant and it means the user has to confirm the subscription
16
  following simple standard instructions sent to him via email.
17
 
18
+ Newsletter 2.5 works.
19
+
20
+ Take the time to read the user guide, to configure
21
+ it as if it would be a new installed plug-in, to enter the subscription form panel and
22
+ configure it. Read the user guide about WordPress cron system and how it can affect
23
+ the sending process. If you need to translate the subscription form, use the
24
+ subscription form panel, please, do not hack the language files, they are
25
+ used only on activation. On some WordPress installations the automatic update does not
26
+ trigger the activation process. It's important, so try to deactivate and reactivate the
27
+ plug-in if it does not saves e-mails. If you update manually uploading the plug-in
28
+ with FTP, deactivate it first and the reactivate.
29
+
30
+ Please, DO NOT hack the plug-in files and then, when things go wrong, try to solve
31
+ the problem writing me... I have no time to answer to all. Reinstall if you're in doubt
32
+ about the plug-in integrity.
33
+
34
+ Thank you.
35
+
36
  Each step of subscribe and cancel process is fully configurable and translatable.
37
 
38
  Subscription form and profile form are easily configurable from administrative panels and you
61
 
62
  == Frequently Asked Questions ==
63
 
64
+ None.
 
 
65
 
66
  == Screen shots ==
67
 
68
  No screen shots are available at this time.
69
+
70
+ == Changelog ==
71
+
72
+ = 2.5.1.7 =
73
+
74
+ * fixed the widget which was no showing the lists and extra fields
75
+
76
+ = 2.5.1.6 =
77
+
78
+ * fixed {unlock_url} tag
79
+
80
+ = 2.5.1.5 =
81
+
82
+ * fixed issues on multi email sending
83
+ * main configuration panel all options open because people was missing to expand panels
84
+ * subscriber panel does not more show up the full list on first open
85
+ * fixed privacy check box on widget
86
+
87
+ = 2.5.1.4 =
88
+
89
+ * fixed a missing form element on subscriber list panel that caused some buttons to not work
90
+
91
+ = 2.5.1.3 =
92
+
93
+ * added compatibility with lite cache
94
+ * fixed the list checkboxes on user edit panel
95
+ * removed the 100 users limit on search panel
96
+
97
+ = 2.5.1.2 =
98
+
99
+ * fixed unsubscription administrator notifications
100
+ * replaced sex with gender in notification emails
101
+ * fixed the confirm/unconfirm button on user list
102
+ * fixed some labels
103
+ * subscription form html
104
+
105
+
106
+ = 2.5.1.1 =
107
+
108
+ * added {date} tag and {date_'format'} tag, where 'format' can be any of the PHP date formats
109
+ * added {blog_description} tag
110
+ * updated custom forms documentation
111
+ * fixed extended subscriber profile collection
112
+
113
+ = 2.5.1 =
114
+
115
+ * Improved documentation about delivery engine, WordPress cron and multisite
116
+ * New button to force a run of the delivery engine
117
+ * Fixed images on theme 1
118
+ * Fixed the widget field check
119
+ * Renamed panel "user profile" in "subscription form" (since no one read the user guide.. may be due to my bad English... :-)
120
+ * Updated theme documentation
121
+ * Reintroduced theme CSS
122
+ * Added CDATA on JavaScript
123
+ * Added theme 3
124
+
125
+ = 2.5.0 =
126
+
127
+ * first major release after 1.5.9
themes/blank/theme.php ADDED
@@ -0,0 +1 @@
 
1
+ <p>Blank newsletter!</p>
themes/empty.css ADDED
@@ -0,0 +1 @@
 
1
+ /* Empty css for theme that does not need it */
themes/theme-1/theme.php CHANGED
@@ -34,6 +34,9 @@ while ($posts->have_posts())
34
  ?>
35
  <tr>
36
  <td style="font-size: 14px; color: #666">
 
 
 
37
  <p><a href="<?php echo get_permalink(); ?>" style="font-size: 16px; color: #000; text-decoration: none"><?php the_title(); ?></a></p>
38
 
39
  <?php the_excerpt(); ?>
34
  ?>
35
  <tr>
36
  <td style="font-size: 14px; color: #666">
37
+ <?php if ($image != null) { ?>
38
+ <img src="<?php echo $image; ?>" alt="picture" align="left"/>
39
+ <?php } ?>
40
  <p><a href="<?php echo get_permalink(); ?>" style="font-size: 16px; color: #000; text-decoration: none"><?php the_title(); ?></a></p>
41
 
42
  <?php the_excerpt(); ?>
themes/theme-3/header.jpg ADDED
Binary file
themes/theme-3/theme-3.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
- $posts = new WP_Query();
3
- $posts->query(array('showposts'=>10, 'post_status'=>'publish'));
4
-
5
- $texts['notice'] = 'You received this email because you are subscribed to ' . get_option('blogname');
6
-
7
- $texts['header'] = '';
8
-
9
- $empty_image = get_option('blogurl') . '/wp-content/plugins/newsletter/themes/with-picture/empty.gif';
10
-
11
- @include(dirname(__FILE__) . '/' . WPLANG . '.php');
12
- ?>
13
-
14
- <table align="center" width="600" cellpadding="5" cellspacing="0" style="border-width:2px; border-style:solid; border-color:#aaa;" >
15
- <!--<tr><td width="600" colspan="2"><div style="margin:10px;"><small><?php echo $texts['notice']; ?></small></div></td></tr>-->
16
- <tr>
17
- <td width="600" colspan="2">
18
- <span style="font-size: 38px; color:silver"><?php echo get_option('blogname'); ?></span>
19
- </td>
20
- </tr>
21
- <tr>
22
- <td width="600" colspan="2">
23
- <p>Hi {name},<br />
24
- here the last news from my blog!</p>
25
- </td>
26
- </tr>
27
- <tr>
28
- <td width="150" valign="top" align="left" style="border-right: 1px solid #ccc">
29
-
30
- <strong>Categories</strong><br />
31
- <?php echo wp_list_categories(array('title_li'=>'', 'echo'=>0, 'style'=>'none')); ?>
32
-
33
- <br /><br />
34
-
35
- <strong>Tags</strong><br />
36
- <?php echo wp_tag_cloud(array('title_li'=>'', 'echo'=>0, 'smallest'=>9, 'largest'=>'14', 'unit'=>'px')); ?>
37
-
38
- <br /><br />
39
-
40
-
41
- <strong>Pages</strong><br />
42
- <?php wp_page_menu(array('link_after'=>'<br />')); ?>
43
- </td>
44
- <td width="450" valign="top" align="left">
45
-
46
-
47
- <table cellspacing="10">
48
- <?php
49
- while ($posts->have_posts())
50
- {
51
- $posts->the_post();
52
- ?>
53
- <tr>
54
- <!--
55
- <td valign="top">
56
- <a href="<?php echo get_permalink(); ?>"><img src="<?php echo nt_post_image($post->ID, 'thumbnail', $empty_image); ?>" width="100"/></a>
57
- </td>
58
- -->
59
- <td valign="top" align="left">
60
- <a href="<?php echo get_permalink(); ?>"><strong><?php the_title(); ?></strong></a><br />
61
- <?php echo the_excerpt(); ?>
62
- </td>
63
- </tr>
64
- <?php } ?>
65
- </table>
66
-
67
- </td>
68
- </tr>
69
- <tr>
70
- <td colspan="2" height="40" bgcolor="#e9eee8">
71
- <small>
72
- If you want to unsubscribe <a href="{unsubscription_url}">unsubscribe click here</a>.
73
- <br />
74
- &copy; <?php echo get_option('blogname'); ?>
75
- </small>
76
- </td>
77
- </tr>
78
- </table>
79
-
80
-
81
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
themes/theme-3/theme.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // If you want to translate or customize this theme, just copy the file inside the folder
3
+ // wp-content/plugins/newsletter-pro-custom/themes
4
+ // (create it if it does not exist) and the a new theme called "theme-1" will appear
5
+ // on autocompose menu. You can rename the file if you want.
6
+
7
+ $posts = new WP_Query();
8
+ $posts->query(array('showposts' => 10, 'post_status' => 'publish'));
9
+ ?>
10
+
11
+ <br />
12
+
13
+ <table cellspacing="0" align="center" border="0" style="max-width:600px; width:600px; background-color: #eee;" cellpadding="0" width="600px">
14
+ <!-- Header -->
15
+ <tr style="background: #455560; background-image: url(<?php echo plugins_url('header.jpg', __FILE__); ?>); height:80px;width:600px;" cellspacing="0" border="0" align="center" cellpadding="0" width="600" height="80">
16
+ <td height="80" width="600" style="color: #fff; font-size: 30px; font-family: Arial;" align="center" valign="middle">
17
+ <?php echo get_option('blogname'); ?>
18
+ </td>
19
+ </tr>
20
+ <tr style="background: #d0d0d0; height:20px;width:600px;">
21
+ <td valign="top" height="20" width="600" bgcolor="#ffffff" align="center" style="font-family: Arial; font-size: 12px">
22
+ <?php echo get_option('blogdescription'); ?>
23
+ </td>
24
+ </tr>
25
+ <tr>
26
+ <td>
27
+ <table cellspacing="0" border="0" style="max-width:600px; width:600px; background-color: #eee;font-family:helvetica,arial,sans-serif;color:#555;font-size:13px;line-height:15px;" align="center" cellpadding="20" width="600px">
28
+ <tr>
29
+ <td>
30
+ <table cellpadding="0" cellspacing="0" border="0" bordercolor="" width="100%" bgcolor="#ffffff">
31
+ <?php
32
+ while ($posts->have_posts()) {
33
+ $posts->the_post();
34
+ $image = nt_post_image(get_the_ID());
35
+ ?>
36
+ <tr>
37
+ <td style="font-family: Arial; font-size: 12px">
38
+ <?php if ($image != null) { ?>
39
+ <img src="<?php echo $image; ?>" alt="picture" align="left" width="100" height="100" style="margin-right: 10px"/>
40
+ <?php } ?>
41
+ <a href="<?php echo get_permalink(); ?>" style="color: #000; text-decoration: none"><b><?php the_title(); ?></b></a><br />
42
+
43
+ <?php the_excerpt(); ?>
44
+ </td>
45
+ </tr>
46
+ <?php
47
+ }
48
+ ?>
49
+ </table>
50
+
51
+ </td>
52
+ </tr>
53
+ </table>
54
+ </td>
55
+ </tr>
56
+ <tr>
57
+ <td bgcolor="#ffffff" style="font-family: Arial; font-size: 12px">
58
+
59
+ This email was sent to <b>{email}</b> because you opted in on <?php echo get_option('blogname'); ?> website.
60
+ <br />
61
+
62
+ <a href="{profile_url}">Manage Subscriptions</a> |
63
+
64
+ <a href="{unsubscription_url}">Unsubscribe</a>
65
+ </td>
66
+ </tr>
67
+ </table>
users-edit.php CHANGED
@@ -11,6 +11,9 @@ if (isset($_GET['id'])) {
11
  }
12
  else {
13
  if ($nc->is_action('save')) {
 
 
 
14
  $nc->save($wpdb->prefix . 'newsletter');
15
  }
16
  }
@@ -41,7 +44,7 @@ $options_profile = get_option('newsletter_profile');
41
  <tr valign="top">
42
  <th>Name and email</th>
43
  <td>
44
- name: <?php $nc->text('name', 30); ?> surname: <?php $nc->text('surname', 30); ?>
45
  email: <?php $nc->text('email', 40); ?> sex: <?php $nc->select('sex', array('n'=>'Not specified', 'f'=>'female', 'm'=>'male')); ?>
46
  </td>
47
  </tr>
11
  }
12
  else {
13
  if ($nc->is_action('save')) {
14
+ for($i=1; $i<=NEWSLETTER_LIST_MAX; $i++) {
15
+ if (!isset($nc->data['list_' . $i])) $nc->data['list_' . $i] = 0;
16
+ }
17
  $nc->save($wpdb->prefix . 'newsletter');
18
  }
19
  }
44
  <tr valign="top">
45
  <th>Name and email</th>
46
  <td>
47
+ first name: <?php $nc->text('name', 30); ?> last name: <?php $nc->text('surname', 30); ?>
48
  email: <?php $nc->text('email', 40); ?> sex: <?php $nc->select('sex', array('n'=>'Not specified', 'f'=>'female', 'm'=>'male')); ?>
49
  </td>
50
  </tr>
users.php CHANGED
@@ -75,8 +75,12 @@ if ($action == 'list_manage') {
75
  }
76
 
77
 
78
-
79
- $list = newsletter_search($options['search_text'], $options['search_status'], $options['search_order'], $options['search_list'], $options['search_link']);
 
 
 
 
80
 
81
  $nc = new NewsletterControls($options);
82
  $nc->errors($errors);
@@ -154,7 +158,8 @@ $nc->messages($messages);
154
  <form id="channel" method="post" action="">
155
  <?php $nc->init(); ?>
156
  <input type="hidden" name="options[subscriber_id]"/>
157
-
 
158
  <?php
159
  $tmp = $wpdb->get_results($wpdb->prepare("select distinct newsletter, url from " . $wpdb->prefix . "newsletter_stats order by newsletter,url"));
160
  $links = array(''=>'Unfiltered');
@@ -181,14 +186,10 @@ $nc->messages($messages);
181
  </table>
182
 
183
 
184
-
185
-
186
-
187
 
188
  <h3>Search results</h3>
189
 
190
- <?php if ($list) { ?>
191
-
192
  <table class="widefat">
193
  <thead>
194
  <tr>
75
  }
76
 
77
 
78
+ if ($action == 'search') {
79
+ $list = newsletter_search($options['search_text'], $options['search_status'], $options['search_order'], $options['search_list'], $options['search_link']);
80
+ }
81
+ else {
82
+ $list = array();
83
+ }
84
 
85
  $nc = new NewsletterControls($options);
86
  $nc->errors($errors);
158
  <form id="channel" method="post" action="">
159
  <?php $nc->init(); ?>
160
  <input type="hidden" name="options[subscriber_id]"/>
161
+ <input type="hidden" name="options[subscriber_status]"/>
162
+
163
  <?php
164
  $tmp = $wpdb->get_results($wpdb->prepare("select distinct newsletter, url from " . $wpdb->prefix . "newsletter_stats order by newsletter,url"));
165
  $links = array(''=>'Unfiltered');
186
  </table>
187
 
188
 
189
+ <?php if (!empty($list)) { ?>
 
 
190
 
191
  <h3>Search results</h3>
192
 
 
 
193
  <table class="widefat">
194
  <thead>
195
  <tr>
widget.php CHANGED
@@ -1,8 +1,5 @@
1
  <?php
2
 
3
- /**
4
- * Newsletter widget version 2.0: it'll replace the old version left for compatibility.
5
- */
6
  class NewsletterWidget extends WP_Widget {
7
 
8
  function NewsletterWidget() {
@@ -24,28 +21,60 @@ class NewsletterWidget extends WP_Widget {
24
  $options = get_option('newsletter');
25
  $options_profile = get_option('newsletter_profile');
26
  if (stripos($instance['text'], '<form') === false) {
27
- $form .= '<div class="newsletter newsletter-widget"><form action="' . $newsletter->options_main['url'] . '" method="post">';
28
  $form .= '<input type="hidden" name="na" value="s"/>';
29
  $form .= '<input type="hidden" name="nr" value="widget"/>';
 
30
  if ($options_profile['name_status'] == 2)
31
  $form .= '<p><input type="text" name="nn" value="' . $options_profile['name'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
 
32
  if ($options_profile['surname_status'] == 2)
33
  $form .= '<p><input type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
 
34
  $form .= '<p><input type="text" name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
 
35
  if ($options_profile['sex_status'] == 2) {
36
  $form .= '<p><select name="nx" class="newsletter-sex">';
37
  $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
38
  $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
39
  $form .= '</select></p>';
40
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  $form .= '<p><input type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
42
  $form .= '</form></div>';
43
  if (strpos($buffer, '{subscription_form}') !== false) $buffer = str_replace('{subscription_form}', $form, $buffer);
44
  else $buffer .= $form;
45
  }
46
  else {
47
- $buffer = str_ireplace('<form', '<form method="post" action="' . $newsletter->options_main['url'] . '"', $buffer);
48
- $buffer = str_ireplace('</form>', '<input type="hidden" name="na" value="s"/></form>', $buffer);
49
  }
50
 
51
  echo $buffer;
1
  <?php
2
 
 
 
 
3
  class NewsletterWidget extends WP_Widget {
4
 
5
  function NewsletterWidget() {
21
  $options = get_option('newsletter');
22
  $options_profile = get_option('newsletter_profile');
23
  if (stripos($instance['text'], '<form') === false) {
24
+ $form .= '<div class="newsletter newsletter-widget"><form action="' . $newsletter->options_main['url'] . '" onsubmit="return newsletter_check(this)" method="post">';
25
  $form .= '<input type="hidden" name="na" value="s"/>';
26
  $form .= '<input type="hidden" name="nr" value="widget"/>';
27
+
28
  if ($options_profile['name_status'] == 2)
29
  $form .= '<p><input type="text" name="nn" value="' . $options_profile['name'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
30
+
31
  if ($options_profile['surname_status'] == 2)
32
  $form .= '<p><input type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
33
+
34
  $form .= '<p><input type="text" name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
35
+
36
  if ($options_profile['sex_status'] == 2) {
37
  $form .= '<p><select name="nx" class="newsletter-sex">';
38
  $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
39
  $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
40
  $form .= '</select></p>';
41
  }
42
+
43
+ // Extra profile fields
44
+ for ($i = 1; $i <= 19; $i++) {
45
+ if ($options_profile['profile_' . $i . '_status'] != 2) continue;
46
+ if ($options_profile['profile_' . $i . '_type'] == 'text') {
47
+ $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>';
48
+ }
49
+ if ($options_profile['profile_' . $i . '_type'] == 'select') {
50
+ $form .= '<p>' . $options_profile['profile_' . $i] . '<br /><select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
51
+ $opts = explode(',', $options_profile['profile_' . $i . '_options']);
52
+ for ($i = 0; $i < count($opts); $i++) {
53
+ $form .= '<option>' . trim($opts[$i]) . '</option>';
54
+ }
55
+ $form .= '</select></p>';
56
+ }
57
+ }
58
+
59
+ $lists = '';
60
+ for ($i = 1; $i <= 9; $i++) {
61
+ if ($options_profile['list_' . $i . '_status'] != 2) continue;
62
+ $lists .= '<input type="checkbox" name="nl[]" value="' . $i . '"/>&nbsp;' . $options_profile['list_' . $i] . '<br />';
63
+ }
64
+ if (!empty($lists)) $form .= '<p>' . $lists . '</p>';
65
+
66
+ if ($options_profile['privacy_status'] == 1) {
67
+ $form .= '<p><input type="checkbox" name="ny"/>&nbsp;' . $options_profile['privacy'] . '</p>';
68
+ }
69
+
70
  $form .= '<p><input type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
71
  $form .= '</form></div>';
72
  if (strpos($buffer, '{subscription_form}') !== false) $buffer = str_replace('{subscription_form}', $form, $buffer);
73
  else $buffer .= $form;
74
  }
75
  else {
76
+ $buffer = str_ireplace('<form', '<form method="post" action="' . $newsletter->options_main['url'] . '" onsubmit="return newsletter_check(this)"', $buffer);
77
+ $buffer = str_ireplace('</form>', '<input type="hidden" name="na" value="s"/><input type="hidden" name="nr" value="widget"/></form>', $buffer);
78
  }
79
 
80
  echo $buffer;