Subscribe2 - Version 4.1

Version Description

Download this release

Release Info

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

Code changes from version 3.7 to 4.1

ReadMe.txt CHANGED
@@ -3,8 +3,8 @@ 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
- Stable tag: 3.7
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
@@ -44,9 +44,9 @@ This token will automatically be replaced by the subscription form, and will dis
44
  = Which version should I be using, I'm on WordPress x.x.x? =
45
  WordPress 2.0.x will be supported until 2010. Subscribe2 will remain supported (but not actively developed) until WordPress 2.0.x is no longer supported. For WordPress 2.0.x use the Subscribe code from the 2.x stable.
46
 
47
- WordPress 2.1.x and 2.2.x are also supported. For the latest information visit http://subscribe2.wordpress.com. For versions of WordPress use Subscribe2 code from the 3.x stable.
48
 
49
- Finally, there is a development version for WordPress 2.3 but as WordPress 2.3 is not recommended for active websites you should only get this code from the branch if you are testing it.
50
 
51
  = How do I upgrade from a previous version? =
52
  If you are upgrading from any 2.1.x version of subscribe2, please delete both the /subscribe.php and /wp-content/plugins/subscribe2.php files before copying the new files into place. Your subscriber list will remain intact, and your options should be preserved. Now create a WordPress Page as described above.
@@ -78,6 +78,25 @@ Batches will occur for each group of message as described above. A site on Drea
78
 
79
  == Version History ==
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  Version 3.7 by Matthew Robinson
82
 
83
  * Change from deprecated get_settings -> get_option
@@ -134,6 +153,12 @@ Version 3.0 by Matthew Robinson
134
 
135
  * Updated for WordPress 2.1 Branch
136
 
 
 
 
 
 
 
137
  Version 2.21 by Matthew Robinson
138
 
139
  * Change from deprecated get_settings -> get_option
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.3
7
+ Stable tag: 4.1
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
44
  = Which version should I be using, I'm on WordPress x.x.x? =
45
  WordPress 2.0.x will be supported until 2010. Subscribe2 will remain supported (but not actively developed) until WordPress 2.0.x is no longer supported. For WordPress 2.0.x use the Subscribe code from the 2.x stable.
46
 
47
+ WordPress 2.1.x and 2.2.x are supported. For the latest information visit http://subscribe2.wordpress.com. For these versions of WordPress use Subscribe2 code from the 3.x stable.
48
 
49
+ Finally, WordPress 2.3 is supported. Again, for the latest information visit http://subscribe2.wordpress.com. For this versions of WordPress use Subscribe2 code from the 4.x stable.
50
 
51
  = How do I upgrade from a previous version? =
52
  If you are upgrading from any 2.1.x version of subscribe2, please delete both the /subscribe.php and /wp-content/plugins/subscribe2.php files before copying the new files into place. Your subscriber list will remain intact, and your options should be preserved. Now create a WordPress Page as described above.
78
 
79
  == Version History ==
80
 
81
+ Version 4.1 by Matthew Robinson
82
+
83
+ * Fixed sending of notifications for Pages
84
+ * Fixed password protected post bug for Digest email notifications
85
+ * Fixed blank email headers if admin data is not at ID 1
86
+
87
+ Version 4.0 by Matthew Robinson
88
+
89
+ * Compatible with WordPress 2.3
90
+ * Widget Code now integrated into the main plugin and added as an option
91
+ * More Options for Email Notifications
92
+ * Category Lists fixed for WordPress 2.3 and now show empty categories
93
+
94
+ Version 3.8 by Matthew Robinson
95
+
96
+ * Fixed User Menu Settings when Digests enabled
97
+ * Changed Registered Subscribers to Registered Users in drop down to avoid confusion
98
+ * Minor code revisions for admin menu layout
99
+
100
  Version 3.7 by Matthew Robinson
101
 
102
  * Change from deprecated get_settings -> get_option
153
 
154
  * Updated for WordPress 2.1 Branch
155
 
156
+ Version 2.22 by Matthew Robinson
157
+
158
+ * Fixed User Menu Settings when Digests enabled
159
+ * Changed Registered Subscribers to Registered Users in drop down to avoid confusion
160
+ * Minor code revisions for admin menu layout
161
+
162
  Version 2.21 by Matthew Robinson
163
 
164
  * Change from deprecated get_settings -> get_option
subscribe2/subscribe2.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
- Description: Notifies an email list when new entries are posted. Tested with WordPress 2.1.x and 2.2.x.
6
- Version: 3.7
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
@@ -41,7 +41,7 @@ define('S2PAGE', '0');
41
 
42
  // our version number. Don't touch this or any line below
43
  // unless you know exacly what you are doing
44
- define('S2VERSION', '3.7');
45
  define ('S2PATH', trailingslashit(dirname(__FILE__)));
46
 
47
  // use Owen's excellent ButtonSnap library
@@ -146,7 +146,7 @@ class s2class {
146
  function install() {
147
  // include upgrade-functions for maybe_create_table;
148
  if (!function_exists('maybe_create_table')) {
149
- require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
150
  }
151
  $date = date('Y-m-d');
152
  $sql = "CREATE TABLE $this->public (
@@ -169,7 +169,7 @@ class s2class {
169
 
170
  // include upgrade-functions for maybe_create_table;
171
  if (!function_exists('maybe_create_table')) {
172
- require_once(ABSPATH . 'wp-admin/upgrade-functions.php');
173
  }
174
  $date = date('Y-m-d');
175
  maybe_add_column($this->public, 'date', "ALTER TABLE `$this->public` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active`;");
@@ -217,13 +217,13 @@ class s2class {
217
  if ('' == $string) {
218
  return;
219
  }
220
- $string = str_replace('BLOGNAME', get_option('blogname'), $string);
221
- $string = str_replace('BLOGLINK', get_bloginfo('url'), $string);
222
- $string = str_replace('TITLE', stripslashes($this->post_title), $string);
223
- $string = str_replace('PERMALINK', $this->permalink, $string);
224
- $string = str_replace('MYNAME', stripslashes($this->myname), $string);
225
- $string = str_replace('EMAIL', $this->myemail, $string);
226
- $string = str_replace('AUTHORNAME', $this->authorname, $string);
227
  return $string;
228
  } // end substitute()
229
 
@@ -235,7 +235,7 @@ class s2class {
235
 
236
  // Set sender details
237
  if ('' == $this->myname) {
238
- $admin = get_userdata(1);
239
  $this->myname = $admin->display_name;
240
  $this->myemail = $admin->user_email;
241
  }
@@ -260,8 +260,7 @@ class s2class {
260
 
261
  // BCC all recipients
262
  $bcc = '';
263
- if ( (defined('BCCLIMIT') && (BCCLIMIT > 0) ) &&
264
- (count($recipients) > BCCLIMIT) ) {
265
  // we're on Dreamhost, and have more than 30 susbcribers
266
  $count = 1;
267
  $batch = array();
@@ -326,21 +325,19 @@ class s2class {
326
  /**
327
  Sends an email notification of a new post
328
  */
329
- function publish($id = 0) {
330
- if (!$id) { return $id; }
331
 
332
  // are we doing daily digests? If so, don't send anything now
333
- if ($this->subscribe2_options['email_freq'] != 'never') { return $id; }
334
 
335
- // we need to determine whether this is a new post, or an edit
336
- if ($this->private) {
337
- // this post was published from draft status
338
- // OR is an edit of an existing post
339
- // so send no notification
340
- return $id;
341
  }
342
 
343
- $post_cats = wp_get_post_cats('1', $id);
344
  $post_cats_string = implode(',', $post_cats);
345
  $check = false;
346
  // is the current post assigned to any categories
@@ -356,19 +353,14 @@ class s2class {
356
  // excluded categories?
357
  if ('0' == $this->subscribe2_options['reg_override']) {
358
  // nope? okay, let's leave
359
- return $id;
360
  }
361
  }
362
 
363
- global $wpdb;
364
- $post =& get_post($id);
365
- // is the post password protected?
366
- if ( ($this->subscribe2_options['password'] == "no") && ($post->post_password != '') ) {return $id; }
367
-
368
  // is this post set in the future?
369
  if ($post->post_date > current_time('mysql')) {
370
  // bail out
371
- return $id;
372
  }
373
 
374
  // lets collect our public subscribers
@@ -384,12 +376,12 @@ class s2class {
384
  // do we have subscribers?
385
  if ( (empty($public)) && (empty($registered)) ) {
386
  // if not, no sense doing anything else
387
- return $id;
388
  }
389
  // we set these class variables so that we can avoid
390
  // passing them in function calls a little later
391
  $this->post_title = $post->post_title;
392
- $this->permalink = "<a href=\"" . get_permalink($id) . "\">" . get_permalink($id) . "</a>";
393
 
394
  $author = get_userdata($post->post_author);
395
  $this->authorname = $author->display_name;
@@ -400,7 +392,7 @@ class s2class {
400
  $user =& $author;
401
  } else {
402
  // get admin details
403
- $user = get_userdata(1);
404
  }
405
  $this->myemail = $user->user_email;
406
  $this->myname = $user->display_name;
@@ -411,7 +403,7 @@ class s2class {
411
 
412
  $plaintext = $post->post_content;
413
  $content = apply_filters('the_content', $post->post_content);
414
- $content = str_replace(']]>', ']]&gt', $content);
415
  $excerpt = $post->post_excerpt;
416
  if ('' == $excerpt) {
417
  // no excerpt, is there a <!--more--> ?
@@ -434,7 +426,7 @@ class s2class {
434
  }
435
 
436
  // first we send plaintext summary emails
437
- $body = str_replace('POST', $excerpt, $mailtext);
438
  $registered = $this->get_registered("cats=$post_cats_string&format=text&amount=excerpt");
439
  if (empty($registered)) {
440
  $recipients = (array)$public;
@@ -446,37 +438,16 @@ class s2class {
446
  }
447
  $this->mail($recipients, $subject, $body);
448
  // next we send plaintext full content emails
449
- $body = str_replace('POST', strip_tags($plaintext), $mailtext);
450
  $this->mail($this->get_registered("cats=$post_cats_string&format=text&amount=post"), $subject, $body);
451
  // finally we send html full content emails
452
  $body = str_replace("\r\n", "<br />\r\n", $mailtext);
453
- $body = str_replace('POST', $content, $body);
454
  $this->mail($this->get_registered("cats=$post_cats_string&format=html"), $subject, $body, 'html');
455
 
456
  return $id;
457
  } // end publish()
458
 
459
- /**
460
- Sends a notification when a draft post is published
461
- */
462
- function private2publish($id = 0) {
463
- if (0 == $id) { return $id; }
464
-
465
- $this->publish($id);
466
- $this->private = TRUE;
467
- return $id;
468
- } // end private2publish()
469
-
470
- /**
471
- Prevents notifications from being sent when editing posts
472
- */
473
- function edit($id = 0) {
474
- if (0 == $id) { return; }
475
-
476
- $this->private = TRUE;
477
- return $id;
478
- }
479
-
480
  /**
481
  Send confirmation email to the user
482
  */
@@ -494,7 +465,8 @@ class s2class {
494
  // ACTION = 1 to subscribe, 0 to unsubscribe
495
  // HASH = md5 hash of email address
496
  // ID = user's ID in the subscribe2 table
497
- $link = get_option('siteurl') . "/?s2=";
 
498
 
499
  if ('add' == $what) {
500
  $link .= '1';
@@ -504,7 +476,7 @@ class s2class {
504
  $link .= md5($this->email);
505
  $link .= $id;
506
 
507
- $admin = get_userdata(1);
508
  $this->myname = $admin->display_name;
509
 
510
  if ($is_remind == TRUE) {
@@ -522,14 +494,14 @@ class s2class {
522
 
523
  $body = str_replace("LINK", $link, $body);
524
 
525
- $mailheaders .= "From: $admin->display_name <$admin->user_email>\n";
526
- $mailheaders .= "Return-Path: <$admin->user_email>\n";
527
  $mailheaders .= "X-Mailer:PHP" . phpversion() . "\n";
528
  $mailheaders .= "Precedence: list\nList-Id: " . get_option('blogname') . "\n";
529
  $mailheaders .= "MIME-Version: 1.0\n";
530
  $mailheaders .= "Content-Type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
531
 
532
- @wp_mail ($this->email, $subject, $body, $mailheaders);
533
  } // end send_confirm()
534
 
535
  /* ===== Subscriber functions ===== */
@@ -648,7 +620,7 @@ class s2class {
648
  function remind($emails = '') {
649
  if ('' == $emails) { return false; }
650
 
651
- $admin = get_userdata(1);
652
  $this->myname = $admin->display_name;
653
 
654
  $recipients = explode(",", $emails);
@@ -712,8 +684,8 @@ class s2class {
712
  $this->activate();
713
  $this->message = $this->added;
714
  $subject = '[' . get_option('blogname') . '] ' . __('New subscriber', 'subscribe2');
715
- $message = "$this->email " . __('subscribed to email notifications!', 'subscribe2');
716
- $recipients = $wpdb->get_col("SELECT DISTINCT(user_email) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key='wp_user_level' AND $wpdb->usermeta.meta_value='10'");
717
  $this->mail($recipients, $subject, $message);
718
  $this->filtered = 1;
719
  } elseif ('0' == $action) {
@@ -865,14 +837,14 @@ class s2class {
865
 
866
  if (0 == $user_id) { return $user_id; }
867
  $user = get_userdata($user_id);
868
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
869
 
870
  if (0 == $this->subscribe2_options['reg_override']) {
871
  // registered users are not allowed to subscribe to
872
  // excluded categories
873
  $exclude = explode(',', $this->subscribe2_options['exclude']);
874
- foreach ($all_cats as $cat => $cat_ID) {
875
- if (in_array($all_cats[$cat]->cat_ID, $exclude)) {
876
  $cat = (int)$cat;
877
  unset($all_cats[$cat]);
878
  }
@@ -880,7 +852,7 @@ class s2class {
880
  }
881
 
882
  foreach ($all_cats as $cat) {
883
- ('' == $cats) ? $cats = "$cat->cat_ID" : $cats .= ",$cat->cat_ID";
884
  }
885
 
886
  if ('' == $cats) {
@@ -1020,6 +992,19 @@ class s2class {
1020
  update_usermeta($user_ID, 's2_subscribed', implode(',', $newcats));
1021
  }
1022
  } // end autosub_new_category
 
 
 
 
 
 
 
 
 
 
 
 
 
1023
 
1024
  /* ===== Menus ===== */
1025
  /**
@@ -1134,10 +1119,10 @@ class s2class {
1134
  if (function_exists('wp_nonce_field')) {
1135
  wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1136
  }
1137
- echo "<p style=\"align:left\">" . __('Enter addresses, one per line or comma-seperated', 'subscribe2') . "<br />\r\n";
1138
- echo "<input type=\"hidden\" name=\"s2_admin\" value=\"subscribe\" />";
1139
- echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea>";
1140
- echo "<br /><span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Subscribe', 'subscribe2') . "\"/></span>";
1141
  echo "</form></div>";
1142
 
1143
  // subscriber lists
@@ -1147,7 +1132,7 @@ class s2class {
1147
  // show the selected subscribers
1148
  $alternate = 'alternate';
1149
  if (!empty($subscribers)) {
1150
- echo "<p align=\"center\"><b>" . __('Registered on the left, confirmed in the middle, unconfirmed on the right', 'subscribe2') . "</b></p>";
1151
  if (is_writable(ABSPATH . 'wp-content')) {
1152
  $exportcsv = implode(",", $subscribers);
1153
  echo "<form method=\"post\" action=\"\">\r\n";
@@ -1156,7 +1141,7 @@ class s2class {
1156
  }
1157
  echo "<input type=\"hidden\" name=\"exportcsv\" value=\"$exportcsv\" />\r\n";
1158
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"exportcsv\" />\r\n";
1159
- echo "<p align=\"right\"><span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Save Emails to CSV File','subscribe2') . "\" /></span>\r\n";
1160
  echo "</form>\r\n";
1161
  }
1162
  }
@@ -1168,9 +1153,9 @@ class s2class {
1168
  if (in_array($subscriber, $unconfirmed)) {
1169
  echo " align=\"right\">";
1170
  } elseif (in_array($subscriber, $confirmed)) {
1171
- echo "align=\"center\">";
1172
  } else {
1173
- echo "align=\"left\" colspan=\"3\">";
1174
  }
1175
  echo "<a href=\"mailto:$subscriber\">$subscriber</a>\r\n";
1176
  if (in_array($subscriber, $unconfirmed) || in_array($subscriber, $confirmed) ) {
@@ -1217,7 +1202,7 @@ class s2class {
1217
  }
1218
  echo "<input type=\"hidden\" name=\"reminderemails\" value=\"$reminderemails\" />\r\n";
1219
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"remind\" />\r\n";
1220
- echo "<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Send Reminder Email','subscribe2') . "\" />\r\n";
1221
  echo "</form>";
1222
  }
1223
  echo "</div>\r\n";
@@ -1236,7 +1221,7 @@ class s2class {
1236
  echo "<input type=\"radio\" name=\"manage\" value=\"unsubscribe\" />" . __('Unsubscribe', 'subscribe2') . "<br /><br />\r\n";
1237
  echo "<input type=\"hidden\" name=\"emails\" value=\"$emails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"register\" />\r\n";
1238
  $this->display_category_form();
1239
- echo "<p align=\"right\"><span class=\"submit\"><input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></span></form>";
1240
 
1241
  echo "</div>\r\n";
1242
  echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
@@ -1274,6 +1259,10 @@ class s2class {
1274
  ($_POST['show_button'] == '1') ? $showbutton = '1' : $showbutton = '0';
1275
  $this->subscribe2_options['show_button'] = $showbutton;
1276
 
 
 
 
 
1277
  // send as author or admin?
1278
  $sender = 'author';
1279
  if ('admin' == $_POST['sender']) {
@@ -1289,7 +1278,12 @@ class s2class {
1289
 
1290
  // send per-post or digest emails
1291
  $email_freq = $_POST['email_freq'];
 
 
 
 
1292
  $this->subscribe2_options['email_freq'] = $email_freq;
 
1293
  wp_clear_scheduled_hook('s2_digest_cron');
1294
  $scheds = (array) wp_get_schedules();
1295
  $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int) $scheds[$email_freq]['interval'] : 0;
@@ -1299,8 +1293,20 @@ class s2class {
1299
  } else {
1300
  if (!wp_next_scheduled('s2_digest_cron')) {
1301
  // if we are using digest schedule the event and prime last_cron as now
1302
- wp_schedule_event(time() + $interval, $email_freq, 's2_digest_cron');
1303
- $now = date('Y-m-d H:i:s', time());
 
 
 
 
 
 
 
 
 
 
 
 
1304
  $this->subscribe2_options['last_s2cron'] = $now;
1305
  }
1306
  }
@@ -1361,18 +1367,17 @@ class s2class {
1361
  echo __('Send Email From', 'subscribe2') . ': ';
1362
  echo "<input type=\"radio\" name=\"sender\" value=\"author\"";
1363
  if ('author' == $this->subscribe2_options['sender']) {
1364
- echo "checked=\"checked\" ";
1365
  }
1366
  echo " /> " . __('Author of the post', 'subscribe2') . " &nbsp;&nbsp;";
1367
  echo "<input type=\"radio\" name=\"sender\" value=\"admin\"";
1368
  if ('admin' == $this->subscribe2_options['sender']) {
1369
- echo "checked=\"checked\" ";
1370
  }
1371
  echo " /> " . __('Blog Admin', 'subscribe2') . "<br /><br />\r\n";
1372
  if (function_exists('wp_schedule_event')) {
1373
  echo __('Send Email as Digest', 'subscribe2') . ": <br /><br />\r\n";
1374
  $this->display_digest_choices();
1375
- echo "<br />\r\n";
1376
  }
1377
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1378
  echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
@@ -1420,6 +1425,13 @@ class s2class {
1420
  }
1421
  echo " /> " . __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "<br /><br />\r\n";
1422
 
 
 
 
 
 
 
 
1423
  //Auto Subscription for new registrations
1424
  echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
1425
  echo __('Subscribe new users registering with your blog', 'subscribe2') . ":<br />\r\n";
@@ -1519,7 +1531,7 @@ class s2class {
1519
  update_usermeta($user_ID, 's2_autosub', $_POST['new_category']);
1520
 
1521
  $cats = $_POST['category'];
1522
- if (empty($cats)) {
1523
  $cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1524
  if ($cats) {
1525
  foreach ($cats as $cat) {
@@ -1527,6 +1539,13 @@ class s2class {
1527
  }
1528
  }
1529
  update_usermeta($user_ID, 's2_subscribed', '-1');
 
 
 
 
 
 
 
1530
  } else {
1531
  if (!is_array($cats)) {
1532
  $cats = array($_POST['category']);
@@ -1537,13 +1556,13 @@ class s2class {
1537
  if (!empty($remove)) {
1538
  // remove subscription to these cat IDs
1539
  foreach ($remove as $id) {
1540
- delete_usermeta($user_ID, "s2_cat" .$id);
1541
  }
1542
  }
1543
  if (!empty($new)) {
1544
  // add subscription to these cat IDs
1545
  foreach ($new as $id) {
1546
- update_usermeta($user_ID, 's2_cat' . $id, "$id");
1547
  }
1548
  }
1549
  update_usermeta($user_ID, 's2_subscribed', implode(',', $cats));
@@ -1584,12 +1603,12 @@ class s2class {
1584
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
1585
  echo "<input type=\"radio\" name=\"new_category\" value=\"yes\" ";
1586
  if ('yes' == get_usermeta($user_ID, 's2_autosub')) {
1587
- echo "checked=\"yes\" ";
1588
  }
1589
  echo "/> Yes &nbsp;&nbsp;";
1590
  echo "<input type=\"radio\" name=\"new_category\" value=\"no\" ";
1591
  if ('no' == get_usermeta($user_ID, 's2_autosub')) {
1592
- echo "checked=\"yes\" ";
1593
  }
1594
  echo "/> No<br /><br />";
1595
 
@@ -1600,19 +1619,19 @@ class s2class {
1600
  // we're doing daily digests, so just show
1601
  // subscribe / unnsubscribe
1602
  echo __('Receive daily summary of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
1603
- echo "<input type=\"radio\" name=\"category\" value=\"1\" ";
1604
- if (get_usermeta($user_ID, 's2_subscribed')) {
1605
  echo "checked=\"yes\" ";
1606
  }
1607
- echo "/> Yes <input type=\"radio\" name=\"category\" value=\"\" ";
1608
- if (! get_usermeta($user_ID, 's2_subscribed')) {
1609
  echo "checked=\"yes\" ";
1610
  }
1611
  echo "/> No";
1612
  }
1613
 
1614
  // submit
1615
- echo "<p align=\"right\"><span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __("Update Preferences &raquo;", 'subscribe2') . "\" /></span></p>";
1616
  echo "</form></div>\r\n";
1617
 
1618
  include(ABSPATH . 'wp-admin/admin-footer.php');
@@ -1685,14 +1704,14 @@ class s2class {
1685
  function display_category_form($selected = array(), $override = 1) {
1686
  global $wpdb;
1687
 
1688
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1689
  $exclude = explode(',', $this->subscribe2_options['exclude']);
1690
 
1691
  if (0 == $override) {
1692
  // registered users are not allowed to subscribe to
1693
  // excluded categories
1694
- foreach ($all_cats as $cat => $cat_ID) {
1695
- if (in_array($all_cats[$cat]->cat_ID, $exclude)) {
1696
  $cat = (int)$cat;
1697
  unset($all_cats[$cat]);
1698
  }
@@ -1710,23 +1729,23 @@ class s2class {
1710
  $j++;
1711
  }
1712
  if (0 == $j) {
1713
- echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1714
- if (in_array($cat->cat_ID, $selected)) {
1715
  echo " checked=\"checked\" ";
1716
  }
1717
- echo " /> " . $cat->cat_name . "<br />\r\n";
1718
  } else {
1719
 
1720
- echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1721
- if (in_array($cat->cat_ID, $selected)) {
1722
  echo " checked=\"checked\" ";
1723
  }
1724
- echo " /> " . $cat->cat_name . "<br />\r\n";
1725
  }
1726
  $i++;
1727
  }
1728
  echo "</td></tr>\r\n";
1729
- echo "<tr><td align=\"left\">\r\n";
1730
  echo "<input type=\"checkbox\" name=\"checkall\" onclick=\"setAll(this)\" /> " . __('Select / Unselect All' ,'subscribe2') . "\r\n";
1731
  echo "</td></tr>\r\n";
1732
  echo "</table>\r\n";
@@ -1744,9 +1763,9 @@ class s2class {
1744
  'public' => __('Public Subscribers', 'subscribe2'),
1745
  'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
1746
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
1747
- 'registered' => __('Registered Subscribers', 'subscribe2'));
1748
 
1749
- $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1750
 
1751
  // count the number of subscribers
1752
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
@@ -1761,7 +1780,7 @@ class s2class {
1761
  $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='s2_subscribed'");
1762
  $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
1763
  foreach ($all_cats as $cat) {
1764
- $count[$cat->cat_name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='s2_cat$cat->cat_ID'");
1765
  }
1766
 
1767
  // do have actually have some subscribers?
@@ -1785,10 +1804,10 @@ class s2class {
1785
 
1786
  if ($count['registered'] > 0) {
1787
  foreach ($all_cats as $cat) {
1788
- if (in_array($cat->cat_ID, $exclude)) { continue; }
1789
- echo "<option value=\"" . $cat->cat_ID . "\"";
1790
- if ($cat->cat_ID == $selected) { echo " selected=\"selected\" "; }
1791
- echo "> &nbsp;&nbsp;" . $cat->cat_name . "&nbsp;(" . $count[$cat->cat_name] . ") </option>\r\n";
1792
  }
1793
  }
1794
  echo "</select>";
@@ -1816,12 +1835,15 @@ class s2class {
1816
  echo " /> " . $value['display'] . "<br />\r\n";
1817
  }
1818
  if (wp_next_scheduled('s2_digest_cron')) {
 
1819
  $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
1820
  $now = time();
1821
  echo "<p>" . __('Current server time is', 'subscribe2') . ": \r\n";
1822
  echo "<strong>" . gmdate($datetime, $now+ (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
1823
  echo "<p>" . __('Next email notification will be sent', 'subscribe2') . ": \r\n";
1824
  echo "<strong>" . gmdate($datetime, wp_next_scheduled('s2_digest_cron') + (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
 
 
1825
  }
1826
  } // end display_digest_choices()
1827
 
@@ -1925,7 +1947,8 @@ class s2class {
1925
  }
1926
  }
1927
  }
1928
- return preg_replace('|(<p>)(\n)*<!--subscribe2-->(\n)*(</p>)|', $this->s2form, $content);
 
1929
  } // end filter()
1930
 
1931
  /**
@@ -1960,6 +1983,55 @@ class s2class {
1960
  return __('Subscription Confirmation', 'subscribe2');
1961
  } // end title_filter()
1962
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1963
  /* ===== wp-cron functions ===== */
1964
  /**
1965
  Send a daily digest of today's new posts
@@ -1970,7 +2042,7 @@ class s2class {
1970
  // collect posts
1971
  $now = date('Y-m-d H:i:s', time());
1972
  $prev = $this->subscribe2_options['last_s2cron'];
1973
- $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'");
1974
 
1975
  // update last_s2cron execution time before completing or bailing
1976
  $this->subscribe2_options['last_s2cron'] = $now;
@@ -1981,7 +2053,7 @@ class s2class {
1981
 
1982
  // if we have posts, let's prepare the digest
1983
  foreach ($posts as $post) {
1984
- $post_cats = wp_get_post_cats('1', $post->ID);
1985
  $post_cats_string = implode(',', $post_cats);
1986
  $check = false;
1987
  // is the current post assigned to any categories
@@ -1991,6 +2063,16 @@ class s2class {
1991
  $check = true;
1992
  }
1993
  }
 
 
 
 
 
 
 
 
 
 
1994
  // if this post is in an excluded category,
1995
  // don't include it in the digest
1996
  if ($check) {
@@ -2028,7 +2110,7 @@ class s2class {
2028
  $user =& $author;
2029
  } else {
2030
  // get admin detailts
2031
- $user = get_userdata(1);
2032
  }
2033
  $this->myemail = $user->user_email;
2034
  $this->myname = $user->display_name;
@@ -2041,8 +2123,8 @@ class s2class {
2041
  $registered = $this->get_registered();
2042
  $recipients = array_merge((array)$public, (array)$registered);
2043
  $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
2044
- $body = str_replace('TABLE', $table, $mailtext);
2045
- $body = str_replace('POST', $message, $mailtext);
2046
  $this->mail($recipients, $subject, $body);
2047
  } // end subscribe2_cron
2048
 
@@ -2056,9 +2138,13 @@ class s2class {
2056
  $this->subscribe2_options = get_option('subscribe2_options');
2057
 
2058
  add_action('init', array(&$this, 'subscribe2'));
2059
- if('1' == $this->subscribe2_options['show_button']) {
2060
  add_action('init', array(&$this, 'button_init'));
2061
  }
 
 
 
 
2062
  }
2063
 
2064
  function subscribe2() {
@@ -2086,7 +2172,7 @@ class s2class {
2086
  add_action('admin_menu', array(&$this, 'admin_menu'));
2087
  add_action('create_category', array(&$this, 'autosub_new_category'));
2088
  add_action('register_form', array(&$this, 'register_form'));
2089
- add_filter('the_content', array(&$this, 'filter'));
2090
  add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
2091
 
2092
  // add action to display editor buttons if option is enabled
@@ -2106,20 +2192,21 @@ class s2class {
2106
  if ($this->subscribe2_options['email_freq'] != 'never') {
2107
  add_action('s2_digest_cron', array(&$this, 'subscribe2_cron'));
2108
  } else {
2109
- add_action('publish_post', array(&$this, 'publish'));
2110
- add_action('edit_post', array(&$this, 'edit'));
2111
- add_action('private_to_published', array(&$this, 'private2publish'));
2112
- }
2113
-
2114
- // add action to email notification about pages if option is enabled
2115
- if ($this->subscribe2_options['pages'] == 'yes') {
2116
- add_action('publish_page', array(&$this, 'publish'));
 
2117
  }
2118
 
2119
  // load our strings
2120
  $this->load_strings();
2121
  } // end subscribe2()
2122
-
2123
  /* ===== ButtonSnap configuration ===== */
2124
  /**
2125
  Register our button in the QuickTags bar
2
  /*
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
+ Description: Notifies an email list when new entries are posted.
6
+ Version: 4.1
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
41
 
42
  // our version number. Don't touch this or any line below
43
  // unless you know exacly what you are doing
44
+ define('S2VERSION', '4.1');
45
  define ('S2PATH', trailingslashit(dirname(__FILE__)));
46
 
47
  // use Owen's excellent ButtonSnap library
146
  function install() {
147
  // include upgrade-functions for maybe_create_table;
148
  if (!function_exists('maybe_create_table')) {
149
+ require_once(ABSPATH . 'wp-admin/install-helper.php');
150
  }
151
  $date = date('Y-m-d');
152
  $sql = "CREATE TABLE $this->public (
169
 
170
  // include upgrade-functions for maybe_create_table;
171
  if (!function_exists('maybe_create_table')) {
172
+ require_once(ABSPATH . 'wp-admin/install-helper.php');
173
  }
174
  $date = date('Y-m-d');
175
  maybe_add_column($this->public, 'date', "ALTER TABLE `$this->public` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active`;");
217
  if ('' == $string) {
218
  return;
219
  }
220
+ $string = str_replace("BLOGNAME", get_option('blogname'), $string);
221
+ $string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
222
+ $string = str_replace("TITLE", stripslashes($this->post_title), $string);
223
+ $string = str_replace("PERMALINK", $this->permalink, $string);
224
+ $string = str_replace("MYNAME", stripslashes($this->myname), $string);
225
+ $string = str_replace("EMAIL", $this->myemail, $string);
226
+ $string = str_replace("AUTHORNAME", $this->authorname, $string);
227
  return $string;
228
  } // end substitute()
229
 
235
 
236
  // Set sender details
237
  if ('' == $this->myname) {
238
+ $admin = $this->get_userdata();
239
  $this->myname = $admin->display_name;
240
  $this->myemail = $admin->user_email;
241
  }
260
 
261
  // BCC all recipients
262
  $bcc = '';
263
+ if ( (defined('BCCLIMIT')) && (BCCLIMIT > 0) && (count($recipients) > BCCLIMIT) ) {
 
264
  // we're on Dreamhost, and have more than 30 susbcribers
265
  $count = 1;
266
  $batch = array();
325
  /**
326
  Sends an email notification of a new post
327
  */
328
+ function publish($post = 0) {
329
+ if (!$post) { return $post; }
330
 
331
  // are we doing daily digests? If so, don't send anything now
332
+ if ($this->subscribe2_options['email_freq'] != 'never') { return $post; }
333
 
334
+ // is the current post a page
335
+ // and should this not generate a notification email?
336
+ if ( ($this->subscribe2_options['pages'] == 'no') && ($post->post_type == 'page') ) {
337
+ return $post;
 
 
338
  }
339
 
340
+ $post_cats = wp_get_post_categories($post->ID);
341
  $post_cats_string = implode(',', $post_cats);
342
  $check = false;
343
  // is the current post assigned to any categories
353
  // excluded categories?
354
  if ('0' == $this->subscribe2_options['reg_override']) {
355
  // nope? okay, let's leave
356
+ return $post;
357
  }
358
  }
359
 
 
 
 
 
 
360
  // is this post set in the future?
361
  if ($post->post_date > current_time('mysql')) {
362
  // bail out
363
+ return $post;
364
  }
365
 
366
  // lets collect our public subscribers
376
  // do we have subscribers?
377
  if ( (empty($public)) && (empty($registered)) ) {
378
  // if not, no sense doing anything else
379
+ return $post;
380
  }
381
  // we set these class variables so that we can avoid
382
  // passing them in function calls a little later
383
  $this->post_title = $post->post_title;
384
+ $this->permalink = "<a href=\"" . get_permalink($post->ID) . "\">" . get_permalink($post->ID) . "</a>";
385
 
386
  $author = get_userdata($post->post_author);
387
  $this->authorname = $author->display_name;
392
  $user =& $author;
393
  } else {
394
  // get admin details
395
+ $user = $this->get_userdata();
396
  }
397
  $this->myemail = $user->user_email;
398
  $this->myname = $user->display_name;
403
 
404
  $plaintext = $post->post_content;
405
  $content = apply_filters('the_content', $post->post_content);
406
+ $content = str_replace("]]>", "]]&gt", $content);
407
  $excerpt = $post->post_excerpt;
408
  if ('' == $excerpt) {
409
  // no excerpt, is there a <!--more--> ?
426
  }
427
 
428
  // first we send plaintext summary emails
429
+ $body = str_replace("POST", $excerpt, $mailtext);
430
  $registered = $this->get_registered("cats=$post_cats_string&format=text&amount=excerpt");
431
  if (empty($registered)) {
432
  $recipients = (array)$public;
438
  }
439
  $this->mail($recipients, $subject, $body);
440
  // next we send plaintext full content emails
441
+ $body = str_replace("POST", strip_tags($plaintext), $mailtext);
442
  $this->mail($this->get_registered("cats=$post_cats_string&format=text&amount=post"), $subject, $body);
443
  // finally we send html full content emails
444
  $body = str_replace("\r\n", "<br />\r\n", $mailtext);
445
+ $body = str_replace("POST", $content, $body);
446
  $this->mail($this->get_registered("cats=$post_cats_string&format=html"), $subject, $body, 'html');
447
 
448
  return $id;
449
  } // end publish()
450
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
451
  /**
452
  Send confirmation email to the user
453
  */
465
  // ACTION = 1 to subscribe, 0 to unsubscribe
466
  // HASH = md5 hash of email address
467
  // ID = user's ID in the subscribe2 table
468
+ //use home instead of siteurl incase index.php is not in core wordpress directory
469
+ $link = get_option('home') . "/?s2=";
470
 
471
  if ('add' == $what) {
472
  $link .= '1';
476
  $link .= md5($this->email);
477
  $link .= $id;
478
 
479
+ $admin = $this->get_userdata();
480
  $this->myname = $admin->display_name;
481
 
482
  if ($is_remind == TRUE) {
494
 
495
  $body = str_replace("LINK", $link, $body);
496
 
497
+ $mailheaders .= "From: " . $admin->display_name . " <" . $admin->user_email . ">\n";
498
+ $mailheaders .= "Return-Path: " . $admin->user_email . "\n";
499
  $mailheaders .= "X-Mailer:PHP" . phpversion() . "\n";
500
  $mailheaders .= "Precedence: list\nList-Id: " . get_option('blogname') . "\n";
501
  $mailheaders .= "MIME-Version: 1.0\n";
502
  $mailheaders .= "Content-Type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
503
 
504
+ @mail($this->email, $subject, $body, $mailheaders);
505
  } // end send_confirm()
506
 
507
  /* ===== Subscriber functions ===== */
620
  function remind($emails = '') {
621
  if ('' == $emails) { return false; }
622
 
623
+ $admin = $this->get_userdata();
624
  $this->myname = $admin->display_name;
625
 
626
  $recipients = explode(",", $emails);
684
  $this->activate();
685
  $this->message = $this->added;
686
  $subject = '[' . get_option('blogname') . '] ' . __('New subscriber', 'subscribe2');
687
+ $message = $this->email . __('subscribed to email notifications!', 'subscribe2');
688
+ $recipients = $wpdb->get_col("SELECT DISTINCT(user_email) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key='$wpdb->prefix . user_level' AND $wpdb->usermeta.meta_value='10'");
689
  $this->mail($recipients, $subject, $message);
690
  $this->filtered = 1;
691
  } elseif ('0' == $action) {
837
 
838
  if (0 == $user_id) { return $user_id; }
839
  $user = get_userdata($user_id);
840
+ $all_cats = get_categories(array('hide_empty' => false));
841
 
842
  if (0 == $this->subscribe2_options['reg_override']) {
843
  // registered users are not allowed to subscribe to
844
  // excluded categories
845
  $exclude = explode(',', $this->subscribe2_options['exclude']);
846
+ foreach ($all_cats as $cat => $term_id) {
847
+ if (in_array($all_cats[$cat]->term_id, $exclude)) {
848
  $cat = (int)$cat;
849
  unset($all_cats[$cat]);
850
  }
852
  }
853
 
854
  foreach ($all_cats as $cat) {
855
+ ('' == $cats) ? $cats = "$cat->term_id" : $cats .= ",$cat->term_id";
856
  }
857
 
858
  if ('' == $cats) {
992
  update_usermeta($user_ID, 's2_subscribed', implode(',', $newcats));
993
  }
994
  } // end autosub_new_category
995
+
996
+ /**
997
+ Get admin data from record 1 or first user with admin rights
998
+ */
999
+ function get_userdata() {
1000
+ global $wpdb;
1001
+ $admin = get_userdata(1);
1002
+ if (empty($admin)) {
1003
+ $sql = "SELECT DISTINCT(ID) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key='$wpdb->prefix . user_level' AND $wpdb->usermeta.meta_value='10' LIMIT 1";
1004
+ $admin = get_userdata($wpdb->get_var($sql));
1005
+ }
1006
+ return $admin;
1007
+ } //end get_userdata
1008
 
1009
  /* ===== Menus ===== */
1010
  /**
1119
  if (function_exists('wp_nonce_field')) {
1120
  wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1121
  }
1122
+ echo __('Enter addresses, one per line or comma-seperated', 'subscribe2') . "<br />\r\n";
1123
+ echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea><br />\r\n";
1124
+ echo "<span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Subscribe', 'subscribe2') . "\"/>\r\n";
1125
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"subscribe\" /></span>";
1126
  echo "</form></div>";
1127
 
1128
  // subscriber lists
1132
  // show the selected subscribers
1133
  $alternate = 'alternate';
1134
  if (!empty($subscribers)) {
1135
+ echo "<p align=\"center\"><b>" . __('Registered on the left, confirmed in the middle, unconfirmed on the right', 'subscribe2') . "</b></p>\r\n";
1136
  if (is_writable(ABSPATH . 'wp-content')) {
1137
  $exportcsv = implode(",", $subscribers);
1138
  echo "<form method=\"post\" action=\"\">\r\n";
1141
  }
1142
  echo "<input type=\"hidden\" name=\"exportcsv\" value=\"$exportcsv\" />\r\n";
1143
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"exportcsv\" />\r\n";
1144
+ echo "<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Save Emails to CSV File','subscribe2') . "\" /></p>\r\n";
1145
  echo "</form>\r\n";
1146
  }
1147
  }
1153
  if (in_array($subscriber, $unconfirmed)) {
1154
  echo " align=\"right\">";
1155
  } elseif (in_array($subscriber, $confirmed)) {
1156
+ echo " align=\"center\">";
1157
  } else {
1158
+ echo " align=\"left\" colspan=\"3\">";
1159
  }
1160
  echo "<a href=\"mailto:$subscriber\">$subscriber</a>\r\n";
1161
  if (in_array($subscriber, $unconfirmed) || in_array($subscriber, $confirmed) ) {
1202
  }
1203
  echo "<input type=\"hidden\" name=\"reminderemails\" value=\"$reminderemails\" />\r\n";
1204
  echo "<input type=\"hidden\" name=\"s2_admin\" value=\"remind\" />\r\n";
1205
+ echo "<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Send Reminder Email','subscribe2') . "\" /></p>\r\n";
1206
  echo "</form>";
1207
  }
1208
  echo "</div>\r\n";
1221
  echo "<input type=\"radio\" name=\"manage\" value=\"unsubscribe\" />" . __('Unsubscribe', 'subscribe2') . "<br /><br />\r\n";
1222
  echo "<input type=\"hidden\" name=\"emails\" value=\"$emails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"register\" />\r\n";
1223
  $this->display_category_form();
1224
+ echo "<p class=\"submit\"><input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></p></form>";
1225
 
1226
  echo "</div>\r\n";
1227
  echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
1259
  ($_POST['show_button'] == '1') ? $showbutton = '1' : $showbutton = '0';
1260
  $this->subscribe2_options['show_button'] = $showbutton;
1261
 
1262
+ // show widget in Presentation->Widgets
1263
+ ($_POST['widget'] == '1') ? $showwidget = '1' : $showwidget = '0';
1264
+ $this->subscribe2_options['widget'] = $showwidget;
1265
+
1266
  // send as author or admin?
1267
  $sender = 'author';
1268
  if ('admin' == $_POST['sender']) {
1278
 
1279
  // send per-post or digest emails
1280
  $email_freq = $_POST['email_freq'];
1281
+ if ($email_freq != $this->subscribe2_options['email_freq']) {
1282
+ //ensure $timestamp is used if cron period changes
1283
+ $check = true;
1284
+ }
1285
  $this->subscribe2_options['email_freq'] = $email_freq;
1286
+ $previous_time = wp_next_scheduled('s2_digest_cron');
1287
  wp_clear_scheduled_hook('s2_digest_cron');
1288
  $scheds = (array) wp_get_schedules();
1289
  $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int) $scheds[$email_freq]['interval'] : 0;
1293
  } else {
1294
  if (!wp_next_scheduled('s2_digest_cron')) {
1295
  // if we are using digest schedule the event and prime last_cron as now
1296
+ $time = time() + $interval;
1297
+ if ($interval < 86400) {
1298
+ // Schedule CRON events occurring less than daily starting now and periodically thereafter
1299
+ $timestamp = &$time;
1300
+ } else {
1301
+ // Schedule other CRON events starting at midnight and periodically thereafter
1302
+ $timestamp = mktime(0, 0, 0, date('m', $time), date('d', $time), date('Y', $time));
1303
+ }
1304
+ if ( ('on' == $_POST['reset_cron']) || $check ) {
1305
+ wp_schedule_event($timestamp, $email_freq, 's2_digest_cron');
1306
+ } else {
1307
+ wp_schedule_event($previous_time, $email_freq, 's2_digest_cron');
1308
+ }
1309
+ $now = date('Y-m-d H:i:s', $time);
1310
  $this->subscribe2_options['last_s2cron'] = $now;
1311
  }
1312
  }
1367
  echo __('Send Email From', 'subscribe2') . ': ';
1368
  echo "<input type=\"radio\" name=\"sender\" value=\"author\"";
1369
  if ('author' == $this->subscribe2_options['sender']) {
1370
+ echo " checked=\"checked\" ";
1371
  }
1372
  echo " /> " . __('Author of the post', 'subscribe2') . " &nbsp;&nbsp;";
1373
  echo "<input type=\"radio\" name=\"sender\" value=\"admin\"";
1374
  if ('admin' == $this->subscribe2_options['sender']) {
1375
+ echo " checked=\"checked\" ";
1376
  }
1377
  echo " /> " . __('Blog Admin', 'subscribe2') . "<br /><br />\r\n";
1378
  if (function_exists('wp_schedule_event')) {
1379
  echo __('Send Email as Digest', 'subscribe2') . ": <br /><br />\r\n";
1380
  $this->display_digest_choices();
 
1381
  }
1382
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1383
  echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
1425
  }
1426
  echo " /> " . __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "<br /><br />\r\n";
1427
 
1428
+ // show Widget
1429
+ echo "<input type=\"checkbox\" name=\"widget\" value=\"1\"";
1430
+ if ('1' == $this->subscribe2_options['widget']) {
1431
+ echo " checked=\"checked\"";
1432
+ }
1433
+ echo " /> " . __('Enable Subscribe2 Widget?', 'subscribe2') . "<br /><br />\r\n";
1434
+
1435
  //Auto Subscription for new registrations
1436
  echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
1437
  echo __('Subscribe new users registering with your blog', 'subscribe2') . ":<br />\r\n";
1531
  update_usermeta($user_ID, 's2_autosub', $_POST['new_category']);
1532
 
1533
  $cats = $_POST['category'];
1534
+ if ( (empty($cats)) || ($cats == '-1') ) {
1535
  $cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1536
  if ($cats) {
1537
  foreach ($cats as $cat) {
1539
  }
1540
  }
1541
  update_usermeta($user_ID, 's2_subscribed', '-1');
1542
+ } elseif ($cats == 'digest') {
1543
+ $all_cats = get_categories(array('hide_empty' => false));
1544
+ foreach ($all_cats as $cat) {
1545
+ ('' == $catids) ? $catids = "$cat->term_id" : $catids .= ",$cat->term_id";
1546
+ update_usermeta($user_ID, 's2_cat' . $cat->term_id, $cat->term_id);
1547
+ }
1548
+ update_usermeta($user_ID, 's2_subscribed', $catids);
1549
  } else {
1550
  if (!is_array($cats)) {
1551
  $cats = array($_POST['category']);
1556
  if (!empty($remove)) {
1557
  // remove subscription to these cat IDs
1558
  foreach ($remove as $id) {
1559
+ delete_usermeta($user_ID, "s2_cat" . $id);
1560
  }
1561
  }
1562
  if (!empty($new)) {
1563
  // add subscription to these cat IDs
1564
  foreach ($new as $id) {
1565
+ update_usermeta($user_ID, 's2_cat' . $id, $id);
1566
  }
1567
  }
1568
  update_usermeta($user_ID, 's2_subscribed', implode(',', $cats));
1603
  echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
1604
  echo "<input type=\"radio\" name=\"new_category\" value=\"yes\" ";
1605
  if ('yes' == get_usermeta($user_ID, 's2_autosub')) {
1606
+ echo "checked=\"checked\" ";
1607
  }
1608
  echo "/> Yes &nbsp;&nbsp;";
1609
  echo "<input type=\"radio\" name=\"new_category\" value=\"no\" ";
1610
  if ('no' == get_usermeta($user_ID, 's2_autosub')) {
1611
+ echo "checked=\"checked\" ";
1612
  }
1613
  echo "/> No<br /><br />";
1614
 
1619
  // we're doing daily digests, so just show
1620
  // subscribe / unnsubscribe
1621
  echo __('Receive daily summary of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
1622
+ echo "<input type=\"radio\" name=\"category\" value=\"digest\" ";
1623
+ if (get_usermeta($user_ID, 's2_subscribed') != '-1') {
1624
  echo "checked=\"yes\" ";
1625
  }
1626
+ echo "/> Yes <input type=\"radio\" name=\"category\" value=\"-1\" ";
1627
+ if (get_usermeta($user_ID, 's2_subscribed') == '-1') {
1628
  echo "checked=\"yes\" ";
1629
  }
1630
  echo "/> No";
1631
  }
1632
 
1633
  // submit
1634
+ echo "<p class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __("Update Preferences &raquo;", 'subscribe2') . "\" /></p>";
1635
  echo "</form></div>\r\n";
1636
 
1637
  include(ABSPATH . 'wp-admin/admin-footer.php');
1704
  function display_category_form($selected = array(), $override = 1) {
1705
  global $wpdb;
1706
 
1707
+ $all_cats = get_categories(array('hide_empty' => false));
1708
  $exclude = explode(',', $this->subscribe2_options['exclude']);
1709
 
1710
  if (0 == $override) {
1711
  // registered users are not allowed to subscribe to
1712
  // excluded categories
1713
+ foreach ($all_cats as $cat => $term_id) {
1714
+ if (in_array($all_cats[$cat]->term_id, $exclude)) {
1715
  $cat = (int)$cat;
1716
  unset($all_cats[$cat]);
1717
  }
1729
  $j++;
1730
  }
1731
  if (0 == $j) {
1732
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
1733
+ if (in_array($cat->term_id, $selected)) {
1734
  echo " checked=\"checked\" ";
1735
  }
1736
+ echo " /> " . $cat->name . "<br />\r\n";
1737
  } else {
1738
 
1739
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->term_id . "\"";
1740
+ if (in_array($cat->term_id, $selected)) {
1741
  echo " checked=\"checked\" ";
1742
  }
1743
+ echo " /> " . $cat->name . "<br />\r\n";
1744
  }
1745
  $i++;
1746
  }
1747
  echo "</td></tr>\r\n";
1748
+ echo "<tr><td align=\"left\" colspan=\"2\">\r\n";
1749
  echo "<input type=\"checkbox\" name=\"checkall\" onclick=\"setAll(this)\" /> " . __('Select / Unselect All' ,'subscribe2') . "\r\n";
1750
  echo "</td></tr>\r\n";
1751
  echo "</table>\r\n";
1763
  'public' => __('Public Subscribers', 'subscribe2'),
1764
  'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
1765
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
1766
+ 'registered' => __('Registered Users', 'subscribe2'));
1767
 
1768
+ $all_cats = get_categories(array('hide_empty' => false));
1769
 
1770
  // count the number of subscribers
1771
  $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
1780
  $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='s2_subscribed'");
1781
  $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
1782
  foreach ($all_cats as $cat) {
1783
+ $count[$cat->name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='s2_cat$cat->term_id'");
1784
  }
1785
 
1786
  // do have actually have some subscribers?
1804
 
1805
  if ($count['registered'] > 0) {
1806
  foreach ($all_cats as $cat) {
1807
+ if (in_array($cat->term_id, $exclude)) { continue; }
1808
+ echo "<option value=\"" . $cat->term_id . "\"";
1809
+ if ($cat->term_id == $selected) { echo " selected=\"selected\" "; }
1810
+ echo "> &nbsp;&nbsp;" . $cat->name . "&nbsp;(" . $count[$cat->name] . ") </option>\r\n";
1811
  }
1812
  }
1813
  echo "</select>";
1835
  echo " /> " . $value['display'] . "<br />\r\n";
1836
  }
1837
  if (wp_next_scheduled('s2_digest_cron')) {
1838
+ echo "<p><input type=\"checkbox\" name=\"reset_cron\" /> " . __('Reset the schedule time and date for periodic email notifications', 'subscribe2') . "</p>\r\n";
1839
  $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
1840
  $now = time();
1841
  echo "<p>" . __('Current server time is', 'subscribe2') . ": \r\n";
1842
  echo "<strong>" . gmdate($datetime, $now+ (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
1843
  echo "<p>" . __('Next email notification will be sent', 'subscribe2') . ": \r\n";
1844
  echo "<strong>" . gmdate($datetime, wp_next_scheduled('s2_digest_cron') + (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
1845
+ } else {
1846
+ echo "<br />";
1847
  }
1848
  } // end display_digest_choices()
1849
 
1947
  }
1948
  }
1949
  }
1950
+ $content = preg_replace('|<!--subscribe2-->|', $this->s2form, $content);
1951
+ return $content;
1952
  } // end filter()
1953
 
1954
  /**
1983
  return __('Subscription Confirmation', 'subscribe2');
1984
  } // end title_filter()
1985
 
1986
+ /* ===== widget functions ===== */
1987
+ /**
1988
+ Registers our widget so it appears with the other available
1989
+ widgets and can be dragged and dropped into any active sidebars
1990
+ */
1991
+ function widget_subscribe2widget($args) {
1992
+ extract($args);
1993
+ $options = get_option('widget_subscribe2widget');
1994
+ $title = empty($options['title']) ? __('Subscribe2') : $options['title'];
1995
+ echo $before_widget;
1996
+ echo $before_title . $title . $after_title;
1997
+ echo "<div class=\"search\">";
1998
+ $content = s2class::filter('<!--subscribe2-->');
1999
+ echo $content;
2000
+ echo "</div>";
2001
+ echo $after_widget;
2002
+ }
2003
+
2004
+ /**
2005
+ Register the optional widget control form
2006
+ */
2007
+ function widget_subscribe2widget_control() {
2008
+ $options = $newoptions = get_option('widget_subscribe2widget');
2009
+ if ($_POST["s2w-submit"]) {
2010
+ $newoptions['title'] = strip_tags(stripslashes($_POST["s2w-title"]));
2011
+ }
2012
+ if ($options != $newoptions) {
2013
+ $options = $newoptions;
2014
+ update_option('widget_subscribe2widget', $options);
2015
+ }
2016
+ $title = htmlspecialchars($options['title'], ENT_QUOTES);
2017
+ echo "<p><label for=\"s2w-title\">" . __('Title:');
2018
+ echo "<input style=\"width: 250px;\" id=\"s2w-title\" name=\"s2w-title\" type=\"text\" value=\"" . $title . "\" /></label></p>";
2019
+ echo "<input type=\"hidden\" id=\"s2w-submit\" name=\"s2w-submit\" value=\"1\" />";
2020
+ }
2021
+
2022
+ /**
2023
+ Actually register the Widget into the WordPress Widget API
2024
+ */
2025
+ function register_subscribe2widget() {
2026
+ //Check Sidebar Widget and Subscribe2 plugins are activated
2027
+ if ( !function_exists('register_sidebar_widget') || !class_exists('s2class')) {
2028
+ return;
2029
+ } else {
2030
+ register_sidebar_widget('Subscribe2Widget', array(&$this, 'widget_subscribe2widget'));
2031
+ register_widget_control('Subscribe2Widget', array(&$this, 'widget_subscribe2widget_control'));
2032
+ }
2033
+ }
2034
+
2035
  /* ===== wp-cron functions ===== */
2036
  /**
2037
  Send a daily digest of today's new posts
2042
  // collect posts
2043
  $now = date('Y-m-d H:i:s', time());
2044
  $prev = $this->subscribe2_options['last_s2cron'];
2045
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content, post_type, post_password FROM $wpdb->posts WHERE post_date >= '$prev' AND post_date < '$now' AND post_status IN ('publish', 'private') AND post_type IN ('post', 'page')");
2046
 
2047
  // update last_s2cron execution time before completing or bailing
2048
  $this->subscribe2_options['last_s2cron'] = $now;
2053
 
2054
  // if we have posts, let's prepare the digest
2055
  foreach ($posts as $post) {
2056
+ $post_cats = wp_get_post_categories($post->ID);
2057
  $post_cats_string = implode(',', $post_cats);
2058
  $check = false;
2059
  // is the current post assigned to any categories
2063
  $check = true;
2064
  }
2065
  }
2066
+ // is the current post private
2067
+ // and should this not generate a notification email?
2068
+ if ( ($this->subscribe2_options['password'] == "no") && ($post->post_password != '') ) {
2069
+ $check = true;
2070
+ }
2071
+ // is the current post a page
2072
+ // and should this not generate a notification email?
2073
+ if ( ($this->subscribe2_options['pages'] == 'no') && ($post->post_type == 'page') ) {
2074
+ $check = true;
2075
+ }
2076
  // if this post is in an excluded category,
2077
  // don't include it in the digest
2078
  if ($check) {
2110
  $user =& $author;
2111
  } else {
2112
  // get admin detailts
2113
+ $user = $this->get_userdata();
2114
  }
2115
  $this->myemail = $user->user_email;
2116
  $this->myname = $user->display_name;
2123
  $registered = $this->get_registered();
2124
  $recipients = array_merge((array)$public, (array)$registered);
2125
  $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
2126
+ $body = str_replace("TABLE", $table, $mailtext);
2127
+ $body = str_replace("POST", $message, $mailtext);
2128
  $this->mail($recipients, $subject, $body);
2129
  } // end subscribe2_cron
2130
 
2138
  $this->subscribe2_options = get_option('subscribe2_options');
2139
 
2140
  add_action('init', array(&$this, 'subscribe2'));
2141
+ if ('1' == $this->subscribe2_options['show_button']) {
2142
  add_action('init', array(&$this, 'button_init'));
2143
  }
2144
+ // add action to display widget if option is enabled
2145
+ if ('1' == $this->subscribe2_options['widget']) {
2146
+ add_action('plugins_loaded', array(&$this, 'register_subscribe2widget'));
2147
+ }
2148
  }
2149
 
2150
  function subscribe2() {
2172
  add_action('admin_menu', array(&$this, 'admin_menu'));
2173
  add_action('create_category', array(&$this, 'autosub_new_category'));
2174
  add_action('register_form', array(&$this, 'register_form'));
2175
+ add_filter('the_content', array(&$this, 'filter'), 10);
2176
  add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
2177
 
2178
  // add action to display editor buttons if option is enabled
2192
  if ($this->subscribe2_options['email_freq'] != 'never') {
2193
  add_action('s2_digest_cron', array(&$this, 'subscribe2_cron'));
2194
  } else {
2195
+ add_action('new_to_publish', array(&$this, 'publish'));
2196
+ add_action('draft_to_publish', array(&$this, 'publish'));
2197
+ add_action('pending_to_publish', array(&$this, 'publish'));
2198
+ add_action('private_to_publish', array(&$this, 'publish'));
2199
+ if ($this->subscribe2_options['password'] == "yes") {
2200
+ add_action('new_to_private', array(&$this, 'publish'));
2201
+ add_action('draft_to_private', array(&$this, 'publish'));
2202
+ add_action('pending_to_private', array(&$this, 'publish'));
2203
+ }
2204
  }
2205
 
2206
  // load our strings
2207
  $this->load_strings();
2208
  } // end subscribe2()
2209
+
2210
  /* ===== ButtonSnap configuration ===== */
2211
  /**
2212
  Register our button in the QuickTags bar
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-08-05 19:38+0100\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"
@@ -54,15 +54,15 @@ msgstr ""
54
  msgid "Your email:"
55
  msgstr ""
56
 
57
- #: subscribe2.php:81 subscribe2.php:1140 subscribe2.php:1235
58
  msgid "Subscribe"
59
  msgstr ""
60
 
61
- #: subscribe2.php:81 subscribe2.php:1236
62
  msgid "Unsubscribe"
63
  msgstr ""
64
 
65
- #: subscribe2.php:81 subscribe2.php:1671
66
  msgid "Send"
67
  msgstr ""
68
 
@@ -102,7 +102,7 @@ msgstr ""
102
  msgid "Options reset!"
103
  msgstr ""
104
 
105
- #: subscribe2.php:108 subscribe2.php:1144
106
  msgid "Subscribers"
107
  msgstr ""
108
 
@@ -110,7 +110,7 @@ msgstr ""
110
  msgid "Subscribe2 Options"
111
  msgstr ""
112
 
113
- #: subscribe2.php:109 subscribe2.php:2137
114
  msgid "Subscribe2"
115
  msgstr ""
116
 
@@ -126,388 +126,400 @@ msgstr ""
126
  msgid "Once Weekly"
127
  msgstr ""
128
 
129
- #: subscribe2.php:714
130
  msgid "New subscriber"
131
  msgstr ""
132
 
133
- #: subscribe2.php:715
134
  msgid "subscribed to email notifications!"
135
  msgstr ""
136
 
137
- #: subscribe2.php:1052
138
  msgid "Address(es) subscribed!"
139
  msgstr ""
140
 
141
- #: subscribe2.php:1055
142
  msgid "deleted!"
143
  msgstr ""
144
 
145
- #: subscribe2.php:1058
146
  msgid "status changed!"
147
  msgstr ""
148
 
149
- #: subscribe2.php:1061
150
  msgid "Reminder Email(s) Sent!"
151
  msgstr ""
152
 
153
- #: subscribe2.php:1064
154
  msgid "CSV File Created in wp-content"
155
  msgstr ""
156
 
157
- #: subscribe2.php:1067
158
  msgid "Registered Users Subscribed!"
159
  msgstr ""
160
 
161
- #: subscribe2.php:1070
162
  msgid "Registered Users Unsubscribed!"
163
  msgstr ""
164
 
165
- #: subscribe2.php:1132
166
  msgid "Subscribe Addresses"
167
  msgstr ""
168
 
169
- #: subscribe2.php:1137
170
  msgid "Enter addresses, one per line or comma-seperated"
171
  msgstr ""
172
 
173
- #: subscribe2.php:1146
174
  msgid "Filter"
175
  msgstr ""
176
 
177
- #: subscribe2.php:1150
178
  msgid ""
179
  "Registered on the left, confirmed in the middle, unconfirmed on the right"
180
  msgstr ""
181
 
182
- #: subscribe2.php:1159
183
  msgid "Save Emails to CSV File"
184
  msgstr ""
185
 
186
- #: subscribe2.php:1210
187
  msgid "NONE"
188
  msgstr ""
189
 
190
- #: subscribe2.php:1220
191
  msgid "Send Reminder Email"
192
  msgstr ""
193
 
194
- #: subscribe2.php:1227
195
  msgid "Categories"
196
  msgstr ""
197
 
198
- #: subscribe2.php:1228
199
  msgid ""
200
  "Existing Registered Users can be automatically (un)subscribed to categories "
201
  "using this section."
202
  msgstr ""
203
 
204
- #: subscribe2.php:1229
205
  msgid "Consider User Privacy as changes cannot be undone"
206
  msgstr ""
207
 
208
- #: subscribe2.php:1234
209
  msgid "Action to perform"
210
  msgstr ""
211
 
212
- #: subscribe2.php:1239 subscribe2.php:1475
213
  msgid "Submit"
214
  msgstr ""
215
 
216
- #: subscribe2.php:1338
217
  msgid "Delivery Options"
218
  msgstr ""
219
 
220
- #: subscribe2.php:1339
221
  msgid "Send Emails for Pages"
222
  msgstr ""
223
 
224
- #: subscribe2.php:1344 subscribe2.php:1355 subscribe2.php:1446
225
  msgid "Yes"
226
  msgstr ""
227
 
228
- #: subscribe2.php:1349 subscribe2.php:1360 subscribe2.php:1440
229
- #: subscribe2.php:1451
230
  msgid "No"
231
  msgstr ""
232
 
233
- #: subscribe2.php:1350
234
  msgid "Send Emails for Password Protected Posts"
235
  msgstr ""
236
 
237
- #: subscribe2.php:1361
238
  msgid "Send Email From"
239
  msgstr ""
240
 
241
- #: subscribe2.php:1366
242
  msgid "Author of the post"
243
  msgstr ""
244
 
245
- #: subscribe2.php:1371
246
  msgid "Blog Admin"
247
  msgstr ""
248
 
249
- #: subscribe2.php:1373
250
  msgid "Send Email as Digest"
251
  msgstr ""
252
 
253
- #: subscribe2.php:1377
254
  msgid "Email Templates"
255
  msgstr ""
256
 
257
- #: subscribe2.php:1380
258
  msgid "New Post email (must not be empty)"
259
  msgstr ""
260
 
261
- #: subscribe2.php:1384
262
  msgid "Message substitions"
263
  msgstr ""
264
 
265
- #: subscribe2.php:1388
266
  msgid "the post's title"
267
  msgstr ""
268
 
269
- #: subscribe2.php:1389
270
  msgid ""
271
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
272
  "preferences</i>)"
273
  msgstr ""
274
 
275
- #: subscribe2.php:1390
276
  msgid "a list of post titles (for digest emails)"
277
  msgstr ""
278
 
279
- #: subscribe2.php:1391
280
  msgid "the post's permalink"
281
  msgstr ""
282
 
283
- #: subscribe2.php:1392
284
  msgid "the admin or post author's name"
285
  msgstr ""
286
 
287
- #: subscribe2.php:1393
288
  msgid "the admin or post author's email"
289
  msgstr ""
290
 
291
- #: subscribe2.php:1394
292
  msgid "the post author's name"
293
  msgstr ""
294
 
295
- #: subscribe2.php:1395
296
  msgid ""
297
  "the generated link to confirm a request<br />(<i>only used in the "
298
  "confirmation email template</i>)"
299
  msgstr ""
300
 
301
- #: subscribe2.php:1396
302
  msgid ""
303
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
304
  "confirmation email template</i>)"
305
  msgstr ""
306
 
307
- #: subscribe2.php:1398
308
  msgid "Subscribe / Unsubscribe confirmation email"
309
  msgstr ""
310
 
311
- #: subscribe2.php:1401
312
  msgid "Reminder email to Unconfirmed Subscribers"
313
  msgstr ""
314
 
315
- #: subscribe2.php:1406
316
  msgid "Excluded Categories"
317
  msgstr ""
318
 
319
- #: subscribe2.php:1407
320
  msgid ""
321
  "Posts assigned to any Excluded Category do not generate notifications and "
322
  "are not included in digest notifications"
323
  msgstr ""
324
 
325
- #: subscribe2.php:1413
326
  msgid "Allow registered users to subscribe to excluded categories?"
327
  msgstr ""
328
 
329
- #: subscribe2.php:1416
330
  msgid "Writing Options"
331
  msgstr ""
332
 
333
- #: subscribe2.php:1421
334
  msgid "Show the Subscribe2 button on the Write toolbar?"
335
  msgstr ""
336
 
337
- #: subscribe2.php:1424
 
 
 
 
338
  msgid "Auto Subscribe"
339
  msgstr ""
340
 
341
- #: subscribe2.php:1425
342
  msgid "Subscribe new users registering with your blog"
343
  msgstr ""
344
 
345
- #: subscribe2.php:1430
346
  msgid "Automatically"
347
  msgstr ""
348
 
349
- #: subscribe2.php:1435
350
  msgid "Display option on Registration Form"
351
  msgstr ""
352
 
353
- #: subscribe2.php:1441
354
  msgid "Registration Form option is checked by default"
355
  msgstr ""
356
 
357
- #: subscribe2.php:1452
358
  msgid "Auto-subscribe users to receive email as"
359
  msgstr ""
360
 
361
- #: subscribe2.php:1457 subscribe2.php:1567
362
  msgid "HTML"
363
  msgstr ""
364
 
365
- #: subscribe2.php:1462
366
  msgid "Plain Text - Full"
367
  msgstr ""
368
 
369
- #: subscribe2.php:1467
370
  msgid "Plain Text - Excerpt"
371
  msgstr ""
372
 
373
- #: subscribe2.php:1470
374
  msgid "Barred Domains"
375
  msgstr ""
376
 
377
- #: subscribe2.php:1471
378
  msgid ""
379
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
380
  "each entry and omit the \"@\" symbol, for example email.com)"
381
  msgstr ""
382
 
383
- #: subscribe2.php:1480
384
  msgid "Reset Default"
385
  msgstr ""
386
 
387
- #: subscribe2.php:1481
388
  msgid ""
389
  "Use this to reset all options to their defaults. This <strong><em>will not</"
390
  "em></strong> modify your list of subscribers."
391
  msgstr ""
392
 
393
- #: subscribe2.php:1488
394
  msgid "RESET"
395
  msgstr ""
396
 
397
- #: subscribe2.php:1508
398
  msgid "Subscription preferences updated."
399
  msgstr ""
400
 
401
- #: subscribe2.php:1555
402
  msgid "Notification Settings"
403
  msgstr ""
404
 
405
- #: subscribe2.php:1562
406
  msgid "Receive email as"
407
  msgstr ""
408
 
409
- #: subscribe2.php:1572
410
  msgid "Plain Text"
411
  msgstr ""
412
 
413
- #: subscribe2.php:1574
414
  msgid "Email contains"
415
  msgstr ""
416
 
417
- #: subscribe2.php:1575
418
  msgid "Excerpt Only"
419
  msgstr ""
420
 
421
- #: subscribe2.php:1575
422
  msgid "Full Post"
423
  msgstr ""
424
 
425
- #: subscribe2.php:1583
426
  msgid "Note: HTML format will always deliver the full post."
427
  msgstr ""
428
 
429
- #: subscribe2.php:1584
430
  msgid "Automatically subscribe me to newly created categories"
431
  msgstr ""
432
 
433
- #: subscribe2.php:1597
434
  msgid "Subscribed Categories"
435
  msgstr ""
436
 
437
- #: subscribe2.php:1602
438
  msgid "Receive daily summary of new posts?"
439
  msgstr ""
440
 
441
- #: subscribe2.php:1615
442
  msgid "Update Preferences &raquo;"
443
  msgstr ""
444
 
445
- #: subscribe2.php:1660
446
  msgid "Send email to all subscribers"
447
  msgstr ""
448
 
449
- #: subscribe2.php:1665
450
  msgid "Subject"
451
  msgstr ""
452
 
453
- #: subscribe2.php:1665
454
  msgid "A message from "
455
  msgstr ""
456
 
457
- #: subscribe2.php:1668
458
  msgid "Recipients: "
459
  msgstr ""
460
 
461
- #: subscribe2.php:1730
462
  msgid "Select / Unselect All"
463
  msgstr ""
464
 
465
- #: subscribe2.php:1743
466
  msgid "All Subscribers"
467
  msgstr ""
468
 
469
- #: subscribe2.php:1744
470
  msgid "Public Subscribers"
471
  msgstr ""
472
 
473
- #: subscribe2.php:1745
474
  msgid "Confirmed"
475
  msgstr ""
476
 
477
- #: subscribe2.php:1746
478
  msgid "Unconfirmed"
479
  msgstr ""
480
 
481
- #: subscribe2.php:1747
482
- msgid "Registered Subscribers"
483
  msgstr ""
484
 
485
- #: subscribe2.php:1803
486
  msgid "Per Post Email"
487
  msgstr ""
488
 
489
- #: subscribe2.php:1821
 
 
 
 
490
  msgid "Current server time is"
491
  msgstr ""
492
 
493
- #: subscribe2.php:1823
494
  msgid "Next email notification will be sent"
495
  msgstr ""
496
 
497
- #: subscribe2.php:1834
498
  msgid "Check here to Subscribe to email notifications for new posts"
499
  msgstr ""
500
 
501
- #: subscribe2.php:1843
502
  msgid ""
503
  "By Registering with this blog you are also agreeing to recieve email "
504
  "notifications for new posts"
505
  msgstr ""
506
 
507
- #: subscribe2.php:1960
508
  msgid "Subscription Confirmation"
509
  msgstr ""
510
 
511
- #: subscribe2.php:2039
 
 
 
 
512
  msgid "Digest Email"
513
  msgstr ""
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2007-11-02 20:03+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"
54
  msgid "Your email:"
55
  msgstr ""
56
 
57
+ #: subscribe2.php:81 subscribe2.php:1124 subscribe2.php:1220
58
  msgid "Subscribe"
59
  msgstr ""
60
 
61
+ #: subscribe2.php:81 subscribe2.php:1221
62
  msgid "Unsubscribe"
63
  msgstr ""
64
 
65
+ #: subscribe2.php:81 subscribe2.php:1690
66
  msgid "Send"
67
  msgstr ""
68
 
102
  msgid "Options reset!"
103
  msgstr ""
104
 
105
+ #: subscribe2.php:108 subscribe2.php:1129
106
  msgid "Subscribers"
107
  msgstr ""
108
 
110
  msgid "Subscribe2 Options"
111
  msgstr ""
112
 
113
+ #: subscribe2.php:109 subscribe2.php:1994 subscribe2.php:2224
114
  msgid "Subscribe2"
115
  msgstr ""
116
 
126
  msgid "Once Weekly"
127
  msgstr ""
128
 
129
+ #: subscribe2.php:686
130
  msgid "New subscriber"
131
  msgstr ""
132
 
133
+ #: subscribe2.php:687
134
  msgid "subscribed to email notifications!"
135
  msgstr ""
136
 
137
+ #: subscribe2.php:1037
138
  msgid "Address(es) subscribed!"
139
  msgstr ""
140
 
141
+ #: subscribe2.php:1040
142
  msgid "deleted!"
143
  msgstr ""
144
 
145
+ #: subscribe2.php:1043
146
  msgid "status changed!"
147
  msgstr ""
148
 
149
+ #: subscribe2.php:1046
150
  msgid "Reminder Email(s) Sent!"
151
  msgstr ""
152
 
153
+ #: subscribe2.php:1049
154
  msgid "CSV File Created in wp-content"
155
  msgstr ""
156
 
157
+ #: subscribe2.php:1052
158
  msgid "Registered Users Subscribed!"
159
  msgstr ""
160
 
161
+ #: subscribe2.php:1055
162
  msgid "Registered Users Unsubscribed!"
163
  msgstr ""
164
 
165
+ #: subscribe2.php:1117
166
  msgid "Subscribe Addresses"
167
  msgstr ""
168
 
169
+ #: subscribe2.php:1122
170
  msgid "Enter addresses, one per line or comma-seperated"
171
  msgstr ""
172
 
173
+ #: subscribe2.php:1131
174
  msgid "Filter"
175
  msgstr ""
176
 
177
+ #: subscribe2.php:1135
178
  msgid ""
179
  "Registered on the left, confirmed in the middle, unconfirmed on the right"
180
  msgstr ""
181
 
182
+ #: subscribe2.php:1144
183
  msgid "Save Emails to CSV File"
184
  msgstr ""
185
 
186
+ #: subscribe2.php:1195
187
  msgid "NONE"
188
  msgstr ""
189
 
190
+ #: subscribe2.php:1205
191
  msgid "Send Reminder Email"
192
  msgstr ""
193
 
194
+ #: subscribe2.php:1212
195
  msgid "Categories"
196
  msgstr ""
197
 
198
+ #: subscribe2.php:1213
199
  msgid ""
200
  "Existing Registered Users can be automatically (un)subscribed to categories "
201
  "using this section."
202
  msgstr ""
203
 
204
+ #: subscribe2.php:1214
205
  msgid "Consider User Privacy as changes cannot be undone"
206
  msgstr ""
207
 
208
+ #: subscribe2.php:1219
209
  msgid "Action to perform"
210
  msgstr ""
211
 
212
+ #: subscribe2.php:1224 subscribe2.php:1487
213
  msgid "Submit"
214
  msgstr ""
215
 
216
+ #: subscribe2.php:1344
217
  msgid "Delivery Options"
218
  msgstr ""
219
 
220
+ #: subscribe2.php:1345
221
  msgid "Send Emails for Pages"
222
  msgstr ""
223
 
224
+ #: subscribe2.php:1350 subscribe2.php:1361 subscribe2.php:1458
225
  msgid "Yes"
226
  msgstr ""
227
 
228
+ #: subscribe2.php:1355 subscribe2.php:1366 subscribe2.php:1452
229
+ #: subscribe2.php:1463
230
  msgid "No"
231
  msgstr ""
232
 
233
+ #: subscribe2.php:1356
234
  msgid "Send Emails for Password Protected Posts"
235
  msgstr ""
236
 
237
+ #: subscribe2.php:1367
238
  msgid "Send Email From"
239
  msgstr ""
240
 
241
+ #: subscribe2.php:1372
242
  msgid "Author of the post"
243
  msgstr ""
244
 
245
+ #: subscribe2.php:1377
246
  msgid "Blog Admin"
247
  msgstr ""
248
 
249
+ #: subscribe2.php:1379
250
  msgid "Send Email as Digest"
251
  msgstr ""
252
 
253
+ #: subscribe2.php:1382
254
  msgid "Email Templates"
255
  msgstr ""
256
 
257
+ #: subscribe2.php:1385
258
  msgid "New Post email (must not be empty)"
259
  msgstr ""
260
 
261
+ #: subscribe2.php:1389
262
  msgid "Message substitions"
263
  msgstr ""
264
 
265
+ #: subscribe2.php:1393
266
  msgid "the post's title"
267
  msgstr ""
268
 
269
+ #: subscribe2.php:1394
270
  msgid ""
271
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
272
  "preferences</i>)"
273
  msgstr ""
274
 
275
+ #: subscribe2.php:1395
276
  msgid "a list of post titles (for digest emails)"
277
  msgstr ""
278
 
279
+ #: subscribe2.php:1396
280
  msgid "the post's permalink"
281
  msgstr ""
282
 
283
+ #: subscribe2.php:1397
284
  msgid "the admin or post author's name"
285
  msgstr ""
286
 
287
+ #: subscribe2.php:1398
288
  msgid "the admin or post author's email"
289
  msgstr ""
290
 
291
+ #: subscribe2.php:1399
292
  msgid "the post author's name"
293
  msgstr ""
294
 
295
+ #: subscribe2.php:1400
296
  msgid ""
297
  "the generated link to confirm a request<br />(<i>only used in the "
298
  "confirmation email template</i>)"
299
  msgstr ""
300
 
301
+ #: subscribe2.php:1401
302
  msgid ""
303
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
304
  "confirmation email template</i>)"
305
  msgstr ""
306
 
307
+ #: subscribe2.php:1403
308
  msgid "Subscribe / Unsubscribe confirmation email"
309
  msgstr ""
310
 
311
+ #: subscribe2.php:1406
312
  msgid "Reminder email to Unconfirmed Subscribers"
313
  msgstr ""
314
 
315
+ #: subscribe2.php:1411
316
  msgid "Excluded Categories"
317
  msgstr ""
318
 
319
+ #: subscribe2.php:1412
320
  msgid ""
321
  "Posts assigned to any Excluded Category do not generate notifications and "
322
  "are not included in digest notifications"
323
  msgstr ""
324
 
325
+ #: subscribe2.php:1418
326
  msgid "Allow registered users to subscribe to excluded categories?"
327
  msgstr ""
328
 
329
+ #: subscribe2.php:1421
330
  msgid "Writing Options"
331
  msgstr ""
332
 
333
+ #: subscribe2.php:1426
334
  msgid "Show the Subscribe2 button on the Write toolbar?"
335
  msgstr ""
336
 
337
+ #: subscribe2.php:1433
338
+ msgid "Enable Subscribe2 Widget?"
339
+ msgstr ""
340
+
341
+ #: subscribe2.php:1436
342
  msgid "Auto Subscribe"
343
  msgstr ""
344
 
345
+ #: subscribe2.php:1437
346
  msgid "Subscribe new users registering with your blog"
347
  msgstr ""
348
 
349
+ #: subscribe2.php:1442
350
  msgid "Automatically"
351
  msgstr ""
352
 
353
+ #: subscribe2.php:1447
354
  msgid "Display option on Registration Form"
355
  msgstr ""
356
 
357
+ #: subscribe2.php:1453
358
  msgid "Registration Form option is checked by default"
359
  msgstr ""
360
 
361
+ #: subscribe2.php:1464
362
  msgid "Auto-subscribe users to receive email as"
363
  msgstr ""
364
 
365
+ #: subscribe2.php:1469 subscribe2.php:1586
366
  msgid "HTML"
367
  msgstr ""
368
 
369
+ #: subscribe2.php:1474
370
  msgid "Plain Text - Full"
371
  msgstr ""
372
 
373
+ #: subscribe2.php:1479
374
  msgid "Plain Text - Excerpt"
375
  msgstr ""
376
 
377
+ #: subscribe2.php:1482
378
  msgid "Barred Domains"
379
  msgstr ""
380
 
381
+ #: subscribe2.php:1483
382
  msgid ""
383
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
384
  "each entry and omit the \"@\" symbol, for example email.com)"
385
  msgstr ""
386
 
387
+ #: subscribe2.php:1492
388
  msgid "Reset Default"
389
  msgstr ""
390
 
391
+ #: subscribe2.php:1493
392
  msgid ""
393
  "Use this to reset all options to their defaults. This <strong><em>will not</"
394
  "em></strong> modify your list of subscribers."
395
  msgstr ""
396
 
397
+ #: subscribe2.php:1500
398
  msgid "RESET"
399
  msgstr ""
400
 
401
+ #: subscribe2.php:1520
402
  msgid "Subscription preferences updated."
403
  msgstr ""
404
 
405
+ #: subscribe2.php:1574
406
  msgid "Notification Settings"
407
  msgstr ""
408
 
409
+ #: subscribe2.php:1581
410
  msgid "Receive email as"
411
  msgstr ""
412
 
413
+ #: subscribe2.php:1591
414
  msgid "Plain Text"
415
  msgstr ""
416
 
417
+ #: subscribe2.php:1593
418
  msgid "Email contains"
419
  msgstr ""
420
 
421
+ #: subscribe2.php:1594
422
  msgid "Excerpt Only"
423
  msgstr ""
424
 
425
+ #: subscribe2.php:1594
426
  msgid "Full Post"
427
  msgstr ""
428
 
429
+ #: subscribe2.php:1602
430
  msgid "Note: HTML format will always deliver the full post."
431
  msgstr ""
432
 
433
+ #: subscribe2.php:1603
434
  msgid "Automatically subscribe me to newly created categories"
435
  msgstr ""
436
 
437
+ #: subscribe2.php:1616
438
  msgid "Subscribed Categories"
439
  msgstr ""
440
 
441
+ #: subscribe2.php:1621
442
  msgid "Receive daily summary of new posts?"
443
  msgstr ""
444
 
445
+ #: subscribe2.php:1634
446
  msgid "Update Preferences &raquo;"
447
  msgstr ""
448
 
449
+ #: subscribe2.php:1679
450
  msgid "Send email to all subscribers"
451
  msgstr ""
452
 
453
+ #: subscribe2.php:1684
454
  msgid "Subject"
455
  msgstr ""
456
 
457
+ #: subscribe2.php:1684
458
  msgid "A message from "
459
  msgstr ""
460
 
461
+ #: subscribe2.php:1687
462
  msgid "Recipients: "
463
  msgstr ""
464
 
465
+ #: subscribe2.php:1749
466
  msgid "Select / Unselect All"
467
  msgstr ""
468
 
469
+ #: subscribe2.php:1762
470
  msgid "All Subscribers"
471
  msgstr ""
472
 
473
+ #: subscribe2.php:1763
474
  msgid "Public Subscribers"
475
  msgstr ""
476
 
477
+ #: subscribe2.php:1764
478
  msgid "Confirmed"
479
  msgstr ""
480
 
481
+ #: subscribe2.php:1765
482
  msgid "Unconfirmed"
483
  msgstr ""
484
 
485
+ #: subscribe2.php:1766
486
+ msgid "Registered Users"
487
  msgstr ""
488
 
489
+ #: subscribe2.php:1822
490
  msgid "Per Post Email"
491
  msgstr ""
492
 
493
+ #: subscribe2.php:1838
494
+ msgid "Reset the schedule time and date for periodic email notifications"
495
+ msgstr ""
496
+
497
+ #: subscribe2.php:1841
498
  msgid "Current server time is"
499
  msgstr ""
500
 
501
+ #: subscribe2.php:1843
502
  msgid "Next email notification will be sent"
503
  msgstr ""
504
 
505
+ #: subscribe2.php:1856
506
  msgid "Check here to Subscribe to email notifications for new posts"
507
  msgstr ""
508
 
509
+ #: subscribe2.php:1865
510
  msgid ""
511
  "By Registering with this blog you are also agreeing to recieve email "
512
  "notifications for new posts"
513
  msgstr ""
514
 
515
+ #: subscribe2.php:1983
516
  msgid "Subscription Confirmation"
517
  msgstr ""
518
 
519
+ #: subscribe2.php:2017
520
+ msgid "Title:"
521
+ msgstr ""
522
+
523
+ #: subscribe2.php:2121
524
  msgid "Digest Email"
525
  msgstr ""
subscribe2/tinymce/editor_plugin.js CHANGED
@@ -13,7 +13,7 @@ var TinyMCE_Subscribe2Quicktags = {
13
  getControlHTML : function(cn) {
14
  switch (cn) {
15
  case 'subscribe2quicktags':
16
- buttons = tinyMCE.getButtonHTML('subscribe2', 'lang_subscribe2quicktags_subscribe2', '{$pluginurl}/../s2_button.png', 'subscribe2');
17
  return buttons;
18
  }
19
  return '';
@@ -41,10 +41,10 @@ var TinyMCE_Subscribe2Quicktags = {
41
  }
42
 
43
  alt = "Placeholder for Subscribe2 form";
44
- cssstyle = 'background:url(../wp-content/plugins/subscribe2/s2_marker.png) no-repeat 5px 5px;';
45
 
46
  html = ''
47
- + '<img src="../wp-content/plugins/subscribe2/spacer.gif" '
48
  + 'width="210px" height="25px" '
49
  + 'alt="'+alt+'" title="'+alt+'" style="'+cssstyle+'" class="mce_plugin_s2_img" />';
50
 
@@ -64,7 +64,7 @@ var TinyMCE_Subscribe2Quicktags = {
64
  // Parse all <!--subscribe2--> tags and replace them with images
65
  var startPos = 0;
66
  var alt = "Placeholder for Subscribe2 form";
67
- var cssstyle = 'background:url(../wp-content/plugins/subscribe2/s2_marker.png) no-repeat 5px 5px;';
68
  while ((startPos = content.indexOf('<!--subscribe2', startPos)) != -1) {
69
  var endPos = content.indexOf('-->', startPos) + 3;
70
  // Insert image
13
  getControlHTML : function(cn) {
14
  switch (cn) {
15
  case 'subscribe2quicktags':
16
+ buttons = tinyMCE.getButtonHTML('subscribe2', 'lang_subscribe2quicktags_subscribe2', '{$pluginurl}/../include/s2_button.png', 'subscribe2');
17
  return buttons;
18
  }
19
  return '';
41
  }
42
 
43
  alt = "Placeholder for Subscribe2 form";
44
+ cssstyle = 'background:url(../wp-content/plugins/subscribe2/include/s2_marker.png) no-repeat 5px 5px;';
45
 
46
  html = ''
47
+ + '<img src="../wp-content/plugins/subscribe2/include/spacer.gif" '
48
  + 'width="210px" height="25px" '
49
  + 'alt="'+alt+'" title="'+alt+'" style="'+cssstyle+'" class="mce_plugin_s2_img" />';
50
 
64
  // Parse all <!--subscribe2--> tags and replace them with images
65
  var startPos = 0;
66
  var alt = "Placeholder for Subscribe2 form";
67
+ var cssstyle = 'background:url(../wp-content/plugins/subscribe2/include/s2_marker.png) no-repeat 5px 5px;';
68
  while ((startPos = content.indexOf('<!--subscribe2', startPos)) != -1) {
69
  var endPos = content.indexOf('-->', startPos) + 3;
70
  // Insert image