Subscribe2 - Version 2.10

Version Description

Download this release

Release Info

Developer MattyRob
Plugin Icon 128x128 Subscribe2
Version 2.10
Comparing to
See all releases

Code changes from version 3.0 to 2.10

ReadMe.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: MattyRob, Skippy, Ravan
3
  Donate link: http://subscribe2.wordpress.com/donate/
4
  Tags: posts, subscription, email
5
  Requires at least: 2.0.x
6
- Tested up to: 2.2
7
 
8
  Sends a list of subscribers an email notification when new posts are published to your blog
9
 
@@ -77,28 +77,6 @@ Batches will occur for each group of message as described above. A site on Drea
77
 
78
  == Version History ==
79
 
80
- Version 3.0 by Matthew Robinson
81
-
82
- * Updated for WordPress 2.1 Branch
83
-
84
- Version 2.14 by Matthew Robinson
85
-
86
- * Amended DREAMHOST setting to BCCLIMIT as more hosts are limiting emails
87
- * Fixed oversight in upgrade() function
88
-
89
- Version 2.13 by Matthew Robinson
90
-
91
- * Added WordPress nonce functionality to improve admin security
92
-
93
- Version 2.12 by Matthew Robinson
94
-
95
- * Fix for missing Quicktags (probably since version 2.2.10)
96
- * Fix for occasional email issue where excerpts are incomplete
97
-
98
- Version 2.11 by Matthew Robinson
99
- * Fixed bug that would cause all subscribers to get digest emails
100
- * Added Select All check box to category listing
101
-
102
  Version 2.10 by Matthew Robinson
103
  * Improved sign up process by double checking email address
104
  * Fix for submenu issues encountered in WP 2.0.6
3
  Donate link: http://subscribe2.wordpress.com/donate/
4
  Tags: posts, subscription, email
5
  Requires at least: 2.0.x
6
+ Tested up to: 2.1
7
 
8
  Sends a list of subscribers an email notification when new posts are published to your blog
9
 
77
 
78
  == Version History ==
79
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  Version 2.10 by Matthew Robinson
81
  * Improved sign up process by double checking email address
82
  * Fix for submenu issues encountered in WP 2.0.6
subscribe2/include.php CHANGED
@@ -31,16 +31,12 @@ if (!isset($this->subscribe2_options['barred'])) {
31
  $this->subscribe2_options['barred'] = '';
32
  } // option containing domains barred from public registration
33
 
34
- if (!isset($this->subscribe2_options['email_freq'])) {
35
- $this->subscribe2_options['email_freq'] = "never";
36
- } // option for sending emails periodically or per-post
37
-
38
  if (!isset($this->subscribe2_options['mailtext'])) {
39
  $this->subscribe2_options['mailtext'] = "BLOGNAME has posted a new item, 'TITLE'\r\nPOST\r\nYou may view the latest post at\r\nPERMALINK\r\nYou received this e-mail because you asked to be notified when new updates are posted.\r\nBest regards,\r\nMYNAME\r\nEMAIL";
40
  } // Default notification email text
41
 
42
  if (!isset($this->subscribe2_options['confirm_email'])) {
43
- $this->subscribe2_options['confirm_email'] = "BLOGNAME has received a request to ACTION for this email address. To complete your request please click on the link below:\n\nLINK\n\nIf you did not request this, please feel free to disregard this notice!\n\nThank you,\nMYNAME.";
44
  } // Default confirmation email text
45
 
46
  if (!isset($this->subscribe2_options['remind_email'])) {
31
  $this->subscribe2_options['barred'] = '';
32
  } // option containing domains barred from public registration
33
 
 
 
 
 
34
  if (!isset($this->subscribe2_options['mailtext'])) {
35
  $this->subscribe2_options['mailtext'] = "BLOGNAME has posted a new item, 'TITLE'\r\nPOST\r\nYou may view the latest post at\r\nPERMALINK\r\nYou received this e-mail because you asked to be notified when new updates are posted.\r\nBest regards,\r\nMYNAME\r\nEMAIL";
36
  } // Default notification email text
37
 
38
  if (!isset($this->subscribe2_options['confirm_email'])) {
39
+ $this->subscribe2_options['confirm_email'] = "In order to confirm your request for BLOGNAME, please click on the link below:\n\nLINK\n\nIf you did not request this, please feel free to disregard this notice!\n\nThank you,\nMYNAME.";
40
  } // Default confirmation email text
41
 
42
  if (!isset($this->subscribe2_options['remind_email'])) {
subscribe2/subscribe2.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 2.3.1 for WP2.1
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
10
 
11
  /*
12
- Copyright (C) 2006-7 Matthew Robinson
13
  Based on the Original Subscribe2 plugin by
14
  Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
15
 
@@ -29,66 +29,25 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
  http://www.gnu.org/licenses/gpl.html
30
  */
31
 
32
- // If you are on a host that limits the numner of recipients
33
- // permitted on each outgoing email message
34
- // change this value to your hosts limit
35
- define('BCCLIMIT', '0');
 
 
 
36
 
37
  // by default, subscribe2 grabs the first page from your database for use
38
  // when displaying the confirmation screen to public subscribers.
39
  // You can override this by specifying a page ID below.
40
  define('S2PAGE', '0');
41
 
42
- // our version number. Don't touch.
43
- define('S2VERSION', '2.3.1');
44
-
45
- // Add the Subscribe code into the WP API
46
- add_action('init', 's2init');
47
-
48
- // maybe add our button
49
- $s2_options = array();
50
- $s2_options = get_option('subscribe2_options');
51
- if ('1' == $s2_options['show_button']) {
52
- // use Owen's excellent ButtonSnap library
53
- include(ABSPATH . '/wp-content/plugins/buttonsnap.php');
54
- add_action('init', 's2_button_init');
55
- add_action('marker_css', 'subscribe2_css');
56
- }
57
- unset($s2_options);
58
-
59
- function s2init() {
60
- global $subscribe2;
61
- $mysubscribe2 = new subscribe2();
62
- $mysubscribe2->subscribe2();
63
- }
64
-
65
- /* ===== ButtonSnap configuration ===== */
66
- /**
67
- Register our button in the QuickTags bar
68
- */
69
- function s2_button_init() {
70
- $url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_button.png';
71
- buttonsnap_textbutton($url, 'Subscribe2', '<!--subscribe2-->');
72
- buttonsnap_register_marker('subscribe2', 's2_marker');
73
- }
74
 
75
- /**
76
- Style a marker in the Rich Text Editor for our tag
77
- By default, the RTE suppresses output of HTML comments, so this places a CSS style on our token in order to make it display
78
- */
79
- function subscribe2_css() {
80
- $marker_url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_marker.png';
81
- echo "
82
- .s2_marker {
83
- display: block;
84
- height: 45px;
85
- margin-top: 5px;
86
- background-image: url({$marker_url});
87
- background-repeat: no-repeat;
88
- background-position: center;
89
- }
90
- ";
91
- }
92
 
93
  // start our class
94
  class subscribe2 {
@@ -102,9 +61,7 @@ class subscribe2 {
102
 
103
  $this->please_log_in = "<p>" . __('To manage your subscription options please ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-login.php\">login</a>.</p>";
104
 
105
- $this->use_profile_admin = "<p>" . __('You may manage your subscription options from your ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-admin/users.php?page=" . plugin_basename(__FILE__) . "\">profile</a>.</p>";
106
-
107
- $this->use_profile_users = "<p>" . __('You may manage your subscription options from your ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-admin/profile.php?page=" . plugin_basename(__FILE__) . "\">profile</a>.</p>";
108
 
109
  $this->confirmation_sent = "<p>" . __('A confirmation message is on its way!', 'subscribe2') . "</p>";
110
 
@@ -147,36 +104,37 @@ class subscribe2 {
147
  function admin_menu() {
148
  add_management_page(__('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), "manage_options", __FILE__, array(&$this, 'manage_menu'));
149
  add_options_page(__('Subscribe2 Options', 'subscribe2'), __('Subscribe2','subscribe2'), "manage_options", __FILE__, array(&$this, 'options_menu'));
150
- if (current_user_can('manage_options')) {
151
- add_submenu_page('users.php', __('Subscriptions', 'subscribe2'), __('Subscriptions', 'subscribe2'), "read", __FILE__, array(&$this, 'user_menu'));
152
- } else {
153
- add_submenu_page('profile.php', __('Subscriptions', 'subscribe2'), __('Subscriptions', 'subscribe2'), "read", __FILE__, array(&$this, 'user_menu'));
154
- }
155
- add_submenu_page('post-new.php', __('Mail Subscribers','subscribe2'), __('Mail Subscribers', 'subscribe2'),"manage_options", __FILE__, array(&$this, 'write_menu'));
156
- $s2nonce = md5('subscribe2');
157
  }
158
 
 
159
  /**
160
- Insert Javascript into admin_header
161
  */
162
- function admin_head() {
163
- echo "<script type=\"text/javascript\">\r\n";
164
- echo "<!--\r\n";
165
- echo "function setAll(theElement) {\r\n";
166
- echo " var theForm = theElement.form, z = 0;\r\n";
167
- echo " for(z=0; z<theForm.length;z++){\r\n";
168
- echo " if(theForm[z].type == 'checkbox' && theForm[z].name == 'category[]'){\r\n";
169
- echo " theForm[z].checked = theElement.checked;\r\n";
170
- echo " }\r\n";
171
- echo " }\r\n";
172
- echo "}\r\n";
173
- echo "-->\r\n";
174
- echo "</script>\r\n";
175
  }
176
 
177
- function add_weekly_sched($sched) {
178
- $sched['weekly'] = array('interval' => 604800, 'display' => __('Once Weekly','subscribe2'));
179
- return $sched;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
  }
181
 
182
  /* ===== Install, upgrade, reset ===== */
@@ -185,7 +143,7 @@ class subscribe2 {
185
  */
186
  function install() {
187
  // include upgrade-functions for maybe_create_table;
188
- if (!function_exists('maybe_create_table')) {
189
  require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
190
  }
191
  $date = date('Y-m-d');
@@ -208,21 +166,23 @@ class subscribe2 {
208
  global $wpdb;
209
 
210
  // include upgrade-functions for maybe_create_table;
211
- if (!function_exists('maybe_create_table')) {
212
  require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
213
  }
214
  $date = date('Y-m-d');
215
  maybe_add_column($this->public, 'date', "ALTER TABLE `$this->public` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active`;");
216
 
217
  // let's take the time to check process registered users
218
- // existing public subscribers are subscribed to all categories
219
  $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
220
- if (!empty($users)) {
221
  foreach ($users as $user) {
222
  $this->register($user);
223
  }
224
  }
225
  // update the options table to serialized format
 
 
226
  $old_options = $wpdb->get_col("SELECT option_name from $wpdb->options where option_name LIKE 's2%' AND option_name != 's2_future_posts'");
227
 
228
  if (!empty($old_options)) {
@@ -234,8 +194,6 @@ class subscribe2 {
234
  }
235
  }
236
  $this->subscribe2_options['version'] = S2VERSION;
237
- //double check that the options are in the database
238
- require_once(ABSPATH . "/wp-content/plugins/subscribe2/include.php");
239
  update_option('subscribe2_options', $this->subscribe2_options);
240
  } // end upgrade()
241
 
@@ -246,7 +204,6 @@ class subscribe2 {
246
  delete_option('subscribe2_options');
247
  unset($this->subscribe2_options);
248
  require(ABSPATH . "/wp-content/plugins/subscribe2/include.php");
249
- update_option('subscribe2_options', $this->subscribe2_options);
250
  } // end reset()
251
 
252
  /* ===== mail handling ===== */
@@ -299,8 +256,8 @@ class subscribe2 {
299
 
300
  // BCC all recipients
301
  $bcc = '';
302
- if ( (defined('BCCLIMIT') && (BCCLIMIT > 0) ) &&
303
- (count($recipients) > BCCLIMIT) ) {
304
  // we're on Dreamhost, and have more than 30 susbcribers
305
  $count = 1;
306
  $batch = array();
@@ -310,7 +267,7 @@ class subscribe2 {
310
  next($recipients);
311
  $recipient = trim($recipient);
312
  // sanity check -- make sure we have a valid email
313
- if (!is_email($recipient)) { continue; }
314
  // and NOT the sender's email, since they'll
315
  // get a copy anyway
316
  if ( (! empty($recipient)) && ($this->myemail != $recipient) ) {
@@ -340,10 +297,10 @@ class subscribe2 {
340
  foreach ($recipients as $recipient) {
341
  $recipient = trim($recipient);
342
  // sanity check -- make sure we have a valid email
343
- if (!is_email($recipient)) { continue; }
344
  // and NOT the sender's email, since they'll
345
  // get a copy anyway
346
- if ( (!empty($recipient)) && ($this->myemail != $recipient) ) {
347
  ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ",\r\n $recipient";
348
  // Headers constructed as per definition at http://www.ietf.org/rfc/rfc2822.txt
349
  }
@@ -351,7 +308,7 @@ class subscribe2 {
351
  $headers .= "$bcc\r\n";
352
  }
353
  // actually send mail
354
- if ( (defined('BCCLIMIT')) && (BCCLIMIT > 0) && (isset($batch)) ) {
355
  foreach ($batch as $bcc) {
356
  $newheaders = $headers . "$bcc\r\n";
357
  @wp_mail($this->myemail, $subject, $mailtext, $newheaders);
@@ -364,18 +321,21 @@ class subscribe2 {
364
  /**
365
  Sends an email notification of a new post
366
  */
367
- function publish($id = 0) {
368
- if ( (!$id) || is_page($id) ) { return $id; }
369
 
370
  // are we doing daily digests? If so, don't send anything now
371
- if ($this->subscribe2_options['email_freq'] != 'never') { return; }
372
 
373
  // we need to determine whether this is a new post, or an edit
374
- if ($this->private) {
375
- // this post was published from draft status
376
- // OR is an edit of an existing post
377
- // so send no notification
378
- return $id;
 
 
 
379
  }
380
 
381
  $post_cats = wp_get_post_cats('1', $id);
@@ -399,16 +359,29 @@ class subscribe2 {
399
  }
400
 
401
  global $wpdb;
402
- $post =& get_post($id);
403
  // is this post set in the future?
404
  if ($post->post_date > current_time('mysql')) {
 
 
 
 
 
 
 
 
 
 
 
 
 
405
  // bail out
406
  return $id;
407
  }
408
 
409
  // lets collect our public subscribers
410
  // and all our registered subscribers for these categories
411
- if (!$check) {
412
  // if this post is assigned to an excluded
413
  // category, then this test will prevent
414
  // the public from receiving notification
@@ -417,7 +390,7 @@ class subscribe2 {
417
  $registered = $this->get_registered("cats=$post_cats_string");
418
 
419
  // do we have subscribers?
420
- if ( (empty($public)) && (empty($registered)) ) {
421
  // if not, no sense doing anything else
422
  return $id;
423
  }
@@ -459,7 +432,7 @@ class subscribe2 {
459
  // no <!--more-->, so grab the first 55 words
460
  $excerpt = strip_tags($plaintext);
461
  $excerpt_length = 55;
462
- $words = explode(' ', $excerpt, $excerpt_length + 1);
463
  if (count($words) > $excerpt_length) {
464
  array_pop($words);
465
  array_push($words, '[...]');
@@ -517,11 +490,11 @@ class subscribe2 {
517
  */
518
  function send_confirm($what = '', $is_remind = FALSE) {
519
  if ($this->filtered == 1) { return; }
520
- if ( (!$this->email) || (!$what) ) {
521
  return false;
522
  }
523
  $id = $this->get_id($this->email);
524
- if (!$id) {
525
  return false;
526
  }
527
 
@@ -541,7 +514,7 @@ class subscribe2 {
541
 
542
  $admin = get_userdata(1);
543
  $this->myname = $admin->display_name;
544
-
545
  if ($is_remind == TRUE) {
546
  $body = $this->substitute(stripslashes($this->subscribe2_options['remind_email']));
547
  $subject = stripslashes($this->remind_subject);
@@ -605,7 +578,7 @@ class subscribe2 {
605
  function get_email ($id = 0) {
606
  global $wpdb;
607
 
608
- if (!$id) {
609
  return false;
610
  }
611
  return $wpdb->get_var("SELECT email FROM $this->public WHERE id=$id");
@@ -617,7 +590,7 @@ class subscribe2 {
617
  function get_id ($email = '') {
618
  global $wpdb;
619
 
620
- if (!$email) {
621
  return false;
622
  }
623
  return $wpdb->get_var("SELECT id FROM $this->public WHERE email='$email'");
@@ -662,7 +635,7 @@ class subscribe2 {
662
  }
663
  }
664
 
665
- if (!is_email($email)) { return false; }
666
 
667
  if (false !== $this->is_public($email)) {
668
  $wpdb->get_results("UPDATE $this->public SET date=NOW() WHERE email='$email'");
@@ -685,7 +658,7 @@ class subscribe2 {
685
  }
686
  }
687
 
688
- if (!is_email($email)) { return false; }
689
  $wpdb->get_results("DELETE FROM $this->public WHERE email='$email'");
690
  } // end delete()
691
 
@@ -718,7 +691,7 @@ class subscribe2 {
718
  $this->myname = $admin->display_name;
719
 
720
  $recipients = explode(",", $emails);
721
- if (!is_array($recipients)) { $recipients = array(); }
722
  foreach ($recipients as $recipient) {
723
  $this->email = $recipient;
724
  $this->send_confirm('add', TRUE);
@@ -857,11 +830,11 @@ class subscribe2 {
857
  $subscribers = array();
858
 
859
  parse_str($args, $r);
860
- if (!isset($r['cats']))
861
  $r['cats'] = '';
862
- if (!isset($r['format']))
863
  $r['format'] = 'all';
864
- if (!isset($r['amount']))
865
  $r['amount'] = 'all';
866
 
867
  $JOIN = ''; $AND = '';
@@ -911,7 +884,7 @@ class subscribe2 {
911
  if ('' == $email) { return false; }
912
 
913
  global $wpdb;
914
- if (!empty($this->signup_dates)) {
915
  return $this->signup_dates[$email];
916
  } else {
917
  $results = $wpdb->get_results("SELECT email, date FROM $this->public", ARRAY_N);
@@ -931,18 +904,14 @@ class subscribe2 {
931
 
932
  if (0 == $user_id) { return $user_id; }
933
  $user = get_userdata($user_id);
934
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
935
- foreach ($all_cats as $cat) {
936
- ('' == $cats) ? $cats = "$cat->cat_ID" : $cats .= ",$cat->cat_ID";
937
- }
938
 
939
  // has this user previously signed up for email notification?
940
  if (false !== $this->is_public($user->user_email)) {
941
  // delete this user from the public table, and subscribe them to all the categories
942
  $this->delete($user->user_email);
943
- update_usermeta($user_id, 's2_subscribed', $cats);
944
- foreach(explode(',', $cats) as $cat) {
945
- update_usermeta($user_id, 's2_cat' . $all_cats->cat_ID, "$all_cats->cat_ID");
946
  }
947
  update_usermeta($user_id, 's2_format', 'text');
948
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
@@ -951,23 +920,26 @@ class subscribe2 {
951
  $check = get_usermeta($user_id, 's2_subscribed');
952
  // ensure existing subscriptions are not overwritten on upgrade
953
  if (empty($check)) {
954
- if ('yes' == $this->subscribe2_options['autosub']) {
955
- // don't add entires by default if autosub is off, messes up daily digests
956
  update_usermeta($user_id, 's2_subscribed', $this->get_all_categories());
957
  foreach(explode(',', $this->get_all_categories()) as $cat) {
958
  update_usermeta($user_id, 's2_cat' . $cat, "$cat");
959
  }
960
- if ('html' == $this->subscribe2_options['autoformat']) {
961
  update_usermeta($user_id, 's2_format', 'html');
962
  update_usermeta($user_id, 's2_excerpt', 'post');
963
- } elseif ('fulltext' == $this->subscribe2_options['autoformat']) {
964
  update_usermeta($user_id, 's2_format', 'text');
965
  update_usermeta($user_id, 's2_excerpt', 'post');
966
  } else {
967
  update_usermeta($user_id, 's2_format', 'text');
968
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
969
  }
970
- }
 
 
 
 
971
  }
972
  }
973
  return $user_id;
@@ -977,7 +949,7 @@ class subscribe2 {
977
  Subscribe all registered users to category selected on Admin Manage Page
978
  */
979
  function subscribe_registered_users ($emails = '', $cats = '') {
980
- if ( ('' == $emails) || ('' == $cats) ) { return false; }
981
  global $wpdb;
982
 
983
  $useremails = explode(",", $emails);
@@ -986,17 +958,17 @@ class subscribe2 {
986
  $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
987
  $user_IDs = $wpdb->get_col($sql);
988
  $cats = $_POST['category'];
989
- if (!is_array($cats)) {
990
  $cats = array($_POST['category']);
991
  }
992
 
993
  foreach ($user_IDs as $user_ID) {
994
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
995
- if (!is_array($old_cats)) {
996
  $old_cats = array($old_cats);
997
  }
998
  $new = array_diff($cats, $old_cats);
999
- if (!empty($new)) {
1000
  // add subscription to these cat IDs
1001
  foreach ($new as $id) {
1002
  update_usermeta($user_ID, 's2_cat' . $id, "$id");
@@ -1011,7 +983,7 @@ class subscribe2 {
1011
  Unsubscribe all registered users to category selected on Admin Manage Page
1012
  */
1013
  function unsubscribe_registered_users ($emails = '', $cats = '') {
1014
- if ( ('' == $emails) || ('' == $cats) ) { return false; }
1015
  global $wpdb;
1016
 
1017
  $useremails = explode(",", $emails);
@@ -1020,17 +992,17 @@ class subscribe2 {
1020
  $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
1021
  $user_IDs = $wpdb->get_col($sql);
1022
  $cats = $_POST['category'];
1023
- if (!is_array($cats)) {
1024
  $cats = array($_POST['category']);
1025
  }
1026
 
1027
  foreach ($user_IDs as $user_ID) {
1028
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1029
- if (!is_array($old_cats)) {
1030
  $old_cats = array($old_cats);
1031
  }
1032
  $remain = array_diff($old_cats, $cats);
1033
- if (!empty($remain)) {
1034
  // remove subscription to these cat IDs and update s2_subscribed
1035
  foreach ($cats as $id) {
1036
  delete_usermeta($user_ID, 's2_cat' . $id, "$id");
@@ -1059,7 +1031,7 @@ class subscribe2 {
1059
 
1060
  foreach ($user_IDs as $user_ID) {
1061
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1062
- if (!is_array($old_cats)) {
1063
  $old_cats = array($old_cats);
1064
  }
1065
  // add subscription to these cat IDs
@@ -1074,20 +1046,19 @@ class subscribe2 {
1074
  Our management page
1075
  */
1076
  function manage_menu() {
1077
- global $wpdb, $s2nonce;
1078
 
1079
  //Get Registered Subscribers for bulk management
1080
  $registered = $this->get_registered();
1081
- if (!empty($registered)) {
1082
  $emails = implode(",", $registered);
1083
  }
1084
 
1085
  $what = '';
1086
- $reminderform = false;
1087
 
1088
  // was anything POSTed ?
1089
  if (isset($_POST['s2_admin'])) {
1090
- check_admin_referer('subscribe2-manage_subscribers' . $s2nonce);
1091
  if ('subscribe' == $_POST['s2_admin']) {
1092
  foreach (preg_split ("/[\s,]+/", $_POST['addresses']) as $email) {
1093
  if (is_email($email)) {
@@ -1138,7 +1109,7 @@ class subscribe2 {
1138
  $subscribers = $unconfirmed;
1139
  if (!empty($unconfirmed)) {
1140
  $reminderemails = implode(",", $unconfirmed);
1141
- $reminderform = true;
1142
  }
1143
  } elseif (is_numeric($_POST['what'])) {
1144
  $what = intval($_POST['what']);
@@ -1155,7 +1126,7 @@ class subscribe2 {
1155
  $confirmed = $this->get_public();
1156
  $subscribers = $confirmed;
1157
  $what = 'confirmed';
1158
- if (empty($subscribers)) {
1159
  $unconfirmed = $this->get_public(0);
1160
  $subscribers = $unconfirmed;
1161
  $what = 'unconfirmed';
@@ -1177,9 +1148,6 @@ class subscribe2 {
1177
  echo "<div class=\"wrap\">";
1178
  echo "<h2>" . __('Subscribe Addresses', 'subscribe2') . "</h2>\r\n";
1179
  echo "<form method=\"post\" action=\"\">\r\n";
1180
- if (function_exists('wp_nonce_field')) {
1181
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1182
- }
1183
  echo "<span style=\"align:left\">" . __('Enter addresses, one per line or comma-seperated', 'subscribe2') . "</span><br />\r\n";
1184
  echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea>";
1185
  echo "<span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Subscribe', 'subscribe2') . "\"/>";
@@ -1196,14 +1164,7 @@ class subscribe2 {
1196
  echo "<p align=\"center\"><b>" . __('Registered on the left, confirmed in the middle, unconfirmed on the right', 'subscribe2') . "</b></p>";
1197
  if (is_writable(ABSPATH . '/wp-content')) {
1198
  $exportcsv = implode(",", $subscribers);
1199
- echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1200
- if (function_exists('wp_nonce_field')) {
1201
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1202
- }
1203
- echo "<input type=\"hidden\" name=\"exportcsv\" value=\"$exportcsv\" />\r\n";
1204
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"exportcsv\" />\r\n";
1205
- echo "<input type=\"submit\" name=\"submit\" value=\"" . __('Save Emails to CSV File','subscribe2') . "\" />\r\n";
1206
- echo "</form></span>\r\n";
1207
  }
1208
  }
1209
  echo "<table cellpadding=\"2\" cellspacing=\"2\">";
@@ -1220,29 +1181,11 @@ class subscribe2 {
1220
  }
1221
  echo "<a href=\"mailto:$subscriber\">$subscriber</a>\r\n";
1222
  if (in_array($subscriber, $unconfirmed) || in_array($subscriber, $confirmed) ) {
1223
- echo "(" . $this->signup_date($subscriber) . ")</td>\r\n";
1224
- echo "<td width=\"5%\" align=\"center\">\r\n";
1225
- echo "<form method=\"post\" action=\"\">";
1226
- if (function_exists('wp_nonce_field')) {
1227
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1228
- }
1229
- echo "<input type=\"hidden\" name=\"email\" value=\"$subscriber\" />\r\n";
1230
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"toggle\" />\r\n";
1231
- echo "<input type=\"hidden\" name=\"what\" value=\"$what\" />\r\n";
1232
- echo "<input type=\"submit\" name=\"submit\" value=\"";
1233
  (in_array($subscriber, $unconfirmed)) ? $foo = '&lt;-' : $foo= '-&gt;';
1234
- echo "$foo\" /></form></td>\r\n";
1235
- echo "<td width=\"2%\" align=\"center\">\r\n";
1236
- echo "<form method=\"post\" action=\"\">\r\n";
1237
- if (function_exists('wp_nonce_field')) {
1238
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1239
- }
1240
- echo "<span class=\"delete\">\r\n";
1241
- echo "<input type=\"hidden\" name=\"email\" value=\"$subscriber\" />\r\n";
1242
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"delete\" />\r\n";
1243
- echo "<input type=\"hidden\" name=\"what\" value=\"$what\" />\r\n";
1244
- echo "<input type=\"submit\" name=\"submit\" value=\"X\" />\r\n";
1245
- echo "</span></form>";
1246
  }
1247
  echo "</td></tr>\r\n";
1248
  ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
@@ -1251,16 +1194,7 @@ class subscribe2 {
1251
  echo "<tr><td align=\"center\"><b>" . __('NONE', 'subscribe2') . "</b></td></tr>\r\n";
1252
  }
1253
  echo "</table>";
1254
- if ($reminderform) {
1255
- echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1256
- if (function_exists('wp_nonce_field')) {
1257
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1258
- }
1259
- echo "<input type=\"hidden\" name=\"reminderemails\" value=\"$reminderemails\" />\r\n";
1260
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"remind\" />\r\n";
1261
- echo "<input type=\"submit\" name=\"submit\" value=\"" . __('Send Reminder Email','subscribe2') . "\" />\r\n";
1262
- echo "</form></span>";
1263
- }
1264
  echo "</div>\r\n";
1265
 
1266
  //show bulk managment form
@@ -1268,12 +1202,8 @@ class subscribe2 {
1268
  echo "<h2 >" . __('Categories', 'subscribe2') . "</h2>\r\n";
1269
  echo __('Existing Registered Users can be automatically (un)subscribed to categories using this section.', 'subscribe2') . "<br />\r\n";
1270
  echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
1271
- echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1272
- if (function_exists('wp_nonce_field')) {
1273
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1274
- }
1275
- echo "<input type=\"hidden\" name=\"emails\" value=\"$emails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"register\" />";
1276
- $this->display_category_form();
1277
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Subscribe','subscribe2') . "\" />";
1278
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Unsubscribe','subscribe2') . "\" /></form></span>";
1279
 
@@ -1289,11 +1219,8 @@ class subscribe2 {
1289
  Our options page
1290
  */
1291
  function options_menu() {
1292
- global $s2nonce;
1293
-
1294
  // was anything POSTed?
1295
  if (isset($_POST['s2_admin'])) {
1296
- check_admin_referer('subscribe2-options_subscribers' . $s2nonce);
1297
  if ('RESET' == $_POST['s2_admin']) {
1298
  $this->reset();
1299
  echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_reset</p></strong></div>";
@@ -1304,7 +1231,7 @@ class subscribe2 {
1304
  } else {
1305
  $exclude_cats = '';
1306
  }
1307
- $this->subscribe2_options['exclude'] = $exclude_cats;
1308
  // allow override?
1309
  (isset($_POST['reg_override'])) ? $override = '1' : $override = '0';
1310
  $this->subscribe2_options['reg_override'] = $override;
@@ -1318,77 +1245,51 @@ class subscribe2 {
1318
  if ('admin' == $_POST['sender']) {
1319
  $sender = 'admin';
1320
  }
1321
- $this->subscribe2_options['sender'] = $sender;
1322
-
1323
- // send per-post or digest emails
1324
- $email_freq = $_POST['email_freq'];
1325
- $this->subscribe2_options['email_freq'] = $email_freq;
1326
- wp_clear_scheduled_hook('s2_digest_cron');
1327
- $scheds = (array) wp_get_schedules();
1328
- $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int) $scheds[$email_freq]['interval'] : 0;
1329
- if ($interval == 0) {
1330
- // if we are on per-post emails remove last_cron entry
1331
- unset($this->subscribe2_options['last_s2cron']);
1332
- } else {
1333
- if (!wp_next_scheduled('s2_digest_cron')) {
1334
- // if we are using digest schedule the event and prime last_cron as now
1335
- wp_schedule_event(time() + $interval, $email_freq, 's2_digest_cron');
1336
- $now = date('Y-m-d H:i:s', time());
1337
- $this->subscribe2_options['last_s2cron'] = $now;
1338
- }
1339
- }
1340
 
1341
  // email templates
1342
  $mailtext = $_POST['mailtext'];
1343
- $this->subscribe2_options['mailtext'] = $mailtext;
1344
  $confirm_email = $_POST['confirm_email'];
1345
- $this->subscribe2_options['confirm_email'] = $confirm_email;
1346
  $remind_email = $_POST['remind_email'];
1347
- $this->subscribe2_options['remind_email'] = $remind_email;
1348
 
1349
  //automatic subscription
1350
  $autosub_option = $_POST['autosub'];
1351
- $this->subscribe2_options['autosub']= $autosub_option;
1352
  $autosub_format_option = $_POST['autoformat'];
1353
- $this->subscribe2_options['autoformat']= $autosub_format_option;
1354
 
1355
  //barred domains
1356
  $barred_option = $_POST['barred'];
1357
- $this->subscribe2_options['barred'] = $barred_option;
1358
  echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_saved</p></strong></div>";
1359
- update_option('subscribe2_options', $this->subscribe2_options);
1360
  }
1361
  }
1362
  // show our form
1363
  echo "<div class=\"wrap\">";
1364
- echo "<form method=\"post\" action=\"\">\r\n";
1365
- if (function_exists('wp_nonce_field')) {
1366
- wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
1367
- }
1368
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"options\" />\r\n";
1369
- echo "<h2>" . __('Delivery Options', 'subscribe2') . ":</h2>\r\n";
1370
  echo __('Send Email From', 'subscribe2') . ': ';
1371
- echo "<input type=\"radio\" name=\"sender\" value=\"author\"";
1372
  if ('author' == $this->subscribe2_options['sender']) {
1373
  echo "checked=\"checked\" ";
1374
  }
1375
  echo " /> " . __('Author of the post', 'subscribe2') . " &nbsp;&nbsp;";
1376
- echo "<input type=\"radio\" name=\"sender\" value=\"admin\"";
1377
  if ('admin' == $this->subscribe2_options['sender']) {
1378
  echo "checked=\"checked\" ";
1379
  }
1380
- echo " /> " . __('Blog Admin', 'subscribe2') . "<br /><br />\r\n";
1381
- if (function_exists('wp_schedule_event')) {
1382
- echo __('Send Email as Digest', 'subscribe2') . ": <br /><br />\r\n";
1383
- $this->display_digest_choices();
1384
- echo "<br />\r\n";
1385
- }
1386
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1387
- echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
1388
  echo "<tr><td>";
1389
  echo __('New Post email (must not be empty)', 'subscribe2') . ":";
1390
  echo "<br />\r\n";
1391
- echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
1392
  echo "</td><td valign=\"top\" rowspan=\"3\">";
1393
  echo "<h3>" . __('Message substitions', 'subscribe2') . "</h3>\r\n";
1394
  echo "<dl>";
@@ -1404,38 +1305,38 @@ class subscribe2 {
1404
  echo "<dt><b>ACTION</b></dt><dd>" . __("Action performed by LINK in confirmation email<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
1405
  echo "</dl></td></tr><tr><td>";
1406
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
1407
- echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea><br /><br />\r\n";
1408
- echo "</td></tr><tr valign=\"top\"><td>";
1409
  echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
1410
- echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
1411
- echo "</td></tr></table><br />\r\n";
1412
 
1413
  // excluded categories
1414
  echo "<h2>" . __('Excluded Categories', 'subscribe2') . "</h2>\r\n";
1415
  $this->display_category_form(explode(',', $this->get_excluded_cats()));
1416
- echo "<center><input type=\"checkbox\" name=\"reg_override\" value=\"1\"";
1417
  if ('1' == $this->subscribe2_options['reg_override']) {
1418
- echo " checked=\"checked\"";
1419
  }
1420
- echo " /> " . __('Allow registered users to subscribe to excluded categories?', 'subscribe2') . "</center><br />\r\n";
1421
  echo "<h2>" . __('Writing Options', 'subscribe2') . "</h2>\r\n";
1422
- echo "<input type=\"checkbox\" name=\"show_button\" value=\"1\"";
1423
  if ('1' == $this->subscribe2_options['show_button']) {
1424
- echo " checked=\"checked\"";
1425
  }
1426
- echo " /> " . __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "<br /><br />\r\n";
1427
 
1428
  //Auto Subscription for new registrations
1429
  echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
1430
  echo __('Automatically subscribe new users registering with your blog.', 'subscribe2') . "<br />\r\n";
1431
- echo "<input type=\"radio\" name=\"autosub\" value=\"yes\"";
1432
  if ('yes' == $this->subscribe2_options['autosub']) {
1433
- echo " checked=\"checked\"";
1434
  }
1435
  echo " /> " . __('Yes', 'subscribe2') . " &nbsp;&nbsp;";
1436
- echo "<input type=\"radio\" name=\"autosub\" value=\"no\"";
1437
  if ('no' == $this->subscribe2_options['autosub']) {
1438
- echo " checked=\"checked\"";
1439
  }
1440
  echo " /> " . __('No', 'subscribe2') . "<br /><br />\r\n";
1441
  echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
@@ -1453,12 +1354,12 @@ class subscribe2 {
1453
  if ('text' == $this->subscribe2_options['autoformat']) {
1454
  echo "checked=\"checked\" ";
1455
  }
1456
- echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . " <br /><br />";
1457
 
1458
  //barred domains
1459
  echo "<h2>" . __('Barred Domains', 'subscribe2') . "</h2>\r\n";
1460
  echo __('Enter domains to bar from public subscriptions: <br /> (Use a new line for each entry and omit the "@" symbol, for example email.com)', 'subscribe2');
1461
- echo "<br />\r\n<textarea style=\"width: 98%;\" rows=\"4\" cols=\"60\" name=\"barred\">" . $this->subscribe2_options['barred'] . "</textarea>";
1462
 
1463
  // submit
1464
  echo "<p align=\"center\"><span class=\"submit\"><input type=\"submit\" id=\"save\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></span></p>";
@@ -1469,9 +1370,6 @@ class subscribe2 {
1469
  echo "<h2>" . __('Reset Default', 'subscribe2') . "</h2>\r\n";
1470
  echo "<p>" . __('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2') . "</p>\r\n";
1471
  echo "<form method=\"post\" action=\"\">";
1472
- if (function_exists('wp_nonce_field')) {
1473
- wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
1474
- }
1475
  echo "<p align=\"center\"><span class=\"submit\">";
1476
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"RESET\" />";
1477
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('RESET', 'subscribe2') .
@@ -1487,13 +1385,12 @@ class subscribe2 {
1487
  Our profile menu
1488
  */
1489
  function user_menu() {
1490
- global $user_ID, $s2nonce;
1491
 
1492
  get_currentuserinfo();
1493
 
1494
  // was anything POSTed?
1495
  if ( (isset($_POST['s2_admin'])) && ('user' == $_POST['s2_admin']) ) {
1496
- check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
1497
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Subscription preferences updated.', 'subscribe2') . "</strong></p></div>\n";
1498
  $format = 'text';
1499
  $post = 'post';
@@ -1515,21 +1412,21 @@ class subscribe2 {
1515
  delete_usermeta($user_ID, "s2_cat" . $cat);
1516
  }
1517
  }
1518
- delete_usermeta($user_ID, 's2_subscribed');
1519
  } else {
1520
- if (!is_array($cats)) {
1521
  $cats = array($_POST['category']);
1522
  }
1523
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1524
  $remove = array_diff($old_cats, $cats);
1525
  $new = array_diff($cats, $old_cats);
1526
- if (!empty($remove)) {
1527
  // remove subscription to these cat IDs
1528
  foreach ($remove as $id) {
1529
  delete_usermeta($user_ID, "s2_cat" .$id);
1530
  }
1531
  }
1532
- if (!empty($new)) {
1533
  // add subscription to these cat IDs
1534
  foreach ($new as $id) {
1535
  update_usermeta($user_ID, 's2_cat' . $id, "$id");
@@ -1543,11 +1440,8 @@ class subscribe2 {
1543
  echo "<div class=\"wrap\">";
1544
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
1545
  echo "<form method=\"post\" action=\"\">";
1546
- if (function_exists('wp_nonce_field')) {
1547
- wp_nonce_field('subscribe2-user_subscribers' . $s2nonce);
1548
- }
1549
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"user\" />";
1550
- if ($this->subscribe2_options['email_freq'] == 'never') {
1551
  echo __('Receive email as', 'subscribe2') . ": &nbsp;&nbsp;";
1552
  echo "<input type=\"radio\" name=\"s2_format\" value=\"html\"";
1553
  if ('html' == get_usermeta($user_ID, 's2_format')) {
@@ -1571,9 +1465,9 @@ class subscribe2 {
1571
  }
1572
  echo "<p style=\"color: red\">" . __('Note: HTML format will always deliver the full post.', 'subscribe2') . "</p>\r\n";
1573
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
1574
- echo "<input type=\"radio\" name=\"new_category\" value=\"yes\" ";
1575
- if ('yes' == get_usermeta($user_ID, 's2_autosub')) {
1576
- echo "checked=\"yes\" ";
1577
  }
1578
  echo "/> Yes <input type=\"radio\" name=\"new_category\" value=\"no\" ";
1579
  if ('no' == get_usermeta($user_ID, 's2_autosub')) {
@@ -1588,9 +1482,9 @@ class subscribe2 {
1588
  // we're doing daily digests, so just show
1589
  // subscribe / unnsubscribe
1590
  echo __('Receive daily summary of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
1591
- echo "<input type=\"radio\" name=\"category\" value=\"1\" ";
1592
- if (get_usermeta($user_ID, 's2_subscribed')) {
1593
- echo "checked=\"yes\" ";
1594
  }
1595
  echo "/> Yes <input type=\"radio\" name=\"category\" value=\"\" ";
1596
  if (! get_usermeta($user_ID, 's2_subscribed')) {
@@ -1612,11 +1506,8 @@ class subscribe2 {
1612
  Display the Write sub-menu
1613
  */
1614
  function write_menu() {
1615
- global $wpdb, $s2nonce;
1616
-
1617
  // was anything POSTed?
1618
  if (isset($_POST['s2_admin']) && ('mail' == $_POST['s2_admin']) ) {
1619
- check_admin_referer('subscribe2-write_subscribers' . $s2nonce);
1620
  if ('confirmed' == $_POST['what']) {
1621
  $recipients = $this->get_public();
1622
  } elseif ('unconfirmed' == $_POST['what']) {
@@ -1647,9 +1538,6 @@ class subscribe2 {
1647
  // show our form
1648
  echo "<div class=\"wrap\"><h2>" . __('Send email to all subscribers', 'subscribe2') . "</h2>\r\n";
1649
  echo "<form method=\"post\" action=\"\">\r\n";
1650
- if (function_exists('wp_nonce_field')) {
1651
- wp_nonce_field('subscribe2-write_subscribers' . $s2nonce);
1652
- }
1653
  echo __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" name=\"subject\" value=\"" . __('A message from ', 'subscribe2') . get_settings('blogname') . "\" /> <br />";
1654
  echo "<textarea rows=\"12\" cols=\"75\" name=\"message\"></textarea>";
1655
  echo "<br />\r\n";
@@ -1668,13 +1556,13 @@ class subscribe2 {
1668
  /* ===== helper functions: forms and stuff ===== */
1669
  /**
1670
  Display a table of categories with checkboxes
 
1671
  Optionally pre-select those categories specified
1672
  */
1673
  function display_category_form($selected = array(), $override = 1) {
1674
  global $wpdb;
1675
 
1676
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1677
-
1678
  if (0 == $override) {
1679
  // registered users are not allowed to subscribe to
1680
  // excluded categories
@@ -1688,34 +1576,30 @@ class subscribe2 {
1688
  $half = (count($all_cats) / 2);
1689
  $i = 0;
1690
  $j = 0;
1691
- echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
1692
- echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
1693
- foreach ($all_cats as $cat) {
1694
  if ( ($i >= $half) && (0 == $j) ){
1695
- echo "</td><td width=\"50%\" align=\"left\">\r\n";
1696
  $j++;
1697
  }
1698
  if (0 == $j) {
1699
- echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1700
- if (in_array($cat->cat_ID, $selected)) {
1701
  echo " checked=\"checked\" ";
1702
  }
1703
- echo " /> " . $cat->cat_name . "<br />\r\n";
1704
  } else {
1705
 
1706
- echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1707
- if (in_array($cat->cat_ID, $selected)) {
1708
  echo " checked=\"checked\" ";
1709
  }
1710
- echo " /> " . $cat->cat_name . "<br />\r\n";
1711
  }
1712
  $i++;
1713
  }
1714
- echo "</td></tr>\r\n";
1715
- echo "<tr><td align=\"left\">\r\n";
1716
- echo "<input type=\"checkbox\" name=\"checkall\" onclick=\"setAll(this)\" /> " . __('Select / Unselect All' ,'subscribe2') . "\r\n";
1717
- echo "</td></tr>\r\n";
1718
- echo "</table>\r\n";
1719
  } // end display_category_form()
1720
 
1721
  /**
@@ -1732,8 +1616,6 @@ class subscribe2 {
1732
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
1733
  'registered' => __('Registered Subscribers', 'subscribe2'));
1734
 
1735
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1736
-
1737
  // count the number of subscribers
1738
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
1739
  $count['unconfirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='0'");
@@ -1746,8 +1628,8 @@ class subscribe2 {
1746
  }
1747
  $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='s2_subscribed'");
1748
  $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
1749
- foreach ($all_cats as $cat) {
1750
- $count[$cat->cat_name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='s2_cat$cat->cat_ID'");
1751
  }
1752
 
1753
  // do have actually have some subscribers?
@@ -1764,17 +1646,18 @@ class subscribe2 {
1764
  if (in_array($whom, $exclude)) { continue; }
1765
  if (0 == $count[$whom]) { continue; }
1766
 
1767
- echo "<option value=\"" . $whom . "\"";
1768
  if ($whom == $selected) { echo " selected=\"selected\" "; }
1769
  echo ">$display (" . ($count[$whom]) . ")</option>\r\n";
1770
  }
1771
 
1772
  if ($count['registered'] > 0) {
1773
- foreach ($all_cats as $cat) {
1774
- if (in_array($cat->cat_ID, $exclude)) { continue; }
1775
- echo "<option value=\"" . $cat->cat_ID . "\"";
1776
- if ($cat->cat_ID == $selected) { echo " selected=\"selected\" "; }
1777
- echo "> &nbsp;&nbsp;" . $cat->cat_name . "&nbsp;(" . $count[$cat->cat_name] . ") </option>\r\n";
 
1778
  }
1779
  }
1780
  echo "</select>";
@@ -1783,51 +1666,22 @@ class subscribe2 {
1783
  }
1784
  } // end display_subscriber_dropdown()
1785
 
1786
- function display_digest_choices() {
1787
- global $wpdb;
1788
- $schedule = (array)wp_get_schedules();
1789
- $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('Per Post Email','subscribe2'))), $schedule);
1790
- $sort = array();
1791
- foreach ( (array)$schedule as $key => $value ) $sort[$key] = $value['interval'];
1792
- asort($sort);
1793
- $schedule_sorted = array();
1794
- foreach ($sort as $key => $value) {
1795
- $schedule_sorted[$key] = $schedule[$key];
1796
- }
1797
- foreach ($schedule_sorted as $key => $value) {
1798
- echo "<input type=\"radio\" name=\"email_freq\" value=\"" . $key . "\"";
1799
- if ($key == $this->subscribe2_options['email_freq']) {
1800
- echo " checked=\"checked\" ";
1801
- }
1802
- echo " /> " . $value['display'] . "<br />\r\n";
1803
- }
1804
- if (wp_next_scheduled('s2_digest_cron')) {
1805
- $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
1806
- echo "<p>" . __('Next email notification will be sent', 'subscribe2') . ": \r\n";
1807
- echo "<strong>" . gmdate($datetime, wp_next_scheduled('s2_digest_cron') + (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
1808
- }
1809
- } // end display_digest_choices()
1810
-
1811
  /* ===== template and filter functions ===== */
1812
  /**
1813
  Display our form; also handles (un)subscribe requests
1814
  */
1815
  function filter($content = '') {
1816
- if ( ('' == $content) || (! preg_match('|<!--subscribe2-->|', $content)) ) { return $content; }
1817
  $this->s2form = $this->form;
1818
 
1819
  global $user_ID;
1820
  get_currentuserinfo();
1821
  if ($user_ID) {
1822
- if (current_user_can('manage_options')) {
1823
- $this->s2form = $this->use_profile_admin;
1824
- } else {
1825
- $this->s2form = $this->use_profile_users;
1826
- }
1827
  }
1828
  if (isset($_POST['s2_action'])) {
1829
  global $wpdb, $user_email;
1830
- if (!is_email($_POST['email'])) {
1831
  $this->s2form = $this->form . $this->not_an_email;
1832
  } elseif ($this->is_barred($_POST['email'])) {
1833
  $this->s2form = $this->form . $this->barred_domain;
@@ -1885,7 +1739,7 @@ class subscribe2 {
1885
 
1886
  global $wpdb;
1887
 
1888
- if ( (defined('S2PAGE')) && (0 !== S2PAGE) ) {
1889
  return "page_id=" . S2PAGE;
1890
  } else {
1891
  $id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status='static' LIMIT 1");
@@ -1916,23 +1770,49 @@ class subscribe2 {
1916
  } // end template_filter()
1917
 
1918
  /* ===== wp-cron functions ===== */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1919
  /**
1920
  Send a daily digest of today's new posts
1921
  */
1922
- function subscribe2_cron() {
1923
  global $wpdb;
1924
 
1925
- // collect posts
1926
- $now = date('Y-m-d H:i:s', time());
1927
- $prev = $this->subscribe2_options['last_s2cron'];
1928
- $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content FROM $wpdb->posts WHERE post_date >= '$prev' AND post_date < '$now' AND post_status='publish' AND post_type='post'");
1929
 
1930
- // update last_s2cron execution time before completing or bailing
1931
- $this->subscribe2_options['last_s2cron'] = $now;
1932
- update_option('subscribe2_options', $this->subscribe2_options);
1933
-
1934
  // do we have any posts?
1935
- if (empty($posts)) { return; }
1936
 
1937
  // if we have posts, let's prepare the digest
1938
  foreach ($posts as $post) {
@@ -1974,6 +1854,7 @@ class subscribe2 {
1974
  }
1975
 
1976
  $author = get_userdata($post->post_author);
 
1977
 
1978
  // do we send as admin, or post author?
1979
  if ('author' == $this->subscribe2_options['sender']) {
@@ -1985,18 +1866,41 @@ class subscribe2 {
1985
  }
1986
  $this->myemail = $user->user_email;
1987
  $this->myname = $user->display_name;
1988
-
1989
- $scheds = (array) wp_get_schedules();
1990
- $email_freq = $this->subscribe2_options['email_freq'];
1991
- $display = $scheds[$email_freq]['display'];
1992
- $subject = '[' . stripslashes(get_settings('blogname')) . '] ' . $display . ' ' . __('Digest Email', 'subscribe2');
1993
  $public = $this->get_public();
1994
  $registered = $this->get_registered();
1995
  $recipients = array_merge((array)$public, (array)$registered);
1996
  $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
1997
  $body = str_replace('POST', $message, $mailtext);
1998
  $this->mail($recipients, $subject, $body);
1999
- } // end subscribe2_cron
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2000
 
2001
  /* ===== Our constructor ===== */
2002
  /**
@@ -2013,11 +1917,11 @@ class subscribe2 {
2013
 
2014
  // do we need to install anything?
2015
  $this->public = $table_prefix . "subscribe2";
2016
- if(mysql_query("SELECT COUNT(*) FROM ".$this->public)==FALSE) { $this->install(); }
2017
  //do we need to upgrade anything?
2018
  if ($this->subscribe2_options['version'] !== S2VERSION) {
2019
- $this->upgrade();
2020
- }
2021
 
2022
  if (isset($_GET['s2'])) {
2023
  // someone is confirming a request
@@ -2026,21 +1930,23 @@ class subscribe2 {
2026
  add_filter('the_content', array(&$this, 'confirm'));
2027
  }
2028
 
2029
- add_action('admin_head', array(&$this, 'admin_head'));
2030
  add_action('admin_menu', array(&$this, 'admin_menu'));
 
 
 
2031
  add_action('user_register', array(&$this, 'register'));
2032
  add_action('create_category', array(&$this, 'autosub_new_category'));
2033
  add_filter('the_content', array(&$this, 'filter'));
2034
- add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
2035
-
2036
- if ($this->subscribe2_options['email_freq'] != 'never') {
2037
- add_action('s2_digest_cron', array(&$this, 'subscribe2_cron'));
2038
- } else {
2039
- add_action('publish_post', array(&$this, 'publish'));
2040
- add_action('edit_post', array(&$this, 'edit'));
2041
- add_action('private_to_published', array(&$this, 'private2publish'));
 
2042
  }
2043
-
2044
  // load our strings
2045
  $this->load_strings();
2046
  } // end subscribe2()
@@ -2082,5 +1988,14 @@ class subscribe2 {
2082
  var $confirm_subject = '';
2083
  var $options_saved = '';
2084
  var $options_reset = '';
 
2085
  } // end class subscribe2
 
 
 
 
 
 
 
 
2086
  ?>
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 2.2.10
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
10
 
11
  /*
12
+ Copyright (C) 2006 Matthew Robinson
13
  Based on the Original Subscribe2 plugin by
14
  Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
15
 
29
  http://www.gnu.org/licenses/gpl.html
30
  */
31
 
32
+ // use Owen's excellent ButtonSnap library
33
+ include(ABSPATH . '/wp-content/plugins/buttonsnap.php');
34
+
35
+ // change this to TRUE if you're on Dreamhost
36
+ // (or any other host that limits the number of recipients
37
+ // permitted on each outgoing email message)
38
+ define('DREAMHOST', false);
39
 
40
  // by default, subscribe2 grabs the first page from your database for use
41
  // when displaying the confirmation screen to public subscribers.
42
  // You can override this by specifying a page ID below.
43
  define('S2PAGE', '0');
44
 
45
+ // change this to TRUE if you want a daily digest of the day's posts
46
+ // send to your subscribers
47
+ define('S2DIGEST', false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+ // our version number. Don't touch.
50
+ define('S2VERSION', '2.2.10');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
 
52
  // start our class
53
  class subscribe2 {
61
 
62
  $this->please_log_in = "<p>" . __('To manage your subscription options please ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-login.php\">login</a>.</p>";
63
 
64
+ $this->use_profile = "<p>" . __('You may manage your subscription options from your ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-admin/profile.php?page=" . plugin_basename(__FILE__) . "\">profile</a>.</p>";
 
 
65
 
66
  $this->confirmation_sent = "<p>" . __('A confirmation message is on its way!', 'subscribe2') . "</p>";
67
 
104
  function admin_menu() {
105
  add_management_page(__('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), "manage_options", __FILE__, array(&$this, 'manage_menu'));
106
  add_options_page(__('Subscribe2 Options', 'subscribe2'), __('Subscribe2','subscribe2'), "manage_options", __FILE__, array(&$this, 'options_menu'));
107
+ add_submenu_page('profile.php', __('Subscriptions', 'subscribe2'), __('Subscriptions', 'subscribe2'), "read", __FILE__, array(&$this, 'user_menu'));
108
+ add_submenu_page('post.php', __('Mail Subscribers','subscribe2'), __('Mail Subscribers', 'subscribe2'),"manage_options", __FILE__, array(&$this, 'write_menu'));
 
 
 
 
 
109
  }
110
 
111
+ /* ===== ButtonSnap configuration ===== */
112
  /**
113
+ Register our button in the QuickTags bar
114
  */
115
+ function s2_button_init() {
116
+ $url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_button.png';
117
+ buttonsnap_textbutton($url, 'Subscribe2', '<!--subscribe2-->');
118
+ buttonsnap_register_marker('subscribe2', 's2_marker');
 
 
 
 
 
 
 
 
 
119
  }
120
 
121
+ /**
122
+ Style a marker in the Rich Text Editor for our tag
123
+
124
+ By default, the RTE suppresses output of HTML comments, so this places a CSS style on our token in order to make it display
125
+ */
126
+ function subscribe2_css() {
127
+ $marker_url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_marker.png';
128
+ echo "
129
+ .s2_marker {
130
+ display: block;
131
+ height: 45px;
132
+ margin-top: 5px;
133
+ background-image: url({$marker_url});
134
+ background-repeat: no-repeat;
135
+ background-position: center;
136
+ }
137
+ ";
138
  }
139
 
140
  /* ===== Install, upgrade, reset ===== */
143
  */
144
  function install() {
145
  // include upgrade-functions for maybe_create_table;
146
+ if (! function_exists('maybe_create_table')) {
147
  require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
148
  }
149
  $date = date('Y-m-d');
166
  global $wpdb;
167
 
168
  // include upgrade-functions for maybe_create_table;
169
+ if (! function_exists('maybe_create_table')) {
170
  require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
171
  }
172
  $date = date('Y-m-d');
173
  maybe_add_column($this->public, 'date', "ALTER TABLE `$this->public` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active`;");
174
 
175
  // let's take the time to check process registered users
176
+ // existing public subscribers are subscribed to all categories
177
  $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
178
+ if (! empty($users)) {
179
  foreach ($users as $user) {
180
  $this->register($user);
181
  }
182
  }
183
  // update the options table to serialized format
184
+ // We'll deal with s2_future_posts another time
185
+ // TODO: Fix s2_future posts
186
  $old_options = $wpdb->get_col("SELECT option_name from $wpdb->options where option_name LIKE 's2%' AND option_name != 's2_future_posts'");
187
 
188
  if (!empty($old_options)) {
194
  }
195
  }
196
  $this->subscribe2_options['version'] = S2VERSION;
 
 
197
  update_option('subscribe2_options', $this->subscribe2_options);
198
  } // end upgrade()
199
 
204
  delete_option('subscribe2_options');
205
  unset($this->subscribe2_options);
206
  require(ABSPATH . "/wp-content/plugins/subscribe2/include.php");
 
207
  } // end reset()
208
 
209
  /* ===== mail handling ===== */
256
 
257
  // BCC all recipients
258
  $bcc = '';
259
+ if ( (defined('DREAMHOST') && true == DREAMHOST) &&
260
+ (count($recipients) > 30) ) {
261
  // we're on Dreamhost, and have more than 30 susbcribers
262
  $count = 1;
263
  $batch = array();
267
  next($recipients);
268
  $recipient = trim($recipient);
269
  // sanity check -- make sure we have a valid email
270
+ if (! is_email($recipient)) { continue; }
271
  // and NOT the sender's email, since they'll
272
  // get a copy anyway
273
  if ( (! empty($recipient)) && ($this->myemail != $recipient) ) {
297
  foreach ($recipients as $recipient) {
298
  $recipient = trim($recipient);
299
  // sanity check -- make sure we have a valid email
300
+ if (! is_email($recipient)) { continue; }
301
  // and NOT the sender's email, since they'll
302
  // get a copy anyway
303
+ if ( (! empty($recipient)) && ($this->myemail != $recipient) ) {
304
  ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ",\r\n $recipient";
305
  // Headers constructed as per definition at http://www.ietf.org/rfc/rfc2822.txt
306
  }
308
  $headers .= "$bcc\r\n";
309
  }
310
  // actually send mail
311
+ if ( (defined('DREAMHOST') && true == DREAMHOST) && (isset($batch)) ) {
312
  foreach ($batch as $bcc) {
313
  $newheaders = $headers . "$bcc\r\n";
314
  @wp_mail($this->myemail, $subject, $mailtext, $newheaders);
321
  /**
322
  Sends an email notification of a new post
323
  */
324
+ function publish($id = 0, $cron = 0) {
325
+ if (! $id) { return $id; }
326
 
327
  // are we doing daily digests? If so, don't send anything now
328
+ if ( defined('S2DIGEST') && true == S2DIGEST ) { return; }
329
 
330
  // we need to determine whether this is a new post, or an edit
331
+ if (0 == $cron) {
332
+ // we're not being called from WP-Cron
333
+ if ($this->private) {
334
+ // this post was published from draft status
335
+ // OR is an edit of an existing post
336
+ // so send no notification
337
+ return $id;
338
+ }
339
  }
340
 
341
  $post_cats = wp_get_post_cats('1', $id);
359
  }
360
 
361
  global $wpdb;
362
+ $post = & get_post($id);
363
  // is this post set in the future?
364
  if ($post->post_date > current_time('mysql')) {
365
+ // is wp-cron installed?
366
+ if (function_exists('wp_cron_init')) {
367
+ // are we doing daily digests?
368
+ if ( defined('S2DIGEST') && false == S2DIGEST ) {
369
+ // not doing daily digests, so
370
+ // add this post to the list of
371
+ // future posts
372
+ $our_post = array('id' => $id, 'date' => $post->post_date);
373
+ $future_posts = get_option('s2_future_posts');
374
+ $future_posts[] = $our_post;
375
+ update_option('s2_future_posts', $future_posts);
376
+ }
377
+ }
378
  // bail out
379
  return $id;
380
  }
381
 
382
  // lets collect our public subscribers
383
  // and all our registered subscribers for these categories
384
+ if (! $check) {
385
  // if this post is assigned to an excluded
386
  // category, then this test will prevent
387
  // the public from receiving notification
390
  $registered = $this->get_registered("cats=$post_cats_string");
391
 
392
  // do we have subscribers?
393
+ if ( empty($public) && empty($registered) ) {
394
  // if not, no sense doing anything else
395
  return $id;
396
  }
432
  // no <!--more-->, so grab the first 55 words
433
  $excerpt = strip_tags($plaintext);
434
  $excerpt_length = 55;
435
+ $words = explode(' ', $plaintext, $excerpt_length + 1);
436
  if (count($words) > $excerpt_length) {
437
  array_pop($words);
438
  array_push($words, '[...]');
490
  */
491
  function send_confirm($what = '', $is_remind = FALSE) {
492
  if ($this->filtered == 1) { return; }
493
+ if ( (! $this->email) || (! $what) ) {
494
  return false;
495
  }
496
  $id = $this->get_id($this->email);
497
+ if (! $id) {
498
  return false;
499
  }
500
 
514
 
515
  $admin = get_userdata(1);
516
  $this->myname = $admin->display_name;
517
+
518
  if ($is_remind == TRUE) {
519
  $body = $this->substitute(stripslashes($this->subscribe2_options['remind_email']));
520
  $subject = stripslashes($this->remind_subject);
578
  function get_email ($id = 0) {
579
  global $wpdb;
580
 
581
+ if (! $id) {
582
  return false;
583
  }
584
  return $wpdb->get_var("SELECT email FROM $this->public WHERE id=$id");
590
  function get_id ($email = '') {
591
  global $wpdb;
592
 
593
+ if (! $email) {
594
  return false;
595
  }
596
  return $wpdb->get_var("SELECT id FROM $this->public WHERE email='$email'");
635
  }
636
  }
637
 
638
+ if (! is_email($email)) { return false; }
639
 
640
  if (false !== $this->is_public($email)) {
641
  $wpdb->get_results("UPDATE $this->public SET date=NOW() WHERE email='$email'");
658
  }
659
  }
660
 
661
+ if (! is_email($email)) { return false; }
662
  $wpdb->get_results("DELETE FROM $this->public WHERE email='$email'");
663
  } // end delete()
664
 
691
  $this->myname = $admin->display_name;
692
 
693
  $recipients = explode(",", $emails);
694
+ if (! is_array($recipients)) { $recipients = array(); }
695
  foreach ($recipients as $recipient) {
696
  $this->email = $recipient;
697
  $this->send_confirm('add', TRUE);
830
  $subscribers = array();
831
 
832
  parse_str($args, $r);
833
+ if (! isset($r['cats']))
834
  $r['cats'] = '';
835
+ if (! isset($r['format']))
836
  $r['format'] = 'all';
837
+ if (! isset($r['amount']))
838
  $r['amount'] = 'all';
839
 
840
  $JOIN = ''; $AND = '';
884
  if ('' == $email) { return false; }
885
 
886
  global $wpdb;
887
+ if (! empty($this->signup_dates)) {
888
  return $this->signup_dates[$email];
889
  } else {
890
  $results = $wpdb->get_results("SELECT email, date FROM $this->public", ARRAY_N);
904
 
905
  if (0 == $user_id) { return $user_id; }
906
  $user = get_userdata($user_id);
 
 
 
 
907
 
908
  // has this user previously signed up for email notification?
909
  if (false !== $this->is_public($user->user_email)) {
910
  // delete this user from the public table, and subscribe them to all the categories
911
  $this->delete($user->user_email);
912
+ update_usermeta($user_id, 's2_subscribed', $this->get_all_categories());
913
+ foreach(explode(',', $this->get_all_categories()) as $cat) {
914
+ update_usermeta($user_id, 's2_cat' . $cat, "$cat");
915
  }
916
  update_usermeta($user_id, 's2_format', 'text');
917
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
920
  $check = get_usermeta($user_id, 's2_subscribed');
921
  // ensure existing subscriptions are not overwritten on upgrade
922
  if (empty($check)) {
923
+ if ('yes' == $this->subscribe2_options['s2_autosub']) {
 
924
  update_usermeta($user_id, 's2_subscribed', $this->get_all_categories());
925
  foreach(explode(',', $this->get_all_categories()) as $cat) {
926
  update_usermeta($user_id, 's2_cat' . $cat, "$cat");
927
  }
928
+ if ('html' == $this->subscribe2_options['s2_autoformat']) {
929
  update_usermeta($user_id, 's2_format', 'html');
930
  update_usermeta($user_id, 's2_excerpt', 'post');
931
+ } elseif ('fulltext' == $this->subscribe2_options['s2_autoformat']) {
932
  update_usermeta($user_id, 's2_format', 'text');
933
  update_usermeta($user_id, 's2_excerpt', 'post');
934
  } else {
935
  update_usermeta($user_id, 's2_format', 'text');
936
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
937
  }
938
+ } else {
939
+ update_usermeta($user_id, 's2_subscribed', '');
940
+ update_usermeta($user_id, 's2_format', 'text');
941
+ update_usermeta($user_id, 's2_excerpt', 'excerpt');
942
+ }
943
  }
944
  }
945
  return $user_id;
949
  Subscribe all registered users to category selected on Admin Manage Page
950
  */
951
  function subscribe_registered_users ($emails = '', $cats = '') {
952
+ if (('' == $emails) || ('' == $cats)) { return false; }
953
  global $wpdb;
954
 
955
  $useremails = explode(",", $emails);
958
  $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
959
  $user_IDs = $wpdb->get_col($sql);
960
  $cats = $_POST['category'];
961
+ if (! is_array($cats)) {
962
  $cats = array($_POST['category']);
963
  }
964
 
965
  foreach ($user_IDs as $user_ID) {
966
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
967
+ if (! is_array($old_cats)) {
968
  $old_cats = array($old_cats);
969
  }
970
  $new = array_diff($cats, $old_cats);
971
+ if (! empty($new)) {
972
  // add subscription to these cat IDs
973
  foreach ($new as $id) {
974
  update_usermeta($user_ID, 's2_cat' . $id, "$id");
983
  Unsubscribe all registered users to category selected on Admin Manage Page
984
  */
985
  function unsubscribe_registered_users ($emails = '', $cats = '') {
986
+ if (('' == $emails) || ('' == $cats)) { return false; }
987
  global $wpdb;
988
 
989
  $useremails = explode(",", $emails);
992
  $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
993
  $user_IDs = $wpdb->get_col($sql);
994
  $cats = $_POST['category'];
995
+ if (! is_array($cats)) {
996
  $cats = array($_POST['category']);
997
  }
998
 
999
  foreach ($user_IDs as $user_ID) {
1000
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1001
+ if (! is_array($old_cats)) {
1002
  $old_cats = array($old_cats);
1003
  }
1004
  $remain = array_diff($old_cats, $cats);
1005
+ if (! empty($remain)) {
1006
  // remove subscription to these cat IDs and update s2_subscribed
1007
  foreach ($cats as $id) {
1008
  delete_usermeta($user_ID, 's2_cat' . $id, "$id");
1031
 
1032
  foreach ($user_IDs as $user_ID) {
1033
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1034
+ if (! is_array($old_cats)) {
1035
  $old_cats = array($old_cats);
1036
  }
1037
  // add subscription to these cat IDs
1046
  Our management page
1047
  */
1048
  function manage_menu() {
1049
+ global $wpdb;
1050
 
1051
  //Get Registered Subscribers for bulk management
1052
  $registered = $this->get_registered();
1053
+ if(!empty($registered)) {
1054
  $emails = implode(",", $registered);
1055
  }
1056
 
1057
  $what = '';
1058
+ $reminderform = '';
1059
 
1060
  // was anything POSTed ?
1061
  if (isset($_POST['s2_admin'])) {
 
1062
  if ('subscribe' == $_POST['s2_admin']) {
1063
  foreach (preg_split ("/[\s,]+/", $_POST['addresses']) as $email) {
1064
  if (is_email($email)) {
1109
  $subscribers = $unconfirmed;
1110
  if (!empty($unconfirmed)) {
1111
  $reminderemails = implode(",", $unconfirmed);
1112
+ $reminderform = "<span class=\"submit\"><form method=\"post\" action=\"\"><input type=\"hidden\" name=\"reminderemails\" value=\"$reminderemails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"remind\" /><input type=\"submit\" name=\"submit\" value=\"" . __('Send Reminder Email','subscribe2') . "\" /></form></span>";
1113
  }
1114
  } elseif (is_numeric($_POST['what'])) {
1115
  $what = intval($_POST['what']);
1126
  $confirmed = $this->get_public();
1127
  $subscribers = $confirmed;
1128
  $what = 'confirmed';
1129
+ if (empty ($subscribers)) {
1130
  $unconfirmed = $this->get_public(0);
1131
  $subscribers = $unconfirmed;
1132
  $what = 'unconfirmed';
1148
  echo "<div class=\"wrap\">";
1149
  echo "<h2>" . __('Subscribe Addresses', 'subscribe2') . "</h2>\r\n";
1150
  echo "<form method=\"post\" action=\"\">\r\n";
 
 
 
1151
  echo "<span style=\"align:left\">" . __('Enter addresses, one per line or comma-seperated', 'subscribe2') . "</span><br />\r\n";
1152
  echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea>";
1153
  echo "<span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Subscribe', 'subscribe2') . "\"/>";
1164
  echo "<p align=\"center\"><b>" . __('Registered on the left, confirmed in the middle, unconfirmed on the right', 'subscribe2') . "</b></p>";
1165
  if (is_writable(ABSPATH . '/wp-content')) {
1166
  $exportcsv = implode(",", $subscribers);
1167
+ echo "<span class=\"submit\"><form method=\"post\" action=\"\"><input type=\"hidden\" name=\"exportcsv\" value=\"$exportcsv\" /><input type=\"hidden\" name=\"s2_admin\" value=\"exportcsv\" /><input type=\"submit\" name=\"submit\" value=\"" . __('Save Emails to CSV File','subscribe2') . "\" /></form></span>";
 
 
 
 
 
 
 
1168
  }
1169
  }
1170
  echo "<table cellpadding=\"2\" cellspacing=\"2\">";
1181
  }
1182
  echo "<a href=\"mailto:$subscriber\">$subscriber</a>\r\n";
1183
  if (in_array($subscriber, $unconfirmed) || in_array($subscriber, $confirmed) ) {
1184
+ echo "(" . $this->signup_date($subscriber) . ")</td>";
1185
+ echo "<td width=\"5%\" align=\"center\"><form method=\"post\" action=\"\"><input type=\"hidden\" name=\"email\" value=\"$subscriber\" /><input type=\"hidden\" name=\"s2_admin\" value=\"toggle\" /><input type=\"hidden\" name=\"what\" value=\"$what\" /><input type=\"submit\" name=\"submit\" value=\"";
 
 
 
 
 
 
 
 
1186
  (in_array($subscriber, $unconfirmed)) ? $foo = '&lt;-' : $foo= '-&gt;';
1187
+ echo "$foo\" /></form></td>";
1188
+ echo "<td width=\"2%\" align=\"center\"><form method=\"post\" action=\"\"><span class=\"delete\"><input type=\"hidden\" name=\"email\" value=\"$subscriber\" /><input type=\"hidden\" name=\"s2_admin\" value=\"delete\" /><input type=\"hidden\" name=\"what\" value=\"$what\" /><input type=\"submit\" name=\"submit\" value=\"X\" /></span></form>";
 
 
 
 
 
 
 
 
 
 
1189
  }
1190
  echo "</td></tr>\r\n";
1191
  ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
1194
  echo "<tr><td align=\"center\"><b>" . __('NONE', 'subscribe2') . "</b></td></tr>\r\n";
1195
  }
1196
  echo "</table>";
1197
+ if (!empty($reminderform)) {echo $reminderform;}
 
 
 
 
 
 
 
 
 
1198
  echo "</div>\r\n";
1199
 
1200
  //show bulk managment form
1202
  echo "<h2 >" . __('Categories', 'subscribe2') . "</h2>\r\n";
1203
  echo __('Existing Registered Users can be automatically (un)subscribed to categories using this section.', 'subscribe2') . "<br />\r\n";
1204
  echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
1205
+ echo "<span class=\"submit\"><form method=\"post\" action=\"\"><input type=\"hidden\" name=\"emails\" value=\"$emails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"register\" />";
1206
+ $this->display_category_form(explode(',', $this->get_excluded_cats()));
 
 
 
 
1207
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Subscribe','subscribe2') . "\" />";
1208
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Unsubscribe','subscribe2') . "\" /></form></span>";
1209
 
1219
  Our options page
1220
  */
1221
  function options_menu() {
 
 
1222
  // was anything POSTed?
1223
  if (isset($_POST['s2_admin'])) {
 
1224
  if ('RESET' == $_POST['s2_admin']) {
1225
  $this->reset();
1226
  echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_reset</p></strong></div>";
1231
  } else {
1232
  $exclude_cats = '';
1233
  }
1234
+ $this->subscribe2_options['exclude'] = $exclude_cats;
1235
  // allow override?
1236
  (isset($_POST['reg_override'])) ? $override = '1' : $override = '0';
1237
  $this->subscribe2_options['reg_override'] = $override;
1245
  if ('admin' == $_POST['sender']) {
1246
  $sender = 'admin';
1247
  }
1248
+ $this->subscribe2_options['sender'] = $sender;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1249
 
1250
  // email templates
1251
  $mailtext = $_POST['mailtext'];
1252
+ $this->subscribe2_options['mailtext'] = $mailtext;
1253
  $confirm_email = $_POST['confirm_email'];
1254
+ $this->subscribe2_options['confirm_email'] = $confirm_email;
1255
  $remind_email = $_POST['remind_email'];
1256
+ $this->subscribe2_options['remind_email'] = $remind_email;
1257
 
1258
  //automatic subscription
1259
  $autosub_option = $_POST['autosub'];
1260
+ $this->subscribe2_options['autosub']= $autosub_option;
1261
  $autosub_format_option = $_POST['autoformat'];
1262
+ $this->subscribe2_options['autoformat']= $autosub_format_option;
1263
 
1264
  //barred domains
1265
  $barred_option = $_POST['barred'];
1266
+ $this->subscribe2_options['barred'] = $barred_option;
1267
  echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_saved</p></strong></div>";
1268
+ update_option( 'subscribe2_options', $this->subscribe2_options );
1269
  }
1270
  }
1271
  // show our form
1272
  echo "<div class=\"wrap\">";
1273
+ echo "<form method=\"post\" action=\"\">";
1274
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"options\" />";
1275
+ echo "<h2>" . __('Delivery Options', 'subscribe2') . ":</h2>";
 
 
 
1276
  echo __('Send Email From', 'subscribe2') . ': ';
1277
+ echo "<input type=\"radio\" name=\"sender\" value=\"author\" ";
1278
  if ('author' == $this->subscribe2_options['sender']) {
1279
  echo "checked=\"checked\" ";
1280
  }
1281
  echo " /> " . __('Author of the post', 'subscribe2') . " &nbsp;&nbsp;";
1282
+ echo "<input type=\"radio\" name=\"sender\" value=\"admin\" ";
1283
  if ('admin' == $this->subscribe2_options['sender']) {
1284
  echo "checked=\"checked\" ";
1285
  }
1286
+ echo " /> " . __('Blog Admin', 'subscribe2') . "<br />\r\n";
 
 
 
 
 
1287
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1288
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">";
1289
  echo "<tr><td>";
1290
  echo __('New Post email (must not be empty)', 'subscribe2') . ":";
1291
  echo "<br />\r\n";
1292
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><p>\r\n";
1293
  echo "</td><td valign=\"top\" rowspan=\"3\">";
1294
  echo "<h3>" . __('Message substitions', 'subscribe2') . "</h3>\r\n";
1295
  echo "<dl>";
1305
  echo "<dt><b>ACTION</b></dt><dd>" . __("Action performed by LINK in confirmation email<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
1306
  echo "</dl></td></tr><tr><td>";
1307
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
1308
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea><p>";
1309
+ echo "</td></tr><tr><td>";
1310
  echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
1311
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><p>";
1312
+ echo "</td></tr></table>\r\n";
1313
 
1314
  // excluded categories
1315
  echo "<h2>" . __('Excluded Categories', 'subscribe2') . "</h2>\r\n";
1316
  $this->display_category_form(explode(',', $this->get_excluded_cats()));
1317
+ echo "<p align=\"center\"><input type=\"checkbox\" name=\"reg_override\" value=\"1\"";
1318
  if ('1' == $this->subscribe2_options['reg_override']) {
1319
+ echo "checked=\"checked\"";
1320
  }
1321
+ echo "/> " . __('Allow registered users to subscribe to excluded categories?', 'subscribe2') . "</p>";
1322
  echo "<h2>" . __('Writing Options', 'subscribe2') . "</h2>\r\n";
1323
+ echo "<p align=\"center\"><input type=\"checkbox\" name=\"show_button\" value=\"1\"";
1324
  if ('1' == $this->subscribe2_options['show_button']) {
1325
+ echo "checked=\"checked\"";
1326
  }
1327
+ echo "/> " . __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "</p>";
1328
 
1329
  //Auto Subscription for new registrations
1330
  echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
1331
  echo __('Automatically subscribe new users registering with your blog.', 'subscribe2') . "<br />\r\n";
1332
+ echo "<input type=\"radio\" name=\"autosub\" value=\"yes\" ";
1333
  if ('yes' == $this->subscribe2_options['autosub']) {
1334
+ echo "checked=\"checked\" ";
1335
  }
1336
  echo " /> " . __('Yes', 'subscribe2') . " &nbsp;&nbsp;";
1337
+ echo "<input type=\"radio\" name=\"autosub\" value=\"no\" ";
1338
  if ('no' == $this->subscribe2_options['autosub']) {
1339
+ echo "checked=\"checked\" ";
1340
  }
1341
  echo " /> " . __('No', 'subscribe2') . "<br /><br />\r\n";
1342
  echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
1354
  if ('text' == $this->subscribe2_options['autoformat']) {
1355
  echo "checked=\"checked\" ";
1356
  }
1357
+ echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . " &nbsp;&nbsp;";
1358
 
1359
  //barred domains
1360
  echo "<h2>" . __('Barred Domains', 'subscribe2') . "</h2>\r\n";
1361
  echo __('Enter domains to bar from public subscriptions: <br /> (Use a new line for each entry and omit the "@" symbol, for example email.com)', 'subscribe2');
1362
+ echo "<textarea style=\"width: 98%;\" rows=\"4\" cols=\"60\" name=\"barred\">" . $this->subscribe2_options['barred'] . "</textarea>";
1363
 
1364
  // submit
1365
  echo "<p align=\"center\"><span class=\"submit\"><input type=\"submit\" id=\"save\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></span></p>";
1370
  echo "<h2>" . __('Reset Default', 'subscribe2') . "</h2>\r\n";
1371
  echo "<p>" . __('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2') . "</p>\r\n";
1372
  echo "<form method=\"post\" action=\"\">";
 
 
 
1373
  echo "<p align=\"center\"><span class=\"submit\">";
1374
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"RESET\" />";
1375
  echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('RESET', 'subscribe2') .
1385
  Our profile menu
1386
  */
1387
  function user_menu() {
1388
+ global $user_ID;
1389
 
1390
  get_currentuserinfo();
1391
 
1392
  // was anything POSTed?
1393
  if ( (isset($_POST['s2_admin'])) && ('user' == $_POST['s2_admin']) ) {
 
1394
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Subscription preferences updated.', 'subscribe2') . "</strong></p></div>\n";
1395
  $format = 'text';
1396
  $post = 'post';
1412
  delete_usermeta($user_ID, "s2_cat" . $cat);
1413
  }
1414
  }
1415
+ update_usermeta($user_ID, 's2_subscribed', '');
1416
  } else {
1417
+ if (! is_array($cats)) {
1418
  $cats = array($_POST['category']);
1419
  }
1420
  $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1421
  $remove = array_diff($old_cats, $cats);
1422
  $new = array_diff($cats, $old_cats);
1423
+ if (! empty($remove)) {
1424
  // remove subscription to these cat IDs
1425
  foreach ($remove as $id) {
1426
  delete_usermeta($user_ID, "s2_cat" .$id);
1427
  }
1428
  }
1429
+ if (! empty($new)) {
1430
  // add subscription to these cat IDs
1431
  foreach ($new as $id) {
1432
  update_usermeta($user_ID, 's2_cat' . $id, "$id");
1440
  echo "<div class=\"wrap\">";
1441
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
1442
  echo "<form method=\"post\" action=\"\">";
 
 
 
1443
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"user\" />";
1444
+ if ( defined('S2DIGEST') && FALSE == S2DIGEST ) {
1445
  echo __('Receive email as', 'subscribe2') . ": &nbsp;&nbsp;";
1446
  echo "<input type=\"radio\" name=\"s2_format\" value=\"html\"";
1447
  if ('html' == get_usermeta($user_ID, 's2_format')) {
1465
  }
1466
  echo "<p style=\"color: red\">" . __('Note: HTML format will always deliver the full post.', 'subscribe2') . "</p>\r\n";
1467
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
1468
+ echo "<input type=\"radio\" name=\"new_category\" value=\"yes\" ";
1469
+ if ('yes' == get_usermeta($user_ID, 's2_autosub')) {
1470
+ echo "checked=\"yes\" ";
1471
  }
1472
  echo "/> Yes <input type=\"radio\" name=\"new_category\" value=\"no\" ";
1473
  if ('no' == get_usermeta($user_ID, 's2_autosub')) {
1482
  // we're doing daily digests, so just show
1483
  // subscribe / unnsubscribe
1484
  echo __('Receive daily summary of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
1485
+ echo "<input type=\"radio\" name=\"category\" value=\"1\" ";
1486
+ if (get_usermeta($user_ID, 's2_subscribed')) {
1487
+ echo "checked=\"yes\" ";
1488
  }
1489
  echo "/> Yes <input type=\"radio\" name=\"category\" value=\"\" ";
1490
  if (! get_usermeta($user_ID, 's2_subscribed')) {
1506
  Display the Write sub-menu
1507
  */
1508
  function write_menu() {
 
 
1509
  // was anything POSTed?
1510
  if (isset($_POST['s2_admin']) && ('mail' == $_POST['s2_admin']) ) {
 
1511
  if ('confirmed' == $_POST['what']) {
1512
  $recipients = $this->get_public();
1513
  } elseif ('unconfirmed' == $_POST['what']) {
1538
  // show our form
1539
  echo "<div class=\"wrap\"><h2>" . __('Send email to all subscribers', 'subscribe2') . "</h2>\r\n";
1540
  echo "<form method=\"post\" action=\"\">\r\n";
 
 
 
1541
  echo __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" name=\"subject\" value=\"" . __('A message from ', 'subscribe2') . get_settings('blogname') . "\" /> <br />";
1542
  echo "<textarea rows=\"12\" cols=\"75\" name=\"message\"></textarea>";
1543
  echo "<br />\r\n";
1556
  /* ===== helper functions: forms and stuff ===== */
1557
  /**
1558
  Display a table of categories with checkboxes
1559
+
1560
  Optionally pre-select those categories specified
1561
  */
1562
  function display_category_form($selected = array(), $override = 1) {
1563
  global $wpdb;
1564
 
1565
+ $all_cats = $this->get_all_categories('array');
 
1566
  if (0 == $override) {
1567
  // registered users are not allowed to subscribe to
1568
  // excluded categories
1576
  $half = (count($all_cats) / 2);
1577
  $i = 0;
1578
  $j = 0;
1579
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">";
1580
+ echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">";
1581
+ foreach ($all_cats as $cat_ID => $cat_name) {
1582
  if ( ($i >= $half) && (0 == $j) ){
1583
+ echo "</td><td width=\"50%\" align=\"left\">";
1584
  $j++;
1585
  }
1586
  if (0 == $j) {
1587
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat_ID . "\"";
1588
+ if (in_array($cat_ID, $selected)) {
1589
  echo " checked=\"checked\" ";
1590
  }
1591
+ echo " /> " . $cat_name . "<br />\r\n";
1592
  } else {
1593
 
1594
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat_ID . "\"";
1595
+ if (in_array($cat_ID, $selected)) {
1596
  echo " checked=\"checked\" ";
1597
  }
1598
+ echo " /> " . $cat_name . "<br />\r\n";
1599
  }
1600
  $i++;
1601
  }
1602
+ echo "</td></tr></table>\r\n";
 
 
 
 
1603
  } // end display_category_form()
1604
 
1605
  /**
1616
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
1617
  'registered' => __('Registered Subscribers', 'subscribe2'));
1618
 
 
 
1619
  // count the number of subscribers
1620
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
1621
  $count['unconfirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='0'");
1628
  }
1629
  $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='s2_subscribed'");
1630
  $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
1631
+ foreach ($this->get_all_categories('array') as $cat_ID => $cat_name) {
1632
+ $count[$cat_name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='s2_cat$cat_ID'");
1633
  }
1634
 
1635
  // do have actually have some subscribers?
1646
  if (in_array($whom, $exclude)) { continue; }
1647
  if (0 == $count[$whom]) { continue; }
1648
 
1649
+ echo "<option value=\"$whom\"";
1650
  if ($whom == $selected) { echo " selected=\"selected\" "; }
1651
  echo ">$display (" . ($count[$whom]) . ")</option>\r\n";
1652
  }
1653
 
1654
  if ($count['registered'] > 0) {
1655
+ foreach ($this->get_all_categories('array') as $cat_ID => $cat_name) {
1656
+ if (in_array($cat_ID, $exclude)) { continue; }
1657
+ if (0 == $count[$cat_name]) { continue; }
1658
+ echo "<option value=\"$cat_ID\"";
1659
+ if ($cat_ID == $selected) { echo " selected=\"selected\" "; }
1660
+ echo "> &nbsp;&nbsp;$cat_name (" . $count[$cat_name] . ") </option>\r\n";
1661
  }
1662
  }
1663
  echo "</select>";
1666
  }
1667
  } // end display_subscriber_dropdown()
1668
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1669
  /* ===== template and filter functions ===== */
1670
  /**
1671
  Display our form; also handles (un)subscribe requests
1672
  */
1673
  function filter($content = '') {
1674
+ if (('' == $content) || (! preg_match('|<!--subscribe2-->|', $content))) { return $content; }
1675
  $this->s2form = $this->form;
1676
 
1677
  global $user_ID;
1678
  get_currentuserinfo();
1679
  if ($user_ID) {
1680
+ $this->s2form = $this->use_profile;
 
 
 
 
1681
  }
1682
  if (isset($_POST['s2_action'])) {
1683
  global $wpdb, $user_email;
1684
+ if (! is_email($_POST['email'])) {
1685
  $this->s2form = $this->form . $this->not_an_email;
1686
  } elseif ($this->is_barred($_POST['email'])) {
1687
  $this->s2form = $this->form . $this->barred_domain;
1739
 
1740
  global $wpdb;
1741
 
1742
+ if ( defined('S2PAGE') && 0 !== S2PAGE ) {
1743
  return "page_id=" . S2PAGE;
1744
  } else {
1745
  $id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status='static' LIMIT 1");
1770
  } // end template_filter()
1771
 
1772
  /* ===== wp-cron functions ===== */
1773
+ /**
1774
+ Send notifications for any posts that are now visible
1775
+ */
1776
+ function subscribe2_hourly() {
1777
+ $future_posts = get_option('s2_future_posts');
1778
+
1779
+ // if we have no future posts, bail out
1780
+ if (! $future_posts) { return; }
1781
+
1782
+ // this will hold the posts that aren't yet visible
1783
+ $not_yet = array();
1784
+
1785
+ foreach ($future_posts as $post) {
1786
+ if ( current_time('mysql') > $post['date'] ) {
1787
+ // this post is now visible, so let's
1788
+ // send a notification
1789
+ $this->publish($post['id'], 1);
1790
+ } else {
1791
+ array_push($not_yet, $post);
1792
+ }
1793
+ }
1794
+ // are the number of elements in $not_yet
1795
+ // the same as in $future posts?
1796
+ if ( count($not_yet) != count($future_posts) ) {
1797
+ // if not, then some posts have been removed
1798
+ // from $future_posts, and the remainder need
1799
+ // to be recorded back to the database
1800
+ update_option('s2_future_posts', $not_yet);
1801
+ }
1802
+ } // end subscribe2_hourly
1803
+
1804
  /**
1805
  Send a daily digest of today's new posts
1806
  */
1807
+ function subscribe2_daily() {
1808
  global $wpdb;
1809
 
1810
+ // collect yesterday's posts
1811
+ $yesterday = date('Y-m-d', (get_option('wp_cron_daily_lastrun')-60));
1812
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content FROM $wpdb->posts WHERE post_date > '$yesterday 00:00:00' AND post_date < '$yesterday 23:59:59' AND post_status='publish'");
 
1813
 
 
 
 
 
1814
  // do we have any posts?
1815
+ if (! $posts) { return; }
1816
 
1817
  // if we have posts, let's prepare the digest
1818
  foreach ($posts as $post) {
1854
  }
1855
 
1856
  $author = get_userdata($post->post_author);
1857
+ $this->authorname = $author->display_name;
1858
 
1859
  // do we send as admin, or post author?
1860
  if ('author' == $this->subscribe2_options['sender']) {
1866
  }
1867
  $this->myemail = $user->user_email;
1868
  $this->myname = $user->display_name;
1869
+
1870
+ $subject = '[' . stripslashes(get_settings('blogname')) . '] ' . __('Daily Digest', 'subscribe2') . ' ' . $yesterday;
 
 
 
1871
  $public = $this->get_public();
1872
  $registered = $this->get_registered();
1873
  $recipients = array_merge((array)$public, (array)$registered);
1874
  $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
1875
  $body = str_replace('POST', $message, $mailtext);
1876
  $this->mail($recipients, $subject, $body);
1877
+ } // end subscribe2_daily
1878
+
1879
+ /**
1880
+ If the to-be-deleted post was future-dated, remove it from the list of future-dated posts
1881
+ */
1882
+ function delete_future($id = 0) {
1883
+ if (0 == $id) { return $id; }
1884
+
1885
+ $future = get_settings('s2_future_posts');
1886
+ // if we have no future-dated posts scheduled, bail out
1887
+ if ( ! $future) {
1888
+ return $id;
1889
+ }
1890
+ foreach ($future as $post) {
1891
+ // is the deleted post in the list of future posts?
1892
+ if ($id == $post['id']) {
1893
+ // skip it
1894
+ continue;
1895
+ } else {
1896
+ // add this to the new list of future posts
1897
+ $new_future[] = $post;
1898
+ }
1899
+ }
1900
+ if ($new_future != $future) {
1901
+ update_option('s2_future_posts', $new_future);
1902
+ }
1903
+ } // end delete_future()
1904
 
1905
  /* ===== Our constructor ===== */
1906
  /**
1917
 
1918
  // do we need to install anything?
1919
  $this->public = $table_prefix . "subscribe2";
1920
+ if(mysql_query("SELECT COUNT(*) FROM ".$this->public)==FALSE) { $this->install(); }
1921
  //do we need to upgrade anything?
1922
  if ($this->subscribe2_options['version'] !== S2VERSION) {
1923
+ $this->upgrade();
1924
+ }
1925
 
1926
  if (isset($_GET['s2'])) {
1927
  // someone is confirming a request
1930
  add_filter('the_content', array(&$this, 'confirm'));
1931
  }
1932
 
 
1933
  add_action('admin_menu', array(&$this, 'admin_menu'));
1934
+ add_action('publish_post', array(&$this, 'publish'));
1935
+ add_action('edit_post', array(&$this, 'edit'));
1936
+ add_action('private_to_published', array(&$this, 'private2publish'));
1937
  add_action('user_register', array(&$this, 'register'));
1938
  add_action('create_category', array(&$this, 'autosub_new_category'));
1939
  add_filter('the_content', array(&$this, 'filter'));
1940
+ add_action('wp_cron_hourly', array(&$this, 'subscribe2_hourly'));
1941
+ if (defined('S2DIGEST') && TRUE == S2DIGEST) {
1942
+ add_action('wp_cron_daily', array(&$this, 'subscribe2_daily'));
1943
+ }
1944
+ add_action('delete_post', array(&$this, 'delete_future'));
1945
+ // add our button
1946
+ if ('1' == $this->subscribe2_options['show_button']) {
1947
+ add_action('init', array(&$this, 's2_button_init'));
1948
+ add_action('marker_css', array(&$this, 'subscribe2_css'));
1949
  }
 
1950
  // load our strings
1951
  $this->load_strings();
1952
  } // end subscribe2()
1988
  var $confirm_subject = '';
1989
  var $options_saved = '';
1990
  var $options_reset = '';
1991
+
1992
  } // end class subscribe2
1993
+
1994
+ function s2init() {
1995
+ global $subscribe2;
1996
+ $mysubscribe2 = new subscribe2();
1997
+ $mysubscribe2->subscribe2();
1998
+ }
1999
+
2000
+ add_action('init', 's2init');
2001
  ?>
subscribe2/subscribe2.pot CHANGED
@@ -8,7 +8,7 @@ msgid ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2007-03-19 19:24+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,449 +16,429 @@ msgstr ""
16
  "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
- #: subscribe2.php:103
20
  msgid "To manage your subscription options please "
21
  msgstr ""
22
 
23
- #: subscribe2.php:105 subscribe2.php:107
24
  msgid "You may manage your subscription options from your "
25
  msgstr ""
26
 
27
- #: subscribe2.php:109
28
  msgid "A confirmation message is on its way!"
29
  msgstr ""
30
 
31
- #: subscribe2.php:111
32
  msgid "That email address is already subscribed."
33
  msgstr ""
34
 
35
- #: subscribe2.php:113
36
  msgid "That email address is not subscribed."
37
  msgstr ""
38
 
39
- #: subscribe2.php:115
40
  msgid "Sorry, but that does not look like an email address to me."
41
  msgstr ""
42
 
43
- #: subscribe2.php:117
44
  msgid ""
45
  "Sorry, email addresses at that domain are currently barred due to spam, "
46
  "please use an alternative email address."
47
  msgstr ""
48
 
49
- #: subscribe2.php:119
50
  msgid "Message sent!"
51
  msgstr ""
52
 
53
- #: subscribe2.php:121
54
  msgid "Your email:"
55
  msgstr ""
56
 
57
- #: subscribe2.php:121 subscribe2.php:1185 subscribe2.php:1277
58
  msgid "Subscribe"
59
  msgstr ""
60
 
61
- #: subscribe2.php:121 subscribe2.php:1278
62
  msgid "Unsubscribe"
63
  msgstr ""
64
 
65
- #: subscribe2.php:121 subscribe2.php:1659
66
  msgid "Send"
67
  msgstr ""
68
 
69
- #: subscribe2.php:124
70
  msgid "No such email address is registered."
71
  msgstr ""
72
 
73
- #: subscribe2.php:126
74
  msgid "You have successfully subscribed!"
75
  msgstr ""
76
 
77
- #: subscribe2.php:128
78
  msgid "You have successfully unsubscribed."
79
  msgstr ""
80
 
81
- #: subscribe2.php:130
82
  msgid "Please confirm your request"
83
  msgstr ""
84
 
85
- #: subscribe2.php:132
86
  msgid "Subscription Reminder"
87
  msgstr ""
88
 
89
- #: subscribe2.php:134
90
  msgid "subscribe"
91
  msgstr ""
92
 
93
- #: subscribe2.php:136
94
  msgid "unsubscribe"
95
  msgstr ""
96
 
97
- #: subscribe2.php:139
98
  msgid "Options saved!"
99
  msgstr ""
100
 
101
- #: subscribe2.php:140
102
  msgid "Options reset!"
103
  msgstr ""
104
 
105
- #: subscribe2.php:148 subscribe2.php:1190
106
  msgid "Subscribers"
107
  msgstr ""
108
 
109
- #: subscribe2.php:149
110
  msgid "Subscribe2 Options"
111
  msgstr ""
112
 
113
- #: subscribe2.php:149
114
  msgid "Subscribe2"
115
  msgstr ""
116
 
117
- #: subscribe2.php:151 subscribe2.php:153
118
  msgid "Subscriptions"
119
  msgstr ""
120
 
121
- #: subscribe2.php:155
122
  msgid "Mail Subscribers"
123
  msgstr ""
124
 
125
- #: subscribe2.php:178
126
- msgid "Once Weekly"
127
- msgstr ""
128
-
129
- #: subscribe2.php:780
130
  msgid "New subscriber"
131
  msgstr ""
132
 
133
- #: subscribe2.php:781
134
  msgid "subscribed to email notifications!"
135
  msgstr ""
136
 
137
- #: subscribe2.php:1098
138
  msgid "Address(es) subscribed!"
139
  msgstr ""
140
 
141
- #: subscribe2.php:1101
142
  msgid "deleted!"
143
  msgstr ""
144
 
145
- #: subscribe2.php:1104
146
  msgid "status changed!"
147
  msgstr ""
148
 
149
- #: subscribe2.php:1107
150
  msgid "Reminder Email(s) Sent!"
151
  msgstr ""
152
 
153
- #: subscribe2.php:1110
154
  msgid "CSV File Created in wp-content"
155
  msgstr ""
156
 
157
- #: subscribe2.php:1113
158
  msgid "Registered Users Subscribed!"
159
  msgstr ""
160
 
161
- #: subscribe2.php:1116
162
  msgid "Registered Users Unsubscribed!"
163
  msgstr ""
164
 
165
- #: subscribe2.php:1178
 
 
 
 
166
  msgid "Subscribe Addresses"
167
  msgstr ""
168
 
169
- #: subscribe2.php:1183
170
  msgid "Enter addresses, one per line or comma-seperated"
171
  msgstr ""
172
 
173
- #: subscribe2.php:1192
174
  msgid "Filter"
175
  msgstr ""
176
 
177
- #: subscribe2.php:1196
178
  msgid ""
179
  "Registered on the left, confirmed in the middle, unconfirmed on the right"
180
  msgstr ""
181
 
182
- #: subscribe2.php:1205
183
  msgid "Save Emails to CSV File"
184
  msgstr ""
185
 
186
- #: subscribe2.php:1251
187
  msgid "NONE"
188
  msgstr ""
189
 
190
- #: subscribe2.php:1261
191
- msgid "Send Reminder Email"
192
- msgstr ""
193
-
194
- #: subscribe2.php:1268
195
  msgid "Categories"
196
  msgstr ""
197
 
198
- #: subscribe2.php:1269
199
  msgid ""
200
  "Existing Registered Users can be automatically (un)subscribed to categories "
201
  "using this section."
202
  msgstr ""
203
 
204
- #: subscribe2.php:1270
205
  msgid "Consider User Privacy as changes cannot be undone"
206
  msgstr ""
207
 
208
- #: subscribe2.php:1369
209
  msgid "Delivery Options"
210
  msgstr ""
211
 
212
- #: subscribe2.php:1370
213
  msgid "Send Email From"
214
  msgstr ""
215
 
216
- #: subscribe2.php:1375
217
  msgid "Author of the post"
218
  msgstr ""
219
 
220
- #: subscribe2.php:1380
221
  msgid "Blog Admin"
222
  msgstr ""
223
 
224
- #: subscribe2.php:1382
225
- msgid "Send Email as Digest"
226
- msgstr ""
227
-
228
- #: subscribe2.php:1386
229
  msgid "Email Templates"
230
  msgstr ""
231
 
232
- #: subscribe2.php:1389
233
  msgid "New Post email (must not be empty)"
234
  msgstr ""
235
 
236
- #: subscribe2.php:1393
237
  msgid "Message substitions"
238
  msgstr ""
239
 
240
- #: subscribe2.php:1397
241
  msgid "the post's title"
242
  msgstr ""
243
 
244
- #: subscribe2.php:1398
245
  msgid ""
246
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
247
  "preferences</i>)"
248
  msgstr ""
249
 
250
- #: subscribe2.php:1399
251
  msgid "the post's permalink"
252
  msgstr ""
253
 
254
- #: subscribe2.php:1400
255
  msgid "the admin or post author's name"
256
  msgstr ""
257
 
258
- #: subscribe2.php:1401
259
  msgid "the admin or post author's email"
260
  msgstr ""
261
 
262
- #: subscribe2.php:1402
263
  msgid "the post author's name"
264
  msgstr ""
265
 
266
- #: subscribe2.php:1403
267
  msgid ""
268
  "the generated link to confirm a request<br />(<i>only used in the "
269
  "confirmation email template</i>)"
270
  msgstr ""
271
 
272
- #: subscribe2.php:1404
273
  msgid ""
274
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
275
  "confirmation email template</i>)"
276
  msgstr ""
277
 
278
- #: subscribe2.php:1406
279
  msgid "Subscribe / Unsubscribe confirmation email"
280
  msgstr ""
281
 
282
- #: subscribe2.php:1409
283
  msgid "Reminder email to Unconfirmed Subscribers"
284
  msgstr ""
285
 
286
- #: subscribe2.php:1414
287
  msgid "Excluded Categories"
288
  msgstr ""
289
 
290
- #: subscribe2.php:1420
291
  msgid "Allow registered users to subscribe to excluded categories?"
292
  msgstr ""
293
 
294
- #: subscribe2.php:1421
295
  msgid "Writing Options"
296
  msgstr ""
297
 
298
- #: subscribe2.php:1426
299
  msgid "Show the Subscribe2 button on the Write toolbar?"
300
  msgstr ""
301
 
302
- #: subscribe2.php:1429
303
  msgid "Auto Subscribe"
304
  msgstr ""
305
 
306
- #: subscribe2.php:1430
307
  msgid "Automatically subscribe new users registering with your blog."
308
  msgstr ""
309
 
310
- #: subscribe2.php:1435
311
  msgid "Yes"
312
  msgstr ""
313
 
314
- #: subscribe2.php:1440
315
  msgid "No"
316
  msgstr ""
317
 
318
- #: subscribe2.php:1441
319
  msgid "Auto-subscribe users to receive email as"
320
  msgstr ""
321
 
322
- #: subscribe2.php:1446 subscribe2.php:1556
323
  msgid "HTML"
324
  msgstr ""
325
 
326
- #: subscribe2.php:1451
327
  msgid "Plain Text - Full"
328
  msgstr ""
329
 
330
- #: subscribe2.php:1456
331
  msgid "Plain Text - Excerpt"
332
  msgstr ""
333
 
334
- #: subscribe2.php:1459
335
  msgid "Barred Domains"
336
  msgstr ""
337
 
338
- #: subscribe2.php:1460
339
  msgid ""
340
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
341
  "each entry and omit the \"@\" symbol, for example email.com)"
342
  msgstr ""
343
 
344
- #: subscribe2.php:1464
345
  msgid "Submit"
346
  msgstr ""
347
 
348
- #: subscribe2.php:1469
349
  msgid "Reset Default"
350
  msgstr ""
351
 
352
- #: subscribe2.php:1470
353
  msgid ""
354
  "Use this to reset all options to their defaults. This <strong><em>will not</"
355
  "em></strong> modify your list of subscribers."
356
  msgstr ""
357
 
358
- #: subscribe2.php:1477
359
  msgid "RESET"
360
  msgstr ""
361
 
362
- #: subscribe2.php:1497
363
  msgid "Subscription preferences updated."
364
  msgstr ""
365
 
366
- #: subscribe2.php:1544
367
  msgid "Notification Settings"
368
  msgstr ""
369
 
370
- #: subscribe2.php:1551
371
  msgid "Receive email as"
372
  msgstr ""
373
 
374
- #: subscribe2.php:1561
375
  msgid "Plain Text"
376
  msgstr ""
377
 
378
- #: subscribe2.php:1563
379
  msgid "Email contains"
380
  msgstr ""
381
 
382
- #: subscribe2.php:1564
383
  msgid "Excerpt Only"
384
  msgstr ""
385
 
386
- #: subscribe2.php:1564
387
  msgid "Full Post"
388
  msgstr ""
389
 
390
- #: subscribe2.php:1572
391
  msgid "Note: HTML format will always deliver the full post."
392
  msgstr ""
393
 
394
- #: subscribe2.php:1573
395
  msgid "Automatically subscribe me to newly created categories"
396
  msgstr ""
397
 
398
- #: subscribe2.php:1585
399
  msgid "Subscribed Categories"
400
  msgstr ""
401
 
402
- #: subscribe2.php:1590
403
  msgid "Receive daily summary of new posts?"
404
  msgstr ""
405
 
406
- #: subscribe2.php:1603
407
  msgid "Update Preferences &raquo;"
408
  msgstr ""
409
 
410
- #: subscribe2.php:1648
411
  msgid "Send email to all subscribers"
412
  msgstr ""
413
 
414
- #: subscribe2.php:1653
415
  msgid "Subject"
416
  msgstr ""
417
 
418
- #: subscribe2.php:1653
419
  msgid "A message from "
420
  msgstr ""
421
 
422
- #: subscribe2.php:1656
423
  msgid "Recipients: "
424
  msgstr ""
425
 
426
- #: subscribe2.php:1716
427
- msgid "Select / Unselect All"
428
- msgstr ""
429
-
430
- #: subscribe2.php:1729
431
  msgid "All Subscribers"
432
  msgstr ""
433
 
434
- #: subscribe2.php:1730
435
  msgid "Public Subscribers"
436
  msgstr ""
437
 
438
- #: subscribe2.php:1731
439
  msgid "Confirmed"
440
  msgstr ""
441
 
442
- #: subscribe2.php:1732
443
  msgid "Unconfirmed"
444
  msgstr ""
445
 
446
- #: subscribe2.php:1733
447
  msgid "Registered Subscribers"
448
  msgstr ""
449
 
450
- #: subscribe2.php:1789
451
- msgid "Per Post Email"
452
- msgstr ""
453
-
454
- #: subscribe2.php:1806
455
- msgid "Next email notification will be sent"
456
- msgstr ""
457
-
458
- #: subscribe2.php:1906
459
  msgid "Subscription Confirmation"
460
  msgstr ""
461
 
462
- #: subscribe2.php:1992
463
- msgid "Digest Email"
464
  msgstr ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2007-01-07 19:26+0000\n"
12
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
  "Content-Type: text/plain; charset=CHARSET\n"
17
  "Content-Transfer-Encoding: 8bit\n"
18
 
19
+ #: subscribe2.php:62
20
  msgid "To manage your subscription options please "
21
  msgstr ""
22
 
23
+ #: subscribe2.php:64
24
  msgid "You may manage your subscription options from your "
25
  msgstr ""
26
 
27
+ #: subscribe2.php:66
28
  msgid "A confirmation message is on its way!"
29
  msgstr ""
30
 
31
+ #: subscribe2.php:68
32
  msgid "That email address is already subscribed."
33
  msgstr ""
34
 
35
+ #: subscribe2.php:70
36
  msgid "That email address is not subscribed."
37
  msgstr ""
38
 
39
+ #: subscribe2.php:72
40
  msgid "Sorry, but that does not look like an email address to me."
41
  msgstr ""
42
 
43
+ #: subscribe2.php:74
44
  msgid ""
45
  "Sorry, email addresses at that domain are currently barred due to spam, "
46
  "please use an alternative email address."
47
  msgstr ""
48
 
49
+ #: subscribe2.php:76
50
  msgid "Message sent!"
51
  msgstr ""
52
 
53
+ #: subscribe2.php:78
54
  msgid "Your email:"
55
  msgstr ""
56
 
57
+ #: subscribe2.php:78 subscribe2.php:1153 subscribe2.php:1207
58
  msgid "Subscribe"
59
  msgstr ""
60
 
61
+ #: subscribe2.php:78 subscribe2.php:1208
62
  msgid "Unsubscribe"
63
  msgstr ""
64
 
65
+ #: subscribe2.php:78 subscribe2.php:1547
66
  msgid "Send"
67
  msgstr ""
68
 
69
+ #: subscribe2.php:81
70
  msgid "No such email address is registered."
71
  msgstr ""
72
 
73
+ #: subscribe2.php:83
74
  msgid "You have successfully subscribed!"
75
  msgstr ""
76
 
77
+ #: subscribe2.php:85
78
  msgid "You have successfully unsubscribed."
79
  msgstr ""
80
 
81
+ #: subscribe2.php:87
82
  msgid "Please confirm your request"
83
  msgstr ""
84
 
85
+ #: subscribe2.php:89
86
  msgid "Subscription Reminder"
87
  msgstr ""
88
 
89
+ #: subscribe2.php:91
90
  msgid "subscribe"
91
  msgstr ""
92
 
93
+ #: subscribe2.php:93
94
  msgid "unsubscribe"
95
  msgstr ""
96
 
97
+ #: subscribe2.php:96
98
  msgid "Options saved!"
99
  msgstr ""
100
 
101
+ #: subscribe2.php:97
102
  msgid "Options reset!"
103
  msgstr ""
104
 
105
+ #: subscribe2.php:105 subscribe2.php:1158
106
  msgid "Subscribers"
107
  msgstr ""
108
 
109
+ #: subscribe2.php:106
110
  msgid "Subscribe2 Options"
111
  msgstr ""
112
 
113
+ #: subscribe2.php:106
114
  msgid "Subscribe2"
115
  msgstr ""
116
 
117
+ #: subscribe2.php:107
118
  msgid "Subscriptions"
119
  msgstr ""
120
 
121
+ #: subscribe2.php:108
122
  msgid "Mail Subscribers"
123
  msgstr ""
124
 
125
+ #: subscribe2.php:753
 
 
 
 
126
  msgid "New subscriber"
127
  msgstr ""
128
 
129
+ #: subscribe2.php:754
130
  msgid "subscribed to email notifications!"
131
  msgstr ""
132
 
133
+ #: subscribe2.php:1069
134
  msgid "Address(es) subscribed!"
135
  msgstr ""
136
 
137
+ #: subscribe2.php:1072
138
  msgid "deleted!"
139
  msgstr ""
140
 
141
+ #: subscribe2.php:1075
142
  msgid "status changed!"
143
  msgstr ""
144
 
145
+ #: subscribe2.php:1078
146
  msgid "Reminder Email(s) Sent!"
147
  msgstr ""
148
 
149
+ #: subscribe2.php:1081
150
  msgid "CSV File Created in wp-content"
151
  msgstr ""
152
 
153
+ #: subscribe2.php:1084
154
  msgid "Registered Users Subscribed!"
155
  msgstr ""
156
 
157
+ #: subscribe2.php:1087
158
  msgid "Registered Users Unsubscribed!"
159
  msgstr ""
160
 
161
+ #: subscribe2.php:1112
162
+ msgid "Send Reminder Email"
163
+ msgstr ""
164
+
165
+ #: subscribe2.php:1149
166
  msgid "Subscribe Addresses"
167
  msgstr ""
168
 
169
+ #: subscribe2.php:1151
170
  msgid "Enter addresses, one per line or comma-seperated"
171
  msgstr ""
172
 
173
+ #: subscribe2.php:1160
174
  msgid "Filter"
175
  msgstr ""
176
 
177
+ #: subscribe2.php:1164
178
  msgid ""
179
  "Registered on the left, confirmed in the middle, unconfirmed on the right"
180
  msgstr ""
181
 
182
+ #: subscribe2.php:1167
183
  msgid "Save Emails to CSV File"
184
  msgstr ""
185
 
186
+ #: subscribe2.php:1194
187
  msgid "NONE"
188
  msgstr ""
189
 
190
+ #: subscribe2.php:1202
 
 
 
 
191
  msgid "Categories"
192
  msgstr ""
193
 
194
+ #: subscribe2.php:1203
195
  msgid ""
196
  "Existing Registered Users can be automatically (un)subscribed to categories "
197
  "using this section."
198
  msgstr ""
199
 
200
+ #: subscribe2.php:1204
201
  msgid "Consider User Privacy as changes cannot be undone"
202
  msgstr ""
203
 
204
+ #: subscribe2.php:1275
205
  msgid "Delivery Options"
206
  msgstr ""
207
 
208
+ #: subscribe2.php:1276
209
  msgid "Send Email From"
210
  msgstr ""
211
 
212
+ #: subscribe2.php:1281
213
  msgid "Author of the post"
214
  msgstr ""
215
 
216
+ #: subscribe2.php:1286
217
  msgid "Blog Admin"
218
  msgstr ""
219
 
220
+ #: subscribe2.php:1287
 
 
 
 
221
  msgid "Email Templates"
222
  msgstr ""
223
 
224
+ #: subscribe2.php:1290
225
  msgid "New Post email (must not be empty)"
226
  msgstr ""
227
 
228
+ #: subscribe2.php:1294
229
  msgid "Message substitions"
230
  msgstr ""
231
 
232
+ #: subscribe2.php:1298
233
  msgid "the post's title"
234
  msgstr ""
235
 
236
+ #: subscribe2.php:1299
237
  msgid ""
238
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
239
  "preferences</i>)"
240
  msgstr ""
241
 
242
+ #: subscribe2.php:1300
243
  msgid "the post's permalink"
244
  msgstr ""
245
 
246
+ #: subscribe2.php:1301
247
  msgid "the admin or post author's name"
248
  msgstr ""
249
 
250
+ #: subscribe2.php:1302
251
  msgid "the admin or post author's email"
252
  msgstr ""
253
 
254
+ #: subscribe2.php:1303
255
  msgid "the post author's name"
256
  msgstr ""
257
 
258
+ #: subscribe2.php:1304
259
  msgid ""
260
  "the generated link to confirm a request<br />(<i>only used in the "
261
  "confirmation email template</i>)"
262
  msgstr ""
263
 
264
+ #: subscribe2.php:1305
265
  msgid ""
266
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
267
  "confirmation email template</i>)"
268
  msgstr ""
269
 
270
+ #: subscribe2.php:1307
271
  msgid "Subscribe / Unsubscribe confirmation email"
272
  msgstr ""
273
 
274
+ #: subscribe2.php:1310
275
  msgid "Reminder email to Unconfirmed Subscribers"
276
  msgstr ""
277
 
278
+ #: subscribe2.php:1315
279
  msgid "Excluded Categories"
280
  msgstr ""
281
 
282
+ #: subscribe2.php:1321
283
  msgid "Allow registered users to subscribe to excluded categories?"
284
  msgstr ""
285
 
286
+ #: subscribe2.php:1322
287
  msgid "Writing Options"
288
  msgstr ""
289
 
290
+ #: subscribe2.php:1327
291
  msgid "Show the Subscribe2 button on the Write toolbar?"
292
  msgstr ""
293
 
294
+ #: subscribe2.php:1330
295
  msgid "Auto Subscribe"
296
  msgstr ""
297
 
298
+ #: subscribe2.php:1331
299
  msgid "Automatically subscribe new users registering with your blog."
300
  msgstr ""
301
 
302
+ #: subscribe2.php:1336
303
  msgid "Yes"
304
  msgstr ""
305
 
306
+ #: subscribe2.php:1341
307
  msgid "No"
308
  msgstr ""
309
 
310
+ #: subscribe2.php:1342
311
  msgid "Auto-subscribe users to receive email as"
312
  msgstr ""
313
 
314
+ #: subscribe2.php:1347 subscribe2.php:1450
315
  msgid "HTML"
316
  msgstr ""
317
 
318
+ #: subscribe2.php:1352
319
  msgid "Plain Text - Full"
320
  msgstr ""
321
 
322
+ #: subscribe2.php:1357
323
  msgid "Plain Text - Excerpt"
324
  msgstr ""
325
 
326
+ #: subscribe2.php:1360
327
  msgid "Barred Domains"
328
  msgstr ""
329
 
330
+ #: subscribe2.php:1361
331
  msgid ""
332
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
333
  "each entry and omit the \"@\" symbol, for example email.com)"
334
  msgstr ""
335
 
336
+ #: subscribe2.php:1365
337
  msgid "Submit"
338
  msgstr ""
339
 
340
+ #: subscribe2.php:1370
341
  msgid "Reset Default"
342
  msgstr ""
343
 
344
+ #: subscribe2.php:1371
345
  msgid ""
346
  "Use this to reset all options to their defaults. This <strong><em>will not</"
347
  "em></strong> modify your list of subscribers."
348
  msgstr ""
349
 
350
+ #: subscribe2.php:1375
351
  msgid "RESET"
352
  msgstr ""
353
 
354
+ #: subscribe2.php:1394
355
  msgid "Subscription preferences updated."
356
  msgstr ""
357
 
358
+ #: subscribe2.php:1441
359
  msgid "Notification Settings"
360
  msgstr ""
361
 
362
+ #: subscribe2.php:1445
363
  msgid "Receive email as"
364
  msgstr ""
365
 
366
+ #: subscribe2.php:1455
367
  msgid "Plain Text"
368
  msgstr ""
369
 
370
+ #: subscribe2.php:1457
371
  msgid "Email contains"
372
  msgstr ""
373
 
374
+ #: subscribe2.php:1458
375
  msgid "Excerpt Only"
376
  msgstr ""
377
 
378
+ #: subscribe2.php:1458
379
  msgid "Full Post"
380
  msgstr ""
381
 
382
+ #: subscribe2.php:1466
383
  msgid "Note: HTML format will always deliver the full post."
384
  msgstr ""
385
 
386
+ #: subscribe2.php:1467
387
  msgid "Automatically subscribe me to newly created categories"
388
  msgstr ""
389
 
390
+ #: subscribe2.php:1479
391
  msgid "Subscribed Categories"
392
  msgstr ""
393
 
394
+ #: subscribe2.php:1484
395
  msgid "Receive daily summary of new posts?"
396
  msgstr ""
397
 
398
+ #: subscribe2.php:1497
399
  msgid "Update Preferences &raquo;"
400
  msgstr ""
401
 
402
+ #: subscribe2.php:1539
403
  msgid "Send email to all subscribers"
404
  msgstr ""
405
 
406
+ #: subscribe2.php:1541
407
  msgid "Subject"
408
  msgstr ""
409
 
410
+ #: subscribe2.php:1541
411
  msgid "A message from "
412
  msgstr ""
413
 
414
+ #: subscribe2.php:1544
415
  msgid "Recipients: "
416
  msgstr ""
417
 
418
+ #: subscribe2.php:1613
 
 
 
 
419
  msgid "All Subscribers"
420
  msgstr ""
421
 
422
+ #: subscribe2.php:1614
423
  msgid "Public Subscribers"
424
  msgstr ""
425
 
426
+ #: subscribe2.php:1615
427
  msgid "Confirmed"
428
  msgstr ""
429
 
430
+ #: subscribe2.php:1616
431
  msgid "Unconfirmed"
432
  msgstr ""
433
 
434
+ #: subscribe2.php:1617
435
  msgid "Registered Subscribers"
436
  msgstr ""
437
 
438
+ #: subscribe2.php:1760
 
 
 
 
 
 
 
 
439
  msgid "Subscription Confirmation"
440
  msgstr ""
441
 
442
+ #: subscribe2.php:1870
443
+ msgid "Daily Digest"
444
  msgstr ""