Subscribe2 - Version 4.16

Version Description

Download this release

Release Info

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

Code changes from version 4.14 to 4.16

ReadMe.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: MattyRob, Skippy, RavanH
3
  Donate link: http://subscribe2.wordpress.com/donate/
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 2.0.x
6
- Tested up to: 2.7
7
- Stable tag: 4.14
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
@@ -93,13 +93,36 @@ Registered Users have registered with your WorPress blog (provided you have enab
93
 
94
  == Screenshots ==
95
 
96
- 1. The Write->Subscribers admin page generated by the plugin.
97
- 2. The Manage->Subscribers admin page generated by the plugin.
98
  3. The Users->Subscriptions admin page generated by the plugin.
99
  4. The Options->Subscribe2 admin page generated by the plugin.
100
 
101
  == Version History ==
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  Version 4.14 by Matthew Robinson
104
 
105
  * Reordered some functions to improve grouping
3
  Donate link: http://subscribe2.wordpress.com/donate/
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 2.0.x
6
+ Tested up to: 2.7.1
7
+ Stable tag: 4.16
8
 
9
  Sends a list of subscribers an email notification when new posts are published to your blog
10
 
93
 
94
  == Screenshots ==
95
 
96
+ 1. The Posts->Mail Subscribers admin page generated by the plugin.
97
+ 2. The Tools->Subscribers admin page generated by the plugin.
98
  3. The Users->Subscriptions admin page generated by the plugin.
99
  4. The Options->Subscribe2 admin page generated by the plugin.
100
 
101
  == Version History ==
102
 
103
+ Version 4.16 by Matthew Robinson
104
+
105
+ * Correct minor layout issue in Settings->Subscribe2
106
+ * Allow users to define the div class name for the widget for styling purposes
107
+ * Select from a greater number of notification senders via dropdown list in Settings
108
+ * Improved efficiency of newly added WordPressMU code
109
+ * Added ability to manage across-blog subscriptions when using WordPressMU
110
+ * Fixed bug whereby Public Subscribers may not have got notification emails for posts if Private Posts were blocked
111
+ * Added ability to define email Subject contents in Settings->Subscribe2
112
+ * Sanity checks of email subject and body templates to ensure they are not empty
113
+ * Introduced s2_html_email and s2_plain_email filters to allow manipulation of email messages after construction
114
+ * Amended handling of database entries to simplify code and database needs
115
+ * Improved the layout of the Subscriber drop down menu
116
+ * Added bullet points to the TABLE of posts
117
+ * Ensure database remains clean when categories are deleted
118
+ * Added new option to manage how auto-subscribe handles excluded categories
119
+
120
+ Version 4.15 by Matthew Robinson
121
+
122
+ * Fixed E_DEPRECATE warning caused by a variable being passed by reference to the ksort() function
123
+ * Fixed called to undefined function caused by typo
124
+ * Fixed a syntax error in the SQL code constructors affecting some users
125
+
126
  Version 4.14 by Matthew Robinson
127
 
128
  * Reordered some functions to improve grouping
counterwidget.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Subscribe2 Counter Widget
4
- Version: 4.14
5
  Plugin URI: http://subscribe2.wordpress.com
6
  Description: Adds a sidebar widget to easily customize and display your Subscribe2 subscribers stats.
7
  Author: Matthew Robinson
1
  <?php
2
  /*
3
  Plugin Name: Subscribe2 Counter Widget
4
+ Version: 4.16
5
  Plugin URI: http://subscribe2.wordpress.com
6
  Description: Adds a sidebar widget to easily customize and display your Subscribe2 subscribers stats.
7
  Author: Matthew Robinson
include/options.php CHANGED
@@ -6,6 +6,10 @@ if (!isset($this->subscribe2_options['autosub'])) {
6
  $this->subscribe2_options['autosub'] = "no";
7
  } // option to autosubscribe registered users to new categories
8
 
 
 
 
 
9
  if (!isset($this->subscribe2_options['wpregdef'])) {
10
  $this->subscribe2_options['wpregdef'] = "no";
11
  } // option to check registration form box by default
@@ -90,11 +94,23 @@ if (!isset($this->subscribe2_options['mailtext'])) {
90
  $this->subscribe2_options['mailtext'] = __("BLOGNAME has posted a new item, 'TITLE'\n\nPOST\n\nYou may view the latest post at\nPERMALINK\n\nYou received this e-mail because you asked to be notified when new updates are posted.\nBest regards,\nMYNAME\nEMAIL", "subscribe2");
91
  } // Default notification email text
92
 
 
 
 
 
93
  if (!isset($this->subscribe2_options['confirm_email'])) {
94
  $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.", "subscribe2");
95
  } // Default confirmation email text
96
 
 
 
 
 
97
  if (!isset($this->subscribe2_options['remind_email'])) {
98
  $this->subscribe2_options['remind_email'] = __("This email address was subscribed for notifications at BLOGNAME (BLOGLINK) but the subscription remains incomplete.\n\nIf you wish to complete your subscription please click on the link below:\n\nLINK\n\nIf you do not wish to complete your subscription please ignore this email and your address will be removed from our database.\n\nRegards,\nMYNAME", "subscribe2");
99
  } // Default reminder email text
 
 
 
 
100
  ?>
6
  $this->subscribe2_options['autosub'] = "no";
7
  } // option to autosubscribe registered users to new categories
8
 
9
+ if (!isset($this->subscribe2_options['newreg_override'])) {
10
+ $this->subscribe2_options['newreg_override'] = "no";
11
+ } // option to autosubscribe registered users to new categories
12
+
13
  if (!isset($this->subscribe2_options['wpregdef'])) {
14
  $this->subscribe2_options['wpregdef'] = "no";
15
  } // option to check registration form box by default
94
  $this->subscribe2_options['mailtext'] = __("BLOGNAME has posted a new item, 'TITLE'\n\nPOST\n\nYou may view the latest post at\nPERMALINK\n\nYou received this e-mail because you asked to be notified when new updates are posted.\nBest regards,\nMYNAME\nEMAIL", "subscribe2");
95
  } // Default notification email text
96
 
97
+ if (!isset($this->subscribe2_options['notification_subject'])) {
98
+ $this->subscribe2_options['notification_subject'] = "[BLOGNAME] TITLE";
99
+ } // Default notification email subject
100
+
101
  if (!isset($this->subscribe2_options['confirm_email'])) {
102
  $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.", "subscribe2");
103
  } // Default confirmation email text
104
 
105
+ if (!isset($this->subscribe2_options['confirm_subject'])) {
106
+ $this->subscribe2_options['confirm_subject'] = "[BLOGNAME] " . __('Please confirm your request', 'subscribe2');
107
+ } // Default confirmation email subject
108
+
109
  if (!isset($this->subscribe2_options['remind_email'])) {
110
  $this->subscribe2_options['remind_email'] = __("This email address was subscribed for notifications at BLOGNAME (BLOGLINK) but the subscription remains incomplete.\n\nIf you wish to complete your subscription please click on the link below:\n\nLINK\n\nIf you do not wish to complete your subscription please ignore this email and your address will be removed from our database.\n\nRegards,\nMYNAME", "subscribe2");
111
  } // Default reminder email text
112
+
113
+ if (!isset($this->subscribe2_options['remind_subject'])) {
114
+ $this->subscribe2_options['remind_subject'] = "[BLOGNAME] " . __('Subscription Reminder', 'subscribe2');;
115
+ } // Default reminder email subject
116
  ?>
include/s2_user_admin.css CHANGED
@@ -1,50 +1,83 @@
1
  ul.s2_blogs {
2
- float:left;
3
  width: 99%;
4
- }
5
 
6
  ul.s2_blogs li {
 
 
7
  display: block;
8
- width: 300px;
9
  float: left;
10
- padding: .5em 1em;
11
- background-color: #e3e3e3;
12
- margin-right: 1em;
13
- }
 
 
 
 
 
 
14
 
15
  ul.s2_blogs li .name {
16
  display: block;
17
- }
 
18
 
19
  ul.s2_blogs li .buttons {
20
  display: block;
21
- float: left;
 
22
  white-space: nowrap;
23
- }
 
24
 
25
  ul.s2_blogs li .buttons a {
26
- font-size: .8em;
27
  display: block;
28
  float: left;
29
  padding: .1em .5em;
30
  background-color: #666;
31
  color: white;
32
- margin: .5em .5em 0 0;
33
- }
34
 
35
- ul.s2_blogs li .buttons a:hover {
36
  background-color: whitesmoke;
37
  color: #666;
38
  }
39
 
40
- ul.s2_blogs_unsubscribed li .buttons {
41
- float: right;
42
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- ul.s2_blogs_unsubscribed li .buttons a {
45
- margin: 0 0 0 1em;
46
  }
47
 
48
- ul.s2_blogs_unsubscribed li .name {
 
 
49
  float: left;
 
 
 
 
 
 
 
 
 
50
  }
1
  ul.s2_blogs {
2
+ float: left;
3
  width: 99%;
4
+ }
5
 
6
  ul.s2_blogs li {
7
+ background-color: #E3E3E3;
8
+ border:1px solid #E0E0E0;
9
  display: block;
 
10
  float: left;
11
+ margin: 3px;
12
+ padding: 0.5em;
13
+ position: relative;
14
+ white-space: nowrap;
15
+ width: 47%;
16
+ }
17
+
18
+ ul.s2_blogs li: hover {
19
+ border-color: #666;
20
+ }
21
 
22
  ul.s2_blogs li .name {
23
  display: block;
24
+ float: left;
25
+ }
26
 
27
  ul.s2_blogs li .buttons {
28
  display: block;
29
+ float: right;
30
+ margin-left: -6px;
31
  white-space: nowrap;
32
+ font-size: .8em;
33
+ }
34
 
35
  ul.s2_blogs li .buttons a {
 
36
  display: block;
37
  float: left;
38
  padding: .1em .5em;
39
  background-color: #666;
40
  color: white;
41
+ margin: 0 0 0 1em;
42
+ }
43
 
44
+ ul.s2_blogs li .buttons a: hover {
45
  background-color: whitesmoke;
46
  color: #666;
47
  }
48
 
49
+ ul.s2_blogs div.additional_info {
50
+ display: none;
51
+ width: 75%;
52
+ padding: .5em 1em;
53
+ position: absolute;
54
+ left: -2px;
55
+ bottom: 2.4em;
56
+ margin-bottom: 2px;
57
+ z-index: 9;
58
+ background-color: #666;
59
+ color: #fff;
60
+ border: 1px solid white;
61
+ border-bottom: medium none;
62
+ -moz-border-radius-topright: .5em;
63
+ -moz-border-radius-topleft: .5em;
64
+ }
65
 
66
+ ul.s2_blogs li: hover div.additional_info {
67
+ display: block;
68
  }
69
 
70
+ ul.s2_blogs div.additional_info li {
71
+ display: block;
72
+ width: auto;
73
  float: left;
74
+ padding: 1px;
75
+ background-color: transparent;
76
+ margin-right: 0;
77
+ border: medium none;
78
+ margin-bottom: 0;
79
+ }
80
+
81
+ ul.s2_blogs div.additional_info .description {
82
+ font-style: italic;
83
  }
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
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.14
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
@@ -31,7 +31,7 @@ along with Subscribe2. If not, see <http://www.gnu.org/licenses/>.
31
 
32
  // our version number. Don't touch this or any line below
33
  // unless you know exacly what you are doing
34
- define('S2VERSION', '4.14');
35
  define('S2PATH', trailingslashit(dirname(__FILE__)));
36
 
37
  // Pre-2.6 compatibility
@@ -42,8 +42,8 @@ if (!defined('WP_CONTENT_DIR')) {
42
  define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
43
  }
44
 
45
- // use Owen's excellent ButtonSnap library
46
- if (!function_exists('buttonsnap_textbutton')) {
47
  require(WP_CONTENT_DIR . '/plugins/subscribe2/include/buttonsnap.php');
48
  }
49
 
@@ -91,10 +91,6 @@ class s2class {
91
 
92
  $this->deleted = "<p>" . __('You have successfully unsubscribed.', 'subscribe2') . "</p>";
93
 
94
- $this->confirm_subject = "[" . html_entity_decode(get_option('blogname')) . "] " . __('Please confirm your request', 'subscribe2');
95
-
96
- $this->remind_subject = "[" . html_entity_decode(get_option('blogname')) . "] " . __('Subscription Reminder', 'subscribe2');
97
-
98
  $this->subscribe = __('subscribe', 'subscribe2'); //ACTION replacement in subscribing confirmation email
99
 
100
  $this->unsubscribe = __('unsubscribe', 'subscribe2'); //ACTION replacement in unsubscribing in confirmation email
@@ -178,8 +174,7 @@ class s2class {
178
  Upgrade the database
179
  */
180
  function upgrade() {
181
- global $wpdb;
182
-
183
  // include upgrade-functions for maybe_create_table;
184
  if (!function_exists('maybe_create_table')) {
185
  require_once(ABSPATH . 'wp-admin/install-helper.php');
@@ -189,7 +184,7 @@ class s2class {
189
 
190
  // let's take the time to check process registered users
191
  // existing public subscribers are subscribed to all categories
192
- $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
193
  if (!empty($users)) {
194
  foreach ($users as $user) {
195
  $this->register($user);
@@ -212,11 +207,9 @@ class s2class {
212
  update_option('subscribe2_options', $this->subscribe2_options);
213
 
214
  // upgrade old wpmu user meta data to new
215
- global $wp_version, $wpmu_version;
216
- if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
217
  $this->namechange_subscribe2_widget();
218
  // loop through all users
219
- $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
220
  foreach ($users as $user) {
221
  // get categories which the user is subscribed to (old ones)
222
  $categories = get_usermeta($user, 's2_subscribed');
@@ -238,18 +231,13 @@ class s2class {
238
  update_usermeta($user, $this->get_usermeta_keyname('s2_cat') . $subscribed_category, $subscribed_category);
239
  }
240
  update_usermeta($user, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $subscribed_categories));
241
- } else {
242
- $current_s2_subscribed = get_usermeta($user, $this->get_usermeta_keyname('s2_subscribed'));
243
- if (empty($current_s2_subscribed)) {
244
- update_usermeta($user, $this->get_usermeta_keyname('s2_subscribed'), '-1');
245
- }
246
  }
247
  restore_current_blog();
248
  }
249
 
250
  // delete old user meta keys
251
  delete_usermeta($user, 's2_subscribed');
252
- foreach ($categories as $cat) if ($cat != '-1') {
253
  delete_usermeta($user, 's2_cat' . $cat);
254
  }
255
  }
@@ -279,7 +267,7 @@ class s2class {
279
  $string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
280
  $string = str_replace("TITLE", stripslashes($this->post_title), $string);
281
  $string = str_replace("PERMALINK", $this->permalink, $string);
282
- if (strstr("TINYLINK", $string)) {
283
  $tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->permalink));
284
  if ( ($tinylink !== 'Error') || ($tinylink != FALSE) ) {
285
  $string = str_replace("TINYLINK", $tinylink, $string);
@@ -296,12 +284,12 @@ class s2class {
296
  /**
297
  Delivers email to recipients in HTML or plaintext
298
  */
299
- function mail ($recipients = array(), $subject = '', $message = '', $type='text') {
300
  if ( (empty($recipients)) || ('' == $message) ) { return; }
301
 
302
  // Set sender details
303
  if ('' == $this->myname) {
304
- $admin = $this->get_userdata();
305
  $this->myname = html_entity_decode($admin->display_name);
306
  $this->myemail = $admin->user_email;
307
  }
@@ -316,22 +304,23 @@ class s2class {
316
  $headers .= "MIME-Version: 1.0\n";
317
  $headers .= "Content-Type: " . get_bloginfo('html_type') . "; charset=\"". get_bloginfo('charset') . "\"\n";
318
  if ('yes' == $this->subscribe2_options['stylesheet']) {
319
- $mailtext = "<html><head><title>" . $subject . "</title><link rel=\"stylesheet\" href=\"" . get_bloginfo('stylesheet_url') . "\" type=\"text/css\" media=\"screen\" /></head><body>" . $message . "</body></html>";
320
  } else {
321
- $mailtext = "<html><head><title>" . $subject . "</title></head><body>" . $message . "</body></html>";
322
  }
323
  } else {
324
  $headers .= "MIME-Version: 1.0\n";
325
  $headers .= "Content-Type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
326
  $message = preg_replace('|&[^a][^m][^p].{0,3};|', '', $message);
327
  $message = preg_replace('|&amp;|', '&', $message);
328
- $mailtext = wordwrap(strip_tags($message), 80, "\n");
 
329
  }
330
 
331
  // Replace any escaped html symbols in subject
332
  $subject = html_entity_decode($subject);
333
 
334
- // Construct BCC headers for sending or send individual emails
335
  $bcc = '';
336
  natcasesort($recipients);
337
  if ($this->subscribe2_options['bcclimit'] == 1) {
@@ -362,31 +351,24 @@ class s2class {
362
  $count = 1;
363
  $batch = array();
364
  foreach ($recipients as $recipient) {
365
- // advance the array pointer by one, for use down below
366
- // the array pointer _is not_ advanced by the foreach() loop itself
367
- next($recipients);
368
  $recipient = trim($recipient);
369
  // sanity check -- make sure we have a valid email
370
  if (!is_email($recipient)) { continue; }
371
  // and NOT the sender's email, since they'll get a copy anyway
372
- if ( (! empty($recipient)) && ($this->myemail != $recipient) ) {
373
  ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ", $recipient";
374
  // Bcc Headers now constructed by phpmailer class
375
  }
376
  if ($this->subscribe2_options['bcclimit'] == $count) {
377
- $count = 1;
378
  $batch[] = $bcc;
379
  $bcc = '';
380
- } else {
381
- if (false == current($recipients)) {
382
- // we've reached the end of the subscriber list
383
- // add what we have to the batch, and move on
384
- $batch[] = $bcc;
385
- break;
386
- } else {
387
- $count++;
388
- }
389
  }
 
 
 
 
 
390
  }
391
  }
392
  // rewind the array, just to be safe
@@ -443,7 +425,7 @@ class s2class {
443
  $check = true;
444
  }
445
  }
446
- // if so, bail out
447
  if ($check) {
448
  // hang on -- can registered users subscribe to
449
  // excluded categories?
@@ -454,17 +436,17 @@ class s2class {
454
  }
455
 
456
  // Are we sending notifications for Private posts?
457
- if ($this->subscribe2_options['private'] == "yes") {
 
458
  // don't send notification to public users
459
  $check = true;
460
  }
461
 
462
- // lets collect our public subscribers
463
- // and all our registered subscribers for these categories
464
  if (!$check) {
465
  // if this post is assigned to an excluded
466
- // category, then this test will prevent
467
- // the public from receiving notification
468
  $public = $this->get_public();
469
  }
470
  $registered = $this->get_registered("cats=$post_cats_string");
@@ -485,17 +467,17 @@ class s2class {
485
  // do we send as admin, or post author?
486
  if ('author' == $this->subscribe2_options['sender']) {
487
  // get author details
488
- $user =& $author;
489
  } else {
490
  // get admin details
491
- $user = $this->get_userdata();
492
  }
493
  $this->myemail = $user->user_email;
494
  $this->myname = html_entity_decode($user->display_name);
495
  // Get email subject
496
- $subject = stripslashes(strip_tags($this->substitute($this->s2_subject)));
497
  // Get the message template
498
- $mailtext = apply_filter('s2_email_template', $this->subscribe2_options['mailtext']);
499
  $mailtext = stripslashes($this->substitute($mailtext));
500
 
501
  $plaintext = $post->post_content;
@@ -587,12 +569,12 @@ class s2class {
587
  $link .= md5($this->email);
588
  $link .= $id;
589
 
590
- $admin = $this->get_userdata();
591
  $this->myname = html_entity_decode($admin->display_name);
592
 
593
  if ($is_remind == TRUE) {
594
  $body = $this->substitute(stripslashes($this->subscribe2_options['remind_email']));
595
- $subject = stripslashes($this->remind_subject);
596
  } else {
597
  $body = $this->substitute(stripslashes($this->subscribe2_options['confirm_email']));
598
  if ('add' == $what) {
@@ -600,7 +582,7 @@ class s2class {
600
  } elseif ('del' == $what) {
601
  $body = str_replace("ACTION", $this->unsubscribe, $body);
602
  }
603
- $subject = stripslashes($this->confirm_subject);
604
  }
605
 
606
  $body = str_replace("LINK", $link, $body);
@@ -620,7 +602,7 @@ class s2class {
620
  /**
621
  Given a public subscriber ID, returns the email address
622
  */
623
- function get_email ($id = 0) {
624
  global $wpdb;
625
 
626
  if (!$id) {
@@ -632,7 +614,7 @@ class s2class {
632
  /**
633
  Given a public subscriber email, returns the subscriber ID
634
  */
635
- function get_id ($email = '') {
636
  global $wpdb;
637
 
638
  if (!$email) {
@@ -645,7 +627,7 @@ class s2class {
645
  Activate an public subscriber email address
646
  If the address is not already present, it will be added
647
  */
648
- function activate ($email = '') {
649
  global $wpdb;
650
 
651
  if ('' == $email) {
@@ -668,7 +650,7 @@ class s2class {
668
  /**
669
  Add an public subscriber to the subscriber table as unconfirmed
670
  */
671
- function add ($email = '') {
672
  if ($this->filtered ==1) { return; }
673
  global $wpdb;
674
 
@@ -748,7 +730,7 @@ class s2class {
748
  list($user, $domain) = split('@', $email);
749
  $bar_check = stristr($barred_option, $domain);
750
 
751
- if(!empty($bar_check)) {
752
  return true;
753
  } else {
754
  return false;
@@ -848,7 +830,7 @@ class s2class {
848
  /**
849
  Return an array of all the public subscribers
850
  */
851
- function get_public ($confirmed = 1) {
852
  global $wpdb;
853
  if (1 == $confirmed) {
854
  if ('' == $this->all_public) {
@@ -864,16 +846,34 @@ class s2class {
864
  } // end get_public()
865
 
866
  /**
867
- Return an array of registered subscribers
868
- Collect all the registered users of the blog who are subscribed to the specified categories
869
  */
870
- function get_registered ($args = '') {
871
- global $wpdb, $wp_version, $wpmu_version;
872
 
873
- // Is this WordPressMU or not?
874
- if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
875
- $s2_mu = true;
 
 
 
 
 
 
 
 
 
 
 
876
  }
 
 
 
 
 
 
 
 
877
 
878
  $format = '';
879
  $amount = '';
@@ -881,12 +881,12 @@ class s2class {
881
  $subscribers = array();
882
 
883
  parse_str($args, $r);
884
- if (!isset($r['cats']))
885
- $r['cats'] = '';
886
  if (!isset($r['format']))
887
  $r['format'] = 'all';
888
  if (!isset($r['amount']))
889
  $r['amount'] = 'all';
 
 
890
 
891
  $JOIN = ''; $AND = '';
892
  // text or HTML subscribers
@@ -915,15 +915,15 @@ class s2class {
915
  if ('' != $r['cats']) {
916
  $JOIN .= "INNER JOIN $wpdb->usermeta AS d ON a.user_id = d.user_id ";
917
  foreach (explode(',', $r['cats']) as $cat) {
918
- ('' == $and) ? $and = "d.meta_key='{$this->get_usermeta_keyname('s2_cat')}$cat'" : $and .= " OR d.meta_key='{$this->get_usermeta_keyname('s2_cat')}$cat'";
919
  }
920
  $AND .= " AND ($and)";
921
  }
922
 
923
- if ($s2_mu) {
924
- $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS e ON a.user_id = e.user_id " . $JOIN . "WHERE a.meta_key='" . $wpdb->prefix . "capabilities' AND e.meta_key='{$this->get_usermeta_keyname('s2_subscribed')}'" . $AND;
925
  } else {
926
- $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='{$this->get_usermeta_keyname('s2_subscribed')}'" . $AND;
927
  }
928
  $result = $wpdb->get_col($sql);
929
  if ($result) {
@@ -954,16 +954,15 @@ class s2class {
954
  Create the appropriate usermeta values when a user registers
955
  If the registering user had previously subscribed to notifications, this function will delete them from the public subscriber list first
956
  */
957
- function register ($user_id = 0) {
958
  global $wpdb;
959
 
960
  if (0 == $user_id) { return $user_id; }
961
  $user = get_userdata($user_id);
962
  $all_cats = get_categories(array('hide_empty' => false));
963
 
964
- if (0 == $this->subscribe2_options['reg_override']) {
965
- // registered users are not allowed to subscribe to
966
- // excluded categories
967
  $exclude = explode(',', $this->subscribe2_options['exclude']);
968
  foreach ($all_cats as $cat => $term_id) {
969
  if (in_array($all_cats[$cat]->term_id, $exclude)) {
@@ -987,7 +986,7 @@ class s2class {
987
  // delete this user from the public table, and subscribe them to all the categories
988
  $this->delete($user->user_email);
989
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), $cats);
990
- foreach(explode(',', $cats) as $cat) {
991
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
992
  }
993
  update_usermeta($user_id, 's2_format', 'text');
@@ -997,6 +996,7 @@ class s2class {
997
  // create post format entries for all users
998
  $check_format = get_usermeta($user_id, 's2_format');
999
  if (empty($check_format)) {
 
1000
  if ('html' == $this->subscribe2_options['autoformat']) {
1001
  update_usermeta($user_id, 's2_format', 'html');
1002
  update_usermeta($user_id, 's2_excerpt', 'post');
@@ -1008,22 +1008,22 @@ class s2class {
1008
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
1009
  }
1010
  update_usermeta($user_id, 's2_autosub', $this->subscribe2_options['autosub_def']);
1011
- }
1012
- // ensure existing subscriptions are not overwritten on upgrade
1013
- $check_subscribed = get_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1014
- // if the are no existing subscriptions, create them based on admin options
1015
- if (empty($check_subscribed)) {
1016
- // add entries by default if autosub is on
1017
  if ( ('yes' == $this->subscribe2_options['autosub']) || (('wpreg' == $this->subscribe2_options['autosub']) && ('on' == $_POST['subscribe'])) ) {
1018
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), $cats);
1019
- foreach(explode(',', $cats) as $cat) {
1020
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1021
  }
1022
- } else {
1023
- update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), '-1');
1024
  }
1025
- } else {
1026
- update_usermeta($user_id, 's2_autosub', 'no');
 
 
 
 
 
 
 
1027
  }
1028
  }
1029
  return $user_id;
@@ -1032,7 +1032,7 @@ class s2class {
1032
  /**
1033
  Subscribe all registered users to category selected on Admin Manage Page
1034
  */
1035
- function subscribe_registered_users ($emails = '', $cats = '') {
1036
  if ( ('' == $emails) || ('' == $cats) ) { return false; }
1037
  global $wpdb;
1038
 
@@ -1047,11 +1047,7 @@ class s2class {
1047
 
1048
  foreach ($user_IDs as $user_ID) {
1049
  $old_cats = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1050
- if ($old_cats == '-1') {
1051
- $old_cats = array();
1052
- } else {
1053
- $old_cats = explode(',', $old_cats);
1054
- }
1055
  if (!is_array($old_cats)) {
1056
  $old_cats = array($old_cats);
1057
  }
@@ -1070,7 +1066,7 @@ class s2class {
1070
  /**
1071
  Unsubscribe all registered users to category selected on Admin Manage Page
1072
  */
1073
- function unsubscribe_registered_users ($emails = '', $cats = '') {
1074
  if ( ('' == $emails) || ('' == $cats) ) { return false; }
1075
  global $wpdb;
1076
 
@@ -1100,7 +1096,7 @@ class s2class {
1100
  foreach ($cats as $id) {
1101
  delete_usermeta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1102
  }
1103
- update_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '-1');
1104
  }
1105
  }
1106
  } // end unsubscribe_registered_users()
@@ -1146,9 +1142,10 @@ class s2class {
1146
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $term_id, $term_id);
1147
  }
1148
  if (empty($cats)) {
1149
- $cats = array('-1');
 
 
1150
  }
1151
- update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $cats));
1152
 
1153
  // don't restore_current_blog(); -> redirect to new subscription page
1154
  $redirect_to_subscriptionpage = true;
@@ -1163,16 +1160,15 @@ class s2class {
1163
 
1164
  // delete subscription to all categories on that blog
1165
  $cats = get_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1166
- if ($cats == '-1') {
1167
- $cats = array();
1168
- } else {
1169
- $cats = explode(',', $cats);
1170
- if (!is_array($cats)) $cats = array($cats);
1171
  }
 
1172
  foreach ($cats as $id) {
1173
  delete_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $id);
1174
  }
1175
- update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), '-1');
1176
 
1177
  // remove level_0 users
1178
  if (!current_user_can(1)) {
@@ -1187,7 +1183,7 @@ class s2class {
1187
  delete_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1188
  }
1189
  }
1190
- restore_current_blog();
1191
  $redirect_to_subscriptionpage = true;
1192
  }
1193
  }
@@ -1217,7 +1213,7 @@ class s2class {
1217
  Autosubscribe registered users to newly created categories
1218
  if registered user has selected this option
1219
  */
1220
- function autosub_new_category ($new_category='') {
1221
  global $wpdb;
1222
 
1223
  $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key='s2_autosub' AND $wpdb->usermeta.meta_value='yes'";
@@ -1236,25 +1232,49 @@ class s2class {
1236
  }
1237
  } // end autosub_new_category()
1238
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1239
  /**
1240
  Get admin data from record 1 or first user with admin rights
1241
  */
1242
- function get_userdata() {
1243
  global $wpdb, $userdata;
1244
 
1245
- // get details of current user
1246
- $admin = &$userdata;
 
 
1247
 
1248
- // if current under is empty or isn't an administrator get user record 1
1249
- if ( (empty($admin)) || $userdata->{$wpdb->prefix . "user_level"} != 10) {
1250
- $admin = get_userdata(1);
 
1251
  }
1252
 
1253
- // if user record 1 is empty grab the first admin from the database
1254
  if (empty($admin)) {
1255
  $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";
1256
  $admin = get_userdata($wpdb->get_var($sql));
1257
  }
 
1258
  return $admin;
1259
  } //end get_userdata()
1260
 
@@ -1267,8 +1287,9 @@ class s2class {
1267
 
1268
  //Get Registered Subscribers for bulk management
1269
  $registered = $this->get_registered();
1270
- if (!empty($registered)) {
1271
- $emails = implode(",", $registered);
 
1272
  }
1273
 
1274
  // was anything POSTed ?
@@ -1291,25 +1312,25 @@ class s2class {
1291
  foreach ($_POST['delete'] as $address) {
1292
  $this->delete($address);
1293
  }
1294
- echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Address(es) deleted!', 'subscribe2') . "</strong></p></div>";
1295
  }
1296
  if ($_POST['confirm']) {
1297
  foreach ($_POST['confirm'] as $address) {
1298
  $this->toggle($address);
1299
  }
1300
- $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
1301
  }
1302
  if ($_POST['unconfirm']) {
1303
  foreach ($_POST['unconfirm'] as $address) {
1304
  $this->toggle($address);
1305
  }
1306
- $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
1307
  }
1308
  echo $message;
1309
  } elseif ($_POST['searchterm']) {
1310
  $confirmed = $this->get_public();
1311
  $unconfirmed = $this->get_public(0);
1312
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$registered);
1313
  foreach ($subscribers as $subscriber) {
1314
  if (is_numeric(stripos($subscriber, $_POST['searchterm']))) {
1315
  $result[] = $subscriber;
@@ -1317,7 +1338,7 @@ class s2class {
1317
  }
1318
  } elseif ($_POST['remind']) {
1319
  $this->remind($_POST['reminderemails']);
1320
- echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Reminder Email(s) Sent!', 'subscribe2') . "</strong></p></div>";
1321
  } elseif ( ($_POST['register']) && ('subscribe' == $_POST['manage']) ) {
1322
  $this->subscribe_registered_users($_POST['emails'], $_POST['category']);
1323
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Registered Users Subscribed!', 'subscribe2') . "</strong></p></div>";
@@ -1334,6 +1355,7 @@ class s2class {
1334
  if ('' == $confirmed) { $confirmed = array(); }
1335
  if ('' == $unconfirmed) { $unconfirmed = array(); }
1336
  if ('' == $registered) { $registered = array(); }
 
1337
 
1338
  $reminderform = false;
1339
  $urlpath = str_replace("\\", "/", S2PATH);
@@ -1348,7 +1370,7 @@ class s2class {
1348
  $page = 1;
1349
  if ('all' == $_POST['what']) {
1350
  $what = 'all';
1351
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$registered);
1352
  } elseif ('public' == $_POST['what']) {
1353
  $what = 'public';
1354
  $subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
@@ -1368,11 +1390,14 @@ class s2class {
1368
  } elseif ('registered' == $_POST['what']) {
1369
  $what = 'registered';
1370
  $subscribers = $registered;
 
 
 
1371
  }
1372
  } elseif (isset($_GET['what'])) {
1373
  if ('all' == $_GET['what']) {
1374
  $what = 'all';
1375
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$registered);
1376
  } elseif ('public' == $_GET['what']) {
1377
  $what = 'public';
1378
  $subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
@@ -1381,7 +1406,7 @@ class s2class {
1381
  $subscribers = $confirmed;
1382
  } elseif ('unconfirmed' == $_GET['what']) {
1383
  $what = 'unconfirmed';
1384
- $subscribers = $unconfirmed;
1385
  if (!empty($subscribers)) {
1386
  $reminderemails = implode(",", $subscribers);
1387
  $reminderform = true;
@@ -1392,10 +1417,13 @@ class s2class {
1392
  } elseif ('registered' == $_GET['what']) {
1393
  $what = 'registered';
1394
  $subscribers = $registered;
 
 
 
1395
  }
1396
  } else {
1397
  $what = 'all';
1398
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$registered);
1399
  }
1400
  if ($_POST['searchterm']) {
1401
  $subscribers = &$result;
@@ -1411,12 +1439,12 @@ class s2class {
1411
  $strip = '';
1412
  if ( $page > 1 ) {
1413
  $args['s2page'] = $page - 1;
1414
- $strip .= '<a class="prev" href="' . clean_url(add_query_arg($args)) . '">&laquo; '. __('Previous Page', 'subscribe2') .'</a>' . "\n";
1415
  }
1416
  if ( $total_pages > 1 ) {
1417
  for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) {
1418
  if ( $page == $page_num ) {
1419
- $strip .= "<strong>" . $page_num . "</strong>\n";
1420
  } else {
1421
  if ( $page_num < 3 || ( $page_num >= $page - 2 && $page_num <= $page + 2 ) || $page_num > $total_pages - 2 ) {
1422
  $args['s2page'] = $page_num;
@@ -1431,7 +1459,7 @@ class s2class {
1431
  }
1432
  if ( ( $page ) * $this->subscribe2_options['entries'] < $total_subscribers ) {
1433
  $args['s2page'] = $page + 1;
1434
- $strip .= "<a class=\"next\" href=\"" . clean_url(add_query_arg($args)) . "\">". __('Next Page', 'subscribe2') . " &raquo;</a>\n";
1435
  }
1436
  }
1437
 
@@ -1498,20 +1526,20 @@ class s2class {
1498
  if (in_array($subscriber, $confirmed)) {
1499
  echo "</td><td align=\"center\">\r\n";
1500
  echo "<input class=\"unconfirm_checkall\" title=\"" . __('Unconfirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"unconfirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
1501
- echo "<td align=\"center\"><span class=\"delete\">\r\n";
1502
- echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
1503
  echo "</span></td>\r\n";
1504
  echo "<td><span style=\"color:#006600\">&#x221A;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1505
  echo "(<span style=\"color:#006600\">" . $this->signup_date($subscriber) . "</span>)\r\n";
1506
  } elseif (in_array($subscriber, $unconfirmed)) {
1507
  echo "<input class=\"confirm_checkall\" title=\"" . __('Confirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"confirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
1508
  echo "<td align=\"center\"></td>\r\n";
1509
- echo "<td align=\"center\"><span class=\"delete\">\r\n";
1510
- echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
1511
  echo "</span></td>\r\n";
1512
  echo "<td><span style=\"color:#FF0000\">&nbsp;!&nbsp;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1513
  echo "(<span style=\"color:#FF0000\">" . $this->signup_date($subscriber) . "</span>)\r\n";
1514
- } elseif (in_array($subscriber, $registered)) {
1515
  echo "</td><td align=\"center\"></td><td align=\"center\"></td>\r\n";
1516
  echo "<td><span style=\"color:#006600\">&reg;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1517
  echo "(<a href=\"" . get_option('siteurl') . "/wp-admin/users.php?page=subscribe2/subscribe2.php&amp;email=$subscriber\">" . __('edit', 'subscribe2') . "</a>)\r\n";
@@ -1573,8 +1601,8 @@ class s2class {
1573
 
1574
  // send as author or admin?
1575
  $sender = 'author';
1576
- if ('admin' == $_POST['sender']) {
1577
- $sender = 'admin';
1578
  }
1579
  $this->subscribe2_options['sender'] = $sender;
1580
 
@@ -1597,7 +1625,7 @@ class s2class {
1597
  unset($this->subscribe2_options['last_s2cron']);
1598
  } else {
1599
  // if we are using digest schedule the event and prime last_cron as now
1600
- $time = current_time('timestamp') + $interval;
1601
  if ($interval < 86400) {
1602
  // Schedule CRON events occurring less than daily starting now and periodically thereafter
1603
  $timestamp = &$time;
@@ -1612,10 +1640,26 @@ class s2class {
1612
  }
1613
  }
1614
 
1615
- // email templates
1616
- $this->subscribe2_options['mailtext'] = $_POST['mailtext'];
1617
- $this->subscribe2_options['confirm_email'] = $_POST['confirm_email'];
1618
- $this->subscribe2_options['remind_email'] = $_POST['remind_email'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1619
 
1620
  // excluded categories
1621
  if (!empty($_POST['category'])) {
@@ -1652,6 +1696,7 @@ class s2class {
1652
 
1653
  //automatic subscription
1654
  $this->subscribe2_options['autosub'] = $_POST['autosub'];
 
1655
  $this->subscribe2_options['wpregdef'] = $_POST['wpregdef'];
1656
  $this->subscribe2_options['autoformat'] = $_POST['autoformat'];
1657
  $this->subscribe2_options['show_autosub'] = $_POST['show_autosub'];
@@ -1678,7 +1723,6 @@ class s2class {
1678
 
1679
  // settings for outgoing emails
1680
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
1681
- echo "<p>";
1682
  echo __('Restrict the number of recipients per email to (0 for unlimited)', 'subscribe2') . ': ';
1683
  echo "<span id=\"s2bcc_1\"><span id=\"s2bcc\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['bcclimit'] . "</span> ";
1684
  echo "<a href=\"#\" onclick=\"s2_show('bcc'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
@@ -1755,28 +1799,22 @@ class s2class {
1755
  }
1756
  echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
1757
  echo __('Send Email From', 'subscribe2') . ': ';
1758
- echo "<label><input type=\"radio\" name=\"sender\" value=\"author\"";
1759
- if ('author' == $this->subscribe2_options['sender']) {
1760
- echo " checked=\"checked\" ";
1761
- }
1762
- echo " /> " . __('Author of the post', 'subscribe2') . "</label>&nbsp;&nbsp;";
1763
- echo "<label><input type=\"radio\" name=\"sender\" value=\"admin\"";
1764
- if ('admin' == $this->subscribe2_options['sender']) {
1765
- echo " checked=\"checked\" ";
1766
- }
1767
- echo " /> " . __('Blog Admin', 'subscribe2') . "</label><br /><br />\r\n";
1768
  if (function_exists('wp_schedule_event')) {
1769
  echo __('Send Emails', 'subscribe2') . ": <br /><br />\r\n";
1770
  $this->display_digest_choices();
1771
  }
1772
- echo "</p>";
1773
 
1774
  // email templates
1775
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1776
  echo"<br />";
1777
  echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
1778
  echo "<tr><td>";
1779
- echo __('New Post email (must not be empty)', 'subscribe2') . ":";
 
 
1780
  echo "<br />\r\n";
1781
  echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
1782
  echo "</td><td valign=\"top\" rowspan=\"3\">";
@@ -1797,9 +1835,13 @@ class s2class {
1797
  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";
1798
  echo "</dl></td></tr><tr><td>";
1799
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
 
 
1800
  echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea><br /><br />\r\n";
1801
  echo "</td></tr><tr valign=\"top\"><td>";
1802
  echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
 
 
1803
  echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
1804
  echo "</td></tr></table><br />\r\n";
1805
 
@@ -1878,7 +1920,18 @@ class s2class {
1878
  echo " checked=\"checked\"";
1879
  }
1880
  echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
1881
- echo __('Registration Form option is checked by default', 'subscribe2') . ": &nbsp;&nbsp;";
 
 
 
 
 
 
 
 
 
 
 
1882
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"";
1883
  if ('yes' == $this->subscribe2_options['wpregdef']) {
1884
  echo " checked=\"checked\"";
@@ -1905,7 +1958,7 @@ class s2class {
1905
  echo "checked=\"checked\" ";
1906
  }
1907
  echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />";
1908
- echo __('Show Auto Subscribe option on Users page', 'subscribe2') . ": <br />\r\n";
1909
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"yes\"";
1910
  if ('yes' == $this->subscribe2_options['show_autosub']) {
1911
  echo " checked=\"checked\"";
@@ -1916,7 +1969,7 @@ class s2class {
1916
  echo " checked=\"checked\"";
1917
  }
1918
  echo " />" . __('No', 'subscribe2') . "</label><br /><br />";
1919
- echo __('Auto Subscribe me to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
1920
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"";
1921
  if ('yes' == $this->subscribe2_options['autosub_def']) {
1922
  echo " checked=\"checked\"";
@@ -1956,7 +2009,7 @@ class s2class {
1956
  Our profile menu
1957
  */
1958
  function user_menu() {
1959
- global $user_ID, $s2nonce, $wp_version, $wpmu_version;
1960
 
1961
  if (isset($_GET['email'])) {
1962
  global $wpdb;
@@ -1965,14 +2018,6 @@ class s2class {
1965
  get_currentuserinfo();
1966
  }
1967
 
1968
- // Is this WordPressMU or not?
1969
- if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
1970
- $s2_mu = true;
1971
- }
1972
- else {
1973
- $s2_mu = false;
1974
- }
1975
-
1976
  // was anything POSTed?
1977
  if ( (isset($_POST['s2_admin'])) && ('user' == $_POST['s2_admin']) ) {
1978
  check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
@@ -1999,7 +2044,7 @@ class s2class {
1999
  delete_usermeta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
2000
  }
2001
  }
2002
- update_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '-1');
2003
  } elseif ($cats == 'digest') {
2004
  $all_cats = get_categories(array('hide_empty' => false));
2005
  foreach ($all_cats as $cat) {
@@ -2082,12 +2127,12 @@ class s2class {
2082
  }
2083
 
2084
  // subscribed categories
2085
- if ($s2_mu) {
2086
  global $blog_id;
2087
  $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2088
  // if we are subscribed to the current blog display an "unsubscribe" link
2089
- if (!empty($subscribed) && $subscribed != "-1") {
2090
- $unsubscribe_link = get_bloginfo('url') . "/wp-admin/?s2mu_unsubscribe=". $blog_id;
2091
  echo "<p><a href=\"". $unsubscribe_link ."\" class=\"button\">" . __('Unsubscribe me from this blog', 'subscribe2') . "</a></p>";
2092
  } else {
2093
  // else we show a "subscribe" link
@@ -2105,11 +2150,11 @@ class s2class {
2105
  echo __('Receive periodic summaries of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
2106
  echo "<p><label>";
2107
  echo "<input type=\"radio\" name=\"category\" value=\"digest\" ";
2108
- if (get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed')) != '-1') {
2109
  echo "checked=\"yes\" ";
2110
  }
2111
  echo "/> " . __('Yes', 'subscribe2') . "</label> <label><input type=\"radio\" name=\"category\" value=\"-1\" ";
2112
- if (get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed')) == '-1') {
2113
  echo "checked=\"yes\" ";
2114
  }
2115
  echo "/> " . __('No', 'subscribe2');
@@ -2122,68 +2167,95 @@ class s2class {
2122
 
2123
 
2124
  // list of subscribed blogs on wordpress mu
2125
- if ($s2_mu) {
2126
  global $blog_id;
2127
- $blogs = get_blog_list( 0, 'all', false );
2128
-
2129
  $blogs_subscribed = array();
2130
  $blogs_notsubscribed = array();
2131
 
2132
  foreach ($blogs as $key => $blog) {
2133
- // exclude current blog
2134
- $is_current_blog = ($blog_id == $blog['blog_id']);
2135
-
2136
  // switch to blog
2137
  switch_to_blog($blog['blog_id']);
2138
 
2139
  // check that the plugin is active on the current blog
2140
  $current_plugins = get_option('active_plugins');
2141
- if ( !is_array($current_plugins) || !in_array('subscribe2/subscribe2.php', $current_plugins)) continue;
 
 
 
 
 
2142
 
2143
  // check if we're subscribed to the blog
2144
  $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2145
- $subscribed = !empty($subscribed) && $subscribed != -1;
2146
 
2147
- $blog['blogname'] = get_bloginfo('name');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2148
  $blog['blogurl'] = get_bloginfo('url');
2149
  $blog['subscribe_page'] = get_bloginfo('url') . "/wp-admin/users.php?page=subscribe2/subscribe2.php";
2150
 
2151
  $key = strtolower($blog['blogname'] . "-" . $blog['blog_id']);
2152
- if ($subscribed) {
2153
  $blogs_subscribed[$key] = $blog;
2154
- } elseif (!$is_current_blog) {
2155
  $blogs_notsubscribed[$key] = $blog;
2156
  }
2157
-
2158
  restore_current_blog();
2159
  }
2160
 
2161
  if (!empty($blogs_subscribed)) {
2162
- ksort(&$blogs_subscribed);
2163
- $unsubscribe_link = get_bloginfo('url') . "/wp-admin/?s2mu_unsubscribe=";
2164
  echo '<h2>' . __('Subscribed Blogs', 'subscribe2') . '</h2>'."\r\n";
2165
-
2166
- echo "<ul class=\"s2_blogs s2_blogs_subscribed\">\r\n";
2167
  foreach ($blogs_subscribed as $blog) {
2168
- echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\">" . wp_html_excerpt($blog['blogname'], 30) . "</a></span>\r\n";
2169
- echo "<span class=\"buttons\"><a href=\"" . $unsubscribe_link . $blog['blog_id'] . "\">" . __('Unsubscribe', 'subscribe2') . "</a>\r\n";
2170
- if ($blog_id != $blog['blog_id']) {
2171
- echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Subscription Settings', 'subscribe2') . "</a>\r\n";
 
 
 
 
 
2172
  }
2173
- echo "</span>";
2174
  echo "</li>";
2175
  }
2176
- echo "</ul>";
2177
  }
2178
-
2179
  if (!empty($blogs_notsubscribed)) {
2180
- ksort(&$blogs_notsubscribed);
2181
- $subscribe_link = get_bloginfo('url') . "/wp-admin/?s2mu_subscribe=";
2182
  echo "<h2>" . __('Subscribe to new blogs', 'subscribe2') . "</h2>\r\n";
2183
- echo "<ul class=\"s2_blogs s2_blogs_unsubscribed\">";
2184
  foreach ($blogs_notsubscribed as $blog) {
2185
- echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\">" . wp_html_excerpt($blog['blogname'], 30) . "</a></span>\r\n";
2186
- echo "<span class=\"buttons\"><a href=\"" . $subscribe_link . $blog['blog_id'] . "\">" . __('Subscribe', 'subscribe2') . "</a></span>\r\n";
 
 
 
 
 
 
 
 
 
2187
  echo "</li>";
2188
  }
2189
  echo "</ul>\r\n";
@@ -2217,6 +2289,8 @@ class s2class {
2217
  } elseif (is_numeric($_POST['what'])) {
2218
  $cat = intval($_POST['what']);
2219
  $recipients = $this->get_registered("cats=$cat");
 
 
2220
  } else {
2221
  $recipients = $this->get_registered();
2222
  }
@@ -2325,19 +2399,15 @@ class s2class {
2325
  $selected is the option to select
2326
  $submit is the text to use on the Submit button
2327
  */
2328
- function display_subscriber_dropdown ($selected = 'registered', $submit = '', $exclude = array()) {
2329
- global $wpdb, $wp_version, $wpmu_version;
2330
-
2331
- // Is this WordPressMU or not?
2332
- if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
2333
- $s2_mu = true;
2334
- }
2335
 
2336
- $who = array('all' => __('All Subscribers', 'subscribe2'),
2337
  'public' => __('Public Subscribers', 'subscribe2'),
2338
  'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
2339
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
2340
- 'registered' => __('Registered Users', 'subscribe2'));
 
2341
 
2342
  $all_cats = get_categories(array('hide_empty' => false));
2343
 
@@ -2351,24 +2421,29 @@ class s2class {
2351
  } else {
2352
  $count['public'] = ($count['confirmed'] + $count['unconfirmed']);
2353
  }
2354
- if ($s2_mu) {
2355
- $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
2356
  } else {
2357
- $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='{$this->get_usermeta_keyname('s2_subscribed')}'");
2358
  }
2359
- $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
2360
- if ($s2_mu) {
 
 
 
 
 
2361
  foreach ($all_cats as $cat) {
2362
- $count[$cat->name] = $wpdb->get_var("SELECT COUNT(a.meta_key) FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id WHERE a.meta_key='" . $wpdb->prefix . "capabilities' AND b.meta_key=('{$this->get_usermeta_keyname('s2_cat')}$cat->term_id')");
2363
  }
2364
  } else {
2365
  foreach ($all_cats as $cat) {
2366
- $count[$cat->name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='{$this->get_usermeta_keyname('s2_cat')}$cat->term_id'");
2367
  }
2368
  }
2369
 
2370
  // do have actually have some subscribers?
2371
- if ( (0 == $count['confirmed']) && (0 == $count['unconfirmed']) && (0 == $count['registered']) ) {
2372
  // no? bail out
2373
  return;
2374
  }
@@ -2397,13 +2472,40 @@ class s2class {
2397
  }
2398
  } // end display_subscriber_dropdown()
2399
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2400
  function display_digest_choices() {
2401
  global $wpdb;
2402
  $scheduled_time = wp_next_scheduled('s2_digest_cron');
2403
  $schedule = (array)wp_get_schedules();
2404
  $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('For each Post', 'subscribe2'))), $schedule);
2405
  $sort = array();
2406
- foreach ( (array)$schedule as $key => $value ) $sort[$key] = $value['interval'];
2407
  asort($sort);
2408
  $schedule_sorted = array();
2409
  foreach ($sort as $key => $value) {
@@ -2449,7 +2551,7 @@ class s2class {
2449
  global $wpdb, $wp_version, $wpmu_version;
2450
 
2451
  // Is this WordPressMU or not?
2452
- if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
2453
  switch($metaname) {
2454
  case 's2_subscribed':
2455
  case 's2_cat':
@@ -2521,7 +2623,7 @@ class s2class {
2521
  */
2522
  function s2_meta_box() {
2523
  global $post_ID;
2524
- $s2mail = get_post_meta($post_ID, 's2mail', true);
2525
  echo "<input type=\"hidden\" name=\"s2meta_nonce\" id=\"s2meta_nonce\" value=\"" . wp_create_nonce(md5(plugin_basename(__FILE__))) . "\" />";
2526
  echo __("Check here to disable sending of an email notification for this post/page", 'subscribe2');
2527
  echo "&nbsp;&nbsp;<input type=\"checkbox\" name=\"s2_meta_field\" value=\"no\"";
@@ -2537,7 +2639,7 @@ class s2class {
2537
  function s2_meta_box_old() {
2538
  echo "<div class=\"dbx-b-ox-wrapper\">\r\n";
2539
  echo "<fieldset id=\"s2_meta_box\" class=\"dbx-box\">\r\n";
2540
- echo "<div class=\"dbx-h-andle-wrapper\"><h3 class=\"dbx-handle\">" . __('Subscribe2 Notification Override', 'subscribe2') . "</h3></div>\r\n";
2541
  echo "<div class=\"dbx-c-ontent-wrapper\"><div class=\"dbx-content\">\r\n";
2542
  $this->s2_meta_box();
2543
  echo "</div></div></fieldset></div>\r\n";
@@ -2680,9 +2782,10 @@ class s2class {
2680
  extract($args);
2681
  $options = get_option('widget_subscribe2widget');
2682
  $title = empty($options['title']) ? __('Subscribe2', 'subscribe2') : $options['title'];
 
2683
  echo $before_widget;
2684
  echo $before_title . $title . $after_title;
2685
- echo "<div class=\"search\">";
2686
  $content = s2class::filter('<!--subscribe2-->');
2687
  echo $content;
2688
  echo "</div>";
@@ -2696,14 +2799,18 @@ class s2class {
2696
  $options = $newoptions = get_option('widget_subscribe2widget');
2697
  if ($_POST["s2w-submit"]) {
2698
  $newoptions['title'] = strip_tags(stripslashes($_POST["s2w-title"]));
 
2699
  }
2700
  if ($options != $newoptions) {
2701
  $options = $newoptions;
2702
  update_option('widget_subscribe2widget', $options);
2703
  }
2704
  $title = htmlspecialchars($options['title'], ENT_QUOTES);
 
2705
  echo "<p><label for=\"s2w-title\">" . __('Title:');
2706
  echo "<input style=\"width: 250px;\" id=\"s2w-title\" name=\"s2w-title\" type=\"text\" value=\"" . $title . "\" /></label></p>";
 
 
2707
  echo "<input type=\"hidden\" id=\"s2w-submit\" name=\"s2w-submit\" value=\"1\" />";
2708
  } // end widget_subscribe2_widget_control()
2709
 
@@ -2762,24 +2869,24 @@ class s2class {
2762
  Register our button in the QuickTags bar
2763
  */
2764
  function button_init() {
2765
- if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') ) return;
2766
- if ( 'true' == get_user_option('rich_editing') ) {
2767
- global $wp_db_version;
2768
- if ($wp_db_version >= 7098) {
2769
- //check if we are using WordPress 2.5+
2770
- add_filter('mce_external_plugins', array(&$this, 'mce3_plugin'));
2771
- add_filter('mce_buttons', array(&$this, 'mce3_button'));
2772
- } else {
2773
- // Load and append our TinyMCE external plugin
2774
- add_filter('mce_plugins', array(&$this, 'mce2_plugin'));
2775
- add_filter('mce_buttons', array(&$this, 'mce2_button'));
2776
- add_filter('tinymce_before_init', array(&$this, 'tinymce2_before_init'));
2777
- }
2778
  } else {
2779
- //use buttonsnap to add button is not using RTE
2780
- buttonsnap_separator();
2781
- buttonsnap_jsbutton(WP_CONTENT_URL . '/plugins/subscribe2/include/s2_button.png', __('Subscribe2', 'subscribe2'), 's2_insert_token();');
 
2782
  }
 
 
 
 
2783
  } // end button_init()
2784
 
2785
  /**
@@ -2813,7 +2920,7 @@ class s2class {
2813
  echo "tinyMCE.loadPlugin('subscribe2quicktags', '" . $this->fullpath . "');\n";
2814
  }
2815
 
2816
- function s2_edit_form() {
2817
  echo "<!-- Start Subscribe2 Quicktags Javascript -->\r\n";
2818
  echo "<script type=\"text/javascript\">\r\n";
2819
  echo "//<![CDATA[\r\n";
@@ -2896,7 +3003,7 @@ class s2class {
2896
  if ($check) {
2897
  continue;
2898
  }
2899
- $table .= $post->post_title . "\r\n";
2900
  $message_posttime .= $post->post_title . "\r\n";
2901
  $message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
2902
  $message_posttime .= get_permalink($post->ID) . "\r\n";
@@ -2936,7 +3043,7 @@ class s2class {
2936
  }
2937
 
2938
  // get admin details
2939
- $user = $this->get_userdata();
2940
  $this->myemail = $user->user_email;
2941
  $this->myname = html_entity_decode($user->display_name);
2942
 
@@ -2948,7 +3055,7 @@ class s2class {
2948
  $all_post_cats_string = implode(',', $all_post_cats);
2949
  $registered = $this->get_registered("cats=$all_post_cats_string");
2950
  $recipients = array_merge((array)$public, (array)$registered);
2951
- $mailtext = apply_filter('s2_email_template', $this->subscribe2_options['mailtext']);
2952
  $mailtext = stripslashes($this->substitute($mailtext));
2953
  $mailtext = str_replace("TABLE", $table, $mailtext);
2954
  $mailtext = str_replace("POSTTIME", $message_posttime, $mailtext);
@@ -2975,10 +3082,17 @@ class s2class {
2975
  } // end s2init()
2976
 
2977
  function subscribe2() {
2978
- global $table_prefix;
2979
 
2980
  load_plugin_textdomain('subscribe2', 'wp-content/plugins/' . dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
2981
 
 
 
 
 
 
 
 
2982
  // do we need to install anything?
2983
  $this->public = $table_prefix . "subscribe2";
2984
  if (!mysql_query("DESCRIBE " . $this->public)) { $this->install(); }
@@ -3011,11 +3125,12 @@ class s2class {
3011
  add_action('admin_menu', array(&$this, 's2_meta_init'));
3012
  add_action('save_post', array(&$this, 's2_meta_handler'));
3013
  add_action('create_category', array(&$this, 'autosub_new_category'));
 
3014
  add_filter('the_content', array(&$this, 'filter'), 10);
3015
  add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
3016
 
3017
  // add actions for other plugins
3018
- if ('1' == $this->subscribe2_options['show_meta']) {
3019
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
3020
  }
3021
  add_filter('ozh_adminmenu_icon', array(&$this, 'ozh_s2_icon'));
@@ -3031,7 +3146,9 @@ class s2class {
3031
  add_action('user_register', array(&$this, 'register'));
3032
  add_action('add_user_to_blog', array(&$this, 'register'), 10, 1);
3033
 
3034
- add_action('admin_init', array(&$this, 'wpmu_subscribe'));
 
 
3035
 
3036
  // add actions for processing posts based on per-post or cron email settings
3037
  if ($this->subscribe2_options['email_freq'] != 'never') {
@@ -3064,7 +3181,6 @@ class s2class {
3064
  var $permalink = '';
3065
  var $myname = '';
3066
  var $myemail = '';
3067
- var $s2_subject = '[BLOGNAME] TITLE';
3068
  var $signup_dates = array();
3069
  var $private = false;
3070
  var $filtered = 0;
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.16
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  */
31
 
32
  // our version number. Don't touch this or any line below
33
  // unless you know exacly what you are doing
34
+ define('S2VERSION', '4.16');
35
  define('S2PATH', trailingslashit(dirname(__FILE__)));
36
 
37
  // Pre-2.6 compatibility
42
  define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
43
  }
44
 
45
+ /* Include buttonsnap library by Owen Winckler */
46
+ if (!class_exists('buttonsnap')) {
47
  require(WP_CONTENT_DIR . '/plugins/subscribe2/include/buttonsnap.php');
48
  }
49
 
91
 
92
  $this->deleted = "<p>" . __('You have successfully unsubscribed.', 'subscribe2') . "</p>";
93
 
 
 
 
 
94
  $this->subscribe = __('subscribe', 'subscribe2'); //ACTION replacement in subscribing confirmation email
95
 
96
  $this->unsubscribe = __('unsubscribe', 'subscribe2'); //ACTION replacement in unsubscribing in confirmation email
174
  Upgrade the database
175
  */
176
  function upgrade() {
177
+ global $wpdb, $wp_version, $wpmu_version;
 
178
  // include upgrade-functions for maybe_create_table;
179
  if (!function_exists('maybe_create_table')) {
180
  require_once(ABSPATH . 'wp-admin/install-helper.php');
184
 
185
  // let's take the time to check process registered users
186
  // existing public subscribers are subscribed to all categories
187
+ $users = $this->get_all_registered('ID');
188
  if (!empty($users)) {
189
  foreach ($users as $user) {
190
  $this->register($user);
207
  update_option('subscribe2_options', $this->subscribe2_options);
208
 
209
  // upgrade old wpmu user meta data to new
210
+ if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
 
211
  $this->namechange_subscribe2_widget();
212
  // loop through all users
 
213
  foreach ($users as $user) {
214
  // get categories which the user is subscribed to (old ones)
215
  $categories = get_usermeta($user, 's2_subscribed');
231
  update_usermeta($user, $this->get_usermeta_keyname('s2_cat') . $subscribed_category, $subscribed_category);
232
  }
233
  update_usermeta($user, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $subscribed_categories));
 
 
 
 
 
234
  }
235
  restore_current_blog();
236
  }
237
 
238
  // delete old user meta keys
239
  delete_usermeta($user, 's2_subscribed');
240
+ foreach ($categories as $cat) {
241
  delete_usermeta($user, 's2_cat' . $cat);
242
  }
243
  }
267
  $string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
268
  $string = str_replace("TITLE", stripslashes($this->post_title), $string);
269
  $string = str_replace("PERMALINK", $this->permalink, $string);
270
+ if (strstr($string, "TINYLINK")) {
271
  $tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->permalink));
272
  if ( ($tinylink !== 'Error') || ($tinylink != FALSE) ) {
273
  $string = str_replace("TINYLINK", $tinylink, $string);
284
  /**
285
  Delivers email to recipients in HTML or plaintext
286
  */
287
+ function mail($recipients = array(), $subject = '', $message = '', $type='text') {
288
  if ( (empty($recipients)) || ('' == $message) ) { return; }
289
 
290
  // Set sender details
291
  if ('' == $this->myname) {
292
+ $admin = $this->get_userdata($this->subscribe2_options['sender']);
293
  $this->myname = html_entity_decode($admin->display_name);
294
  $this->myemail = $admin->user_email;
295
  }
304
  $headers .= "MIME-Version: 1.0\n";
305
  $headers .= "Content-Type: " . get_bloginfo('html_type') . "; charset=\"". get_bloginfo('charset') . "\"\n";
306
  if ('yes' == $this->subscribe2_options['stylesheet']) {
307
+ $mailtext = apply_filters('s2_html_email', "<html><head><title>" . $subject . "</title><link rel=\"stylesheet\" href=\"" . get_bloginfo('stylesheet_url') . "\" type=\"text/css\" media=\"screen\" /></head><body>" . $message . "</body></html>");
308
  } else {
309
+ $mailtext = apply_filters('s2_html_email', "<html><head><title>" . $subject . "</title></head><body>" . $message . "</body></html>");
310
  }
311
  } else {
312
  $headers .= "MIME-Version: 1.0\n";
313
  $headers .= "Content-Type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
314
  $message = preg_replace('|&[^a][^m][^p].{0,3};|', '', $message);
315
  $message = preg_replace('|&amp;|', '&', $message);
316
+ $message = wordwrap(strip_tags($message), 80, "\n");
317
+ $mailtext = apply_filters('s2_plain_email', $message);
318
  }
319
 
320
  // Replace any escaped html symbols in subject
321
  $subject = html_entity_decode($subject);
322
 
323
+ // Construct BCC headers for sending or send individual emails
324
  $bcc = '';
325
  natcasesort($recipients);
326
  if ($this->subscribe2_options['bcclimit'] == 1) {
351
  $count = 1;
352
  $batch = array();
353
  foreach ($recipients as $recipient) {
 
 
 
354
  $recipient = trim($recipient);
355
  // sanity check -- make sure we have a valid email
356
  if (!is_email($recipient)) { continue; }
357
  // and NOT the sender's email, since they'll get a copy anyway
358
+ if ( (!empty($recipient)) && ($this->myemail != $recipient) ) {
359
  ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ", $recipient";
360
  // Bcc Headers now constructed by phpmailer class
361
  }
362
  if ($this->subscribe2_options['bcclimit'] == $count) {
363
+ $count = 0;
364
  $batch[] = $bcc;
365
  $bcc = '';
 
 
 
 
 
 
 
 
 
366
  }
367
+ $count++;
368
+ }
369
+ // add any partially completed batches to our batch array
370
+ if ('' != $bcc) {
371
+ $batch[] = $bcc;
372
  }
373
  }
374
  // rewind the array, just to be safe
425
  $check = true;
426
  }
427
  }
428
+
429
  if ($check) {
430
  // hang on -- can registered users subscribe to
431
  // excluded categories?
436
  }
437
 
438
  // Are we sending notifications for Private posts?
439
+ // Action is added if we are, but double check option and post status
440
+ if ( ($this->subscribe2_options['private'] == "yes") && ($post->post_status == 'private') ) {
441
  // don't send notification to public users
442
  $check = true;
443
  }
444
 
445
+ // lets collect our subscribers
 
446
  if (!$check) {
447
  // if this post is assigned to an excluded
448
+ // category, or is a private post then
449
+ // don't send public subscribers a notification
450
  $public = $this->get_public();
451
  }
452
  $registered = $this->get_registered("cats=$post_cats_string");
467
  // do we send as admin, or post author?
468
  if ('author' == $this->subscribe2_options['sender']) {
469
  // get author details
470
+ $user = &$author;
471
  } else {
472
  // get admin details
473
+ $user = $this->get_userdata($this->subscribe2_options['sender']);
474
  }
475
  $this->myemail = $user->user_email;
476
  $this->myname = html_entity_decode($user->display_name);
477
  // Get email subject
478
+ $subject = stripslashes(strip_tags($this->substitute($this->subscribe2_options['notification_subject'])));
479
  // Get the message template
480
+ $mailtext = apply_filters('s2_email_template', $this->subscribe2_options['mailtext']);
481
  $mailtext = stripslashes($this->substitute($mailtext));
482
 
483
  $plaintext = $post->post_content;
569
  $link .= md5($this->email);
570
  $link .= $id;
571
 
572
+ $admin = $this->get_userdata($this->subscribe2_options['sender']);
573
  $this->myname = html_entity_decode($admin->display_name);
574
 
575
  if ($is_remind == TRUE) {
576
  $body = $this->substitute(stripslashes($this->subscribe2_options['remind_email']));
577
+ $subject = $this->substitute(stripslashes($this->subscribe2_options['remind_subject']));
578
  } else {
579
  $body = $this->substitute(stripslashes($this->subscribe2_options['confirm_email']));
580
  if ('add' == $what) {
582
  } elseif ('del' == $what) {
583
  $body = str_replace("ACTION", $this->unsubscribe, $body);
584
  }
585
+ $subject = $this->substitute(stripslashes($this->subscribe2_options['confirm_subject']));
586
  }
587
 
588
  $body = str_replace("LINK", $link, $body);
602
  /**
603
  Given a public subscriber ID, returns the email address
604
  */
605
+ function get_email($id = 0) {
606
  global $wpdb;
607
 
608
  if (!$id) {
614
  /**
615
  Given a public subscriber email, returns the subscriber ID
616
  */
617
+ function get_id($email = '') {
618
  global $wpdb;
619
 
620
  if (!$email) {
627
  Activate an public subscriber email address
628
  If the address is not already present, it will be added
629
  */
630
+ function activate($email = '') {
631
  global $wpdb;
632
 
633
  if ('' == $email) {
650
  /**
651
  Add an public subscriber to the subscriber table as unconfirmed
652
  */
653
+ function add($email = '') {
654
  if ($this->filtered ==1) { return; }
655
  global $wpdb;
656
 
730
  list($user, $domain) = split('@', $email);
731
  $bar_check = stristr($barred_option, $domain);
732
 
733
+ if (!empty($bar_check)) {
734
  return true;
735
  } else {
736
  return false;
830
  /**
831
  Return an array of all the public subscribers
832
  */
833
+ function get_public($confirmed = 1) {
834
  global $wpdb;
835
  if (1 == $confirmed) {
836
  if ('' == $this->all_public) {
846
  } // end get_public()
847
 
848
  /**
849
+ Return an array of all subscribers
 
850
  */
851
+ function get_all_registered($id = '') {
852
+ global $wpdb;
853
 
854
+ if ($this->s2_mu) {
855
+ if ($id) {
856
+ return $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
857
+ } else {
858
+ $result = $wpdb->get_col("SELECT user_id FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
859
+ $ids = implode(',', $result);
860
+ return $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids) AND user_activation_key=''");
861
+ }
862
+ } else {
863
+ if ($id) {
864
+ return $wpdb->get_col("SELECT ID FROM $wpdb->users");
865
+ } else {
866
+ return $wpdb->get_col("SELECT user_email FROM $wpdb->users");
867
+ }
868
  }
869
+ }
870
+
871
+ /**
872
+ Return an array of registered subscribers
873
+ Collect all the registered users of the blog who are subscribed to the specified categories
874
+ */
875
+ function get_registered($args = '') {
876
+ global $wpdb;
877
 
878
  $format = '';
879
  $amount = '';
881
  $subscribers = array();
882
 
883
  parse_str($args, $r);
 
 
884
  if (!isset($r['format']))
885
  $r['format'] = 'all';
886
  if (!isset($r['amount']))
887
  $r['amount'] = 'all';
888
+ if (!isset($r['cats']))
889
+ $r['cats'] = '';
890
 
891
  $JOIN = ''; $AND = '';
892
  // text or HTML subscribers
915
  if ('' != $r['cats']) {
916
  $JOIN .= "INNER JOIN $wpdb->usermeta AS d ON a.user_id = d.user_id ";
917
  foreach (explode(',', $r['cats']) as $cat) {
918
+ ('' == $and) ? $and = "d.meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$cat'" : $and .= " OR d.meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$cat'";
919
  }
920
  $AND .= " AND ($and)";
921
  }
922
 
923
+ if ($this->s2_mu) {
924
+ $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='" . $wpdb->prefix . "capabilities'" . $AND;
925
  } else {
926
+ $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . "WHERE a.meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'" . $AND;
927
  }
928
  $result = $wpdb->get_col($sql);
929
  if ($result) {
954
  Create the appropriate usermeta values when a user registers
955
  If the registering user had previously subscribed to notifications, this function will delete them from the public subscriber list first
956
  */
957
+ function register($user_id = 0) {
958
  global $wpdb;
959
 
960
  if (0 == $user_id) { return $user_id; }
961
  $user = get_userdata($user_id);
962
  $all_cats = get_categories(array('hide_empty' => false));
963
 
964
+ // Are registered users are allowed to subscribe to excluded categories?
965
+ if ( (0 == $this->subscribe2_options['reg_override']) || ('no' == $this->subscribe2_options['newreg_override']) ) {
 
966
  $exclude = explode(',', $this->subscribe2_options['exclude']);
967
  foreach ($all_cats as $cat => $term_id) {
968
  if (in_array($all_cats[$cat]->term_id, $exclude)) {
986
  // delete this user from the public table, and subscribe them to all the categories
987
  $this->delete($user->user_email);
988
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), $cats);
989
+ foreach (explode(',', $cats) as $cat) {
990
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
991
  }
992
  update_usermeta($user_id, 's2_format', 'text');
996
  // create post format entries for all users
997
  $check_format = get_usermeta($user_id, 's2_format');
998
  if (empty($check_format)) {
999
+ // ensure existing subscription options are not overwritten on upgrade
1000
  if ('html' == $this->subscribe2_options['autoformat']) {
1001
  update_usermeta($user_id, 's2_format', 'html');
1002
  update_usermeta($user_id, 's2_excerpt', 'post');
1008
  update_usermeta($user_id, 's2_excerpt', 'excerpt');
1009
  }
1010
  update_usermeta($user_id, 's2_autosub', $this->subscribe2_options['autosub_def']);
1011
+ // if the are no existing subscriptions, create them if, by default if autosub is on
 
 
 
 
 
1012
  if ( ('yes' == $this->subscribe2_options['autosub']) || (('wpreg' == $this->subscribe2_options['autosub']) && ('on' == $_POST['subscribe'])) ) {
1013
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), $cats);
1014
+ foreach (explode(',', $cats) as $cat) {
1015
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $cat, "$cat");
1016
  }
 
 
1017
  }
1018
+ }
1019
+ $subscribed = get_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1020
+ if (strstr($subscribed, '-1')) {
1021
+ // make sure we remove '-1' from any settings
1022
+ $old_cats = explode(',', $subscribed);
1023
+ $pos = array_search('-1', $old_cats);
1024
+ unset($old_cats[$pos]);
1025
+ $cats = implode(',', $old_cats);
1026
+ update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), $cats);
1027
  }
1028
  }
1029
  return $user_id;
1032
  /**
1033
  Subscribe all registered users to category selected on Admin Manage Page
1034
  */
1035
+ function subscribe_registered_users($emails = '', $cats = '') {
1036
  if ( ('' == $emails) || ('' == $cats) ) { return false; }
1037
  global $wpdb;
1038
 
1047
 
1048
  foreach ($user_IDs as $user_ID) {
1049
  $old_cats = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
1050
+ $old_cats = explode(',', $old_cats);
 
 
 
 
1051
  if (!is_array($old_cats)) {
1052
  $old_cats = array($old_cats);
1053
  }
1066
  /**
1067
  Unsubscribe all registered users to category selected on Admin Manage Page
1068
  */
1069
+ function unsubscribe_registered_users($emails = '', $cats = '') {
1070
  if ( ('' == $emails) || ('' == $cats) ) { return false; }
1071
  global $wpdb;
1072
 
1096
  foreach ($cats as $id) {
1097
  delete_usermeta($user_ID, $this->get_usermeta_keyname('s2_cat') . $id);
1098
  }
1099
+ update_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
1100
  }
1101
  }
1102
  } // end unsubscribe_registered_users()
1142
  update_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $term_id, $term_id);
1143
  }
1144
  if (empty($cats)) {
1145
+ update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), '');
1146
+ } else {
1147
+ update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $cats));
1148
  }
 
1149
 
1150
  // don't restore_current_blog(); -> redirect to new subscription page
1151
  $redirect_to_subscriptionpage = true;
1160
 
1161
  // delete subscription to all categories on that blog
1162
  $cats = get_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1163
+ $cats = explode(',', $cats);
1164
+ if (!is_array($cats)) {
1165
+ $cats = array($cats);
 
 
1166
  }
1167
+
1168
  foreach ($cats as $id) {
1169
  delete_usermeta($user_id, $this->get_usermeta_keyname('s2_cat') . $id);
1170
  }
1171
+ update_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'), '');
1172
 
1173
  // remove level_0 users
1174
  if (!current_user_can(1)) {
1183
  delete_usermeta($user_id, $this->get_usermeta_keyname('s2_subscribed'));
1184
  }
1185
  }
1186
+ restore_current_blog();
1187
  $redirect_to_subscriptionpage = true;
1188
  }
1189
  }
1213
  Autosubscribe registered users to newly created categories
1214
  if registered user has selected this option
1215
  */
1216
+ function autosub_new_category($new_category='') {
1217
  global $wpdb;
1218
 
1219
  $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key='s2_autosub' AND $wpdb->usermeta.meta_value='yes'";
1232
  }
1233
  } // end autosub_new_category()
1234
 
1235
+ function delete_category($deleted_category='') {
1236
+ global $wpdb;
1237
+
1238
+ $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . "$deleted_category'";
1239
+ $user_IDs = $wpdb->get_col($sql);
1240
+ if ('' == $user_IDs) { return; }
1241
+
1242
+ foreach ($user_IDs as $user_ID) {
1243
+ $old_cats = explode(',', get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed')));
1244
+ if (!is_array($old_cats)) {
1245
+ $old_cats = array($old_cats);
1246
+ }
1247
+ // add subscription to these cat IDs
1248
+ update_usermeta($user_ID, $this->get_usermeta_keyname('s2_cat') . $deleted_category, '');
1249
+ $remain = array_diff($old_cats, (array)$deleted_category);
1250
+ update_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), implode(',', $remain));
1251
+ }
1252
+
1253
+ }
1254
+
1255
  /**
1256
  Get admin data from record 1 or first user with admin rights
1257
  */
1258
+ function get_userdata($admin_id) {
1259
  global $wpdb, $userdata;
1260
 
1261
+ // ensure compatability with Subscribe2 < 4.16
1262
+ if ($admin_id == 'admin') {
1263
+ $admin_id = 1;
1264
+ }
1265
 
1266
+ if (is_numeric($admin_id)) {
1267
+ $admin = get_userdata($admin_id);
1268
+ } else {
1269
+ $admin = &$userdata;
1270
  }
1271
 
1272
+ // if user record is empty grab the first admin from the database
1273
  if (empty($admin)) {
1274
  $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";
1275
  $admin = get_userdata($wpdb->get_var($sql));
1276
  }
1277
+
1278
  return $admin;
1279
  } //end get_userdata()
1280
 
1287
 
1288
  //Get Registered Subscribers for bulk management
1289
  $registered = $this->get_registered();
1290
+ $all_users = $this->get_all_registered();
1291
+ if (!empty($all_users)) {
1292
+ $emails = implode(",", $all_users);
1293
  }
1294
 
1295
  // was anything POSTed ?
1312
  foreach ($_POST['delete'] as $address) {
1313
  $this->delete($address);
1314
  }
1315
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Address(es) deleted!', 'subscribe2') . "</strong></p></div>";
1316
  }
1317
  if ($_POST['confirm']) {
1318
  foreach ($_POST['confirm'] as $address) {
1319
  $this->toggle($address);
1320
  }
1321
+ $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
1322
  }
1323
  if ($_POST['unconfirm']) {
1324
  foreach ($_POST['unconfirm'] as $address) {
1325
  $this->toggle($address);
1326
  }
1327
+ $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
1328
  }
1329
  echo $message;
1330
  } elseif ($_POST['searchterm']) {
1331
  $confirmed = $this->get_public();
1332
  $unconfirmed = $this->get_public(0);
1333
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
1334
  foreach ($subscribers as $subscriber) {
1335
  if (is_numeric(stripos($subscriber, $_POST['searchterm']))) {
1336
  $result[] = $subscriber;
1338
  }
1339
  } elseif ($_POST['remind']) {
1340
  $this->remind($_POST['reminderemails']);
1341
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Reminder Email(s) Sent!', 'subscribe2') . "</strong></p></div>";
1342
  } elseif ( ($_POST['register']) && ('subscribe' == $_POST['manage']) ) {
1343
  $this->subscribe_registered_users($_POST['emails'], $_POST['category']);
1344
  echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Registered Users Subscribed!', 'subscribe2') . "</strong></p></div>";
1355
  if ('' == $confirmed) { $confirmed = array(); }
1356
  if ('' == $unconfirmed) { $unconfirmed = array(); }
1357
  if ('' == $registered) { $registered = array(); }
1358
+ if ('' == $all_users) { $all_users = array(); }
1359
 
1360
  $reminderform = false;
1361
  $urlpath = str_replace("\\", "/", S2PATH);
1370
  $page = 1;
1371
  if ('all' == $_POST['what']) {
1372
  $what = 'all';
1373
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
1374
  } elseif ('public' == $_POST['what']) {
1375
  $what = 'public';
1376
  $subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
1390
  } elseif ('registered' == $_POST['what']) {
1391
  $what = 'registered';
1392
  $subscribers = $registered;
1393
+ } elseif ('all_users' == $_POST['what']) {
1394
+ $what = 'all_users';
1395
+ $subscribers = $all_users;
1396
  }
1397
  } elseif (isset($_GET['what'])) {
1398
  if ('all' == $_GET['what']) {
1399
  $what = 'all';
1400
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
1401
  } elseif ('public' == $_GET['what']) {
1402
  $what = 'public';
1403
  $subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
1406
  $subscribers = $confirmed;
1407
  } elseif ('unconfirmed' == $_GET['what']) {
1408
  $what = 'unconfirmed';
1409
+ $subscribers = $unconfirmed;
1410
  if (!empty($subscribers)) {
1411
  $reminderemails = implode(",", $subscribers);
1412
  $reminderform = true;
1417
  } elseif ('registered' == $_GET['what']) {
1418
  $what = 'registered';
1419
  $subscribers = $registered;
1420
+ } elseif ('all_users' == $_GET['what']) {
1421
+ $what = 'all_users';
1422
+ $subscribers = $all_users;
1423
  }
1424
  } else {
1425
  $what = 'all';
1426
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
1427
  }
1428
  if ($_POST['searchterm']) {
1429
  $subscribers = &$result;
1439
  $strip = '';
1440
  if ( $page > 1 ) {
1441
  $args['s2page'] = $page - 1;
1442
+ $strip .= '<a class="prev" href="' . clean_url(add_query_arg($args)) . '">&laquo; '. __('Previous Page', 'subscribe2') .'</a>' . "\n";
1443
  }
1444
  if ( $total_pages > 1 ) {
1445
  for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) {
1446
  if ( $page == $page_num ) {
1447
+ $strip .= "<strong>" . $page_num . "</strong>\n";
1448
  } else {
1449
  if ( $page_num < 3 || ( $page_num >= $page - 2 && $page_num <= $page + 2 ) || $page_num > $total_pages - 2 ) {
1450
  $args['s2page'] = $page_num;
1459
  }
1460
  if ( ( $page ) * $this->subscribe2_options['entries'] < $total_subscribers ) {
1461
  $args['s2page'] = $page + 1;
1462
+ $strip .= "<a class=\"next\" href=\"" . clean_url(add_query_arg($args)) . "\">". __('Next Page', 'subscribe2') . " &raquo;</a>\n";
1463
  }
1464
  }
1465
 
1526
  if (in_array($subscriber, $confirmed)) {
1527
  echo "</td><td align=\"center\">\r\n";
1528
  echo "<input class=\"unconfirm_checkall\" title=\"" . __('Unconfirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"unconfirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
1529
+ echo "<td align=\"center\"><span class=\"delete\">\r\n";
1530
+ echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
1531
  echo "</span></td>\r\n";
1532
  echo "<td><span style=\"color:#006600\">&#x221A;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1533
  echo "(<span style=\"color:#006600\">" . $this->signup_date($subscriber) . "</span>)\r\n";
1534
  } elseif (in_array($subscriber, $unconfirmed)) {
1535
  echo "<input class=\"confirm_checkall\" title=\"" . __('Confirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"confirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
1536
  echo "<td align=\"center\"></td>\r\n";
1537
+ echo "<td align=\"center\"><span class=\"delete\">\r\n";
1538
+ echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
1539
  echo "</span></td>\r\n";
1540
  echo "<td><span style=\"color:#FF0000\">&nbsp;!&nbsp;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1541
  echo "(<span style=\"color:#FF0000\">" . $this->signup_date($subscriber) . "</span>)\r\n";
1542
+ } elseif (in_array($subscriber, $all_users)) {
1543
  echo "</td><td align=\"center\"></td><td align=\"center\"></td>\r\n";
1544
  echo "<td><span style=\"color:#006600\">&reg;&nbsp;&nbsp;</span><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a>\r\n";
1545
  echo "(<a href=\"" . get_option('siteurl') . "/wp-admin/users.php?page=subscribe2/subscribe2.php&amp;email=$subscriber\">" . __('edit', 'subscribe2') . "</a>)\r\n";
1601
 
1602
  // send as author or admin?
1603
  $sender = 'author';
1604
+ if (is_numeric($_POST['sender'])) {
1605
+ $sender = $_POST['sender'];
1606
  }
1607
  $this->subscribe2_options['sender'] = $sender;
1608
 
1625
  unset($this->subscribe2_options['last_s2cron']);
1626
  } else {
1627
  // if we are using digest schedule the event and prime last_cron as now
1628
+ $time = current_time('timestamp') + $interval;
1629
  if ($interval < 86400) {
1630
  // Schedule CRON events occurring less than daily starting now and periodically thereafter
1631
  $timestamp = &$time;
1640
  }
1641
  }
1642
 
1643
+ // email subject and body templates
1644
+ // ensure that are not empty before updating
1645
+ if (!empty($_POST['notification_subject'])) {
1646
+ $this->subscribe2_options['notification_subject'] = $_POST['notification_subject'];
1647
+ }
1648
+ if (!empty($_POST['mailtext'])) {
1649
+ $this->subscribe2_options['mailtext'] = $_POST['mailtext'];
1650
+ }
1651
+ if (!empty($_POST['confirm_subject'])) {
1652
+ $this->subscribe2_options['confirm_subject'] = $_POST['confirm_subject'];
1653
+ }
1654
+ if (!empty($_POST['confirm_email'])) {
1655
+ $this->subscribe2_options['confirm_email'] = $_POST['confirm_email'];
1656
+ }
1657
+ if (!empty($_POST['remind_subject'])) {
1658
+ $this->subscribe2_options['remind_subject'] = $_POST['remind_subject'];
1659
+ }
1660
+ if (!empty($_POST['remind_email'])) {
1661
+ $this->subscribe2_options['remind_email'] = $_POST['remind_email'];
1662
+ }
1663
 
1664
  // excluded categories
1665
  if (!empty($_POST['category'])) {
1696
 
1697
  //automatic subscription
1698
  $this->subscribe2_options['autosub'] = $_POST['autosub'];
1699
+ $this->subscribe2_options['newreg_override'] = $_POST['newreg_override'];
1700
  $this->subscribe2_options['wpregdef'] = $_POST['wpregdef'];
1701
  $this->subscribe2_options['autoformat'] = $_POST['autoformat'];
1702
  $this->subscribe2_options['show_autosub'] = $_POST['show_autosub'];
1723
 
1724
  // settings for outgoing emails
1725
  echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
 
1726
  echo __('Restrict the number of recipients per email to (0 for unlimited)', 'subscribe2') . ': ';
1727
  echo "<span id=\"s2bcc_1\"><span id=\"s2bcc\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['bcclimit'] . "</span> ";
1728
  echo "<a href=\"#\" onclick=\"s2_show('bcc'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
1799
  }
1800
  echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
1801
  echo __('Send Email From', 'subscribe2') . ': ';
1802
+ echo "<label>\r\n";
1803
+ $this->admin_dropdown(1);
1804
+ echo "</label><br /><br />\r\n";
 
 
 
 
 
 
 
1805
  if (function_exists('wp_schedule_event')) {
1806
  echo __('Send Emails', 'subscribe2') . ": <br /><br />\r\n";
1807
  $this->display_digest_choices();
1808
  }
 
1809
 
1810
  // email templates
1811
  echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1812
  echo"<br />";
1813
  echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
1814
  echo "<tr><td>";
1815
+ echo __('New Post email (must not be empty)', 'subscribe2') . ":<br />\r\n";
1816
+ echo __('Subject Line', 'subscribe2') . ": ";
1817
+ echo "<input type=\"text\" name=\"notification_subject\" value=\"" . stripslashes($this->subscribe2_options['notification_subject']) . "\" size=\"30\" />";
1818
  echo "<br />\r\n";
1819
  echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
1820
  echo "</td><td valign=\"top\" rowspan=\"3\">";
1835
  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";
1836
  echo "</dl></td></tr><tr><td>";
1837
  echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
1838
+ echo __('Subject Line', 'subscribe2') . ": ";
1839
+ echo "<input type=\"text\" name=\"confirm_subject\" value=\"" . stripslashes($this->subscribe2_options['confirm_subject']) . "\" size=\"30\" /><br />\r\n";
1840
  echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea><br /><br />\r\n";
1841
  echo "</td></tr><tr valign=\"top\"><td>";
1842
  echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
1843
+ echo __('Subject Line', 'subscribe2') . ": ";
1844
+ echo "<input type=\"text\" name=\"remind_subject\" value=\"" . stripslashes($this->subscribe2_options['remind_subject']) . "\" size=\"30\" /><br />\r\n";
1845
  echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
1846
  echo "</td></tr></table><br />\r\n";
1847
 
1920
  echo " checked=\"checked\"";
1921
  }
1922
  echo " /> " . __('No', 'subscribe2') . "</label><br /><br />\r\n";
1923
+ echo __('Auto-subscribe includes any excluded categories', 'subscribe2') . ":<br />\r\n";
1924
+ echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"yes\"";
1925
+ if ('yes' == $this->subscribe2_options['newreg_override']) {
1926
+ echo " checked=\"checked\"";
1927
+ }
1928
+ echo " />" . __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
1929
+ echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"no\"";
1930
+ if ('no' == $this->subscribe2_options['newreg_override']) {
1931
+ echo " checked=\"checked\"";
1932
+ }
1933
+ echo " />" . __('No', 'subscribe2') . "</label><br /><br />\r\n";
1934
+ echo __('Registration Form option is checked by default', 'subscribe2') . ":<br />\r\n";
1935
  echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"";
1936
  if ('yes' == $this->subscribe2_options['wpregdef']) {
1937
  echo " checked=\"checked\"";
1958
  echo "checked=\"checked\" ";
1959
  }
1960
  echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />";
1961
+ echo __('Display option for Register Users to auto-subscribe to new categories', 'subscribe2') . ": <br />\r\n";
1962
  echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"yes\"";
1963
  if ('yes' == $this->subscribe2_options['show_autosub']) {
1964
  echo " checked=\"checked\"";
1969
  echo " checked=\"checked\"";
1970
  }
1971
  echo " />" . __('No', 'subscribe2') . "</label><br /><br />";
1972
+ echo __('Option for Register Users to auto-subscribe to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
1973
  echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"";
1974
  if ('yes' == $this->subscribe2_options['autosub_def']) {
1975
  echo " checked=\"checked\"";
2009
  Our profile menu
2010
  */
2011
  function user_menu() {
2012
+ global $user_ID, $s2nonce;
2013
 
2014
  if (isset($_GET['email'])) {
2015
  global $wpdb;
2018
  get_currentuserinfo();
2019
  }
2020
 
 
 
 
 
 
 
 
 
2021
  // was anything POSTed?
2022
  if ( (isset($_POST['s2_admin'])) && ('user' == $_POST['s2_admin']) ) {
2023
  check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
2044
  delete_usermeta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
2045
  }
2046
  }
2047
+ update_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
2048
  } elseif ($cats == 'digest') {
2049
  $all_cats = get_categories(array('hide_empty' => false));
2050
  foreach ($all_cats as $cat) {
2127
  }
2128
 
2129
  // subscribed categories
2130
+ if ($this->s2_mu) {
2131
  global $blog_id;
2132
  $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
2133
  // if we are subscribed to the current blog display an "unsubscribe" link
2134
+ if (!empty($subscribed)) {
2135
+ $unsubscribe_link = get_bloginfo('url') . "/wp-admin/?s2mu_unsubscribe=". $blog_id;
2136
  echo "<p><a href=\"". $unsubscribe_link ."\" class=\"button\">" . __('Unsubscribe me from this blog', 'subscribe2') . "</a></p>";
2137
  } else {
2138
  // else we show a "subscribe" link
2150
  echo __('Receive periodic summaries of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
2151
  echo "<p><label>";
2152
  echo "<input type=\"radio\" name=\"category\" value=\"digest\" ";
2153
+ if (get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'))) {
2154
  echo "checked=\"yes\" ";
2155
  }
2156
  echo "/> " . __('Yes', 'subscribe2') . "</label> <label><input type=\"radio\" name=\"category\" value=\"-1\" ";
2157
+ if (!get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'))) {
2158
  echo "checked=\"yes\" ";
2159
  }
2160
  echo "/> " . __('No', 'subscribe2');
2167
 
2168
 
2169
  // list of subscribed blogs on wordpress mu
2170
+ if ($this->s2_mu) {
2171
  global $blog_id;
2172
+ $blogs = get_blog_list(0, 'all');
2173
+
2174
  $blogs_subscribed = array();
2175
  $blogs_notsubscribed = array();
2176
 
2177
  foreach ($blogs as $key => $blog) {
 
 
 
2178
  // switch to blog
2179
  switch_to_blog($blog['blog_id']);
2180
 
2181
  // check that the plugin is active on the current blog
2182
  $current_plugins = get_option('active_plugins');
2183
+ if (!is_array($current_plugins)) {
2184
+ $current_plugins = (array)$current_plugins;
2185
+ }
2186
+ if (!in_array('subscribe2/subscribe2.php', $current_plugins)) {
2187
+ continue;
2188
+ }
2189
 
2190
  // check if we're subscribed to the blog
2191
  $subscribed = get_usermeta($user_ID, $this->get_usermeta_keyname('s2_subscribed'));
 
2192
 
2193
+ $blogname = get_bloginfo('name');
2194
+ if (strlen($blogname) > 30) {
2195
+ $blog['blogname'] = wp_html_excerpt($blogname, 30) . "..";
2196
+ } else {
2197
+ $blog['blogname'] = $blogname;
2198
+ }
2199
+ $blog['description'] = get_bloginfo('description');
2200
+ if (defined('AUTHOR_AVATARS_VERSION')) {
2201
+ if (!class_exists('UserList'))
2202
+ include_once(ABSPATH . 'wp-content/plugins/author-avatars/lib/UserList.class.php' );
2203
+ $userlist = new UserList();
2204
+ $userlist->roles = array('Administrator', 'Editor', 'Subscriber');
2205
+ $userlist->blogs = array($blog['blog_id']);
2206
+ $userlist->avatar_size = 30;
2207
+ $userlist->use_list_template();
2208
+ $blog['users'] = $userlist->get_output();
2209
+ }
2210
  $blog['blogurl'] = get_bloginfo('url');
2211
  $blog['subscribe_page'] = get_bloginfo('url') . "/wp-admin/users.php?page=subscribe2/subscribe2.php";
2212
 
2213
  $key = strtolower($blog['blogname'] . "-" . $blog['blog_id']);
2214
+ if (!empty($subscribed)) {
2215
  $blogs_subscribed[$key] = $blog;
2216
+ } else {
2217
  $blogs_notsubscribed[$key] = $blog;
2218
  }
 
2219
  restore_current_blog();
2220
  }
2221
 
2222
  if (!empty($blogs_subscribed)) {
2223
+ ksort($blogs_subscribed);
 
2224
  echo '<h2>' . __('Subscribed Blogs', 'subscribe2') . '</h2>'."\r\n";
2225
+ echo "<ul class=\"s2_blogs\">\r\n";
 
2226
  foreach ($blogs_subscribed as $blog) {
2227
+ echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\" title=\"" . $blog['description'] . "\">" . $blog['blogname'] . "</a></span>\r\n";
2228
+ if ($blog_id == $blog['blog_id']) {
2229
+ echo "<span class=\"buttons\">" . __('Viewing Settings Now', 'subscribe2') . "</span>\r\n";
2230
+ } else {
2231
+ echo "<span class=\"buttons\">";
2232
+ if (is_blog_user($blog['blog_id'])) {
2233
+ echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2234
+ }
2235
+ echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_unsubscribe=" . $blog['blog_id'] . "\">" . __('Unsubscribe', 'subscribe2') . "</a></span>\r\n";
2236
  }
2237
+ echo "<div class=\"additional_info\"><span class=\"description\">" . $blog['description'] . "</span>" . $blog['users'] . "</div>\r\n";
2238
  echo "</li>";
2239
  }
2240
+ echo "</ul>\r\n";
2241
  }
2242
+
2243
  if (!empty($blogs_notsubscribed)) {
2244
+ ksort($blogs_notsubscribed);
 
2245
  echo "<h2>" . __('Subscribe to new blogs', 'subscribe2') . "</h2>\r\n";
2246
+ echo "<ul class=\"s2_blogs\">";
2247
  foreach ($blogs_notsubscribed as $blog) {
2248
+ echo "<li><span class=\"name\"><a href=\"" . $blog['blogurl'] . "\" title=\"" . $blog['description'] . "\">" . $blog['blogname'] . "</a></span>\r\n";
2249
+ if ($blog_id == $blog['blog_id']) {
2250
+ echo "<span class=\"buttons\">" . __('Viewing Settings Now', 'subscribe2') . "</span>\r\n";
2251
+ } else {
2252
+ echo "<span class=\"buttons\">";
2253
+ if (is_blog_user($blog['blog_id'])) {
2254
+ echo "<a href=\"". $blog['subscribe_page'] . "\">" . __('View Settings', 'subscribe2') . "</a>\r\n";
2255
+ }
2256
+ echo "<a href=\"" . $blog['blogurl'] . "/wp-admin/?s2mu_subscribe=" . $blog['blog_id'] . "\">" . __('Subscribe', 'subscribe2') . "</a></span>\r\n";
2257
+ }
2258
+ echo "<div class=\"additional_info\"><span class=\"description\">" . $blog['description'] . "</span>" . $blog['users'] . "</div>\r\n";
2259
  echo "</li>";
2260
  }
2261
  echo "</ul>\r\n";
2289
  } elseif (is_numeric($_POST['what'])) {
2290
  $cat = intval($_POST['what']);
2291
  $recipients = $this->get_registered("cats=$cat");
2292
+ } elseif ('all_users' == $_POST['what']) {
2293
+ $recipients = $this->get_all_registered();
2294
  } else {
2295
  $recipients = $this->get_registered();
2296
  }
2399
  $selected is the option to select
2400
  $submit is the text to use on the Submit button
2401
  */
2402
+ function display_subscriber_dropdown($selected = 'registered', $submit = '', $exclude = array()) {
2403
+ global $wpdb;
 
 
 
 
 
2404
 
2405
+ $who = array('all' => __('All Users and Subscribers', 'subscribe2'),
2406
  'public' => __('Public Subscribers', 'subscribe2'),
2407
  'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
2408
  'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
2409
+ 'all_users' => __('All Registered Users', 'subscribe2'),
2410
+ 'registered' => __('Registered Subscribers', 'subscribe2'));
2411
 
2412
  $all_cats = get_categories(array('hide_empty' => false));
2413
 
2421
  } else {
2422
  $count['public'] = ($count['confirmed'] + $count['unconfirmed']);
2423
  }
2424
+ if ($this->s2_mu) {
2425
+ $count['all_users'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities'");
2426
  } else {
2427
+ $count['all_users'] = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->users");
2428
  }
2429
+ if ($this->s2_mu) {
2430
+ $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $wpdb->prefix . "capabilities' AND meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'");
2431
+ } else {
2432
+ $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_subscribed') . "'");
2433
+ }
2434
+ $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['all_users']);
2435
+ if ($this->s2_mu) {
2436
  foreach ($all_cats as $cat) {
2437
+ $count[$cat->name] = $wpdb->get_var("SELECT COUNT(a.meta_key) FROM $wpdb->usermeta AS a INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id WHERE a.meta_key='" . $wpdb->prefix . "capabilities' AND b.meta_key='" . $this->get_usermeta_keyname('s2_cat') . $cat->term_id . "'");
2438
  }
2439
  } else {
2440
  foreach ($all_cats as $cat) {
2441
+ $count[$cat->name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='" . $this->get_usermeta_keyname('s2_cat') . $cat->term_id . "'");
2442
  }
2443
  }
2444
 
2445
  // do have actually have some subscribers?
2446
+ if ( (0 == $count['confirmed']) && (0 == $count['unconfirmed']) && (0 == $count['all_users']) ) {
2447
  // no? bail out
2448
  return;
2449
  }
2472
  }
2473
  } // end display_subscriber_dropdown()
2474
 
2475
+ /**
2476
+ Display a drop down lisy of administrator level users and
2477
+ optionally include a choice for Post Author
2478
+ */
2479
+ function admin_dropdown($inc_author) {
2480
+ global $wpdb;
2481
+
2482
+ $sql = "SELECT ID,display_name 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'";
2483
+ $admins = $wpdb->get_results($sql);
2484
+
2485
+
2486
+ if ($inc_author) {
2487
+ $author[] = (object)array('ID' => 'author', 'display_name' => 'Post Author');
2488
+ $admins = array_merge($author, $admins);
2489
+ }
2490
+
2491
+ echo "<select name=\"sender\">\r\n";
2492
+ foreach ($admins as $admin) {
2493
+ echo "<option value=\"" . $admin->ID . "\"";
2494
+ if ($admin->ID == $this->subscribe2_options['sender']) {
2495
+ echo " selected=\"selected\"";
2496
+ }
2497
+ echo ">" . $admin->display_name . "</option>\r\n";
2498
+ }
2499
+ echo "</select>\r\n";
2500
+ } // end admin_dropdown()
2501
+
2502
  function display_digest_choices() {
2503
  global $wpdb;
2504
  $scheduled_time = wp_next_scheduled('s2_digest_cron');
2505
  $schedule = (array)wp_get_schedules();
2506
  $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('For each Post', 'subscribe2'))), $schedule);
2507
  $sort = array();
2508
+ foreach ((array)$schedule as $key => $value) $sort[$key] = $value['interval'];
2509
  asort($sort);
2510
  $schedule_sorted = array();
2511
  foreach ($sort as $key => $value) {
2551
  global $wpdb, $wp_version, $wpmu_version;
2552
 
2553
  // Is this WordPressMU or not?
2554
+ if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
2555
  switch($metaname) {
2556
  case 's2_subscribed':
2557
  case 's2_cat':
2623
  */
2624
  function s2_meta_box() {
2625
  global $post_ID;
2626
+ $s2mail = get_post_meta($post_ID, 's2mail', true);
2627
  echo "<input type=\"hidden\" name=\"s2meta_nonce\" id=\"s2meta_nonce\" value=\"" . wp_create_nonce(md5(plugin_basename(__FILE__))) . "\" />";
2628
  echo __("Check here to disable sending of an email notification for this post/page", 'subscribe2');
2629
  echo "&nbsp;&nbsp;<input type=\"checkbox\" name=\"s2_meta_field\" value=\"no\"";
2639
  function s2_meta_box_old() {
2640
  echo "<div class=\"dbx-b-ox-wrapper\">\r\n";
2641
  echo "<fieldset id=\"s2_meta_box\" class=\"dbx-box\">\r\n";
2642
+ echo "<div class=\"dbx-h-andle-wrapper\"><h3 class=\"dbx-handle\">" . __('Subscribe2 Notification Override', 'subscribe2') . "</h3></div>\r\n";
2643
  echo "<div class=\"dbx-c-ontent-wrapper\"><div class=\"dbx-content\">\r\n";
2644
  $this->s2_meta_box();
2645
  echo "</div></div></fieldset></div>\r\n";
2782
  extract($args);
2783
  $options = get_option('widget_subscribe2widget');
2784
  $title = empty($options['title']) ? __('Subscribe2', 'subscribe2') : $options['title'];
2785
+ $div = empty($options['div']) ? 'search' : $options['div'];
2786
  echo $before_widget;
2787
  echo $before_title . $title . $after_title;
2788
+ echo "<div class=\"" . $div . "\">";
2789
  $content = s2class::filter('<!--subscribe2-->');
2790
  echo $content;
2791
  echo "</div>";
2799
  $options = $newoptions = get_option('widget_subscribe2widget');
2800
  if ($_POST["s2w-submit"]) {
2801
  $newoptions['title'] = strip_tags(stripslashes($_POST["s2w-title"]));
2802
+ $newoptions['div'] = sanitize_title(strip_tags(stripslashes($_POST["s2w-div"])));
2803
  }
2804
  if ($options != $newoptions) {
2805
  $options = $newoptions;
2806
  update_option('widget_subscribe2widget', $options);
2807
  }
2808
  $title = htmlspecialchars($options['title'], ENT_QUOTES);
2809
+ $div = $options['div'];
2810
  echo "<p><label for=\"s2w-title\">" . __('Title:');
2811
  echo "<input style=\"width: 250px;\" id=\"s2w-title\" name=\"s2w-title\" type=\"text\" value=\"" . $title . "\" /></label></p>";
2812
+ echo "<p><label for=\"s2w-div\">" . __('Div class name:');
2813
+ echo "<input style=\"width: 250px;\" id=\"s2w-title\" name=\"s2w-div\" type=\"text\" value=\"" . $div . "\" /></label></p>";
2814
  echo "<input type=\"hidden\" id=\"s2w-submit\" name=\"s2w-submit\" value=\"1\" />";
2815
  } // end widget_subscribe2_widget_control()
2816
 
2869
  Register our button in the QuickTags bar
2870
  */
2871
  function button_init() {
2872
+ if (!current_user_can('edit_posts') && !current_user_can('edit_pages')) { return; }
2873
+ if ('true' == get_user_option('rich_editing') ) {
2874
+ global $wp_db_version;
2875
+ //check if we are using WordPress 2.5+
2876
+ if ($wp_db_version >= 7098) {
2877
+ // Use WordPress 2.5+ hooks
2878
+ add_filter('mce_external_plugins', array(&$this, 'mce3_plugin'));
2879
+ add_filter('mce_buttons', array(&$this, 'mce3_button'));
 
 
 
 
 
2880
  } else {
2881
+ // Load and append our TinyMCE external plugin
2882
+ add_filter('mce_plugins', array(&$this, 'mce2_plugin'));
2883
+ add_filter('mce_buttons', array(&$this, 'mce2_button'));
2884
+ add_filter('tinymce_before_init', array(&$this, 'tinymce2_before_init'));
2885
  }
2886
+ } else {
2887
+ buttonsnap_separator();
2888
+ buttonsnap_jsbutton(WP_CONTENT_URL . '/plugins/subscribe2/include/s2_button.png', __('Subscribe2', 'subscribe2'), 's2_insert_token();');
2889
+ }
2890
  } // end button_init()
2891
 
2892
  /**
2920
  echo "tinyMCE.loadPlugin('subscribe2quicktags', '" . $this->fullpath . "');\n";
2921
  }
2922
 
2923
+ function s2_edit_form() {
2924
  echo "<!-- Start Subscribe2 Quicktags Javascript -->\r\n";
2925
  echo "<script type=\"text/javascript\">\r\n";
2926
  echo "//<![CDATA[\r\n";
3003
  if ($check) {
3004
  continue;
3005
  }
3006
+ $table .= "* " . $post->post_title . "\r\n";
3007
  $message_posttime .= $post->post_title . "\r\n";
3008
  $message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
3009
  $message_posttime .= get_permalink($post->ID) . "\r\n";
3043
  }
3044
 
3045
  // get admin details
3046
+ $user = $this->get_userdata($this->subscribe2_options['sender']);
3047
  $this->myemail = $user->user_email;
3048
  $this->myname = html_entity_decode($user->display_name);
3049
 
3055
  $all_post_cats_string = implode(',', $all_post_cats);
3056
  $registered = $this->get_registered("cats=$all_post_cats_string");
3057
  $recipients = array_merge((array)$public, (array)$registered);
3058
+ $mailtext = apply_filters('s2_email_template', $this->subscribe2_options['mailtext']);
3059
  $mailtext = stripslashes($this->substitute($mailtext));
3060
  $mailtext = str_replace("TABLE", $table, $mailtext);
3061
  $mailtext = str_replace("POSTTIME", $message_posttime, $mailtext);
3082
  } // end s2init()
3083
 
3084
  function subscribe2() {
3085
+ global $table_prefix, $wp_version, $wpmu_version;
3086
 
3087
  load_plugin_textdomain('subscribe2', 'wp-content/plugins/' . dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
3088
 
3089
+ // Is this WordPressMU or not?
3090
+ if ( (isset($wpmu_version)) || (strpos($wp_version, 'wordpress-mu')) ) {
3091
+ $this->s2_mu = true;
3092
+ } else {
3093
+ $this->s2_mu = false;
3094
+ }
3095
+
3096
  // do we need to install anything?
3097
  $this->public = $table_prefix . "subscribe2";
3098
  if (!mysql_query("DESCRIBE " . $this->public)) { $this->install(); }
3125
  add_action('admin_menu', array(&$this, 's2_meta_init'));
3126
  add_action('save_post', array(&$this, 's2_meta_handler'));
3127
  add_action('create_category', array(&$this, 'autosub_new_category'));
3128
+ add_action('delete_category', array(&$this, 'delete_category'));
3129
  add_filter('the_content', array(&$this, 'filter'), 10);
3130
  add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
3131
 
3132
  // add actions for other plugins
3133
+ if ('1' == $this->subscribe2_options['show_meta']) {
3134
  add_action('wp_meta', array(&$this, 'add_minimeta'), 0);
3135
  }
3136
  add_filter('ozh_adminmenu_icon', array(&$this, 'ozh_s2_icon'));
3146
  add_action('user_register', array(&$this, 'register'));
3147
  add_action('add_user_to_blog', array(&$this, 'register'), 10, 1);
3148
 
3149
+ if ($this->s2_mu) {
3150
+ add_action('admin_init', array(&$this, 'wpmu_subscribe'));
3151
+ }
3152
 
3153
  // add actions for processing posts based on per-post or cron email settings
3154
  if ($this->subscribe2_options['email_freq'] != 'never') {
3181
  var $permalink = '';
3182
  var $myname = '';
3183
  var $myemail = '';
 
3184
  var $signup_dates = array();
3185
  var $private = false;
3186
  var $filtered = 0;
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: 2009-03-19 19:21+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"
@@ -76,13 +76,13 @@ msgstr ""
76
  msgid "Enter email address..."
77
  msgstr ""
78
 
79
- #: subscribe2.php:85 subscribe2.php:1449 subscribe2.php:1542
80
- #: subscribe2.php:2186
81
  msgid "Subscribe"
82
  msgstr ""
83
 
84
- #: subscribe2.php:85 subscribe2.php:1450 subscribe2.php:1543
85
- #: subscribe2.php:2169
86
  msgid "Unsubscribe"
87
  msgstr ""
88
 
@@ -99,637 +99,644 @@ msgid "You have successfully unsubscribed."
99
  msgstr ""
100
 
101
  #: subscribe2.php:94
102
- msgid "Please confirm your request"
103
- msgstr ""
104
-
105
- #: subscribe2.php:96
106
- msgid "Subscription Reminder"
107
- msgstr ""
108
-
109
- #: subscribe2.php:98
110
  msgid "subscribe"
111
  msgstr ""
112
 
113
- #: subscribe2.php:100
114
  msgid "unsubscribe"
115
  msgstr ""
116
 
117
- #: subscribe2.php:103
118
  msgid "Options saved!"
119
  msgstr ""
120
 
121
- #: subscribe2.php:104
122
  msgid "Options reset!"
123
  msgstr ""
124
 
125
- #: subscribe2.php:112
126
  msgid "Subscribers"
127
  msgstr ""
128
 
129
- #: subscribe2.php:115
130
  msgid "Subscribe2 Options"
131
  msgstr ""
132
 
133
- #: subscribe2.php:115 subscribe2.php:2682 subscribe2.php:2782
134
  msgid "Subscribe2"
135
  msgstr ""
136
 
137
- #: subscribe2.php:120 subscribe2.php:1695
138
  msgid "Subscriptions"
139
  msgstr ""
140
 
141
- #: subscribe2.php:124
142
  msgid "Mail Subscribers"
143
  msgstr ""
144
 
145
- #: subscribe2.php:789
146
  msgid "New subscription"
147
  msgstr ""
148
 
149
- #: subscribe2.php:790
150
  msgid "subscribed to email notifications!"
151
  msgstr ""
152
 
153
- #: subscribe2.php:802
154
  msgid "New Unsubscription"
155
  msgstr ""
156
 
157
- #: subscribe2.php:803
158
  msgid "unsubscribed from email notifications!"
159
  msgstr ""
160
 
161
- #: subscribe2.php:1281
162
  msgid "Address(es) subscribed!"
163
  msgstr ""
164
 
165
- #: subscribe2.php:1284
166
  msgid "Address(es) unsubscribed!"
167
  msgstr ""
168
 
169
- #: subscribe2.php:1294
170
  msgid "Address(es) deleted!"
171
  msgstr ""
172
 
173
- #: subscribe2.php:1300 subscribe2.php:1306
174
  msgid "Status changed!"
175
  msgstr ""
176
 
177
- #: subscribe2.php:1320
178
  msgid "Reminder Email(s) Sent!"
179
  msgstr ""
180
 
181
- #: subscribe2.php:1323
182
  msgid "Registered Users Subscribed!"
183
  msgstr ""
184
 
185
- #: subscribe2.php:1326
186
  msgid "Registered Users Unsubscribed!"
187
  msgstr ""
188
 
189
- #: subscribe2.php:1414
190
  msgid "Previous Page"
191
  msgstr ""
192
 
193
- #: subscribe2.php:1434
194
  msgid "Next Page"
195
  msgstr ""
196
 
197
- #: subscribe2.php:1440
198
  msgid "Manage Subscribers"
199
  msgstr ""
200
 
201
- #: subscribe2.php:1445
202
  msgid "Add/Remove Subscribers"
203
  msgstr ""
204
 
205
- #: subscribe2.php:1446
206
  msgid "Enter addresses, one per line or comma-separated"
207
  msgstr ""
208
 
209
- #: subscribe2.php:1453
210
  msgid "Current Subscribers"
211
  msgstr ""
212
 
213
- #: subscribe2.php:1455
214
  msgid "Filter"
215
  msgstr ""
216
 
217
- #: subscribe2.php:1462
218
  msgid "Search Subscribers"
219
  msgstr ""
220
 
221
- #: subscribe2.php:1465
222
  msgid "Send Reminder Email"
223
  msgstr ""
224
 
225
- #: subscribe2.php:1470
226
  msgid "Save Emails to CSV File"
227
  msgstr ""
228
 
229
- #: subscribe2.php:1476 subscribe2.php:1530
230
  msgid "Process"
231
  msgstr ""
232
 
233
- #: subscribe2.php:1485 subscribe2.php:1507
234
  msgid "Confirm this email address"
235
  msgstr ""
236
 
237
- #: subscribe2.php:1487 subscribe2.php:1500
238
  msgid "Unconfirm this email address"
239
  msgstr ""
240
 
241
- #: subscribe2.php:1489 subscribe2.php:1502 subscribe2.php:1510
242
  msgid "Delete this email address"
243
  msgstr ""
244
 
245
- #: subscribe2.php:1493 subscribe2.php:2318
246
  msgid "Select / Unselect All"
247
  msgstr ""
248
 
249
- #: subscribe2.php:1517
250
  msgid "edit"
251
  msgstr ""
252
 
253
- #: subscribe2.php:1524
254
  msgid "No matching subscribers found"
255
  msgstr ""
256
 
257
- #: subscribe2.php:1526
258
  msgid "NONE"
259
  msgstr ""
260
 
261
- #: subscribe2.php:1536
262
  msgid "Categories"
263
  msgstr ""
264
 
265
- #: subscribe2.php:1538
266
  msgid ""
267
  "Existing Registered Users can be automatically (un)subscribed to categories "
268
  "using this section."
269
  msgstr ""
270
 
271
- #: subscribe2.php:1539
272
  msgid "Consider User Privacy as changes cannot be undone"
273
  msgstr ""
274
 
275
- #: subscribe2.php:1541
276
  msgid "Action to perform"
277
  msgstr ""
278
 
279
- #: subscribe2.php:1546 subscribe2.php:1940
280
  msgid "Submit"
281
  msgstr ""
282
 
283
- #: subscribe2.php:1669
284
  msgid "Subscribe2 Settings"
285
  msgstr ""
286
 
287
- #: subscribe2.php:1680 subscribe2.php:2035
288
  msgid "Notification Settings"
289
  msgstr ""
290
 
291
- #: subscribe2.php:1682
292
  msgid "Restrict the number of recipients per email to (0 for unlimited)"
293
  msgstr ""
294
 
295
- #: subscribe2.php:1684 subscribe2.php:1825 subscribe2.php:1834
296
  msgid "Edit"
297
  msgstr ""
298
 
299
- #: subscribe2.php:1687 subscribe2.php:1828 subscribe2.php:1837
300
  msgid "Update"
301
  msgstr ""
302
 
303
- #: subscribe2.php:1688 subscribe2.php:1829 subscribe2.php:1838
304
  msgid "Revert"
305
  msgstr ""
306
 
307
- #: subscribe2.php:1690
308
  msgid "Send Admins notifications for new"
309
  msgstr ""
310
 
311
- #: subscribe2.php:1700
312
  msgid "Unsubscriptions"
313
  msgstr ""
314
 
315
- #: subscribe2.php:1705
316
  msgid "Both"
317
  msgstr ""
318
 
319
- #: subscribe2.php:1710
320
  msgid "Neither"
321
  msgstr ""
322
 
323
- #: subscribe2.php:1712
324
  msgid "Include theme CSS stylesheet in HTML notifications"
325
  msgstr ""
326
 
327
- #: subscribe2.php:1717 subscribe2.php:1729 subscribe2.php:1740
328
- #: subscribe2.php:1751 subscribe2.php:1886 subscribe2.php:1913
329
- #: subscribe2.php:1924 subscribe2.php:2075 subscribe2.php:2111
 
330
  msgid "Yes"
331
  msgstr ""
332
 
333
- #: subscribe2.php:1722 subscribe2.php:1734 subscribe2.php:1745
334
- #: subscribe2.php:1756 subscribe2.php:1880 subscribe2.php:1891
335
- #: subscribe2.php:1918 subscribe2.php:1929 subscribe2.php:2080
336
- #: subscribe2.php:2115
337
  msgid "No"
338
  msgstr ""
339
 
340
- #: subscribe2.php:1724
341
  msgid "Send Emails for Pages"
342
  msgstr ""
343
 
344
- #: subscribe2.php:1735
345
  msgid "Send Emails for Password Protected Posts"
346
  msgstr ""
347
 
348
- #: subscribe2.php:1746
349
  msgid "Send Emails for Private Posts"
350
  msgstr ""
351
 
352
- #: subscribe2.php:1757
353
  msgid "Send Email From"
354
  msgstr ""
355
 
356
- #: subscribe2.php:1762
357
- msgid "Author of the post"
358
- msgstr ""
359
-
360
- #: subscribe2.php:1767
361
- msgid "Blog Admin"
362
- msgstr ""
363
-
364
- #: subscribe2.php:1769
365
  msgid "Send Emails"
366
  msgstr ""
367
 
368
- #: subscribe2.php:1775
369
  msgid "Email Templates"
370
  msgstr ""
371
 
372
- #: subscribe2.php:1779
373
  msgid "New Post email (must not be empty)"
374
  msgstr ""
375
 
376
- #: subscribe2.php:1783
 
 
 
 
377
  msgid "Message substitions"
378
  msgstr ""
379
 
380
- #: subscribe2.php:1787
381
  msgid "the post's title<br />(<i>for per-post emails only</i>)"
382
  msgstr ""
383
 
384
- #: subscribe2.php:1788
385
  msgid ""
386
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
387
  "preferences</i>)"
388
  msgstr ""
389
 
390
- #: subscribe2.php:1789
391
  msgid ""
392
  "the excerpt of the post and the time it was posted<br />(<i>for digest "
393
  "emails only</i>)"
394
  msgstr ""
395
 
396
- #: subscribe2.php:1790
397
  msgid "a list of post titles<br />(<i>for digest emails only</i>)"
398
  msgstr ""
399
 
400
- #: subscribe2.php:1791
401
  msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
402
  msgstr ""
403
 
404
- #: subscribe2.php:1792
405
  msgid ""
406
  "the post's permalink after conversion by TinyURL<br />(<i>for per-post "
407
  "emails only</i>)"
408
  msgstr ""
409
 
410
- #: subscribe2.php:1793
411
  msgid "the admin or post author's name"
412
  msgstr ""
413
 
414
- #: subscribe2.php:1794
415
  msgid "the admin or post author's email"
416
  msgstr ""
417
 
418
- #: subscribe2.php:1795
419
  msgid "the post author's name"
420
  msgstr ""
421
 
422
- #: subscribe2.php:1796
423
  msgid ""
424
  "the generated link to confirm a request<br />(<i>only used in the "
425
  "confirmation email template</i>)"
426
  msgstr ""
427
 
428
- #: subscribe2.php:1797
429
  msgid ""
430
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
431
  "confirmation email template</i>)"
432
  msgstr ""
433
 
434
- #: subscribe2.php:1799
435
  msgid "Subscribe / Unsubscribe confirmation email"
436
  msgstr ""
437
 
438
- #: subscribe2.php:1802
439
  msgid "Reminder email to Unconfirmed Subscribers"
440
  msgstr ""
441
 
442
- #: subscribe2.php:1807
443
  msgid "Excluded Categories"
444
  msgstr ""
445
 
446
- #: subscribe2.php:1809
447
  msgid ""
448
  "Posts assigned to any Excluded Category do not generate notifications and "
449
  "are not included in digest notifications"
450
  msgstr ""
451
 
452
- #: subscribe2.php:1816
453
  msgid "Allow registered users to subscribe to excluded categories?"
454
  msgstr ""
455
 
456
- #: subscribe2.php:1819
457
  msgid "Appearance"
458
  msgstr ""
459
 
460
- #: subscribe2.php:1823
461
  msgid "Set default Subscribe2 page as ID"
462
  msgstr ""
463
 
464
- #: subscribe2.php:1832
465
  msgid "Set the number of Subscribers displayed per page"
466
  msgstr ""
467
 
468
- #: subscribe2.php:1845
469
  msgid "Show a link to your subscription page in \"meta\"?"
470
  msgstr ""
471
 
472
- #: subscribe2.php:1852
473
  msgid "Show the Subscribe2 button on the Write toolbar?"
474
  msgstr ""
475
 
476
- #: subscribe2.php:1859
477
  msgid "Enable Subscribe2 Widget?"
478
  msgstr ""
479
 
480
- #: subscribe2.php:1863
481
  msgid "Auto Subscribe"
482
  msgstr ""
483
 
484
- #: subscribe2.php:1865
485
  msgid "Subscribe new users registering with your blog"
486
  msgstr ""
487
 
488
- #: subscribe2.php:1870
489
  msgid "Automatically"
490
  msgstr ""
491
 
492
- #: subscribe2.php:1875
493
  msgid "Display option on Registration Form"
494
  msgstr ""
495
 
496
- #: subscribe2.php:1881
 
 
 
 
497
  msgid "Registration Form option is checked by default"
498
  msgstr ""
499
 
500
- #: subscribe2.php:1892
501
  msgid "Auto-subscribe users to receive email as"
502
  msgstr ""
503
 
504
- #: subscribe2.php:1897 subscribe2.php:2052
505
  msgid "HTML"
506
  msgstr ""
507
 
508
- #: subscribe2.php:1902
509
  msgid "Plain Text - Full"
510
  msgstr ""
511
 
512
- #: subscribe2.php:1907
513
  msgid "Plain Text - Excerpt"
514
  msgstr ""
515
 
516
- #: subscribe2.php:1908
517
- msgid "Show Auto Subscribe option on Users page"
518
  msgstr ""
519
 
520
- #: subscribe2.php:1919
521
- msgid "Auto Subscribe me to new categories is checked by default"
 
 
522
  msgstr ""
523
 
524
- #: subscribe2.php:1933
525
  msgid "Barred Domains"
526
  msgstr ""
527
 
528
- #: subscribe2.php:1935
529
  msgid ""
530
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
531
  "each entry and omit the \"@\" symbol, for example email.com)"
532
  msgstr ""
533
 
534
- #: subscribe2.php:1943
535
  msgid "Reset Default"
536
  msgstr ""
537
 
538
- #: subscribe2.php:1944
539
  msgid ""
540
  "Use this to reset all options to their defaults. This <strong><em>will not</"
541
  "em></strong> modify your list of subscribers."
542
  msgstr ""
543
 
544
- #: subscribe2.php:1946
545
  msgid "RESET"
546
  msgstr ""
547
 
548
- #: subscribe2.php:1980
549
  msgid "Subscription preferences updated."
550
  msgstr ""
551
 
552
- #: subscribe2.php:2038
553
  msgid "Editing Subscribe2 preferences for user"
554
  msgstr ""
555
 
556
- #: subscribe2.php:2047
557
  msgid "Receive email as"
558
  msgstr ""
559
 
560
- #: subscribe2.php:2057
561
  msgid "Plain Text"
562
  msgstr ""
563
 
564
- #: subscribe2.php:2059
565
  msgid "Email contains"
566
  msgstr ""
567
 
568
- #: subscribe2.php:2060
569
  msgid "Excerpt Only"
570
  msgstr ""
571
 
572
- #: subscribe2.php:2060
573
  msgid "Full Post"
574
  msgstr ""
575
 
576
- #: subscribe2.php:2068
577
  msgid "Note: HTML format will always deliver the full post"
578
  msgstr ""
579
 
580
- #: subscribe2.php:2070
581
  msgid "Automatically subscribe me to newly created categories"
582
  msgstr ""
583
 
584
- #: subscribe2.php:2091
585
  msgid "Unsubscribe me from this blog"
586
  msgstr ""
587
 
588
- #: subscribe2.php:2095
589
  msgid "Subscribe to all categories"
590
  msgstr ""
591
 
592
- #: subscribe2.php:2097
593
  msgid "Subscribed Categories on"
594
  msgstr ""
595
 
596
- #: subscribe2.php:2099
597
  msgid "Subscribed Categories"
598
  msgstr ""
599
 
600
- #: subscribe2.php:2105
601
  msgid "Receive periodic summaries of new posts?"
602
  msgstr ""
603
 
604
- #: subscribe2.php:2120
605
  msgid "Update Preferences"
606
  msgstr ""
607
 
608
- #: subscribe2.php:2164
609
  msgid "Subscribed Blogs"
610
  msgstr ""
611
 
612
- #: subscribe2.php:2171
613
- msgid "View Subscription Settings"
 
 
 
 
614
  msgstr ""
615
 
616
- #: subscribe2.php:2182
617
  msgid "Subscribe to new blogs"
618
  msgstr ""
619
 
620
- #: subscribe2.php:2242
621
  msgid "Send an email to subscribers"
622
  msgstr ""
623
 
624
- #: subscribe2.php:2250
625
  msgid "A message from "
626
  msgstr ""
627
 
628
- #: subscribe2.php:2252
629
  msgid "Subject"
630
  msgstr ""
631
 
632
- #: subscribe2.php:2255
633
  msgid "Recipients: "
634
  msgstr ""
635
 
636
- #: subscribe2.php:2259
637
  msgid "Send"
638
  msgstr ""
639
 
640
- #: subscribe2.php:2336
641
- msgid "All Subscribers"
642
  msgstr ""
643
 
644
- #: subscribe2.php:2337
645
  msgid "Public Subscribers"
646
  msgstr ""
647
 
648
- #: subscribe2.php:2338
649
  msgid "Confirmed"
650
  msgstr ""
651
 
652
- #: subscribe2.php:2339
653
  msgid "Unconfirmed"
654
  msgstr ""
655
 
656
- #: subscribe2.php:2340
657
- msgid "Registered Users"
658
  msgstr ""
659
 
660
- #: subscribe2.php:2404
 
 
 
 
661
  msgid "For each Post"
662
  msgstr ""
663
 
664
- #: subscribe2.php:2419
665
  msgid "Send Digest Notification at"
666
  msgstr ""
667
 
668
- #: subscribe2.php:2431
669
  msgid ""
670
  "This option will work for digest notification sent daily or less frequently"
671
  msgstr ""
672
 
673
- #: subscribe2.php:2434
674
  msgid "Current UTC time is"
675
  msgstr ""
676
 
677
- #: subscribe2.php:2436
678
  msgid "Current blog time is"
679
  msgstr ""
680
 
681
- #: subscribe2.php:2438
682
  msgid "Next email notification will be sent when your blog time is after"
683
  msgstr ""
684
 
685
- #: subscribe2.php:2469
686
  msgid "Settings"
687
  msgstr ""
688
 
689
- #: subscribe2.php:2481
690
  msgid "Check here to Subscribe to email notifications for new posts"
691
  msgstr ""
692
 
693
- #: subscribe2.php:2490
694
  msgid ""
695
  "By registering with this blog you are also agreeing to receive email "
696
  "notifications for new posts but you can unsubscribe at anytime"
697
  msgstr ""
698
 
699
- #: subscribe2.php:2511 subscribe2.php:2512 subscribe2.php:2540
700
  msgid "Subscribe2 Notification Override"
701
  msgstr ""
702
 
703
- #: subscribe2.php:2526
704
  msgid ""
705
  "Check here to disable sending of an email notification for this post/page"
706
  msgstr ""
707
 
708
- #: subscribe2.php:2668
709
  msgid "Subscription Confirmation"
710
  msgstr ""
711
 
712
- #: subscribe2.php:2705
713
  msgid "Title:"
714
  msgstr ""
715
 
716
- #: subscribe2.php:2756
 
 
 
 
717
  msgid "[Un]Subscribe to Posts"
718
  msgstr ""
719
 
720
- #: subscribe2.php:2834
721
  msgid "Weekly"
722
  msgstr ""
723
 
724
- #: subscribe2.php:2902
725
  msgid "Posted on"
726
  msgstr ""
727
 
728
- #: subscribe2.php:2947
729
  msgid "Digest Email"
730
  msgstr ""
731
 
732
- #: include/options.php:90
733
  msgid ""
734
  "BLOGNAME has posted a new item, 'TITLE'\n"
735
  "\n"
@@ -745,7 +752,7 @@ msgid ""
745
  "EMAIL"
746
  msgstr ""
747
 
748
- #: include/options.php:94
749
  msgid ""
750
  "BLOGNAME has received a request to ACTION for this email address. To "
751
  "complete your request please click on the link below:\n"
@@ -758,7 +765,11 @@ msgid ""
758
  "MYNAME."
759
  msgstr ""
760
 
761
- #: include/options.php:98
 
 
 
 
762
  msgid ""
763
  "This email address was subscribed for notifications at BLOGNAME (BLOGLINK) "
764
  "but the subscription remains incomplete.\n"
@@ -773,3 +784,7 @@ msgid ""
773
  "Regards,\n"
774
  "MYNAME"
775
  msgstr ""
 
 
 
 
8
  msgstr ""
9
  "Project-Id-Version: PACKAGE VERSION\n"
10
  "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2009-05-24 20:26+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"
76
  msgid "Enter email address..."
77
  msgstr ""
78
 
79
+ #: subscribe2.php:85 subscribe2.php:1477 subscribe2.php:1570
80
+ #: subscribe2.php:2256
81
  msgid "Subscribe"
82
  msgstr ""
83
 
84
+ #: subscribe2.php:85 subscribe2.php:1478 subscribe2.php:1571
85
+ #: subscribe2.php:2235
86
  msgid "Unsubscribe"
87
  msgstr ""
88
 
99
  msgstr ""
100
 
101
  #: subscribe2.php:94
 
 
 
 
 
 
 
 
102
  msgid "subscribe"
103
  msgstr ""
104
 
105
+ #: subscribe2.php:96
106
  msgid "unsubscribe"
107
  msgstr ""
108
 
109
+ #: subscribe2.php:99
110
  msgid "Options saved!"
111
  msgstr ""
112
 
113
+ #: subscribe2.php:100
114
  msgid "Options reset!"
115
  msgstr ""
116
 
117
+ #: subscribe2.php:108
118
  msgid "Subscribers"
119
  msgstr ""
120
 
121
+ #: subscribe2.php:111
122
  msgid "Subscribe2 Options"
123
  msgstr ""
124
 
125
+ #: subscribe2.php:111 subscribe2.php:2784 subscribe2.php:2888
126
  msgid "Subscribe2"
127
  msgstr ""
128
 
129
+ #: subscribe2.php:116 subscribe2.php:1739
130
  msgid "Subscriptions"
131
  msgstr ""
132
 
133
+ #: subscribe2.php:120
134
  msgid "Mail Subscribers"
135
  msgstr ""
136
 
137
+ #: subscribe2.php:771
138
  msgid "New subscription"
139
  msgstr ""
140
 
141
+ #: subscribe2.php:772
142
  msgid "subscribed to email notifications!"
143
  msgstr ""
144
 
145
+ #: subscribe2.php:784
146
  msgid "New Unsubscription"
147
  msgstr ""
148
 
149
+ #: subscribe2.php:785
150
  msgid "unsubscribed from email notifications!"
151
  msgstr ""
152
 
153
+ #: subscribe2.php:1302
154
  msgid "Address(es) subscribed!"
155
  msgstr ""
156
 
157
+ #: subscribe2.php:1305
158
  msgid "Address(es) unsubscribed!"
159
  msgstr ""
160
 
161
+ #: subscribe2.php:1315
162
  msgid "Address(es) deleted!"
163
  msgstr ""
164
 
165
+ #: subscribe2.php:1321 subscribe2.php:1327
166
  msgid "Status changed!"
167
  msgstr ""
168
 
169
+ #: subscribe2.php:1341
170
  msgid "Reminder Email(s) Sent!"
171
  msgstr ""
172
 
173
+ #: subscribe2.php:1344
174
  msgid "Registered Users Subscribed!"
175
  msgstr ""
176
 
177
+ #: subscribe2.php:1347
178
  msgid "Registered Users Unsubscribed!"
179
  msgstr ""
180
 
181
+ #: subscribe2.php:1442
182
  msgid "Previous Page"
183
  msgstr ""
184
 
185
+ #: subscribe2.php:1462
186
  msgid "Next Page"
187
  msgstr ""
188
 
189
+ #: subscribe2.php:1468
190
  msgid "Manage Subscribers"
191
  msgstr ""
192
 
193
+ #: subscribe2.php:1473
194
  msgid "Add/Remove Subscribers"
195
  msgstr ""
196
 
197
+ #: subscribe2.php:1474
198
  msgid "Enter addresses, one per line or comma-separated"
199
  msgstr ""
200
 
201
+ #: subscribe2.php:1481
202
  msgid "Current Subscribers"
203
  msgstr ""
204
 
205
+ #: subscribe2.php:1483
206
  msgid "Filter"
207
  msgstr ""
208
 
209
+ #: subscribe2.php:1490
210
  msgid "Search Subscribers"
211
  msgstr ""
212
 
213
+ #: subscribe2.php:1493
214
  msgid "Send Reminder Email"
215
  msgstr ""
216
 
217
+ #: subscribe2.php:1498
218
  msgid "Save Emails to CSV File"
219
  msgstr ""
220
 
221
+ #: subscribe2.php:1504 subscribe2.php:1558
222
  msgid "Process"
223
  msgstr ""
224
 
225
+ #: subscribe2.php:1513 subscribe2.php:1535
226
  msgid "Confirm this email address"
227
  msgstr ""
228
 
229
+ #: subscribe2.php:1515 subscribe2.php:1528
230
  msgid "Unconfirm this email address"
231
  msgstr ""
232
 
233
+ #: subscribe2.php:1517 subscribe2.php:1530 subscribe2.php:1538
234
  msgid "Delete this email address"
235
  msgstr ""
236
 
237
+ #: subscribe2.php:1521 subscribe2.php:2392
238
  msgid "Select / Unselect All"
239
  msgstr ""
240
 
241
+ #: subscribe2.php:1545
242
  msgid "edit"
243
  msgstr ""
244
 
245
+ #: subscribe2.php:1552
246
  msgid "No matching subscribers found"
247
  msgstr ""
248
 
249
+ #: subscribe2.php:1554
250
  msgid "NONE"
251
  msgstr ""
252
 
253
+ #: subscribe2.php:1564
254
  msgid "Categories"
255
  msgstr ""
256
 
257
+ #: subscribe2.php:1566
258
  msgid ""
259
  "Existing Registered Users can be automatically (un)subscribed to categories "
260
  "using this section."
261
  msgstr ""
262
 
263
+ #: subscribe2.php:1567
264
  msgid "Consider User Privacy as changes cannot be undone"
265
  msgstr ""
266
 
267
+ #: subscribe2.php:1569
268
  msgid "Action to perform"
269
  msgstr ""
270
 
271
+ #: subscribe2.php:1574 subscribe2.php:1993
272
  msgid "Submit"
273
  msgstr ""
274
 
275
+ #: subscribe2.php:1714
276
  msgid "Subscribe2 Settings"
277
  msgstr ""
278
 
279
+ #: subscribe2.php:1725 subscribe2.php:2080
280
  msgid "Notification Settings"
281
  msgstr ""
282
 
283
+ #: subscribe2.php:1726
284
  msgid "Restrict the number of recipients per email to (0 for unlimited)"
285
  msgstr ""
286
 
287
+ #: subscribe2.php:1728 subscribe2.php:1867 subscribe2.php:1876
288
  msgid "Edit"
289
  msgstr ""
290
 
291
+ #: subscribe2.php:1731 subscribe2.php:1870 subscribe2.php:1879
292
  msgid "Update"
293
  msgstr ""
294
 
295
+ #: subscribe2.php:1732 subscribe2.php:1871 subscribe2.php:1880
296
  msgid "Revert"
297
  msgstr ""
298
 
299
+ #: subscribe2.php:1734
300
  msgid "Send Admins notifications for new"
301
  msgstr ""
302
 
303
+ #: subscribe2.php:1744
304
  msgid "Unsubscriptions"
305
  msgstr ""
306
 
307
+ #: subscribe2.php:1749
308
  msgid "Both"
309
  msgstr ""
310
 
311
+ #: subscribe2.php:1754
312
  msgid "Neither"
313
  msgstr ""
314
 
315
+ #: subscribe2.php:1756
316
  msgid "Include theme CSS stylesheet in HTML notifications"
317
  msgstr ""
318
 
319
+ #: subscribe2.php:1761 subscribe2.php:1773 subscribe2.php:1784
320
+ #: subscribe2.php:1795 subscribe2.php:1928 subscribe2.php:1939
321
+ #: subscribe2.php:1966 subscribe2.php:1977 subscribe2.php:2120
322
+ #: subscribe2.php:2156
323
  msgid "Yes"
324
  msgstr ""
325
 
326
+ #: subscribe2.php:1766 subscribe2.php:1778 subscribe2.php:1789
327
+ #: subscribe2.php:1800 subscribe2.php:1922 subscribe2.php:1933
328
+ #: subscribe2.php:1944 subscribe2.php:1971 subscribe2.php:1982
329
+ #: subscribe2.php:2125 subscribe2.php:2160
330
  msgid "No"
331
  msgstr ""
332
 
333
+ #: subscribe2.php:1768
334
  msgid "Send Emails for Pages"
335
  msgstr ""
336
 
337
+ #: subscribe2.php:1779
338
  msgid "Send Emails for Password Protected Posts"
339
  msgstr ""
340
 
341
+ #: subscribe2.php:1790
342
  msgid "Send Emails for Private Posts"
343
  msgstr ""
344
 
345
+ #: subscribe2.php:1801
346
  msgid "Send Email From"
347
  msgstr ""
348
 
349
+ #: subscribe2.php:1806
 
 
 
 
 
 
 
 
350
  msgid "Send Emails"
351
  msgstr ""
352
 
353
+ #: subscribe2.php:1811
354
  msgid "Email Templates"
355
  msgstr ""
356
 
357
+ #: subscribe2.php:1815
358
  msgid "New Post email (must not be empty)"
359
  msgstr ""
360
 
361
+ #: subscribe2.php:1816 subscribe2.php:1838 subscribe2.php:1843
362
+ msgid "Subject Line"
363
+ msgstr ""
364
+
365
+ #: subscribe2.php:1821
366
  msgid "Message substitions"
367
  msgstr ""
368
 
369
+ #: subscribe2.php:1825
370
  msgid "the post's title<br />(<i>for per-post emails only</i>)"
371
  msgstr ""
372
 
373
+ #: subscribe2.php:1826
374
  msgid ""
375
  "the excerpt or the entire post<br />(<i>based on the subscriber's "
376
  "preferences</i>)"
377
  msgstr ""
378
 
379
+ #: subscribe2.php:1827
380
  msgid ""
381
  "the excerpt of the post and the time it was posted<br />(<i>for digest "
382
  "emails only</i>)"
383
  msgstr ""
384
 
385
+ #: subscribe2.php:1828
386
  msgid "a list of post titles<br />(<i>for digest emails only</i>)"
387
  msgstr ""
388
 
389
+ #: subscribe2.php:1829
390
  msgid "the post's permalink<br />(<i>for per-post emails only</i>)"
391
  msgstr ""
392
 
393
+ #: subscribe2.php:1830
394
  msgid ""
395
  "the post's permalink after conversion by TinyURL<br />(<i>for per-post "
396
  "emails only</i>)"
397
  msgstr ""
398
 
399
+ #: subscribe2.php:1831
400
  msgid "the admin or post author's name"
401
  msgstr ""
402
 
403
+ #: subscribe2.php:1832
404
  msgid "the admin or post author's email"
405
  msgstr ""
406
 
407
+ #: subscribe2.php:1833
408
  msgid "the post author's name"
409
  msgstr ""
410
 
411
+ #: subscribe2.php:1834
412
  msgid ""
413
  "the generated link to confirm a request<br />(<i>only used in the "
414
  "confirmation email template</i>)"
415
  msgstr ""
416
 
417
+ #: subscribe2.php:1835
418
  msgid ""
419
  "Action performed by LINK in confirmation email<br />(<i>only used in the "
420
  "confirmation email template</i>)"
421
  msgstr ""
422
 
423
+ #: subscribe2.php:1837
424
  msgid "Subscribe / Unsubscribe confirmation email"
425
  msgstr ""
426
 
427
+ #: subscribe2.php:1842
428
  msgid "Reminder email to Unconfirmed Subscribers"
429
  msgstr ""
430
 
431
+ #: subscribe2.php:1849
432
  msgid "Excluded Categories"
433
  msgstr ""
434
 
435
+ #: subscribe2.php:1851
436
  msgid ""
437
  "Posts assigned to any Excluded Category do not generate notifications and "
438
  "are not included in digest notifications"
439
  msgstr ""
440
 
441
+ #: subscribe2.php:1858
442
  msgid "Allow registered users to subscribe to excluded categories?"
443
  msgstr ""
444
 
445
+ #: subscribe2.php:1861
446
  msgid "Appearance"
447
  msgstr ""
448
 
449
+ #: subscribe2.php:1865
450
  msgid "Set default Subscribe2 page as ID"
451
  msgstr ""
452
 
453
+ #: subscribe2.php:1874
454
  msgid "Set the number of Subscribers displayed per page"
455
  msgstr ""
456
 
457
+ #: subscribe2.php:1887
458
  msgid "Show a link to your subscription page in \"meta\"?"
459
  msgstr ""
460
 
461
+ #: subscribe2.php:1894
462
  msgid "Show the Subscribe2 button on the Write toolbar?"
463
  msgstr ""
464
 
465
+ #: subscribe2.php:1901
466
  msgid "Enable Subscribe2 Widget?"
467
  msgstr ""
468
 
469
+ #: subscribe2.php:1905
470
  msgid "Auto Subscribe"
471
  msgstr ""
472
 
473
+ #: subscribe2.php:1907
474
  msgid "Subscribe new users registering with your blog"
475
  msgstr ""
476
 
477
+ #: subscribe2.php:1912
478
  msgid "Automatically"
479
  msgstr ""
480
 
481
+ #: subscribe2.php:1917
482
  msgid "Display option on Registration Form"
483
  msgstr ""
484
 
485
+ #: subscribe2.php:1923
486
+ msgid "Auto-subscribe includes any excluded categories"
487
+ msgstr ""
488
+
489
+ #: subscribe2.php:1934
490
  msgid "Registration Form option is checked by default"
491
  msgstr ""
492
 
493
+ #: subscribe2.php:1945
494
  msgid "Auto-subscribe users to receive email as"
495
  msgstr ""
496
 
497
+ #: subscribe2.php:1950 subscribe2.php:2097
498
  msgid "HTML"
499
  msgstr ""
500
 
501
+ #: subscribe2.php:1955
502
  msgid "Plain Text - Full"
503
  msgstr ""
504
 
505
+ #: subscribe2.php:1960
506
  msgid "Plain Text - Excerpt"
507
  msgstr ""
508
 
509
+ #: subscribe2.php:1961
510
+ msgid "Display option for Register Users to auto-subscribe to new categories"
511
  msgstr ""
512
 
513
+ #: subscribe2.php:1972
514
+ msgid ""
515
+ "Option for Register Users to auto-subscribe to new categories is checked by "
516
+ "default"
517
  msgstr ""
518
 
519
+ #: subscribe2.php:1986
520
  msgid "Barred Domains"
521
  msgstr ""
522
 
523
+ #: subscribe2.php:1988
524
  msgid ""
525
  "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
526
  "each entry and omit the \"@\" symbol, for example email.com)"
527
  msgstr ""
528
 
529
+ #: subscribe2.php:1996
530
  msgid "Reset Default"
531
  msgstr ""
532
 
533
+ #: subscribe2.php:1997
534
  msgid ""
535
  "Use this to reset all options to their defaults. This <strong><em>will not</"
536
  "em></strong> modify your list of subscribers."
537
  msgstr ""
538
 
539
+ #: subscribe2.php:1999
540
  msgid "RESET"
541
  msgstr ""
542
 
543
+ #: subscribe2.php:2025
544
  msgid "Subscription preferences updated."
545
  msgstr ""
546
 
547
+ #: subscribe2.php:2083
548
  msgid "Editing Subscribe2 preferences for user"
549
  msgstr ""
550
 
551
+ #: subscribe2.php:2092
552
  msgid "Receive email as"
553
  msgstr ""
554
 
555
+ #: subscribe2.php:2102
556
  msgid "Plain Text"
557
  msgstr ""
558
 
559
+ #: subscribe2.php:2104
560
  msgid "Email contains"
561
  msgstr ""
562
 
563
+ #: subscribe2.php:2105
564
  msgid "Excerpt Only"
565
  msgstr ""
566
 
567
+ #: subscribe2.php:2105
568
  msgid "Full Post"
569
  msgstr ""
570
 
571
+ #: subscribe2.php:2113
572
  msgid "Note: HTML format will always deliver the full post"
573
  msgstr ""
574
 
575
+ #: subscribe2.php:2115
576
  msgid "Automatically subscribe me to newly created categories"
577
  msgstr ""
578
 
579
+ #: subscribe2.php:2136
580
  msgid "Unsubscribe me from this blog"
581
  msgstr ""
582
 
583
+ #: subscribe2.php:2140
584
  msgid "Subscribe to all categories"
585
  msgstr ""
586
 
587
+ #: subscribe2.php:2142
588
  msgid "Subscribed Categories on"
589
  msgstr ""
590
 
591
+ #: subscribe2.php:2144
592
  msgid "Subscribed Categories"
593
  msgstr ""
594
 
595
+ #: subscribe2.php:2150
596
  msgid "Receive periodic summaries of new posts?"
597
  msgstr ""
598
 
599
+ #: subscribe2.php:2165
600
  msgid "Update Preferences"
601
  msgstr ""
602
 
603
+ #: subscribe2.php:2224
604
  msgid "Subscribed Blogs"
605
  msgstr ""
606
 
607
+ #: subscribe2.php:2229 subscribe2.php:2250
608
+ msgid "Viewing Settings Now"
609
+ msgstr ""
610
+
611
+ #: subscribe2.php:2233 subscribe2.php:2254
612
+ msgid "View Settings"
613
  msgstr ""
614
 
615
+ #: subscribe2.php:2245
616
  msgid "Subscribe to new blogs"
617
  msgstr ""
618
 
619
+ #: subscribe2.php:2316
620
  msgid "Send an email to subscribers"
621
  msgstr ""
622
 
623
+ #: subscribe2.php:2324
624
  msgid "A message from "
625
  msgstr ""
626
 
627
+ #: subscribe2.php:2326
628
  msgid "Subject"
629
  msgstr ""
630
 
631
+ #: subscribe2.php:2329
632
  msgid "Recipients: "
633
  msgstr ""
634
 
635
+ #: subscribe2.php:2333
636
  msgid "Send"
637
  msgstr ""
638
 
639
+ #: subscribe2.php:2405
640
+ msgid "All Users and Subscribers"
641
  msgstr ""
642
 
643
+ #: subscribe2.php:2406
644
  msgid "Public Subscribers"
645
  msgstr ""
646
 
647
+ #: subscribe2.php:2407
648
  msgid "Confirmed"
649
  msgstr ""
650
 
651
+ #: subscribe2.php:2408
652
  msgid "Unconfirmed"
653
  msgstr ""
654
 
655
+ #: subscribe2.php:2409
656
+ msgid "All Registered Users"
657
  msgstr ""
658
 
659
+ #: subscribe2.php:2410
660
+ msgid "Registered Subscribers"
661
+ msgstr ""
662
+
663
+ #: subscribe2.php:2506
664
  msgid "For each Post"
665
  msgstr ""
666
 
667
+ #: subscribe2.php:2521
668
  msgid "Send Digest Notification at"
669
  msgstr ""
670
 
671
+ #: subscribe2.php:2533
672
  msgid ""
673
  "This option will work for digest notification sent daily or less frequently"
674
  msgstr ""
675
 
676
+ #: subscribe2.php:2536
677
  msgid "Current UTC time is"
678
  msgstr ""
679
 
680
+ #: subscribe2.php:2538
681
  msgid "Current blog time is"
682
  msgstr ""
683
 
684
+ #: subscribe2.php:2540
685
  msgid "Next email notification will be sent when your blog time is after"
686
  msgstr ""
687
 
688
+ #: subscribe2.php:2571
689
  msgid "Settings"
690
  msgstr ""
691
 
692
+ #: subscribe2.php:2583
693
  msgid "Check here to Subscribe to email notifications for new posts"
694
  msgstr ""
695
 
696
+ #: subscribe2.php:2592
697
  msgid ""
698
  "By registering with this blog you are also agreeing to receive email "
699
  "notifications for new posts but you can unsubscribe at anytime"
700
  msgstr ""
701
 
702
+ #: subscribe2.php:2613 subscribe2.php:2614 subscribe2.php:2642
703
  msgid "Subscribe2 Notification Override"
704
  msgstr ""
705
 
706
+ #: subscribe2.php:2628
707
  msgid ""
708
  "Check here to disable sending of an email notification for this post/page"
709
  msgstr ""
710
 
711
+ #: subscribe2.php:2770
712
  msgid "Subscription Confirmation"
713
  msgstr ""
714
 
715
+ #: subscribe2.php:2810
716
  msgid "Title:"
717
  msgstr ""
718
 
719
+ #: subscribe2.php:2812
720
+ msgid "Div class name:"
721
+ msgstr ""
722
+
723
+ #: subscribe2.php:2862
724
  msgid "[Un]Subscribe to Posts"
725
  msgstr ""
726
 
727
+ #: subscribe2.php:2940
728
  msgid "Weekly"
729
  msgstr ""
730
 
731
+ #: subscribe2.php:3008
732
  msgid "Posted on"
733
  msgstr ""
734
 
735
+ #: subscribe2.php:3053
736
  msgid "Digest Email"
737
  msgstr ""
738
 
739
+ #: include/options.php:94
740
  msgid ""
741
  "BLOGNAME has posted a new item, 'TITLE'\n"
742
  "\n"
752
  "EMAIL"
753
  msgstr ""
754
 
755
+ #: include/options.php:102
756
  msgid ""
757
  "BLOGNAME has received a request to ACTION for this email address. To "
758
  "complete your request please click on the link below:\n"
765
  "MYNAME."
766
  msgstr ""
767
 
768
+ #: include/options.php:106
769
+ msgid "Please confirm your request"
770
+ msgstr ""
771
+
772
+ #: include/options.php:110
773
  msgid ""
774
  "This email address was subscribed for notifications at BLOGNAME (BLOGLINK) "
775
  "but the subscription remains incomplete.\n"
784
  "Regards,\n"
785
  "MYNAME"
786
  msgstr ""
787
+
788
+ #: include/options.php:114
789
+ msgid "Subscription Reminder"
790
+ msgstr ""
tinymce3/editor_plugin.js CHANGED
@@ -1 +1 @@
1
- eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(3(){6.1p(\'6.s.r\',{1o:3(2,f){1n k=\'<A 1m="\'+f+\'/../../G/1l.1k" z="c 1j" />\',9=\'c\',i=2.1i(\'1h\',\'<!--4-->\'),l;l=1g 1f(i.j(/[\\?\\.\\*\\[\\]\\(\\)\\{\\}\\+\\^\\$\\:]/g,3(a){h\'\\\\\'+a}),\'g\');2.1e(\'c\',3(){2.1d(\'1c\',0,k)});2.1b(\'4\',{1a:\'y x w\',19:f+\'/../G/18.17\',16:9});2.15.5(3(){2.d.14(f+"/F/8.F");7(2.E.D){2.E.D.5(3(13,o){7(o.C.q==\'p\'&&2.d.m(o.C,9))o.12=\'4\'})}});2.11.5(3(2,e){e=e.10;7(e.q===\'p\'&&2.d.m(e,9))2.Z.Y(e)});2.X.5(3(2,B,n){B.W(\'4\',n.q===\'p\'&&2.d.m(n,9))});2.V.5(3(2,o){o.8=o.8.j(l,k)});2.U.5(3(2,o){7(o.T)o.8=o.8.j(/<A[^>]+>/g,3(b){7(b.S(\'z="c\')!==-1)b=i;h b})})},R:3(){h{Q:\'y x w\',P:\'O N\',M:\'v://4.u.t\',L:\'v://4.u.t\',K:6.J+"."+6.I}}});6.H.5(\'4\',6.s.r)})();',62,88,'||ed|function|subscribe2|add|tinymce|if|content|cls||im|mceSubscribe2|dom||url||return|sep|replace|pb|pbRE|hasClass|||IMG|nodeName|Subscribe2Plugin|plugins|com|wordpress|http|Token|Subscribe2|Insert|class|img|cm|node|onResolveName|theme|css|include|PluginManager|minorVersion|majorVersion|version|infourl|authorurl|Robinson|Matthew|author|longname|getInfo|indexOf|get|onPostProcess|onBeforeSetContent|setActive|onNodeChange|select|selection|target|onClick|name|th|loadCSS|onInit|cmd|png|s2_button|image|title|addButton|mceInsertContent|execCommand|addCommand|RegExp|new|subscribe2_separator|getParam|mceItemNoResize|gif|trans|src|var|init|create'.split('|'),0,{}))
1
+ (function(){tinymce.create('tinymce.plugins.Subscribe2Plugin',{init:function(ed,url){var pb='<img src="'+url+'/../../include/trans.gif" class="mceSubscribe2 mceItemNoResize" />',cls='mceSubscribe2',sep=ed.getParam('subscribe2_separator','<!--subscribe2-->'),pbRE;pbRE=new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g,function(a){return'\\'+a}),'g');ed.addCommand('mceSubscribe2',function(){ed.execCommand('mceInsertContent',0,pb)});ed.addButton('subscribe2',{title:'Insert Subscribe2 Token',image:url+'/../include/s2_button.png',cmd:cls});ed.onInit.add(function(){ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.node.nodeName=='IMG'&&ed.dom.hasClass(o.node,cls))o.name='subscribe2'})}});ed.onClick.add(function(ed,e){e=e.target;if(e.nodeName==='IMG'&&ed.dom.hasClass(e,cls))ed.selection.select(e)});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('subscribe2',n.nodeName==='IMG'&&ed.dom.hasClass(n,cls))});ed.onBeforeSetContent.add(function(ed,o){o.content=o.content.replace(pbRE,pb)});ed.onPostProcess.add(function(ed,o){if(o.get)o.content=o.content.replace(/<img[^>]+>/g,function(im){if(im.indexOf('class="mceSubscribe2')!==-1)im=sep;return im})})},getInfo:function(){return{longname:'Insert Subscribe2 Token',author:'Matthew Robinson',authorurl:'http://subscribe2.wordpress.com',infourl:'http://subscribe2.wordpress.com',version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add('subscribe2',tinymce.plugins.Subscribe2Plugin)})();
tinymce3/editor_plugin_src.js CHANGED
@@ -1,9 +1,14 @@
1
  (function() {
2
  tinymce.create('tinymce.plugins.Subscribe2Plugin', {
3
  init : function(ed, url) {
4
- var pb = '<img src="' + url + '/../../include/trans.gif" class="mceSubscribe2 mceItemNoResize" />', cls = 'mceSubscribe2', sep = ed.getParam('subscribe2_separator', '<!--subscribe2-->'), pbRE;
 
 
 
5
 
6
- pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {return '\\' + a;}), 'g');
 
 
7
 
8
  // Register commands
9
  ed.addCommand('mceSubscribe2', function() {
@@ -11,7 +16,11 @@
11
  });
12
 
13
  // Register buttons
14
- ed.addButton('subscribe2', {title : 'Insert Subscribe2 Token', image : url + '/../include/s2_button.png', cmd : cls});
 
 
 
 
15
 
16
  ed.onInit.add(function() {
17
  ed.dom.loadCSS(url + "/css/content.css");
1
  (function() {
2
  tinymce.create('tinymce.plugins.Subscribe2Plugin', {
3
  init : function(ed, url) {
4
+ var pb = '<img src="' + url + '/../../include/trans.gif" class="mceSubscribe2 mceItemNoResize" />',
5
+ cls = 'mceSubscribe2',
6
+ sep = ed.getParam('subscribe2_separator', '<!--subscribe2-->'),
7
+ pbRE;
8
 
9
+ pbRE = new RegExp(sep.replace(/[\?\.\*\[\]\(\)\{\}\+\^\$\:]/g, function(a) {
10
+ return '\\' + a;
11
+ }), 'g');
12
 
13
  // Register commands
14
  ed.addCommand('mceSubscribe2', function() {
16
  });
17
 
18
  // Register buttons
19
+ ed.addButton('subscribe2', {
20
+ title : 'Insert Subscribe2 Token',
21
+ image : url + '/../include/s2_button.png',
22
+ cmd : cls
23
+ });
24
 
25
  ed.onInit.add(function() {
26
  ed.dom.loadCSS(url + "/css/content.css");