Subscribe2 - Version 3.0

Version Description

Download this release

Release Info

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

Code changes from version 1.7 to 3.0

ReadMe.txt ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Subscribe2 ===
2
+ Contributors: MattyRob, Skippy, Ravan
3
+ Donate link: http://subscribe2.wordpress.com/donate/
4
+ Tags: posts, subscription, email
5
+ Requires at least: 2.0.x
6
+ Tested up to: 2.2
7
+
8
+ Sends a list of subscribers an email notification when new posts are published to your blog
9
+
10
+ == Description ==
11
+
12
+ Subscribe2 provides a comprehensive subscription management system for WordPress blogs that sends email notifications on a per-post or periodical basis to a list of subscribers when you publish new content to your blog. The plugin also handles subscription requests allowing users to publically subscribe by submitting their email address in an easy to use form or to register with your blog which enables greater flexibility for email content for the subscriber. Admins are given control over the presentation of the email notifications, can bulk manage subscriptions for users and manually send email notices to subscribers.
13
+
14
+ Subscribe2 supports two classes of subscribers: the general public, and registered users of the blog. The general public may subscribe and unsubscribe. They will receive an email notification whenever a new post is made (unless that post is assigned to one of the excluded categories you defined). The general public will receive a plaintext email with an excerpt of the post: either the excerpt you created when making the post, the portion of text before a <!--more--> tag (if present), or the first 55 words of the post.
15
+
16
+ Registered users of the blog can elect to receive email notifications for specific categories. The Users->Subscription menu item will allow them to select the delivery format (plaintext or HTML), amount of message (excerpt or full post), and the categories to which they want to subscribe. You, the blog owner, have the option (Options->Subscribe2) to allow registered users to subscribe to your excluded categories or not.
17
+
18
+ When you post a new item, subscribe2 will generate (at least) one email for each of the following combinations of subscribers:
19
+
20
+ * plaintext excerpt
21
+ * plaintext full post
22
+ * HTML full post
23
+
24
+ So for each new post you make, you may receive up to three emails.
25
+
26
+ == Installation ==
27
+
28
+ 1. Copy buttonsnap.php into your /wp-content/plugins directory.
29
+ 2. Copy the entire /subscribe2/ directory into your /wp-content/plugins/ directory.
30
+ 3. Activate the plugin.
31
+ 4. Click the "Options" admin menu link, and select "Subscribe2".
32
+ 5. Configure the options to taste, including the email template and any categories which should be excluded from notification
33
+ 6. Click the "Manage" admin menu link, and select "Subscribers".
34
+ 7. Manually subscribe people as you see fit.
35
+ 8. Create a WordPress Page (http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the subscribe2 token. Or, if you prefer, you may manually insert the subscribe2 token:
36
+ <!--subscribe2-->
37
+ ***Ensure the token is on a line by itself and that it has a blank line above and below.***
38
+ This token will automatically be replaced by the subscription form, and will display all messages as necessary.
39
+ 9. In the subscribe2.php file define S2PAGE to point at your WordPress page created in step 8.
40
+
41
+ == Frequently Asked Questions ==
42
+
43
+ = Which version should I be using, I'm on WordPress x.x.x? =
44
+ WordPress 2.0.x will be supported until 2010. Subscribe2 will remain supported (but not actively developed) until WordPress 2.0.x is no longer supported. For WordPress 2.0.x use the Subscribe code from the 2.x stable.
45
+
46
+ WordPress 2.1.x and 2.2.x are also supported. For the latest information visit http://subscribe2.wordpress.com. For versions of WordPress use Subscribe2 code from the 3.x stable.
47
+
48
+ Finally, there is a development version for WordPress 2.3 but as WordPress 2.3 is not recommended for active websites you should only get this code from the branch if you are testing it.
49
+
50
+ = How do I upgrade from a previous version? =
51
+ If you are upgrading from any 2.1.x version of subscribe2, please delete both the /subscribe.php and /wp-content/plugins/subscribe2.php files before copying the new files into place. Your subscriber list will remain intact, and your options should be preserved. Now create a WordPress Page as described above.
52
+
53
+ = Why doesn't the form appear in my WordPress page? =
54
+ This is usually caused by one of two things. Firstly, it is possible that the form is there but as you haven't logged out of WordPress yourself you are seeing a message about managing your profile instead. Try logging out and see if it appears.
55
+
56
+ Secondly, make sure that the token (<!--subscribe2-->) is correctly entered in your page with a blank line above and below. The easient way to do this is to deactivate the plugin, visit your WordPress page and view the source. The token should be contained in the source code of the page. If it is not there you either have not correctly entered the token or you have another plguin that is stripping the token from the page code.
57
+
58
+ = Some or all email notifications fail to send, why? =
59
+ In the first instance check this with your hosting provider, they have access to your server logs and will be able to tell you where and why emails are being blocked.
60
+
61
+ Some hosting providers place a restriction on the maximum number of recipients in any one email message. For example, the venerable Dreamhost (http://www.dreamhost.com/) does not allow any message to contain more than 30 recipients.
62
+
63
+ Subscribe2 provides a facility to work around this restriction by sending batches of emails. To enable this feature, edit subscribe2.php in a text editor and go to line 35:
64
+ define('BCCLIMIT', 0);
65
+ Change the 0 to the number of allowed outgoing email recipients as set by your host.
66
+
67
+ Reminder: because subscribe2 places all recipients in BCC fields, and places the blog admin in the TO field, the blog admin will receive one email per batched delivery. So if you have 90 subscribers, the blog admin should receive three post notification emails, one for eah set of 30 BCC recipients.
68
+
69
+ Batches will occur for each group of message as described above. A site on Dreamhost with many public and registered subscribers could conceivably generate a lot of email for your own inbox.
70
+
71
+ == Screenshots ==
72
+
73
+ 1. The Write->Subscribers admin page generated by the plugin.
74
+ 2. The Manage->Subscribers admin page generated by the plugin.
75
+ 3. The Users->Subscriptions admin page generated by the plugin.
76
+ 4. The Options->Subscribe2 admin page generated by the plugin.
77
+
78
+ == Version History ==
79
+
80
+ Version 3.0 by Matthew Robinson
81
+
82
+ * Updated for WordPress 2.1 Branch
83
+
84
+ Version 2.14 by Matthew Robinson
85
+
86
+ * Amended DREAMHOST setting to BCCLIMIT as more hosts are limiting emails
87
+ * Fixed oversight in upgrade() function
88
+
89
+ Version 2.13 by Matthew Robinson
90
+
91
+ * Added WordPress nonce functionality to improve admin security
92
+
93
+ Version 2.12 by Matthew Robinson
94
+
95
+ * Fix for missing Quicktags (probably since version 2.2.10)
96
+ * Fix for occasional email issue where excerpts are incomplete
97
+
98
+ Version 2.11 by Matthew Robinson
99
+ * Fixed bug that would cause all subscribers to get digest emails
100
+ * Added Select All check box to category listing
101
+
102
+ Version 2.10 by Matthew Robinson
103
+ * Improved sign up process by double checking email address
104
+ * Fix for submenu issues encountered in WP 2.0.6
105
+
106
+ Version 2.9 by Matthew Robinson
107
+
108
+ * Fixed get_userdata call issue
109
+ * Added CSV export
110
+ * Reworked options storage routines
111
+
112
+ Version 2.8 by Matthew Robinson
113
+
114
+ * Fixed missing line return in email headers that was causing failed emails
115
+ * Added user feedback messages to profile area
116
+ * Added 'Authorname' to the list of message substitutions in email messages
117
+ * Fixed name and email substitution in Digest Mails
118
+ * Fixed stripslashes issue in email subjects
119
+ * Added new 'Action' token for confirmation emails
120
+
121
+ Version 2.7 by Matthew Robinson
122
+
123
+ * Link to post in HTML emails is now functional
124
+ * Fixed bug in Bulk Management so it works when first loaded
125
+ * Ability to auto subscribe newly registering users
126
+ * Added additional email header information
127
+
128
+ Version 2.6 by Matthew Robinson
129
+
130
+ * Fixed email headers to comply with RFC2822 standard (after breaking them in the first place)
131
+ * Impoved XHTML compliance of user feedback messages and subscription form when presented on a blog
132
+ * Tidied up presentation of the code a little
133
+ * Cached some additional variables
134
+
135
+ Version 2.5 by Matthew Robinson
136
+
137
+ * Added functionality to Bulk Manage registered users subscriptions
138
+
139
+ Version 2.4 by Matthew Robinson
140
+
141
+ * Added functionality to block user specified domains from public subscription
142
+
143
+ Version 2.3 by Matthew Robinson
144
+
145
+ * Added functionality to allow for Subscribe2 Sidebar Widget
146
+ * Added functionality to block public email subscriptins from domains defined under Options
147
+ * Added functionality to send an email reminder to all unconfirmed public subscriber
148
+ * Added removal of html entities (for example &copy;) from plaintext emails
149
+ * Replaced spaces with tabs in Plugin format
150
+ * Minor changes to admin layout to match WordPress admin function layout
151
+
152
+ Version 2.2
153
+
154
+ * By Scott Merrill, see http://www.skippy.net/blog/category/wordpress/plugins/subscribe2/
buttonsnap.php ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*******************************************************************************
3
+ BUTTONSNAP CLASS LIBRARY By Owen Winkler
4
+ http://asymptomatic.net
5
+ WordPress Downloads are at http://redalt.com/downloads
6
+ Version: 1.3.1
7
+ *******************************************************************************/
8
+
9
+ if (!class_exists('buttonsnap')) :
10
+ class buttonsnap
11
+ {
12
+ var $script_output = false;
13
+ var $buttons = array('post'=>array(),'page'=>array(),'any'=>array());
14
+ var $markers = array();
15
+
16
+ function sink_hooks()
17
+ {
18
+ add_action('edit_form_advanced', array(&$this, 'edit_form_advanced'));
19
+ add_action('edit_page_form', array(&$this, 'edit_page_form'));
20
+ add_filter('mce_plugins', array(&$this, 'mce_plugins'));
21
+ }
22
+
23
+ function go_solo()
24
+ {
25
+ $dispatch = isset($_POST['buttonsnapdispatch']) ? $_POST['buttonsnapdispatch'] : @$_GET['buttonsnapdispatch'];
26
+ if($dispatch != '') {
27
+ auth_redirect();
28
+ $selection = isset($_POST['selection']) ? $_POST['selection'] : @$_GET['selection'];
29
+ $selection = apply_filters($dispatch, $selection);
30
+ die($selection);
31
+ }
32
+ if(isset($_GET['docss'])) {
33
+ auth_redirect();
34
+ do_action('marker_css');
35
+ die();
36
+ }
37
+ }
38
+
39
+ function edit_form_advanced()
40
+ {
41
+ if (!$this->script_output) {
42
+ $this->output_script('post');
43
+ $this->script_output = true;
44
+ }
45
+ }
46
+
47
+ function edit_page_form()
48
+ {
49
+ if (!$this->script_output) {
50
+ $this->output_script('page');
51
+ $this->script_output = true;
52
+ }
53
+ }
54
+
55
+ function mce_plugins($plugins)
56
+ {
57
+ if (count($this->markers) > 0) {
58
+
59
+ echo "var buttonsnap_markers = new Array(\n";
60
+ $comma = '';
61
+ foreach ($this->markers as $k => $v) {
62
+ echo "{$comma}\"{$k}\"";
63
+ $comma = "\n,";
64
+ }
65
+ echo "\n);\n";
66
+ echo "var buttonsnap_classes = new Array(\n";
67
+ $comma = '';
68
+ foreach ($this->markers as $k => $v) {
69
+ echo "{$comma}\"{$v}\"";
70
+ $comma = "\n,";
71
+ }
72
+ echo "\n);\n";
73
+
74
+ ?>
75
+
76
+ function TinyMCE_buttonsnap_initInstance(inst) {
77
+ tinyMCE.importCSS(inst.getDoc(), "<?php echo $this->plugin_uri(); ?>?docss=true");
78
+ }
79
+
80
+ function TinyMCE_buttonsnap_parseAttributes(attribute_string) {
81
+ var attributeName = "";
82
+ var attributeValue = "";
83
+ var withInName;
84
+ var withInValue;
85
+ var attributes = new Array();
86
+ var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
87
+ var titleText = tinyMCE.getLang('lang_buttonsnap_more');
88
+ var titleTextPage = tinyMCE.getLang('lang_buttonsnap_page');
89
+
90
+ if (attribute_string == null || attribute_string.length < 2)
91
+ return null;
92
+
93
+ withInName = withInValue = false;
94
+
95
+ for (var i=0; i<attribute_string.length; i++) {
96
+ var chr = attribute_string.charAt(i);
97
+
98
+ if ((chr == '"' || chr == "'") && !withInValue)
99
+ withInValue = true;
100
+ else if ((chr == '"' || chr == "'") && withInValue) {
101
+ withInValue = false;
102
+
103
+ var pos = attributeName.lastIndexOf(' ');
104
+ if (pos != -1)
105
+ attributeName = attributeName.substring(pos+1);
106
+
107
+ attributes[attributeName.toLowerCase()] = attributeValue.substring(1).toLowerCase();
108
+
109
+ attributeName = "";
110
+ attributeValue = "";
111
+ } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue)
112
+ withInName = true;
113
+
114
+ if (chr == '=' && withInName)
115
+ withInName = false;
116
+
117
+ if (withInName)
118
+ attributeName += chr;
119
+
120
+ if (withInValue)
121
+ attributeValue += chr;
122
+ }
123
+
124
+ return attributes;
125
+ }
126
+
127
+ function TinyMCE_buttonsnap_cleanup(type, content) {
128
+ switch (type) {
129
+ case "initial_editor_insert":
130
+ content = TinyMCE_buttonsnap_cleanup("insert_to_editor", content);
131
+ alert('foo');
132
+
133
+ break;
134
+
135
+ case "insert_to_editor":
136
+ var startPos = 0;
137
+
138
+ for(z=0;z<buttonsnap_markers.length;z++) {
139
+ var startPos = 0;
140
+ while ((startPos = content.indexOf('<!--' + buttonsnap_markers[z] + '-->', startPos)) != -1) {
141
+ // Insert image
142
+ var contentAfter = content.substring(startPos + 7 + buttonsnap_markers[z].length);
143
+ content = content.substring(0, startPos);
144
+ content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
145
+ content += ' width="100%" height="10px" ';
146
+ content += 'alt="" class="' + buttonsnap_classes[z] + '" />';
147
+ content += contentAfter;
148
+
149
+ startPos++;
150
+ }
151
+ }
152
+ break;
153
+
154
+ case "get_from_editor":
155
+ var startPos = -1;
156
+ while ((startPos = content.indexOf('<img', startPos+1)) != -1) {
157
+ var endPos = content.indexOf('/>', startPos);
158
+ var attribs = TinyMCE_buttonsnap_parseAttributes(content.substring(startPos + 4, endPos));
159
+
160
+ for(z=0;z<buttonsnap_classes.length;z++) {
161
+ if (attribs['class'] == buttonsnap_classes[z]) {
162
+ endPos += 2;
163
+
164
+ var embedHTML = '<!--' + buttonsnap_markers[z] + '-->';
165
+
166
+ // Insert embed/object chunk
167
+ chunkBefore = content.substring(0, startPos);
168
+ chunkAfter = content.substring(endPos);
169
+ content = chunkBefore + embedHTML + chunkAfter;
170
+ break;
171
+ }
172
+ }
173
+ }
174
+ break;
175
+ }
176
+
177
+ return content;
178
+ }
179
+
180
+ <?php
181
+ $plugins[] = 'buttonsnap';
182
+ }
183
+ return $plugins;
184
+ }
185
+
186
+ function output_script($type = 'any')
187
+ {
188
+ echo '<script type="text/javascript">
189
+ var buttonsnap_request_uri = "' . $this->plugin_uri() . '";
190
+ var buttonsnap_wproot = "' . get_settings('siteurl') . '";
191
+ </script>' . "\n";
192
+ echo <<< ENDSCRIPT
193
+
194
+ <script type="text/javascript">
195
+ addLoadEvent(function () { window.setTimeout('buttonsnap_addbuttons()',1000); });
196
+ var buttonsnap_mozilla = document.getElementById&&!document.all;
197
+ function buttonsnap_safeclick(e)
198
+ {
199
+ if(!buttonsnap_mozilla) {
200
+ e.returnValue = false;
201
+ e.cancelBubble = true;
202
+ }
203
+ }
204
+ function buttonsnap_addEvent( obj, type, fn )
205
+ {
206
+ if (obj.addEventListener)
207
+ obj.addEventListener( type, fn, false );
208
+ else if (obj.attachEvent)
209
+ {
210
+ obj["e"+type+fn] = fn;
211
+ obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
212
+ obj.attachEvent( "on"+type, obj[type+fn] );
213
+ }
214
+ }
215
+ function buttonsnap_newbutton(src, alt) {
216
+ if(window.tinyMCE) {
217
+ var anchor = document.createElement('A');
218
+ anchor.setAttribute('href', 'javascript:;');
219
+ anchor.setAttribute('title', alt);
220
+ var newimage = document.createElement('IMG');
221
+ newimage.setAttribute('src', src);
222
+ newimage.setAttribute('alt', alt);
223
+ newimage.setAttribute('class', 'mceButtonNormal');
224
+ buttonsnap_addEvent(newimage, 'mouseover', function() {tinyMCE.switchClass(this,'mceButtonOver');});
225
+ buttonsnap_addEvent(newimage, 'mouseout', function() {tinyMCE.switchClass(this,'mceButtonNormal');}); //restoreClass(this)
226
+ buttonsnap_addEvent(newimage, 'mousedown', function() {tinyMCE.restoreAndSwitchClass(this,'mceButtonDown');});
227
+ anchor.appendChild(newimage);
228
+ brs = mcetoolbar.getElementsByTagName('BR');
229
+ if(brs.length > 0)
230
+ mcetoolbar.insertBefore(anchor, brs[0]);
231
+ else
232
+ mcetoolbar.appendChild(anchor);
233
+ }
234
+ else if(window.qttoolbar)
235
+ {
236
+ var anchor = document.createElement('input');
237
+ anchor.type = 'button';
238
+ anchor.value = alt;
239
+ anchor.className = 'ed_button';
240
+ anchor.title = alt;
241
+ anchor.id = 'ed_' + alt;
242
+ qttoolbar.appendChild(anchor);
243
+ }
244
+ return anchor;
245
+ }
246
+ function buttonsnap_newseparator() {
247
+ if(window.tinyMCE) {
248
+ var sep = document.createElement('IMG');
249
+
250
+ sep.setAttribute('src', buttonsnap_wproot + '/wp-includes/js/tinymce/themes/advanced/images/spacer.gif');
251
+ sep.className = 'mceSeparatorLine';
252
+ sep.setAttribute('class', 'mceSeparatorLine');
253
+ sep.setAttribute('height', '16');
254
+ sep.setAttribute('width', '1');
255
+ brs = mcetoolbar.getElementsByTagName('BR');
256
+ if(brs.length > 0)
257
+ mcetoolbar.insertBefore(sep, brs[0]);
258
+ else
259
+ mcetoolbar.appendChild(sep);
260
+ }
261
+ }
262
+ function buttonsnap_settext(text) {
263
+ if(window.tinyMCE) {
264
+ window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, text);
265
+ tinyMCE.execCommand("mceCleanup");
266
+ } else {
267
+ edInsertContent(edCanvas, text);
268
+ }
269
+ }
270
+ function buttonsnap_ajax(dispatch) {
271
+ if(window.tinyMCE) {
272
+ selection = tinyMCE.getInstanceById('content').getSelectedText();
273
+ }
274
+ else {
275
+ if (document.selection) {
276
+ document.getElementById('content').focus();
277
+ sel = document.selection.createRange();
278
+ if (sel.text.length > 0) {
279
+ selection = sel.text;
280
+ }
281
+ else {
282
+ selection = '';
283
+ }
284
+ }
285
+ else {
286
+ selection = '';
287
+ }
288
+ }
289
+
290
+ var ajax = new sack(buttonsnap_request_uri);
291
+ ajax.setVar('buttonsnapdispatch', dispatch);
292
+ ajax.setVar('selection', selection);
293
+ ajax.onCompletion = function () {buttonsnap_settext(this.response);};
294
+ ajax.runAJAX();
295
+ }
296
+ var mcetoolbar;
297
+ var qttoolbar = document.getElementById("ed_toolbar");
298
+ function buttonsnap_addbuttons () {
299
+ if(window.tinyMCE) {
300
+ try {
301
+ var edit = document.getElementById(window.tinyMCE.getEditorId('content'));
302
+ for(table = edit;table.tagName != 'TABLE';table = table.parentNode);
303
+ mcetoolbar = table.rows[0].firstChild;
304
+ }
305
+ catch(e) {
306
+ setTimeout('buttonsnap_addbuttons()', 5000);
307
+ return;
308
+ }
309
+ }
310
+ try {
311
+ ENDSCRIPT;
312
+
313
+ switch($type) {
314
+ case 'any':
315
+ $this->buttons['any'] = array_merge($this->buttons['post'], $this->buttons['page'], $this->buttons['any']);
316
+ break;
317
+ default:
318
+ $this->buttons[$type] = array_merge($this->buttons[$type], $this->buttons['any']);
319
+ }
320
+ $usebuttons = $this->buttons[$type];
321
+
322
+ foreach ($usebuttons as $button) {
323
+ if($button['type'] == 'separator') {
324
+ echo "buttonsnap_newseparator();\n";
325
+ }
326
+ else {
327
+ echo "newbtn = buttonsnap_newbutton('{$button['src']}', '{$button['alt']}');\n";
328
+ switch($button['type']) {
329
+ case 'text':
330
+ echo "buttonsnap_addEvent(newbtn, 'click', function(e) {buttonsnap_settext(\"{$button['text']}\");buttonsnap_safeclick(e);});\n";
331
+ break;
332
+ case 'js':
333
+ echo "buttonsnap_addEvent(newbtn, 'click', function(e) {" . $button['js'] . "buttonsnap_safeclick(e);});\n";
334
+ break;
335
+ case 'ajax':
336
+ echo "buttonsnap_addEvent(newbtn, 'click', function(e) {buttonsnap_ajax(\"{$button['hook']}\");buttonsnap_safeclick(e);});\n";
337
+ break;
338
+ default:
339
+ echo "buttonsnap_addEvent(newbtn, 'click', function(e) {alert(\"The :{$button->type}: button is an invalid type\");buttonsnap_safeclick(e);});\n";
340
+ }
341
+ }
342
+ }
343
+ echo <<< MORESCRIPT
344
+ }
345
+ catch(e) {
346
+ setTimeout('buttonsnap_addbuttons()', 5000);
347
+ }
348
+ }
349
+ </script>
350
+
351
+ MORESCRIPT;
352
+ }
353
+
354
+ function textbutton($imgsrc, $alttext, $inserted, $type="any")
355
+ {
356
+ $this->buttons[$type][] = array('type'=>'text', 'src'=>$imgsrc, 'alt'=>$alttext, 'text'=>$inserted);
357
+ return $this->buttons;
358
+ }
359
+
360
+ function jsbutton($imgsrc, $alttext, $js, $type="any")
361
+ {
362
+ $this->buttons[$type][] = array('type'=>'js', 'src'=>$imgsrc, 'alt'=>$alttext, 'js'=>$js);
363
+ return $this->buttons;
364
+ }
365
+
366
+ function ajaxbutton($imgsrc, $alttext, $hook, $type="any")
367
+ {
368
+ $this->buttons[$type][] = array('type'=>'ajax', 'src'=>$imgsrc, 'alt'=>$alttext, 'hook'=>$hook);
369
+ return $this->buttons;
370
+ }
371
+
372
+ function separator($type="any")
373
+ {
374
+ $this->buttons[$type][] = array('type'=>'separator');
375
+ return $this->buttons;
376
+ }
377
+
378
+ function register_marker($marker, $cssclass)
379
+ {
380
+ $this->markers[$marker] = $cssclass;
381
+ }
382
+
383
+ function basename($src='')
384
+ {
385
+ if($src == '') $src = __FILE__;
386
+ $name = preg_replace('/^.*wp-content[\\\\\/]plugins[\\\\\/]/', '', $src);
387
+ return str_replace('\\', '/', $name);
388
+ }
389
+
390
+ function plugin_uri($src = '')
391
+ {
392
+ return get_settings('siteurl') . '/wp-content/plugins/' . $this->basename($src);
393
+ }
394
+
395
+ function include_up($filename) {
396
+ $c=0;
397
+ while(!is_file($filename)) {
398
+ $filename = '../' . $filename;
399
+ $c++;
400
+ if($c==30) {
401
+ echo 'Could not find ' . basename($filename) . '.'; return '';
402
+ }
403
+ }
404
+ return $filename;
405
+ }
406
+
407
+ function debug($foo)
408
+ {
409
+ $args = func_get_args();
410
+ echo "<pre style=\"background-color:#ffeeee;border:1px solid red;\">";
411
+ foreach($args as $arg1)
412
+ {
413
+ echo htmlentities(print_r($arg1, 1)) . "<br/>";
414
+ }
415
+ echo "</pre>";
416
+ }
417
+ }
418
+ $buttonsnap = new buttonsnap();
419
+ function buttonsnap_textbutton($imgsrc, $alttext, $inserted, $type="any") { global $buttonsnap; return $buttonsnap->textbutton($imgsrc, $alttext, $inserted, $type);}
420
+ function buttonsnap_jsbutton($imgsrc, $alttext, $js, $type="any") { global $buttonsnap; return $buttonsnap->jsbutton($imgsrc, $alttext, $js, $type);}
421
+ function buttonsnap_ajaxbutton($imgsrc, $alttext, $hook, $type="any") { global $buttonsnap; return $buttonsnap->ajaxbutton($imgsrc, $alttext, $hook, $type);}
422
+ function buttonsnap_separator($type="any") { global $buttonsnap; return $buttonsnap->separator($type);}
423
+
424
+ function buttonsnap_textbutton_post($imgsrc, $alttext, $inserted) { global $buttonsnap; return $buttonsnap->textbutton($imgsrc, $alttext, $inserted, 'post');}
425
+ function buttonsnap_jsbutton_post($imgsrc, $alttext, $js) { global $buttonsnap; return $buttonsnap->jsbutton($imgsrc, $alttext, $js, 'post');}
426
+ function buttonsnap_ajaxbutton_post($imgsrc, $alttext, $hook) { global $buttonsnap; return $buttonsnap->ajaxbutton($imgsrc, $alttext, $hook, 'post');}
427
+ function buttonsnap_separator_post() { global $buttonsnap; return $buttonsnap->separator('post');}
428
+
429
+ function buttonsnap_textbutton_page($imgsrc, $alttext, $inserted) { global $buttonsnap; return $buttonsnap->textbutton($imgsrc, $alttext, $inserted, 'page');}
430
+ function buttonsnap_jsbutton_page($imgsrc, $alttext, $js) { global $buttonsnap; return $buttonsnap->jsbutton($imgsrc, $alttext, $js, 'page');}
431
+ function buttonsnap_ajaxbutton_page($imgsrc, $alttext, $hook) { global $buttonsnap; return $buttonsnap->ajaxbutton($imgsrc, $alttext, $hook, 'page');}
432
+ function buttonsnap_separator_page() { global $buttonsnap; return $buttonsnap->separator('page');}
433
+
434
+ function buttonsnap_dirname($src = '') {global $buttonsnap; return dirname($buttonsnap->plugin_uri($src));}
435
+ function buttonsnap_register_marker($marker, $cssclass) {global $buttonsnap; return $buttonsnap->register_marker($marker, $cssclass);}
436
+ endif;
437
+ if (!defined('ABSPATH')) {
438
+ require_once($buttonsnap->include_up('wp-config.php'));
439
+ $buttonsnap->go_solo();
440
+ }
441
+ else {
442
+ $buttonsnap->sink_hooks();
443
+ }
444
+
445
+ ?>
subscribe.php DELETED
@@ -1,259 +0,0 @@
1
- <?php
2
-
3
- // Subscribe2
4
- // Copyright 2004 Scott Merrill skippy@skippy.net
5
- // Distributed under the terms of the GNU Public License
6
- // http://www.gnu.org/copyleft/gpl.html
7
-
8
- require_once('./wp-blog-header.php');
9
- $admin = get_userdata(1);
10
-
11
- $s2 = get_option('s2_options');
12
-
13
- $domain = 'subscribe2';
14
- $locale = get_locale();
15
- $mofile = ABSPATH . "wp-content/plugins/$domain-$locale.mo";
16
- load_textdomain($domain, $mofile);
17
-
18
- // the database table to use
19
- $s2_table = $table_prefix . "subscribe2";
20
-
21
- $email = (isset($_POST['email'])) ? $_POST['email'] : '';
22
- $action = (isset($_POST['action'])) ? $_POST['action'] : '';
23
- $hash = (isset($_GET['x'])) ? $_GET['x'] : '';
24
-
25
- if ('' != $hash) {
26
- $foo = explode('x', $hash);
27
- $action = $foo[0];
28
- $id = intval($foo[2]);
29
- $sql = "SELECT email FROM " . $s2_table . " WHERE id='" . $id . "'";
30
- $email = $wpdb->get_var($sql);
31
- if ('' == $email) {
32
- main('invalid');
33
- }
34
- if ('a' == $action) {
35
- $result = s2_check($email);
36
- if ('0' === $result) {
37
- main('not_there');
38
- } elseif ($result > 1) {
39
- s2_confirm($email);
40
- main('added');
41
- } else {
42
- main('already_there');
43
- }
44
- } elseif ('d' == $action) {
45
- s2_delete($email);
46
- main('deleted');
47
- } else {
48
- // safety valve
49
- main();
50
- }
51
- }
52
-
53
- if ( ('' != $action) && ( ('' == $email) || (! is_email($email)) )) {
54
- main('invalid');
55
- }
56
-
57
- if ( strtolower($admin->user_email) == strtolower($email) ) {
58
- main('self');
59
- }
60
-
61
- if ('add' == $action) {
62
- $result = s2_check($email);
63
- if ( ($result == 1) || ($result > date('Y-m-d', strtotime('-1 day'))) ) {
64
- main('already_there');
65
- }
66
- s2_add($email, $result);
67
- s2_send_confirmation ($email, 'add');
68
- main('add_confirm');
69
- } elseif ('delete' == $action) {
70
- if ('0' === s2_check($email)) {
71
- main('not_there');
72
- }
73
- s2_send_confirmation ($email, 'delete');
74
- main('delete_confirm');
75
- } else {
76
- main();
77
- }
78
-
79
- /////////////////
80
- // *** main() ***
81
- // display the main page
82
- /////////////////
83
- function main($doing = '') {
84
- global $s2;
85
-
86
- // Display the page
87
- get_header();
88
- get_sidebar();
89
- // display a message, depending on what was passed to main()
90
- if ('' == $doing) {
91
- $doing = 'welcome';
92
- }
93
- echo '<div id="content" class="narrowcolumn"><div class="post"><p>' . stripslashes($s2["s2_$doing"]) . "</p>\r\n";
94
- if ( ('not_there' == $doing) || ('already_there' == $doing) || ('self' == $doing) || ('invalid' == $doing) || ('welcome' == $doing) ) {
95
- echo '<form method="post" action="' . get_bloginfo('home') . '/subscribe.php"><p>';
96
- echo __('Your email', 'subscribe2') . ':&#160;<input type="text" name="email" value="" size="20" />&#160;<br />';
97
- echo '<input type="radio" name="action" value="add" checked="checked" />' . __('subscribe', 'subscribe2') . "\r\n";
98
- echo '<input type="radio" name="action" value="delete" />' . __('unsubscribe', 'subscribe2') . "&#160;\r\n";
99
- echo '<input type="submit" value="' . __('Send', 'subscribe2') . '!" />';
100
- echo "</p></form>\r\n";
101
- }
102
- echo '<p><strong>' . __('Note', 'subscribe2') . ':</strong> ' . get_settings('blogname') . ' ' . __('values personal privacy', 'subscribe2') . '.<br />';
103
- _e('This list is used solely to inform you when new posts are added.', 'subscribe2');
104
- echo "<br />\r\n";
105
- _e('Your email address will not be shared with any other party', 'subscribe2');
106
- echo ".</p>\r\n";
107
- echo '<p><a href="' . get_settings('siteurl') . '">' . __('Return to ', 'subscribe2') . get_settings('blogname') . "</a></p>\r\n";
108
- echo "</div></div>\r\n";
109
-
110
- get_footer();
111
- die;
112
- } // main()
113
-
114
- ////////////////////
115
- // *** s2_check() ***
116
- // check whether an email address exists in the database
117
- // return values:
118
- // 0 == not present
119
- // 1 == present, and confirmed
120
- // YYY-MM-DD == present, and not confirmed (date of subscription)
121
- ////////////////////
122
- function s2_check ($email = '') {
123
- global $wpdb, $s2_table;
124
-
125
- if ( ('' == $email) || (! is_email($email)) ) {
126
- // no valid email, so bail out
127
- return '0';
128
- }
129
- $query = "SELECT * FROM " . $s2_table . " WHERE email='" . $email . "'";
130
- $foo = $wpdb->get_row($query);
131
-
132
- if ('1' === $foo->active) {
133
- return '1';
134
- } elseif ('0' === $foo->active) {
135
- return $foo->date;
136
- } else {
137
- return '0';
138
- }
139
- } // s2_check
140
-
141
- ///////////////////
142
- // *** s2_add() ***
143
- // add an email address to the database with a status of "0" (unconfirmed)
144
- ///////////////////
145
- function s2_add ($email = '', $status = '0') {
146
- global $wpdb, $s2_table;
147
- if ( ('' == $email) || (! is_email($email)) ) {
148
- // no valid email, so bail out
149
- return;
150
- }
151
-
152
- if ($status > 1) {
153
- // this is a known unconfirmed address
154
- // update their timestamp because we're sending them a new
155
- // confirmation email
156
- $sql = "UPDATE $s2_table SET date = '" . date('Y-m-d') . "' WHERE email = '$email'";
157
- $result = $wpdb->query($sql);
158
- return;
159
- }
160
-
161
- // add this address
162
- $sql = "INSERT INTO $s2_table (email, active, date) VALUES ('$email', '0', '" . date('Y-m-d') . "')";
163
- $result = $wpdb->query($sql);
164
- } // s2_add
165
-
166
- ///////////////////////
167
- // *** s2_confirm() ***
168
- // change the status of an email address in the database to "1" (confirmed)
169
- ///////////////////////
170
- function s2_confirm ($email = '') {
171
- global $s2, $wpdb, $s2_table;
172
-
173
- if ( ('' == $email) || (! is_email($email)) ) {
174
- // no valid email, so bail out
175
- return;
176
- }
177
-
178
- $admin = get_userdata(1);
179
-
180
- if (s2_check($email) > 1) {
181
- $sql = "UPDATE " . $s2_table . " SET active = '1' WHERE email = '" . $email . "'";
182
- $result = $wpdb->query($sql);
183
- $mailtext = __('The following email address has successfully subscribed to your blog', 'subscribe2') . ":\n\n $email\n";
184
- $mailheaders = "From: \"$admin->user_nickname\" <$admin->user_email>\n";
185
- $mailheaders .= "MIME-Version: 1.0\n";
186
- $mailheaders .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";;
187
- @wp_mail($admin->user_email, stripslashes($s2['s2_subscribed_admin_subject']), $mailtext, $mailheaders);
188
- }
189
- } // s2_confirm
190
-
191
- //////////////////////
192
- // *** s2_delete() ***
193
- // remove an email address from the database
194
- //////////////////////
195
- function s2_delete ($email = '') {
196
- global $s2, $wpdb, $s2_table;
197
-
198
- if ( ('' == $email) || (! is_email($email)) ) {
199
- // no valid email, so bail out
200
- return;
201
- }
202
- if ('0' === s2_check($email)) {
203
- // user does not exist, bail out
204
- return;
205
- }
206
- $sql = "DELETE FROM " . $s2_table . " WHERE email = '" . $email . "'";
207
- $result = $wpdb->query($sql);
208
-
209
- $admin = get_userdata(1);
210
-
211
- $mailtext = __('The following email address has successfully unsubscribed from your blog', 'subscribe2') . ":\n\n $email\n";
212
- $mailheaders = "From: \"$admin->user_nickname\" <$admin->user_email>\n";
213
- $mailheaders .= "MIME-Version: 1.0\n";
214
- $mailheaders .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
215
- @wp_mail($admin->user_email, $s2['s2_unsubscribed_admin_subject'], $mailtext, $mailheaders);
216
- } // s2_delete
217
-
218
- ///////////////////////////
219
- // *** s2_send_confirmaion() ***
220
- // send a confirmation email to an address
221
- ///////////////////////////
222
- function s2_send_confirmation ($email = '', $action = '') {
223
- global $wpdb, $s2_table, $s2;
224
-
225
- if ( ('' == $email) || (! is_email($email)) || ('' == $action) ) {
226
- // no valid email or action, so bail out
227
- return;
228
- }
229
-
230
- $sql = "SELECT id FROM " . $s2_table . " WHERE email = '" . $email . "'";
231
- $id = $wpdb->get_var($sql);
232
-
233
- if ('add' == $action) {
234
- // link to confirm their address
235
- $link = get_settings('siteurl') . "/" . basename($_SERVER['PHP_SELF']) . "?x=ax" . md5($email) . "x" . $id;
236
- } elseif ('delete' == $action) {
237
- // link to confirm their address
238
- $link = get_settings('siteurl') . "/" . basename($_SERVER['PHP_SELF']) . "?x=dx" . md5($email) . "x" . $id;
239
- }
240
-
241
- $admin = get_userdata(1);
242
-
243
- $body = stripslashes(str_replace("LINK", $link, $s2['s2_confirm_email']));
244
- $body = str_replace("BLOGNAME", get_settings('blogname'), $body);
245
- $body = str_replace("MYNAME", $admin->user_nickname, $body);
246
- $body = str_replace("EMAIL", $admin->user_email, $body);
247
-
248
- $subject = stripslashes(str_replace("BLOGNAME", get_settings('blogname'), $s2['s2_confirm_subject']));
249
- $subject = str_replace("MYNAME", $admin->user_nickname, $subject);
250
- $subject = str_replace("EMAIL", $admin->user_email, $subject);
251
-
252
- $mailheaders .= "MIME-Version: 1.0\n";
253
- $mailheaders .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
254
- $mailheaders = "From: $admin->user_nickname <$admin->user_email>";
255
-
256
- mail ($email, $subject, $body, $mailheaders);
257
- } // s2_send_confirmation()
258
-
259
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
subscribe2.CHANGELOG DELETED
@@ -1,84 +0,0 @@
1
- Changelog:
2
- 2.1.6
3
- fix some header issues
4
- If sending Excerpts, and the excerpt is empty, use the text before a <!--more--> tag, if present -- thanks Gene! (http://www.terrik.com/)
5
- 2.1.5
6
- work about the postcache bug in WordPress 1.5.1.3 and below
7
- 2.1.4
8
- more i18n fixes
9
- 2.1.3
10
- finally (!) updated to use whatever value is used for the author/admin display name, as defined by "How to display name:" in the user's Profile.
11
- 2.1.2
12
- tidied up i18n: made HTML form submit buttons translatable
13
- 2.1.1
14
- more i18n
15
- 2.1.0
16
- fresh i18n effort: /wp-content/subscribe2/ contains the .mo and .po files
17
- both subscribe2.php and subscribe.php are translatable: place the appropriate .po file in the same directory as the source file for which it provides the translation
18
- 2.0.9
19
- added editable subject line when sending an email to all subscribers
20
- 2.0.8
21
- fixed batch logic
22
- 2.0.7
23
- fixed broken comment
24
- 2.0.6
25
- added $dreamhost manual override to force batched notification delivery
26
- thanks to Wade Emmert and Joe Mezzanini (http://themezz.com/) for their help
27
- added Content-Type text/plain for plaintext mail delivery.
28
- thanks to Toto:
29
- http://www.skippy.net/blog/2005/02/17/subscribe2/#comment-2059
30
- 2.0.5
31
- added strip_tags() to plaintext email delivery, to remove HTML from post content
32
- added date check to suppress sending notification on future-dated posts
33
-
34
- 2.0.4
35
- fixed a typo which broke sending excerpts -- Thanks MarcoB!
36
-
37
- 2.0.3
38
- added __() and _e(), plus subscribe2.po for localization
39
- added stripslashes to (I hope!) all output
40
- 2.0.2
41
- beautified output of categories to exlude
42
-
43
- 2.0.1
44
- minor form fixes -- thanks Matt Read
45
-
46
- 2.0.0
47
- major overhaul.
48
- using new admin menu hooks
49
- added Options page for web-based control of all messages
50
- added HTML email support
51
-
52
- 1.5.6:
53
- tightened up check against our own email; now only checks for an exact match against the admin email as defined in the blog options.
54
- updated description of $categories_to_skip to indicate that category IDs should be entered
55
-
56
- 1.5.5:
57
- fixed error handling when blank or invalid emails are passed to subscribe.php
58
- fixed name used to sign email messages sent from subscribe.php: now using the admin account (user ID 1) email and nicename
59
-
60
- 1.5.4:
61
- fixed s2_style() to check for 1.5, which should fix it for 1.2 again. Sorry 'bout that.
62
-
63
- 1.5.3:
64
- fixed s2_style() to only include the style when loading the Subscriber management page adjusted subscribe.php to (hopefully) utilize the active theme (WordPress 1.5+ only)
65
-
66
- 1.5.2:
67
- fixed subscribe.php link generation (thanks Anthony: http://www.anthonyemigration.net/)
68
- added check before including upgrade-functions.php (thanks Indi: http://www.indi.ca/)
69
- added $categories_to_skip to allow bypass of email for certain categories
70
- added email notification to admin on successful (un)subscribe operation
71
-
72
- 1.5.1:
73
- fixed problem for 1.2 users
74
-
75
- 1.5:
76
- integrated management into WordPress admin section
77
-
78
- 1.1:
79
- added is_array() checks to suppress spurious PHP warnings (thanks aalex: www.sourcelibre.com)
80
- fixed broken $form calls (d'oh)
81
-
82
- 1.0:
83
- first version
84
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
subscribe2.README DELETED
@@ -1,62 +0,0 @@
1
- == subscribe2 ==
2
-
3
- Tags: subscribe, email
4
- copyright (c) 2004 Scott Merrill
5
- skippy@skippy.net | http://skippy.net/
6
- Released under the terms of the GNU General Public License.
7
- Distributed with no warranty. Use it at your own risk.
8
-
9
- This plugin provides a comprehensive subscription management system for WordPress blogs. Visitors can subscribe and unsubscribe through a convenient web-based form. All requests require confirmation by email.
10
- Administators can configure the email template used for new post notifications, as well the messages used for (un)subscription requests. Admins can also subscribe or unsubscribe users, as well as send out an email to all confirmed subscribers.
11
-
12
- == INSTALLATION ==
13
-
14
- 1) Copy the subscribe2.php file into your /wp-content/plugins/ directory.
15
- 2) Copy the subscribe.php file to the root of your WordPress installation.
16
- 3) Activate the plugin.
17
- 4) Click the "Options" admin menu link, and select "Subscribe2".
18
- 5) Configure the options to taste, including the email template and messages displayed to subscribers.
19
- 6) Click the "Manage" admin menu link, and select "Subscribers".
20
- 7) Manually subscribe people as you see fit.
21
- 8) Add a link somewhere in your template to subscribe.php:
22
-
23
- <a href="/subscribe.php">Sign up for email notifications whenever my blog is updated!</a>
24
-
25
- You can use the WordPress Links manager for this, if you'd prefer.
26
-
27
- ***********************
28
- ** AN IMPORTANT NOTE **
29
- ***********************
30
- Some hosting providers place a restriction on the maximum number of recipients in any one email message. For example, the venerable Dreamhost (http://www.dreamhost.com/) does not allow any message to contain more than 30 recipients.
31
-
32
- Previous versions of this plugin would simlpy fail to work correctly if your subscriber list was larger than the maximum number of permitted recipients: the mail server would gobble up the post notification and no one would ever receive the message.
33
-
34
- Starting with version 2.0.6, subscribe2.php now includes a variable, $dreamhost, which is declared at the very top of the script. By default, this variable is 0 (zero). If you change the zero to 1 (one), subscribe2 will now batch post notification messages for 30 (thirty) recipients at a time. If your host is even more restrictive than Dreamhost, simply change all instances of "30" to a lower value that will work.
35
-
36
- To enable this batch operation, edit the file subscribe2.php, move to line 14, and change the 0 to 1. Save the file. You're done.
37
-
38
- Reminder: because subscribe2 places all recipients in BCC fields, and places the blog admin in the TO field, the blog admin will receive one email per batched delivery. So if you have 90 subscribers, the blog admin should receive three post notification emails, one for eah set of 30 BCC recipients.
39
-
40
- Many thanks to Wade Emmert and Joe Messanini for their patience and their assistance in testing this new functionality.
41
-
42
- == TRANSLATION ==
43
- Using the files in /wp-content/subscribe2/ you can translate the text that this plugin displays. Create a subscribe2-xx_XX.po and subscribe2-xx_XX.mo file (where xx_XX is your langauge locale) and place these files in /wp-content/plugins/. subscribe2 will should immediately begin using the translated text you supply.
44
-
45
- The .mo file you create or download will provide translations for both the WordPress administration screens, as well as the user subscription page.
46
-
47
- See here for additional localization information:
48
- http://codex.wordpress.org/Localizing_WordPress
49
-
50
- == Frequently Asked Questions ==
51
- Q. No emails are sent!
52
- A. In the overwhelming majority of cases so far, this is caused by spam filters at the recipient end incorrectly flagging messages as spam. Feel free to contact me if you feel something else is going on.
53
-
54
- Q. The subscribe form is way below my sidebar!
55
- A.edit subscribe.php and move the line:
56
- get_sidebar
57
- from the top to the bottom, just above
58
- get_footer
59
- Be sure to enclose it in <?php ?> as needed.
60
-
61
- Q. I posted an item dated for tomorrow, but no notification was sent!
62
- A. Future-dated posts do not generate notification emails.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
subscribe2/include.php ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // include.php - Handles options and common functions for subscribe2
3
+ // DO NOT EDIT THIS FILE AS IT IS SET BY THE OPTIONS PAGE
4
+
5
+ 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['autoformat'])) {
10
+ $this->subscribe2_options['autoformat'] = "text";
11
+ } // option for default auto-subscription email format
12
+
13
+ if (!isset($this->subscribe2_options['exclude'])) {
14
+ $this->subscribe2_options['exclude'] = "";
15
+ } // option for excluded categories
16
+
17
+ if (!isset($this->subscribe2_options['sender'])) {
18
+ $this->subscribe2_options['sender'] = "author";
19
+ } // option for email notification sender
20
+
21
+ // reg_override : allow registered users to subscribed to excluded cats
22
+ if (!isset($this->subscribe2_options['reg_override'])) {
23
+ $this->subscribe2_options['reg_override'] = "1";
24
+ } // option for excluded categories to be overriden for registered users
25
+
26
+ if (!isset($this->subscribe2_options['show_button'])) {
27
+ $this->subscribe2_options['show_button'] = "1";
28
+ } // option to show Subscribe2 button on Write page
29
+
30
+ if (!isset($this->subscribe2_options['barred'])) {
31
+ $this->subscribe2_options['barred'] = '';
32
+ } // option containing domains barred from public registration
33
+
34
+ if (!isset($this->subscribe2_options['email_freq'])) {
35
+ $this->subscribe2_options['email_freq'] = "never";
36
+ } // option for sending emails periodically or per-post
37
+
38
+ if (!isset($this->subscribe2_options['mailtext'])) {
39
+ $this->subscribe2_options['mailtext'] = "BLOGNAME has posted a new item, 'TITLE'\r\nPOST\r\nYou may view the latest post at\r\nPERMALINK\r\nYou received this e-mail because you asked to be notified when new updates are posted.\r\nBest regards,\r\nMYNAME\r\nEMAIL";
40
+ } // Default notification email text
41
+
42
+ if (!isset($this->subscribe2_options['confirm_email'])) {
43
+ $this->subscribe2_options['confirm_email'] = "BLOGNAME has received a request to ACTION for this email address. To complete your request please click on the link below:\n\nLINK\n\nIf you did not request this, please feel free to disregard this notice!\n\nThank you,\nMYNAME.";
44
+ } // Default confirmation email text
45
+
46
+ if (!isset($this->subscribe2_options['remind_email'])) {
47
+ $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";
48
+ } // Default reminder email text
49
+ ?>
subscribe2/s2_button.png ADDED
Binary file
subscribe2/s2_marker.png ADDED
Binary file
subscribe2/subscribe2.php ADDED
@@ -0,0 +1,2086 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Subscribe2
4
+ Plugin URI: http://subscribe2.wordpress.com
5
+ Description: Notifies an email list when new entries are posted.
6
+ Version: 2.3.1 for WP2.1
7
+ Author: Matthew Robinson
8
+ Author URI: http://subscribe2.wordpress.com
9
+ */
10
+
11
+ /*
12
+ Copyright (C) 2006-7 Matthew Robinson
13
+ Based on the Original Subscribe2 plugin by
14
+ Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
15
+
16
+ This program is free software; you can redistribute it and/or
17
+ modify it under the terms of the GNU General Public License
18
+ as published by the Free Software Foundation; either version 2
19
+ of the License, or (at your option) any later version.
20
+
21
+ This program is distributed in the hope that it will be useful,
22
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
23
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
+ GNU General Public License for more details.
25
+
26
+ You should have received a copy of the GNU General Public License
27
+ along with this program; if not, write to the Free Software
28
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29
+ http://www.gnu.org/licenses/gpl.html
30
+ */
31
+
32
+ // If you are on a host that limits the numner of recipients
33
+ // permitted on each outgoing email message
34
+ // change this value to your hosts limit
35
+ define('BCCLIMIT', '0');
36
+
37
+ // by default, subscribe2 grabs the first page from your database for use
38
+ // when displaying the confirmation screen to public subscribers.
39
+ // You can override this by specifying a page ID below.
40
+ define('S2PAGE', '0');
41
+
42
+ // our version number. Don't touch.
43
+ define('S2VERSION', '2.3.1');
44
+
45
+ // Add the Subscribe code into the WP API
46
+ add_action('init', 's2init');
47
+
48
+ // maybe add our button
49
+ $s2_options = array();
50
+ $s2_options = get_option('subscribe2_options');
51
+ if ('1' == $s2_options['show_button']) {
52
+ // use Owen's excellent ButtonSnap library
53
+ include(ABSPATH . '/wp-content/plugins/buttonsnap.php');
54
+ add_action('init', 's2_button_init');
55
+ add_action('marker_css', 'subscribe2_css');
56
+ }
57
+ unset($s2_options);
58
+
59
+ function s2init() {
60
+ global $subscribe2;
61
+ $mysubscribe2 = new subscribe2();
62
+ $mysubscribe2->subscribe2();
63
+ }
64
+
65
+ /* ===== ButtonSnap configuration ===== */
66
+ /**
67
+ Register our button in the QuickTags bar
68
+ */
69
+ function s2_button_init() {
70
+ $url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_button.png';
71
+ buttonsnap_textbutton($url, 'Subscribe2', '<!--subscribe2-->');
72
+ buttonsnap_register_marker('subscribe2', 's2_marker');
73
+ }
74
+
75
+ /**
76
+ Style a marker in the Rich Text Editor for our tag
77
+ By default, the RTE suppresses output of HTML comments, so this places a CSS style on our token in order to make it display
78
+ */
79
+ function subscribe2_css() {
80
+ $marker_url = get_settings('siteurl') . '/wp-content/plugins/subscribe2/s2_marker.png';
81
+ echo "
82
+ .s2_marker {
83
+ display: block;
84
+ height: 45px;
85
+ margin-top: 5px;
86
+ background-image: url({$marker_url});
87
+ background-repeat: no-repeat;
88
+ background-position: center;
89
+ }
90
+ ";
91
+ }
92
+
93
+ // start our class
94
+ class subscribe2 {
95
+ // variables and constructor are declared at the end
96
+
97
+ /**
98
+ Load all our strings
99
+ */
100
+ function load_strings() {
101
+ // adjust the output of Subscribe2 here
102
+
103
+ $this->please_log_in = "<p>" . __('To manage your subscription options please ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-login.php\">login</a>.</p>";
104
+
105
+ $this->use_profile_admin = "<p>" . __('You may manage your subscription options from your ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-admin/users.php?page=" . plugin_basename(__FILE__) . "\">profile</a>.</p>";
106
+
107
+ $this->use_profile_users = "<p>" . __('You may manage your subscription options from your ', 'subscribe2') . "<a href=\"" . get_settings('siteurl') . "/wp-admin/profile.php?page=" . plugin_basename(__FILE__) . "\">profile</a>.</p>";
108
+
109
+ $this->confirmation_sent = "<p>" . __('A confirmation message is on its way!', 'subscribe2') . "</p>";
110
+
111
+ $this->already_subscribed = "<p>" . __('That email address is already subscribed.', 'subscribe2') . "</p>";
112
+
113
+ $this->not_subscribed = "<p>" . __('That email address is not subscribed.', 'subscribe2') . "</p>";
114
+
115
+ $this->not_an_email = "<p>" . __('Sorry, but that does not look like an email address to me.', 'subscribe2') . "</p>";
116
+
117
+ $this->barred_domain = "<p>" . __('Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2') . "</p>";
118
+
119
+ $this->mail_sent = "<p>" . __('Message sent!', 'subscribe2') . "</p>";
120
+
121
+ $this->form = "<form method=\"post\" action=\"\">" . __('Your email:', 'subscribe2') . "&#160;<input type=\"text\" name=\"email\" value=\"\" size=\"20\" />&#160;<br /><input type=\"radio\" name=\"s2_action\" value=\"subscribe\" checked=\"checked\" /> " . __('Subscribe', 'subscribe2') . " <input type=\"radio\" name=\"s2_action\" value=\"unsubscribe\" /> " . __('Unsubscribe', 'subscribe2') . " &#160;<input type=\"submit\" value=\"" . __('Send', 'subscribe2') . "\" /></form>\r\n";
122
+
123
+ // confirmation messages
124
+ $this->no_such_email = "<p>" . __('No such email address is registered.', 'subscribe2') . "</p>";
125
+
126
+ $this->added = "<p>" . __('You have successfully subscribed!', 'subscribe2') . "</p>";
127
+
128
+ $this->deleted = "<p>" . __('You have successfully unsubscribed.', 'subscribe2') . "</p>";
129
+
130
+ $this->confirm_subject = "[" . get_settings('blogname') . "] " . __('Please confirm your request', 'subscribe2');
131
+
132
+ $this->remind_subject = "[" . get_settings('blogname') . "] " . __('Subscription Reminder', 'subscribe2');
133
+
134
+ $this->subscribe = __('subscribe', 'subscribe2'); //ACTION replacement in subscribing confirmation email
135
+
136
+ $this->unsubscribe = __('unsubscribe', 'subscribe2'); //ACTION replacement in unsubscribing in confirmation email
137
+
138
+ // menu strings
139
+ $this->options_saved = __('Options saved!', 'subscribe2');
140
+ $this->options_reset = __('Options reset!', 'subscribe2');
141
+ } // end load_strings()
142
+
143
+ /* ===== WordPress menu registration ===== */
144
+ /**
145
+ Hook the menu
146
+ */
147
+ function admin_menu() {
148
+ add_management_page(__('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), "manage_options", __FILE__, array(&$this, 'manage_menu'));
149
+ add_options_page(__('Subscribe2 Options', 'subscribe2'), __('Subscribe2','subscribe2'), "manage_options", __FILE__, array(&$this, 'options_menu'));
150
+ if (current_user_can('manage_options')) {
151
+ add_submenu_page('users.php', __('Subscriptions', 'subscribe2'), __('Subscriptions', 'subscribe2'), "read", __FILE__, array(&$this, 'user_menu'));
152
+ } else {
153
+ add_submenu_page('profile.php', __('Subscriptions', 'subscribe2'), __('Subscriptions', 'subscribe2'), "read", __FILE__, array(&$this, 'user_menu'));
154
+ }
155
+ add_submenu_page('post-new.php', __('Mail Subscribers','subscribe2'), __('Mail Subscribers', 'subscribe2'),"manage_options", __FILE__, array(&$this, 'write_menu'));
156
+ $s2nonce = md5('subscribe2');
157
+ }
158
+
159
+ /**
160
+ Insert Javascript into admin_header
161
+ */
162
+ function admin_head() {
163
+ echo "<script type=\"text/javascript\">\r\n";
164
+ echo "<!--\r\n";
165
+ echo "function setAll(theElement) {\r\n";
166
+ echo " var theForm = theElement.form, z = 0;\r\n";
167
+ echo " for(z=0; z<theForm.length;z++){\r\n";
168
+ echo " if(theForm[z].type == 'checkbox' && theForm[z].name == 'category[]'){\r\n";
169
+ echo " theForm[z].checked = theElement.checked;\r\n";
170
+ echo " }\r\n";
171
+ echo " }\r\n";
172
+ echo "}\r\n";
173
+ echo "-->\r\n";
174
+ echo "</script>\r\n";
175
+ }
176
+
177
+ function add_weekly_sched($sched) {
178
+ $sched['weekly'] = array('interval' => 604800, 'display' => __('Once Weekly','subscribe2'));
179
+ return $sched;
180
+ }
181
+
182
+ /* ===== Install, upgrade, reset ===== */
183
+ /**
184
+ Install our table
185
+ */
186
+ function install() {
187
+ // include upgrade-functions for maybe_create_table;
188
+ if (!function_exists('maybe_create_table')) {
189
+ require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
190
+ }
191
+ $date = date('Y-m-d');
192
+ $sql = "CREATE TABLE $this->public (
193
+ id int(11) NOT NULL auto_increment,
194
+ email varchar(64) NOT NULL default '',
195
+ active tinyint(1) default 0,
196
+ date DATE default '$date' NOT NULL,
197
+ PRIMARY KEY (id) )";
198
+
199
+ // create the table, as needed
200
+ maybe_create_table($this->public, $sql);
201
+ $this->reset();
202
+ } // end install()
203
+
204
+ /**
205
+ Upgrade the database
206
+ */
207
+ function upgrade() {
208
+ global $wpdb;
209
+
210
+ // include upgrade-functions for maybe_create_table;
211
+ if (!function_exists('maybe_create_table')) {
212
+ require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
213
+ }
214
+ $date = date('Y-m-d');
215
+ maybe_add_column($this->public, 'date', "ALTER TABLE `$this->public` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active`;");
216
+
217
+ // let's take the time to check process registered users
218
+ // existing public subscribers are subscribed to all categories
219
+ $users = $wpdb->get_col("SELECT ID FROM $wpdb->users");
220
+ if (!empty($users)) {
221
+ foreach ($users as $user) {
222
+ $this->register($user);
223
+ }
224
+ }
225
+ // update the options table to serialized format
226
+ $old_options = $wpdb->get_col("SELECT option_name from $wpdb->options where option_name LIKE 's2%' AND option_name != 's2_future_posts'");
227
+
228
+ if (!empty($old_options)) {
229
+ foreach ($old_options as $option) {
230
+ $value = get_option($option);
231
+ $option_array = substr($option, 3);
232
+ $this->subscribe2_options[$option_array] = $value;
233
+ delete_option($option);
234
+ }
235
+ }
236
+ $this->subscribe2_options['version'] = S2VERSION;
237
+ //double check that the options are in the database
238
+ require_once(ABSPATH . "/wp-content/plugins/subscribe2/include.php");
239
+ update_option('subscribe2_options', $this->subscribe2_options);
240
+ } // end upgrade()
241
+
242
+ /**
243
+ Reset our options
244
+ */
245
+ function reset() {
246
+ delete_option('subscribe2_options');
247
+ unset($this->subscribe2_options);
248
+ require(ABSPATH . "/wp-content/plugins/subscribe2/include.php");
249
+ update_option('subscribe2_options', $this->subscribe2_options);
250
+ } // end reset()
251
+
252
+ /* ===== mail handling ===== */
253
+ /**
254
+ Performs string substitutions for subscribe2 mail texts
255
+ */
256
+ function substitute($string = '') {
257
+ if ('' == $string) {
258
+ return;
259
+ }
260
+ $string = str_replace('BLOGNAME', get_settings('blogname'), $string);
261
+ $string = str_replace('BLOGLINK', get_bloginfo('url'), $string);
262
+ $string = str_replace('TITLE', stripslashes($this->post_title), $string);
263
+ $string = str_replace('PERMALINK', $this->permalink, $string);
264
+ $string = str_replace('MYNAME', stripslashes($this->myname), $string);
265
+ $string = str_replace('EMAIL', $this->myemail, $string);
266
+ $string = str_replace('AUTHORNAME', $this->authorname, $string);
267
+ return $string;
268
+ } // end sustitute()
269
+
270
+ /**
271
+ Delivers email to recipients in HTML or plaintext
272
+ */
273
+ function mail ($recipients = array(), $subject = '', $message = '', $type='text') {
274
+ if ( (empty($recipients)) || ('' == $message) ) { return; }
275
+
276
+ // Set sender details
277
+ if ('' == $this->myname) {
278
+ $admin = get_userdata(1);
279
+ $this->myname = $admin->display_name;
280
+ $this->myemail = $admin->user_email;
281
+ }
282
+ $headers = "From: $this->myname <$this->myemail>\n";
283
+ $headers .= "Return-Path: <$this->myemail>\n";
284
+ $headers .= "X-Mailer:PHP" . phpversion() . "\n";
285
+ $headers .= "Precedence: list\nList-Id: " . get_settings('blogname') . "\n";
286
+
287
+ if ('html' == $type) {
288
+ // To send HTML mail, the Content-type header must be set
289
+ $headers .= "MIME-Version: 1.0\n";
290
+ $headers .= "Content-type: " . get_bloginfo('html_type') . "; charset=\"". get_bloginfo('charset') . "\"\n";
291
+ $mailtext = "<html><head><title>" . $subject . "</title></head><body>" . $message . "</body></html>";
292
+ } else {
293
+ $headers .= "MIME-Version: 1.0\n";
294
+ $headers .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
295
+ $message = preg_replace('|&[^a][^m][^p].{0,3};|', '', $message);
296
+ $message = preg_replace('|&amp;|', '&', $message);
297
+ $mailtext = wordwrap(strip_tags($message), 80, "\n");
298
+ }
299
+
300
+ // BCC all recipients
301
+ $bcc = '';
302
+ if ( (defined('BCCLIMIT') && (BCCLIMIT > 0) ) &&
303
+ (count($recipients) > BCCLIMIT) ) {
304
+ // we're on Dreamhost, and have more than 30 susbcribers
305
+ $count = 1;
306
+ $batch = array();
307
+ foreach ($recipients as $recipient) {
308
+ // advance the array pointer by one, for use down below
309
+ // the array pointer _is not_ advanced by the foreach() loop itself
310
+ next($recipients);
311
+ $recipient = trim($recipient);
312
+ // sanity check -- make sure we have a valid email
313
+ if (!is_email($recipient)) { continue; }
314
+ // and NOT the sender's email, since they'll
315
+ // get a copy anyway
316
+ if ( (! empty($recipient)) && ($this->myemail != $recipient) ) {
317
+ ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ",\r\n $recipient";
318
+ // Headers constructed as per definition at http://www.ietf.org/rfc/rfc2822.txt
319
+ }
320
+ if (30 == $count) {
321
+ $count = 1;
322
+ $batch[] = $bcc;
323
+ $bcc = '';
324
+ } else {
325
+ if (false == current($recipients)) {
326
+ // we've reached the end of the subscriber list
327
+ // add what we have to the batch, and move on
328
+ $batch[] = $bcc;
329
+ break;
330
+ } else {
331
+ $count++;
332
+ }
333
+ }
334
+ }
335
+ // rewind the array, just to be safe
336
+ reset($recipients);
337
+ } else {
338
+ // we're not on dreamhost, or have less than 30
339
+ // subscribers, so do it normal
340
+ foreach ($recipients as $recipient) {
341
+ $recipient = trim($recipient);
342
+ // sanity check -- make sure we have a valid email
343
+ if (!is_email($recipient)) { continue; }
344
+ // and NOT the sender's email, since they'll
345
+ // get a copy anyway
346
+ if ( (!empty($recipient)) && ($this->myemail != $recipient) ) {
347
+ ('' == $bcc) ? $bcc = "Bcc: $recipient" : $bcc .= ",\r\n $recipient";
348
+ // Headers constructed as per definition at http://www.ietf.org/rfc/rfc2822.txt
349
+ }
350
+ }
351
+ $headers .= "$bcc\r\n";
352
+ }
353
+ // actually send mail
354
+ if ( (defined('BCCLIMIT')) && (BCCLIMIT > 0) && (isset($batch)) ) {
355
+ foreach ($batch as $bcc) {
356
+ $newheaders = $headers . "$bcc\r\n";
357
+ @wp_mail($this->myemail, $subject, $mailtext, $newheaders);
358
+ }
359
+ } else {
360
+ @wp_mail($this->myemail, $subject, $mailtext, $headers);
361
+ }
362
+ } // end mail()
363
+
364
+ /**
365
+ Sends an email notification of a new post
366
+ */
367
+ function publish($id = 0) {
368
+ if ( (!$id) || is_page($id) ) { return $id; }
369
+
370
+ // are we doing daily digests? If so, don't send anything now
371
+ if ($this->subscribe2_options['email_freq'] != 'never') { return; }
372
+
373
+ // we need to determine whether this is a new post, or an edit
374
+ if ($this->private) {
375
+ // this post was published from draft status
376
+ // OR is an edit of an existing post
377
+ // so send no notification
378
+ return $id;
379
+ }
380
+
381
+ $post_cats = wp_get_post_cats('1', $id);
382
+ $post_cats_string = implode(',', $post_cats);
383
+ $check = false;
384
+ // is the current post assigned to any categories
385
+ // which should not generate a notification email?
386
+ foreach (explode(',', $this->get_excluded_cats()) as $cat) {
387
+ if (in_array($cat, $post_cats)) {
388
+ $check = true;
389
+ }
390
+ }
391
+ // if so, bail out
392
+ if ($check) {
393
+ // hang on -- can registered users subscribe to
394
+ // excluded categories?
395
+ if ('0' == $this->subscribe2_options['reg_override']) {
396
+ // nope? okay, let's leave
397
+ return $id;
398
+ }
399
+ }
400
+
401
+ global $wpdb;
402
+ $post =& get_post($id);
403
+ // is this post set in the future?
404
+ if ($post->post_date > current_time('mysql')) {
405
+ // bail out
406
+ return $id;
407
+ }
408
+
409
+ // lets collect our public subscribers
410
+ // and all our registered subscribers for these categories
411
+ if (!$check) {
412
+ // if this post is assigned to an excluded
413
+ // category, then this test will prevent
414
+ // the public from receiving notification
415
+ $public = $this->get_public();
416
+ }
417
+ $registered = $this->get_registered("cats=$post_cats_string");
418
+
419
+ // do we have subscribers?
420
+ if ( (empty($public)) && (empty($registered)) ) {
421
+ // if not, no sense doing anything else
422
+ return $id;
423
+ }
424
+ // we set these class variables so that we can avoid
425
+ // passing them in function calls a little later
426
+ $this->post_title = $post->post_title;
427
+ $this->permalink = "<a href=\"" . get_permalink($id) . "\">" . get_permalink($id) . "</a>";
428
+
429
+ $author = get_userdata($post->post_author);
430
+ $this->authorname = $author->display_name;
431
+
432
+ // do we send as admin, or post author?
433
+ if ('author' == $this->subscribe2_options['sender']) {
434
+ // get author details
435
+ $user =& $author;
436
+ } else {
437
+ // get admin details
438
+ $user = get_userdata(1);
439
+ }
440
+ $this->myemail = $user->user_email;
441
+ $this->myname = $user->display_name;
442
+ // Get email subject
443
+ $subject = $this->substitute(stripslashes($this->s2_subject));
444
+ // Get the message template
445
+ $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
446
+
447
+ $plaintext = $post->post_content;
448
+ $content = apply_filters('the_content', $post->post_content);
449
+ $content = str_replace(']]>', ']]&gt', $content);
450
+ $excerpt = $post->post_excerpt;
451
+ if ('' == $excerpt) {
452
+ // no excerpt, is there a <!--more--> ?
453
+ if (false !== strpos($plaintext, '<!--more-->')) {
454
+ list($excerpt, $more) = explode('<!--more-->', $plaintext, 2);
455
+ // strip leading and trailing whitespace
456
+ $excerpt = strip_tags($excerpt);
457
+ $excerpt = trim($excerpt);
458
+ } else {
459
+ // no <!--more-->, so grab the first 55 words
460
+ $excerpt = strip_tags($plaintext);
461
+ $excerpt_length = 55;
462
+ $words = explode(' ', $excerpt, $excerpt_length + 1);
463
+ if (count($words) > $excerpt_length) {
464
+ array_pop($words);
465
+ array_push($words, '[...]');
466
+ $excerpt = implode(' ', $words);
467
+ }
468
+ }
469
+
470
+ }
471
+ // first we send plaintext summary emails
472
+ $body = str_replace('POST', $excerpt, $mailtext);
473
+ $registered = $this->get_registered("cats=$post_cats_string&format=text&amount=excerpt");
474
+ if (empty($registered)) {
475
+ $recipients = (array)$public;
476
+ }
477
+ elseif (empty($public)) {
478
+ $recipients = (array)$registered;
479
+ } else {
480
+ $recipients = array_merge((array)$public, (array)$registered);
481
+ }
482
+ $this->mail($recipients, $subject, $body);
483
+ // next we send plaintext full content emails
484
+ $body = str_replace('POST', strip_tags($plaintext), $mailtext);
485
+ $this->mail($this->get_registered("cats=$post_cats_string&format=text&amount=post"), $subject, $body);
486
+ // finally we send html full content emails
487
+ $body = str_replace("\r\n", "<br />\r\n", $mailtext);
488
+ $body = str_replace('POST', $content, $body);
489
+ $this->mail($this->get_registered("cats=$post_cats_string&format=html"), $subject, $body, 'html');
490
+
491
+ return $id;
492
+ } // end publish()
493
+
494
+ /**
495
+ Sends a notification when a draft post is published
496
+ */
497
+ function private2publish($id = 0) {
498
+ if (0 == $id) { return $id; }
499
+
500
+ $this->publish($id);
501
+ $this->private = TRUE;
502
+ return $id;
503
+ } // end private2publish()
504
+
505
+ /**
506
+ Prevents notifications from being sent when editing posts
507
+ */
508
+ function edit($id = 0) {
509
+ if (0 == $id) { return; }
510
+
511
+ $this->private = TRUE;
512
+ return $id;
513
+ }
514
+
515
+ /**
516
+ Send confirmation email to the user
517
+ */
518
+ function send_confirm($what = '', $is_remind = FALSE) {
519
+ if ($this->filtered == 1) { return; }
520
+ if ( (!$this->email) || (!$what) ) {
521
+ return false;
522
+ }
523
+ $id = $this->get_id($this->email);
524
+ if (!$id) {
525
+ return false;
526
+ }
527
+
528
+ // generate the URL "?s2=ACTION+HASH+ID"
529
+ // ACTION = 1 to subscribe, 0 to unsubscribe
530
+ // HASH = md5 hash of email address
531
+ // ID = user's ID in the subscribe2 table
532
+ $link = get_settings('siteurl') . "?s2=";
533
+
534
+ if ('add' == $what) {
535
+ $link .= '1';
536
+ } elseif ('del' == $what) {
537
+ $link .= '0';
538
+ }
539
+ $link .= md5($this->email);
540
+ $link .= $id;
541
+
542
+ $admin = get_userdata(1);
543
+ $this->myname = $admin->display_name;
544
+
545
+ if ($is_remind == TRUE) {
546
+ $body = $this->substitute(stripslashes($this->subscribe2_options['remind_email']));
547
+ $subject = stripslashes($this->remind_subject);
548
+ } else {
549
+ $body = $this->substitute(stripslashes($this->subscribe2_options['confirm_email']));
550
+ if ('add' == $what) {
551
+ $body = str_replace("ACTION", $this->subscribe, $body);
552
+ } elseif ('del' == $what) {
553
+ $body = str_replace("ACTION", $this->unsubscribe, $body);
554
+ }
555
+ $subject = stripslashes($this->confirm_subject);
556
+ }
557
+
558
+ $body = str_replace("LINK", $link, $body);
559
+
560
+ $mailheaders .= "From: $admin->display_name <$admin->user_email>\n";
561
+ $mailheaders .= "Return-Path: <$admin->user_email>\n";
562
+ $mailheaders .= "X-Mailer:PHP" . phpversion() . "\n";
563
+ $mailheaders .= "Precedence: list\nList-Id: " . get_settings('blogname') . "\n";
564
+ $mailheaders .= "MIME-Version: 1.0\n";
565
+ $mailheaders .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
566
+
567
+ @wp_mail ($this->email, $subject, $body, $mailheaders);
568
+ } // end send_confirm()
569
+
570
+ /* ===== Category functions ===== */
571
+ /**
572
+ Returns a comma-separated list of category IDs which should not generate notifications
573
+ */
574
+ function get_excluded_cats() {
575
+ if ('' != $this->excluded_cats) {
576
+ return $this->excluded_cats;
577
+ } else {
578
+ global $wpdb;
579
+ $this->excluded_cats = $this->subscribe2_options['exclude'];
580
+ return $this->excluded_cats;
581
+ }
582
+ } // end get_excluded_cats()
583
+
584
+ /**
585
+ Return either a comma-separated list of all the category IDs in the blog or an array of cat_ID => cat_name
586
+ */
587
+ function get_all_categories($select = 'id') {
588
+ global $wpdb;
589
+ if ('id' == $select) {
590
+ return implode(',', $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"));
591
+ } else {
592
+ $cats = array();
593
+ $result = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_N);
594
+ foreach ($result as $result) {
595
+ $cats[$result[0]] = $result[1];
596
+ }
597
+ return $cats;
598
+ }
599
+ } // end get_all_categories()
600
+
601
+ /* ===== Subscriber functions ===== */
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) {
609
+ return false;
610
+ }
611
+ return $wpdb->get_var("SELECT email FROM $this->public WHERE id=$id");
612
+ } // end get_email
613
+
614
+ /**
615
+ Given a public subscriber email, returns the subscriber ID
616
+ */
617
+ function get_id ($email = '') {
618
+ global $wpdb;
619
+
620
+ if (!$email) {
621
+ return false;
622
+ }
623
+ return $wpdb->get_var("SELECT id FROM $this->public WHERE email='$email'");
624
+ } // end get_id()
625
+
626
+ /**
627
+ Activate an 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) {
634
+ if ('' != $this->email) {
635
+ $email = $this->email;
636
+ } else {
637
+ return false;
638
+ }
639
+ }
640
+
641
+ if (false !== $this->is_public($email)) {
642
+ $check = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE user_email='$this->email'");
643
+ if ($check) { return; }
644
+ $wpdb->get_results("UPDATE $this->public SET active='1' WHERE email='$email'");
645
+ } else {
646
+ $wpdb->get_results("INSERT INTO $this->public (email, active, date) VALUES ('$email', '1', NOW())");
647
+ }
648
+ } // end activate()
649
+
650
+ /**
651
+ Add an unconfirmed email address to the subscriber list
652
+ */
653
+ function add ($email = '') {
654
+ if ($this->filtered ==1) { return; }
655
+ global $wpdb;
656
+
657
+ if ('' == $email) {
658
+ if ('' != $this->email) {
659
+ $email = $this->email;
660
+ } else {
661
+ return false;
662
+ }
663
+ }
664
+
665
+ if (!is_email($email)) { return false; }
666
+
667
+ if (false !== $this->is_public($email)) {
668
+ $wpdb->get_results("UPDATE $this->public SET date=NOW() WHERE email='$email'");
669
+ } else {
670
+ $wpdb->get_results("INSERT INTO $this->public (email, active, date) VALUES ('$email', '0', NOW())");
671
+ }
672
+ } // end add()
673
+
674
+ /**
675
+ Remove a user from the subscription table
676
+ */
677
+ function delete($email = '') {
678
+ global $wpdb;
679
+
680
+ if ('' == $email) {
681
+ if ('' != $this->email) {
682
+ $email = $this->email;
683
+ } else {
684
+ return false;
685
+ }
686
+ }
687
+
688
+ if (!is_email($email)) { return false; }
689
+ $wpdb->get_results("DELETE FROM $this->public WHERE email='$email'");
690
+ } // end delete()
691
+
692
+ /**
693
+ Toggle a public subscriber's status
694
+ */
695
+ function toggle($email = '') {
696
+ global $wpdb;
697
+
698
+ if ( ('' == $email) || (! is_email($email)) ) { return false; }
699
+
700
+ // let's see if this is a public user
701
+ $status = $this->is_public($email);
702
+ if (false === $status) { return false; }
703
+
704
+ if ('0' == $status) {
705
+ $wpdb->get_results("UPDATE $this->public SET active='1' WHERE email='$email'");
706
+ } else {
707
+ $wpdb->get_results("UPDATE $this->public SET active='0' WHERE email='$email'");
708
+ }
709
+ } // end toggle()
710
+
711
+ /**
712
+ Send reminder email to unconfirmed public subscribers
713
+ */
714
+ function remind($emails = '') {
715
+ if ('' == $emails) { return false; }
716
+
717
+ $admin = get_userdata(1);
718
+ $this->myname = $admin->display_name;
719
+
720
+ $recipients = explode(",", $emails);
721
+ if (!is_array($recipients)) { $recipients = array(); }
722
+ foreach ($recipients as $recipient) {
723
+ $this->email = $recipient;
724
+ $this->send_confirm('add', TRUE);
725
+ }
726
+ } //end remind()
727
+
728
+ /**
729
+ Export email list to CSV download
730
+ */
731
+ function exportcsv($emails = '') {
732
+ if ('' == $emails) {return false; }
733
+
734
+ $f = fopen(ABSPATH . '/wp-content/email.csv', 'w');
735
+ fwrite($f, $emails);
736
+ fclose($f);
737
+ } //end exportcsv
738
+
739
+ /**
740
+ Check email is not from a barred domain
741
+ */
742
+ function is_barred($email='') {
743
+ $barred_option = $this->subscribe2_options['barred'];
744
+ list($user, $domain) = split('@', $email);
745
+ $bar_check = stristr($barred_option, $domain);
746
+
747
+ if(!empty($bar_check)) {
748
+ return true;
749
+ } else {
750
+ return false;
751
+ }
752
+ } //end is_barred()
753
+
754
+ /**
755
+ Confirm request from the link emailed to the user and email the admin
756
+ */
757
+ function confirm($content = '') {
758
+ global $wpdb;
759
+
760
+ if (1 == $this->filtered) { return $content; }
761
+
762
+ $code = $_GET['s2'];
763
+ $action = intval(substr($code, 0, 1));
764
+ $hash = substr($code, 1, 32);
765
+ $code = str_replace($hash, '', $code);
766
+ $id = intval(substr($code, 1));
767
+ if ($id) {
768
+ $this->email = $this->get_email($id);
769
+ if ( (!$this->email) || ($hash !== md5($this->email)) ) {
770
+ return $this->no_such_email;
771
+ }
772
+ } else {
773
+ return $this->no_such_email;
774
+ }
775
+
776
+ if ('1' == $action) {
777
+ // make this subscription active
778
+ $this->activate();
779
+ $this->message = $this->added;
780
+ $subject = '[' . get_settings('blogname') . '] ' . __('New subscriber', 'subscribe2');
781
+ $message = "$this->email " . __('subscribed to email notifications!', 'subscribe2');
782
+ $recipients = $wpdb->get_col("SELECT DISTINCT(user_email) FROM $wpdb->users INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key='wp_user_level' AND $wpdb->usermeta.meta_value='10'");
783
+ $this->mail($recipients, $subject, $message);
784
+ $this->filtered = 1;
785
+ } elseif ('0' == $action) {
786
+ // remove this subscriber
787
+ $this->delete();
788
+ $this->message = $this->deleted;
789
+ $this->filtered = 1;
790
+ }
791
+
792
+ if ('' != $this->message) {
793
+ return $this->message;
794
+ }
795
+ } // end confirm
796
+
797
+ /**
798
+ Is the supplied email address a public subscriber?
799
+ */
800
+ function is_public($email = '') {
801
+ global $wpdb;
802
+
803
+ if ('' == $email) { return false; }
804
+
805
+ $check = $wpdb->get_var("SELECT active FROM $this->public WHERE email='$email'");
806
+ if ( ('0' == $check) || ('1' == $check) ) {
807
+ return $check;
808
+ } else {
809
+ return false;
810
+ }
811
+ } // end is_public
812
+
813
+ /**
814
+ Is the supplied email address a registered user of the blog?
815
+ */
816
+ function is_registered($email = '') {
817
+ global $wpdb;
818
+
819
+ if ('' == $email) { return false; }
820
+
821
+ $check = $wpdb->get_var("SELECT email FROM $wpdb->users WHERE user_email='$email'");
822
+ if ($check) {
823
+ return true;
824
+ } else {
825
+ return false;
826
+ }
827
+ }
828
+
829
+ /**
830
+ Return an array of all the public subscribers
831
+ */
832
+ function get_public ($confirmed = 1) {
833
+ global $wpdb;
834
+ if (1 == $confirmed) {
835
+ if ('' == $this->all_public) {
836
+ $this->all_public = $wpdb->get_col("SELECT email FROM $this->public WHERE active='1'");
837
+ }
838
+ return $this->all_public;
839
+ } else {
840
+ if ('' == $this->all_unconfirmed) {
841
+ $this->all_unconfirmed = $wpdb->get_col("SELECT email FROM $this->public WHERE active='0'");
842
+ }
843
+ return $this->all_unconfirmed;
844
+ }
845
+ } // end get_public()
846
+
847
+ /**
848
+ Return an array of registered subscribers
849
+ Collect all the registered users of the blog who are subscribed to the specified categories
850
+ */
851
+ function get_registered ($args = '') {
852
+ global $wpdb;
853
+
854
+ $format = '';
855
+ $amount = '';
856
+ $cats = '';
857
+ $subscribers = array();
858
+
859
+ parse_str($args, $r);
860
+ if (!isset($r['cats']))
861
+ $r['cats'] = '';
862
+ if (!isset($r['format']))
863
+ $r['format'] = 'all';
864
+ if (!isset($r['amount']))
865
+ $r['amount'] = 'all';
866
+
867
+ $JOIN = ''; $AND = '';
868
+ // text or HTML subscribers
869
+ if ('all' != $r['format']) {
870
+ $JOIN .= "INNER JOIN $wpdb->usermeta AS b ON a.user_id = b.user_id ";
871
+ $AND .= " AND b.meta_key='s2_format' AND b.meta_value=";
872
+ if ('html' == $r['format']) {
873
+ $AND .= "'html'";
874
+ } elseif ('text' == $r['format']) {
875
+ $AND .= "'text'";
876
+ }
877
+ }
878
+
879
+ // full post or excerpt subscribers
880
+ if ('all' != $r['amount']) {
881
+ $JOIN .= "INNER JOIN $wpdb->usermeta AS c ON a.user_id = c.user_id ";
882
+ $AND .= " AND c.meta_key='s2_excerpt' AND c.meta_value=";
883
+ if ('excerpt' == $r['amount']) {
884
+ $AND .= "'excerpt'";
885
+ } elseif ('post' == $r['amount']) {
886
+ $AND.= "'post'";
887
+ }
888
+ }
889
+
890
+ // specific category subscribers
891
+ if ('' != $r['cats']) {
892
+ $JOIN .= "INNER JOIN $wpdb->usermeta AS d ON a.user_id = d.user_id ";
893
+ foreach (explode(',', $r['cats']) as $cat) {
894
+ ('' == $and) ? $and = "d.meta_key='s2_cat$cat'" : $and .= " OR d.meta_key='s2_cat$cat'";
895
+ }
896
+ $AND .= "AND ($and)";
897
+ }
898
+
899
+ $sql = "SELECT a.user_id FROM $wpdb->usermeta AS a " . $JOIN . " WHERE a.meta_key='s2_subscribed'" . $AND;
900
+ $result = $wpdb->get_col($sql);
901
+ if ($result) {
902
+ $ids = implode(',', $result);
903
+ return $wpdb->get_col("SELECT user_email FROM $wpdb->users WHERE ID IN ($ids)");
904
+ }
905
+ } // end get_registered()
906
+
907
+ /**
908
+ Collects the signup date for all public subscribers
909
+ */
910
+ function signup_date($email = '') {
911
+ if ('' == $email) { return false; }
912
+
913
+ global $wpdb;
914
+ if (!empty($this->signup_dates)) {
915
+ return $this->signup_dates[$email];
916
+ } else {
917
+ $results = $wpdb->get_results("SELECT email, date FROM $this->public", ARRAY_N);
918
+ foreach ($results as $result) {
919
+ $this->signup_dates[$result[0]] = $result[1];
920
+ }
921
+ return $this->signup_dates[$email];
922
+ }
923
+ } // end signup_date()
924
+
925
+ /**
926
+ Create the appropriate usermeta values when a user registers
927
+ If the registering user had previously subscribed to notifications, this function will delete them from the public subscriber list first
928
+ */
929
+ function register ($user_id = 0) {
930
+ global $wpdb;
931
+
932
+ if (0 == $user_id) { return $user_id; }
933
+ $user = get_userdata($user_id);
934
+ $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
935
+ foreach ($all_cats as $cat) {
936
+ ('' == $cats) ? $cats = "$cat->cat_ID" : $cats .= ",$cat->cat_ID";
937
+ }
938
+
939
+ // has this user previously signed up for email notification?
940
+ if (false !== $this->is_public($user->user_email)) {
941
+ // delete this user from the public table, and subscribe them to all the categories
942
+ $this->delete($user->user_email);
943
+ update_usermeta($user_id, 's2_subscribed', $cats);
944
+ foreach(explode(',', $cats) as $cat) {
945
+ update_usermeta($user_id, 's2_cat' . $all_cats->cat_ID, "$all_cats->cat_ID");
946
+ }
947
+ update_usermeta($user_id, 's2_format', 'text');
948
+ update_usermeta($user_id, 's2_excerpt', 'excerpt');
949
+ } else {
950
+ // add the usermeta for new registrations, but don't subscribe them
951
+ $check = get_usermeta($user_id, 's2_subscribed');
952
+ // ensure existing subscriptions are not overwritten on upgrade
953
+ if (empty($check)) {
954
+ if ('yes' == $this->subscribe2_options['autosub']) {
955
+ // don't add entires by default if autosub is off, messes up daily digests
956
+ update_usermeta($user_id, 's2_subscribed', $this->get_all_categories());
957
+ foreach(explode(',', $this->get_all_categories()) as $cat) {
958
+ update_usermeta($user_id, 's2_cat' . $cat, "$cat");
959
+ }
960
+ if ('html' == $this->subscribe2_options['autoformat']) {
961
+ update_usermeta($user_id, 's2_format', 'html');
962
+ update_usermeta($user_id, 's2_excerpt', 'post');
963
+ } elseif ('fulltext' == $this->subscribe2_options['autoformat']) {
964
+ update_usermeta($user_id, 's2_format', 'text');
965
+ update_usermeta($user_id, 's2_excerpt', 'post');
966
+ } else {
967
+ update_usermeta($user_id, 's2_format', 'text');
968
+ update_usermeta($user_id, 's2_excerpt', 'excerpt');
969
+ }
970
+ }
971
+ }
972
+ }
973
+ return $user_id;
974
+ } // end register()
975
+
976
+ /**
977
+ Subscribe all registered users to category selected on Admin Manage Page
978
+ */
979
+ function subscribe_registered_users ($emails = '', $cats = '') {
980
+ if ( ('' == $emails) || ('' == $cats) ) { return false; }
981
+ global $wpdb;
982
+
983
+ $useremails = explode(",", $emails);
984
+ $useremails = implode("', '", $useremails);
985
+
986
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
987
+ $user_IDs = $wpdb->get_col($sql);
988
+ $cats = $_POST['category'];
989
+ if (!is_array($cats)) {
990
+ $cats = array($_POST['category']);
991
+ }
992
+
993
+ foreach ($user_IDs as $user_ID) {
994
+ $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
995
+ if (!is_array($old_cats)) {
996
+ $old_cats = array($old_cats);
997
+ }
998
+ $new = array_diff($cats, $old_cats);
999
+ if (!empty($new)) {
1000
+ // add subscription to these cat IDs
1001
+ foreach ($new as $id) {
1002
+ update_usermeta($user_ID, 's2_cat' . $id, "$id");
1003
+ }
1004
+ }
1005
+ $newcats = array_merge($cats, $old_cats);
1006
+ update_usermeta($user_ID, 's2_subscribed', implode(',', $newcats));
1007
+ }
1008
+ } // end subscribe_registered_users
1009
+
1010
+ /**
1011
+ Unsubscribe all registered users to category selected on Admin Manage Page
1012
+ */
1013
+ function unsubscribe_registered_users ($emails = '', $cats = '') {
1014
+ if ( ('' == $emails) || ('' == $cats) ) { return false; }
1015
+ global $wpdb;
1016
+
1017
+ $useremails = explode(",", $emails);
1018
+ $useremails = implode("', '", $useremails);
1019
+
1020
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_email IN ('$useremails')";
1021
+ $user_IDs = $wpdb->get_col($sql);
1022
+ $cats = $_POST['category'];
1023
+ if (!is_array($cats)) {
1024
+ $cats = array($_POST['category']);
1025
+ }
1026
+
1027
+ foreach ($user_IDs as $user_ID) {
1028
+ $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1029
+ if (!is_array($old_cats)) {
1030
+ $old_cats = array($old_cats);
1031
+ }
1032
+ $remain = array_diff($old_cats, $cats);
1033
+ if (!empty($remain)) {
1034
+ // remove subscription to these cat IDs and update s2_subscribed
1035
+ foreach ($cats as $id) {
1036
+ delete_usermeta($user_ID, 's2_cat' . $id, "$id");
1037
+ }
1038
+ update_usermeta($user_ID, 's2_subscribed', implode(',', $remain));
1039
+ } else {
1040
+ // remove subscription to these cat IDs and update s2_subscribed to ''
1041
+ foreach ($cats as $id) {
1042
+ delete_usermeta($user_ID, 's2_cat' . $id, "$id");
1043
+ }
1044
+ update_usermeta($user_ID, 's2_subscribed', '');
1045
+ }
1046
+ }
1047
+ } // end unsubscribe_registered_users
1048
+
1049
+ /**
1050
+ Autosubscribe registered users to newly created categories
1051
+ if registered user has selected this option
1052
+ */
1053
+ function autosub_new_category ($new_category='') {
1054
+ global $wpdb;
1055
+
1056
+ $sql = "SELECT DISTINCT user_id FROM $wpdb->usermeta WHERE $wpdb->usermeta.meta_key='s2_autosub' AND $wpdb->usermeta.meta_value='yes'";
1057
+ $user_IDs = $wpdb->get_col($sql);
1058
+ if ('' == $user_IDs) { return; }
1059
+
1060
+ foreach ($user_IDs as $user_ID) {
1061
+ $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1062
+ if (!is_array($old_cats)) {
1063
+ $old_cats = array($old_cats);
1064
+ }
1065
+ // add subscription to these cat IDs
1066
+ update_usermeta($user_ID, 's2_cat' . $new_category, "$new_category");
1067
+ $newcats = array_merge($old_cats, (array)$new_category);
1068
+ update_usermeta($user_ID, 's2_subscribed', implode(',', $newcats));
1069
+ }
1070
+ } // end autosub_new_category
1071
+
1072
+ /* ===== Menus ===== */
1073
+ /**
1074
+ Our management page
1075
+ */
1076
+ function manage_menu() {
1077
+ global $wpdb, $s2nonce;
1078
+
1079
+ //Get Registered Subscribers for bulk management
1080
+ $registered = $this->get_registered();
1081
+ if (!empty($registered)) {
1082
+ $emails = implode(",", $registered);
1083
+ }
1084
+
1085
+ $what = '';
1086
+ $reminderform = false;
1087
+
1088
+ // was anything POSTed ?
1089
+ if (isset($_POST['s2_admin'])) {
1090
+ check_admin_referer('subscribe2-manage_subscribers' . $s2nonce);
1091
+ if ('subscribe' == $_POST['s2_admin']) {
1092
+ foreach (preg_split ("/[\s,]+/", $_POST['addresses']) as $email) {
1093
+ if (is_email($email)) {
1094
+ $this->activate($email);
1095
+ }
1096
+ }
1097
+ $_POST['what'] = 'confirmed';
1098
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . __('Address(es) subscribed!', 'subscribe2') . "</p></strong></div>";
1099
+ } elseif ('delete' == $_POST['s2_admin']) {
1100
+ $this->delete($_POST['email']);
1101
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . $_POST['email'] . ' ' . __('deleted!', 'subscribe2') . "</p></strong></div>";
1102
+ } elseif ('toggle' == $_POST['s2_admin']) {
1103
+ $this->toggle($_POST['email']);
1104
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . $_POST['email'] . ' ' . __('status changed!', 'subscribe2') . "</p></strong></div>";
1105
+ } elseif ('remind' == $_POST['s2_admin']) {
1106
+ $this->remind($_POST['reminderemails']);
1107
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . __('Reminder Email(s) Sent!','subscribe2') . "</p></strong></div>";
1108
+ } elseif ('exportcsv' == $_POST['s2_admin']) {
1109
+ $this->exportcsv($_POST['exportcsv']);
1110
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . __('CSV File Created in wp-content','subscribe2') . "</p></strong></div>";
1111
+ } elseif ( ('register' == $_POST['s2_admin']) && ('Subscribe' == $_POST['submit']) ) {
1112
+ $this->subscribe_registered_users($_POST['emails'], $_POST['category']);
1113
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . __('Registered Users Subscribed!','subscribe2') . "</p></strong></div>";
1114
+ } elseif ( ('register' == $_POST['s2_admin']) && ('Unsubscribe' == $_POST['submit']) ) {
1115
+ $this->unsubscribe_registered_users($_POST['emails'], $_POST['category']);
1116
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>" . __('Registered Users Unsubscribed!','subscribe2') . "</p></strong></div>";
1117
+ }
1118
+ }
1119
+
1120
+ if (isset($_POST['what'])) {
1121
+ if ('all' == $_POST['what']) {
1122
+ $what = 'all';
1123
+ $confirmed = $this->get_public();
1124
+ $unconfirmed = $this->get_public(0);
1125
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$registered);
1126
+ } elseif ('public' == $_POST['what']) {
1127
+ $what = 'public';
1128
+ $confirmed = $this->get_public();
1129
+ $unconfirmed = $this->get_public(0);
1130
+ $subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
1131
+ } elseif ('confirmed' == $_POST['what']) {
1132
+ $what = 'confirmed';
1133
+ $confirmed = $this->get_public();
1134
+ $subscribers = $confirmed;
1135
+ } elseif ('unconfirmed' == $_POST['what']) {
1136
+ $what = 'unconfirmed';
1137
+ $unconfirmed = $this->get_public(0);
1138
+ $subscribers = $unconfirmed;
1139
+ if (!empty($unconfirmed)) {
1140
+ $reminderemails = implode(",", $unconfirmed);
1141
+ $reminderform = true;
1142
+ }
1143
+ } elseif (is_numeric($_POST['what'])) {
1144
+ $what = intval($_POST['what']);
1145
+ $subscribers = $this->get_registered("cats=$what");
1146
+ } elseif ('registered' == $_POST['what']) {
1147
+ $what = 'registered';
1148
+ $subscribers = $registered;
1149
+ }
1150
+ } elseif ('' == $what) {
1151
+ $what = 'registered';
1152
+ $subscribers = $registered;
1153
+ $registermessage = '';
1154
+ if (empty($subscribers)) {
1155
+ $confirmed = $this->get_public();
1156
+ $subscribers = $confirmed;
1157
+ $what = 'confirmed';
1158
+ if (empty($subscribers)) {
1159
+ $unconfirmed = $this->get_public(0);
1160
+ $subscribers = $unconfirmed;
1161
+ $what = 'unconfirmed';
1162
+ if (empty($subscribers)) {
1163
+ $what = 'all';
1164
+ }
1165
+ }
1166
+ }
1167
+ }
1168
+ if (!empty($subscribers)) {
1169
+ natcasesort($subscribers);
1170
+ }
1171
+ // safety check for our arrays
1172
+ if ('' == $confirmed) { $confirmed = array(); }
1173
+ if ('' == $unconfirmed) { $unconfirmed = array(); }
1174
+ if ('' == $registered) { $registered = array(); }
1175
+
1176
+ // show our form
1177
+ echo "<div class=\"wrap\">";
1178
+ echo "<h2>" . __('Subscribe Addresses', 'subscribe2') . "</h2>\r\n";
1179
+ echo "<form method=\"post\" action=\"\">\r\n";
1180
+ if (function_exists('wp_nonce_field')) {
1181
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1182
+ }
1183
+ echo "<span style=\"align:left\">" . __('Enter addresses, one per line or comma-seperated', 'subscribe2') . "</span><br />\r\n";
1184
+ echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea>";
1185
+ echo "<span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Subscribe', 'subscribe2') . "\"/>";
1186
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"subscribe\" /></span>";
1187
+ echo "</form></div>";
1188
+
1189
+ // subscriber lists
1190
+ echo "<div class=\"wrap\"><h2>" . __('Subscribers', 'subscribe2') . "</h2>\r\n";
1191
+
1192
+ $this->display_subscriber_dropdown($what, __('Filter', 'subscribe2'));
1193
+ // show the selected subscribers
1194
+ $alternate = 'alternate';
1195
+ if (!empty($subscribers)) {
1196
+ echo "<p align=\"center\"><b>" . __('Registered on the left, confirmed in the middle, unconfirmed on the right', 'subscribe2') . "</b></p>";
1197
+ if (is_writable(ABSPATH . '/wp-content')) {
1198
+ $exportcsv = implode(",", $subscribers);
1199
+ echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1200
+ if (function_exists('wp_nonce_field')) {
1201
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1202
+ }
1203
+ echo "<input type=\"hidden\" name=\"exportcsv\" value=\"$exportcsv\" />\r\n";
1204
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"exportcsv\" />\r\n";
1205
+ echo "<input type=\"submit\" name=\"submit\" value=\"" . __('Save Emails to CSV File','subscribe2') . "\" />\r\n";
1206
+ echo "</form></span>\r\n";
1207
+ }
1208
+ }
1209
+ echo "<table cellpadding=\"2\" cellspacing=\"2\">";
1210
+ if (!empty($subscribers)) {
1211
+ foreach ($subscribers as $subscriber) {
1212
+ echo "<tr class=\"$alternate\">";
1213
+ echo "<td width=\"75%\"";
1214
+ if (in_array($subscriber, $unconfirmed)) {
1215
+ echo " align=\"right\">";
1216
+ } elseif (in_array($subscriber, $confirmed)) {
1217
+ echo "align=\"center\">";
1218
+ } else {
1219
+ echo "align=\"left\" colspan=\"3\">";
1220
+ }
1221
+ echo "<a href=\"mailto:$subscriber\">$subscriber</a>\r\n";
1222
+ if (in_array($subscriber, $unconfirmed) || in_array($subscriber, $confirmed) ) {
1223
+ echo "(" . $this->signup_date($subscriber) . ")</td>\r\n";
1224
+ echo "<td width=\"5%\" align=\"center\">\r\n";
1225
+ echo "<form method=\"post\" action=\"\">";
1226
+ if (function_exists('wp_nonce_field')) {
1227
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1228
+ }
1229
+ echo "<input type=\"hidden\" name=\"email\" value=\"$subscriber\" />\r\n";
1230
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"toggle\" />\r\n";
1231
+ echo "<input type=\"hidden\" name=\"what\" value=\"$what\" />\r\n";
1232
+ echo "<input type=\"submit\" name=\"submit\" value=\"";
1233
+ (in_array($subscriber, $unconfirmed)) ? $foo = '&lt;-' : $foo= '-&gt;';
1234
+ echo "$foo\" /></form></td>\r\n";
1235
+ echo "<td width=\"2%\" align=\"center\">\r\n";
1236
+ echo "<form method=\"post\" action=\"\">\r\n";
1237
+ if (function_exists('wp_nonce_field')) {
1238
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1239
+ }
1240
+ echo "<span class=\"delete\">\r\n";
1241
+ echo "<input type=\"hidden\" name=\"email\" value=\"$subscriber\" />\r\n";
1242
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"delete\" />\r\n";
1243
+ echo "<input type=\"hidden\" name=\"what\" value=\"$what\" />\r\n";
1244
+ echo "<input type=\"submit\" name=\"submit\" value=\"X\" />\r\n";
1245
+ echo "</span></form>";
1246
+ }
1247
+ echo "</td></tr>\r\n";
1248
+ ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
1249
+ }
1250
+ } else {
1251
+ echo "<tr><td align=\"center\"><b>" . __('NONE', 'subscribe2') . "</b></td></tr>\r\n";
1252
+ }
1253
+ echo "</table>";
1254
+ if ($reminderform) {
1255
+ echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1256
+ if (function_exists('wp_nonce_field')) {
1257
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1258
+ }
1259
+ echo "<input type=\"hidden\" name=\"reminderemails\" value=\"$reminderemails\" />\r\n";
1260
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"remind\" />\r\n";
1261
+ echo "<input type=\"submit\" name=\"submit\" value=\"" . __('Send Reminder Email','subscribe2') . "\" />\r\n";
1262
+ echo "</form></span>";
1263
+ }
1264
+ echo "</div>\r\n";
1265
+
1266
+ //show bulk managment form
1267
+ echo "<div class=\"wrap\">";
1268
+ echo "<h2 >" . __('Categories', 'subscribe2') . "</h2>\r\n";
1269
+ echo __('Existing Registered Users can be automatically (un)subscribed to categories using this section.', 'subscribe2') . "<br />\r\n";
1270
+ echo "<strong><em style=\"color: red\">" . __('Consider User Privacy as changes cannot be undone', 'subscribe2') . "</em></strong><br />\r\n";
1271
+ echo "<span class=\"submit\"><form method=\"post\" action=\"\">\r\n";
1272
+ if (function_exists('wp_nonce_field')) {
1273
+ wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
1274
+ }
1275
+ echo "<input type=\"hidden\" name=\"emails\" value=\"$emails\" /><input type=\"hidden\" name=\"s2_admin\" value=\"register\" />";
1276
+ $this->display_category_form();
1277
+ echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Subscribe','subscribe2') . "\" />";
1278
+ echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('Unsubscribe','subscribe2') . "\" /></form></span>";
1279
+
1280
+ echo "</div>\r\n";
1281
+ echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
1282
+
1283
+ include(ABSPATH . '/wp-admin/admin-footer.php');
1284
+ // just to be sure
1285
+ die;
1286
+ } // end manage_menu()
1287
+
1288
+ /**
1289
+ Our options page
1290
+ */
1291
+ function options_menu() {
1292
+ global $s2nonce;
1293
+
1294
+ // was anything POSTed?
1295
+ if (isset($_POST['s2_admin'])) {
1296
+ check_admin_referer('subscribe2-options_subscribers' . $s2nonce);
1297
+ if ('RESET' == $_POST['s2_admin']) {
1298
+ $this->reset();
1299
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_reset</p></strong></div>";
1300
+ } elseif ('options' == $_POST['s2_admin']) {
1301
+ // excluded categories
1302
+ if (!empty($_POST['category'])) {
1303
+ $exclude_cats = implode(',', $_POST['category']);
1304
+ } else {
1305
+ $exclude_cats = '';
1306
+ }
1307
+ $this->subscribe2_options['exclude'] = $exclude_cats;
1308
+ // allow override?
1309
+ (isset($_POST['reg_override'])) ? $override = '1' : $override = '0';
1310
+ $this->subscribe2_options['reg_override'] = $override;
1311
+
1312
+ // show button?
1313
+ ($_POST['show_button'] == '1') ? $showbutton = '1' : $showbutton = '0';
1314
+ $this->subscribe2_options['show_button'] = $showbutton;
1315
+
1316
+ // send as author or admin?
1317
+ $sender = 'author';
1318
+ if ('admin' == $_POST['sender']) {
1319
+ $sender = 'admin';
1320
+ }
1321
+ $this->subscribe2_options['sender'] = $sender;
1322
+
1323
+ // send per-post or digest emails
1324
+ $email_freq = $_POST['email_freq'];
1325
+ $this->subscribe2_options['email_freq'] = $email_freq;
1326
+ wp_clear_scheduled_hook('s2_digest_cron');
1327
+ $scheds = (array) wp_get_schedules();
1328
+ $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int) $scheds[$email_freq]['interval'] : 0;
1329
+ if ($interval == 0) {
1330
+ // if we are on per-post emails remove last_cron entry
1331
+ unset($this->subscribe2_options['last_s2cron']);
1332
+ } else {
1333
+ if (!wp_next_scheduled('s2_digest_cron')) {
1334
+ // if we are using digest schedule the event and prime last_cron as now
1335
+ wp_schedule_event(time() + $interval, $email_freq, 's2_digest_cron');
1336
+ $now = date('Y-m-d H:i:s', time());
1337
+ $this->subscribe2_options['last_s2cron'] = $now;
1338
+ }
1339
+ }
1340
+
1341
+ // email templates
1342
+ $mailtext = $_POST['mailtext'];
1343
+ $this->subscribe2_options['mailtext'] = $mailtext;
1344
+ $confirm_email = $_POST['confirm_email'];
1345
+ $this->subscribe2_options['confirm_email'] = $confirm_email;
1346
+ $remind_email = $_POST['remind_email'];
1347
+ $this->subscribe2_options['remind_email'] = $remind_email;
1348
+
1349
+ //automatic subscription
1350
+ $autosub_option = $_POST['autosub'];
1351
+ $this->subscribe2_options['autosub']= $autosub_option;
1352
+ $autosub_format_option = $_POST['autoformat'];
1353
+ $this->subscribe2_options['autoformat']= $autosub_format_option;
1354
+
1355
+ //barred domains
1356
+ $barred_option = $_POST['barred'];
1357
+ $this->subscribe2_options['barred'] = $barred_option;
1358
+ echo "<div id=\"message\" class=\"updated fade\"><strong><p>$this->options_saved</p></strong></div>";
1359
+ update_option('subscribe2_options', $this->subscribe2_options);
1360
+ }
1361
+ }
1362
+ // show our form
1363
+ echo "<div class=\"wrap\">";
1364
+ echo "<form method=\"post\" action=\"\">\r\n";
1365
+ if (function_exists('wp_nonce_field')) {
1366
+ wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
1367
+ }
1368
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"options\" />\r\n";
1369
+ echo "<h2>" . __('Delivery Options', 'subscribe2') . ":</h2>\r\n";
1370
+ echo __('Send Email From', 'subscribe2') . ': ';
1371
+ echo "<input type=\"radio\" name=\"sender\" value=\"author\"";
1372
+ if ('author' == $this->subscribe2_options['sender']) {
1373
+ echo "checked=\"checked\" ";
1374
+ }
1375
+ echo " /> " . __('Author of the post', 'subscribe2') . " &nbsp;&nbsp;";
1376
+ echo "<input type=\"radio\" name=\"sender\" value=\"admin\"";
1377
+ if ('admin' == $this->subscribe2_options['sender']) {
1378
+ echo "checked=\"checked\" ";
1379
+ }
1380
+ echo " /> " . __('Blog Admin', 'subscribe2') . "<br /><br />\r\n";
1381
+ if (function_exists('wp_schedule_event')) {
1382
+ echo __('Send Email as Digest', 'subscribe2') . ": <br /><br />\r\n";
1383
+ $this->display_digest_choices();
1384
+ echo "<br />\r\n";
1385
+ }
1386
+ echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
1387
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"1\" class=\"editform\">\r\n";
1388
+ echo "<tr><td>";
1389
+ echo __('New Post email (must not be empty)', 'subscribe2') . ":";
1390
+ echo "<br />\r\n";
1391
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea><br /><br />\r\n";
1392
+ echo "</td><td valign=\"top\" rowspan=\"3\">";
1393
+ echo "<h3>" . __('Message substitions', 'subscribe2') . "</h3>\r\n";
1394
+ echo "<dl>";
1395
+ echo "<dt><b>BLOGNAME</b></dt><dd>" . get_bloginfo('name') . "</dd>\r\n";
1396
+ echo "<dt><b>BLOGLINK</b></dt><dd>" . get_bloginfo('url') . "</dd>\r\n";
1397
+ echo "<dt><b>TITLE</b></dt><dd>" . __("the post's title", 'subscribe2') . "</dd>\r\n";
1398
+ echo "<dt><b>POST</b></dt><dd>" . __("the excerpt or the entire post<br />(<i>based on the subscriber's preferences</i>)", 'subscribe2') . "</dd>\r\n";
1399
+ echo "<dt><b>PERMALINK</b></dt><dd>" . __("the post's permalink", 'subscribe2') . "</dd>\r\n";
1400
+ echo "<dt><b>MYNAME</b></dt><dd>" . __("the admin or post author's name", 'subscribe2') . "</dd>\r\n";
1401
+ echo "<dt><b>EMAIL</b></dt><dd>" . __("the admin or post author's email", 'subscribe2') . "</dd>\r\n";
1402
+ echo "<dt><b>AUTHORNAME</b></dt><dd>" . __("the post author's name", 'subscribe2') . "</dd>\r\n";
1403
+ echo "<dt><b>LINK</b></dt><dd>" . __("the generated link to confirm a request<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
1404
+ echo "<dt><b>ACTION</b></dt><dd>" . __("Action performed by LINK in confirmation email<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
1405
+ echo "</dl></td></tr><tr><td>";
1406
+ echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
1407
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea><br /><br />\r\n";
1408
+ echo "</td></tr><tr valign=\"top\"><td>";
1409
+ echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
1410
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
1411
+ echo "</td></tr></table><br />\r\n";
1412
+
1413
+ // excluded categories
1414
+ echo "<h2>" . __('Excluded Categories', 'subscribe2') . "</h2>\r\n";
1415
+ $this->display_category_form(explode(',', $this->get_excluded_cats()));
1416
+ echo "<center><input type=\"checkbox\" name=\"reg_override\" value=\"1\"";
1417
+ if ('1' == $this->subscribe2_options['reg_override']) {
1418
+ echo " checked=\"checked\"";
1419
+ }
1420
+ echo " /> " . __('Allow registered users to subscribe to excluded categories?', 'subscribe2') . "</center><br />\r\n";
1421
+ echo "<h2>" . __('Writing Options', 'subscribe2') . "</h2>\r\n";
1422
+ echo "<input type=\"checkbox\" name=\"show_button\" value=\"1\"";
1423
+ if ('1' == $this->subscribe2_options['show_button']) {
1424
+ echo " checked=\"checked\"";
1425
+ }
1426
+ echo " /> " . __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "<br /><br />\r\n";
1427
+
1428
+ //Auto Subscription for new registrations
1429
+ echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
1430
+ echo __('Automatically subscribe new users registering with your blog.', 'subscribe2') . "<br />\r\n";
1431
+ echo "<input type=\"radio\" name=\"autosub\" value=\"yes\"";
1432
+ if ('yes' == $this->subscribe2_options['autosub']) {
1433
+ echo " checked=\"checked\"";
1434
+ }
1435
+ echo " /> " . __('Yes', 'subscribe2') . " &nbsp;&nbsp;";
1436
+ echo "<input type=\"radio\" name=\"autosub\" value=\"no\"";
1437
+ if ('no' == $this->subscribe2_options['autosub']) {
1438
+ echo " checked=\"checked\"";
1439
+ }
1440
+ echo " /> " . __('No', 'subscribe2') . "<br /><br />\r\n";
1441
+ echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
1442
+ echo "<input type=\"radio\" name=\"autoformat\" value=\"html\"";
1443
+ if ('html' == $this->subscribe2_options['autoformat']) {
1444
+ echo "checked=\"checked\" ";
1445
+ }
1446
+ echo "/> " . __('HTML', 'subscribe2') ." &nbsp;&nbsp;";
1447
+ echo "<input type=\"radio\" name=\"autoformat\" value=\"fulltext\" ";
1448
+ if ('fulltext' == $this->subscribe2_options['autoformat']) {
1449
+ echo "checked=\"checked\" ";
1450
+ }
1451
+ echo "/> " . __('Plain Text - Full', 'subscribe2') . " &nbsp;&nbsp;";
1452
+ echo "<input type=\"radio\" name=\"autoformat\" value=\"text\" ";
1453
+ if ('text' == $this->subscribe2_options['autoformat']) {
1454
+ echo "checked=\"checked\" ";
1455
+ }
1456
+ echo "/> " . __('Plain Text - Excerpt', 'subscribe2') . " <br /><br />";
1457
+
1458
+ //barred domains
1459
+ echo "<h2>" . __('Barred Domains', 'subscribe2') . "</h2>\r\n";
1460
+ echo __('Enter domains to bar from public subscriptions: <br /> (Use a new line for each entry and omit the "@" symbol, for example email.com)', 'subscribe2');
1461
+ echo "<br />\r\n<textarea style=\"width: 98%;\" rows=\"4\" cols=\"60\" name=\"barred\">" . $this->subscribe2_options['barred'] . "</textarea>";
1462
+
1463
+ // submit
1464
+ echo "<p align=\"center\"><span class=\"submit\"><input type=\"submit\" id=\"save\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></span></p>";
1465
+ echo "</form>\r\n";
1466
+ echo "</div><div class=\"wrap\">";
1467
+
1468
+ // reset
1469
+ echo "<h2>" . __('Reset Default', 'subscribe2') . "</h2>\r\n";
1470
+ echo "<p>" . __('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2') . "</p>\r\n";
1471
+ echo "<form method=\"post\" action=\"\">";
1472
+ if (function_exists('wp_nonce_field')) {
1473
+ wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
1474
+ }
1475
+ echo "<p align=\"center\"><span class=\"submit\">";
1476
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"RESET\" />";
1477
+ echo "<input type=\"submit\" id=\"deletepost\" name=\"submit\" value=\"" . __('RESET', 'subscribe2') .
1478
+ "\" />";
1479
+ echo "</span></p></form></div>\r\n";
1480
+
1481
+ include(ABSPATH . '/wp-admin/admin-footer.php');
1482
+ // just to be sure
1483
+ die;
1484
+ } // end options_menu()
1485
+
1486
+ /**
1487
+ Our profile menu
1488
+ */
1489
+ function user_menu() {
1490
+ global $user_ID, $s2nonce;
1491
+
1492
+ get_currentuserinfo();
1493
+
1494
+ // was anything POSTed?
1495
+ if ( (isset($_POST['s2_admin'])) && ('user' == $_POST['s2_admin']) ) {
1496
+ check_admin_referer('subscribe2-user_subscribers' . $s2nonce);
1497
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Subscription preferences updated.', 'subscribe2') . "</strong></p></div>\n";
1498
+ $format = 'text';
1499
+ $post = 'post';
1500
+ if ('html' == $_POST['s2_format']) {
1501
+ $format = 'html';
1502
+ }
1503
+ if ('excerpt' == $_POST['s2_excerpt']) {
1504
+ $post = 'excerpt';
1505
+ }
1506
+ update_usermeta($user_ID, 's2_excerpt', $post);
1507
+ update_usermeta($user_ID, 's2_format', $format);
1508
+ update_usermeta($user_ID, 's2_autosub', $_POST['new_category']);
1509
+
1510
+ $cats = $_POST['category'];
1511
+ if (empty($cats)) {
1512
+ $cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1513
+ if ($cats) {
1514
+ foreach ($cats as $cat) {
1515
+ delete_usermeta($user_ID, "s2_cat" . $cat);
1516
+ }
1517
+ }
1518
+ delete_usermeta($user_ID, 's2_subscribed');
1519
+ } else {
1520
+ if (!is_array($cats)) {
1521
+ $cats = array($_POST['category']);
1522
+ }
1523
+ $old_cats = explode(',', get_usermeta($user_ID, 's2_subscribed'));
1524
+ $remove = array_diff($old_cats, $cats);
1525
+ $new = array_diff($cats, $old_cats);
1526
+ if (!empty($remove)) {
1527
+ // remove subscription to these cat IDs
1528
+ foreach ($remove as $id) {
1529
+ delete_usermeta($user_ID, "s2_cat" .$id);
1530
+ }
1531
+ }
1532
+ if (!empty($new)) {
1533
+ // add subscription to these cat IDs
1534
+ foreach ($new as $id) {
1535
+ update_usermeta($user_ID, 's2_cat' . $id, "$id");
1536
+ }
1537
+ }
1538
+ update_usermeta($user_ID, 's2_subscribed', implode(',', $cats));
1539
+ }
1540
+ }
1541
+
1542
+ // show our form
1543
+ echo "<div class=\"wrap\">";
1544
+ echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
1545
+ echo "<form method=\"post\" action=\"\">";
1546
+ if (function_exists('wp_nonce_field')) {
1547
+ wp_nonce_field('subscribe2-user_subscribers' . $s2nonce);
1548
+ }
1549
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"user\" />";
1550
+ if ($this->subscribe2_options['email_freq'] == 'never') {
1551
+ echo __('Receive email as', 'subscribe2') . ": &nbsp;&nbsp;";
1552
+ echo "<input type=\"radio\" name=\"s2_format\" value=\"html\"";
1553
+ if ('html' == get_usermeta($user_ID, 's2_format')) {
1554
+ echo "checked=\"checked\" ";
1555
+ }
1556
+ echo "/> " . __('HTML', 'subscribe2') ." &nbsp;&nbsp;";
1557
+ echo "<input type=\"radio\" name=\"s2_format\" value=\"text\" ";
1558
+ if ('text' == get_usermeta($user_ID, 's2_format')) {
1559
+ echo "checked=\"checked\" ";
1560
+ }
1561
+ echo "/> " . __('Plain Text', 'subscribe2') . "<br /><br />\r\n";
1562
+
1563
+ echo __('Email contains', 'subscribe2') . ": &nbsp;&nbsp;";
1564
+ $amount = array ('excerpt' => __('Excerpt Only', 'subscribe2'), 'post' => __('Full Post', 'subscribe2'));
1565
+ foreach ($amount as $key => $value) {
1566
+ echo "<input type=\"radio\" name=\"s2_excerpt\" value=\"" . $key . "\"";
1567
+ if ($key == get_usermeta($user_ID, 's2_excerpt')) {
1568
+ echo " checked=\"checked\"";
1569
+ }
1570
+ echo " /> $value ";
1571
+ }
1572
+ echo "<p style=\"color: red\">" . __('Note: HTML format will always deliver the full post.', 'subscribe2') . "</p>\r\n";
1573
+ echo __('Automatically subscribe me to newly created categories', 'subscribe2') . ': &nbsp;&nbsp;';
1574
+ echo "<input type=\"radio\" name=\"new_category\" value=\"yes\" ";
1575
+ if ('yes' == get_usermeta($user_ID, 's2_autosub')) {
1576
+ echo "checked=\"yes\" ";
1577
+ }
1578
+ echo "/> Yes <input type=\"radio\" name=\"new_category\" value=\"no\" ";
1579
+ if ('no' == get_usermeta($user_ID, 's2_autosub')) {
1580
+ echo "checked=\"yes\" ";
1581
+ }
1582
+ echo "/> No<br /><br />";
1583
+
1584
+ // subscribed categories
1585
+ echo "<h2>" . __('Subscribed Categories', 'subscribe2') . "</h2>\r\n";
1586
+ $this->display_category_form(explode(',', get_usermeta($user_ID, 's2_subscribed')), $this->subscribe2_options['reg_override']);
1587
+ } else {
1588
+ // we're doing daily digests, so just show
1589
+ // subscribe / unnsubscribe
1590
+ echo __('Receive daily summary of new posts?', 'subscribe2') . ': &nbsp;&nbsp;';
1591
+ echo "<input type=\"radio\" name=\"category\" value=\"1\" ";
1592
+ if (get_usermeta($user_ID, 's2_subscribed')) {
1593
+ echo "checked=\"yes\" ";
1594
+ }
1595
+ echo "/> Yes <input type=\"radio\" name=\"category\" value=\"\" ";
1596
+ if (! get_usermeta($user_ID, 's2_subscribed')) {
1597
+ echo "checked=\"yes\" ";
1598
+ }
1599
+ echo "/> No";
1600
+ }
1601
+
1602
+ // submit
1603
+ echo "<p align=\"right\"><span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __("Update Preferences &raquo;", 'subscribe2') . "\" /></span></p>";
1604
+ echo "</form></div>\r\n";
1605
+
1606
+ include(ABSPATH . '/wp-admin/admin-footer.php');
1607
+ // just to be sure
1608
+ die;
1609
+ } // end user_menu()
1610
+
1611
+ /**
1612
+ Display the Write sub-menu
1613
+ */
1614
+ function write_menu() {
1615
+ global $wpdb, $s2nonce;
1616
+
1617
+ // was anything POSTed?
1618
+ if (isset($_POST['s2_admin']) && ('mail' == $_POST['s2_admin']) ) {
1619
+ check_admin_referer('subscribe2-write_subscribers' . $s2nonce);
1620
+ if ('confirmed' == $_POST['what']) {
1621
+ $recipients = $this->get_public();
1622
+ } elseif ('unconfirmed' == $_POST['what']) {
1623
+ $recipients = $this->get_public(0);
1624
+ } elseif ('public' == $_POST['what']) {
1625
+ $confirmed = $this->get_public();
1626
+ $unconfirmed = $this->get_public(0);
1627
+ $recipients = array_merge((array)$confirmed, (array)$unconfirmed);
1628
+ } elseif (is_numeric($_POST['what'])) {
1629
+ $cat = intval($_POST['what']);
1630
+ $recipients = $this->get_registered("cats=$cat");
1631
+ } else {
1632
+ $recipients = $this->get_registered();
1633
+ }
1634
+ global $user_identity, $user_email;
1635
+ get_currentuserinfo();
1636
+ $this->myname = $user_identity;
1637
+ $this->myemail = $user_email;
1638
+ $subject = strip_tags($_POST['subject']);
1639
+ $message = stripslashes($_POST['message']);
1640
+ $this->mail($recipients, $subject, $message, 'text');
1641
+ $message = $this->mail_sent;
1642
+ }
1643
+
1644
+ if ('' != $message) {
1645
+ echo "<div id=\"message\" class=\"updated\"><strong><p>" . $message . "</p></strong></div>\r\n";
1646
+ }
1647
+ // show our form
1648
+ echo "<div class=\"wrap\"><h2>" . __('Send email to all subscribers', 'subscribe2') . "</h2>\r\n";
1649
+ echo "<form method=\"post\" action=\"\">\r\n";
1650
+ if (function_exists('wp_nonce_field')) {
1651
+ wp_nonce_field('subscribe2-write_subscribers' . $s2nonce);
1652
+ }
1653
+ echo __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" name=\"subject\" value=\"" . __('A message from ', 'subscribe2') . get_settings('blogname') . "\" /> <br />";
1654
+ echo "<textarea rows=\"12\" cols=\"75\" name=\"message\"></textarea>";
1655
+ echo "<br />\r\n";
1656
+ echo __('Recipients: ', 'subscribe2');
1657
+ $this->display_subscriber_dropdown('registered', false, array('all'));
1658
+ echo "<input type=\"hidden\" name=\"s2_admin\" value=\"mail\" />";
1659
+ echo "&nbsp;&nbsp;<span class=\"submit\"><input type=\"submit\" name=\"submit\" value=\"" . __('Send', 'subscribe2') . "\" /></span>&nbsp;";
1660
+ echo "</form></div>\r\n";
1661
+ echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
1662
+
1663
+ include(ABSPATH . '/wp-admin/admin-footer.php');
1664
+ // just to be sure
1665
+ die;
1666
+ } // end write_menu()
1667
+
1668
+ /* ===== helper functions: forms and stuff ===== */
1669
+ /**
1670
+ Display a table of categories with checkboxes
1671
+ Optionally pre-select those categories specified
1672
+ */
1673
+ function display_category_form($selected = array(), $override = 1) {
1674
+ global $wpdb;
1675
+
1676
+ $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1677
+
1678
+ if (0 == $override) {
1679
+ // registered users are not allowed to subscribe to
1680
+ // excluded categories
1681
+ foreach (explode(',', $this->get_excluded_cats()) as $cat) {
1682
+ $category = get_category($cat);
1683
+ $excluded[$cat] = $category->cat_name;
1684
+ }
1685
+ $all_cats = array_diff($all_cats, $excluded);
1686
+ }
1687
+
1688
+ $half = (count($all_cats) / 2);
1689
+ $i = 0;
1690
+ $j = 0;
1691
+ echo "<table width=\"100%\" cellspacing=\"2\" cellpadding=\"5\" class=\"editform\">\r\n";
1692
+ echo "<tr valign=\"top\"><td width=\"50%\" align=\"left\">\r\n";
1693
+ foreach ($all_cats as $cat) {
1694
+ if ( ($i >= $half) && (0 == $j) ){
1695
+ echo "</td><td width=\"50%\" align=\"left\">\r\n";
1696
+ $j++;
1697
+ }
1698
+ if (0 == $j) {
1699
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1700
+ if (in_array($cat->cat_ID, $selected)) {
1701
+ echo " checked=\"checked\" ";
1702
+ }
1703
+ echo " /> " . $cat->cat_name . "<br />\r\n";
1704
+ } else {
1705
+
1706
+ echo "<input type=\"checkbox\" name=\"category[]\" value=\"" . $cat->cat_ID . "\"";
1707
+ if (in_array($cat->cat_ID, $selected)) {
1708
+ echo " checked=\"checked\" ";
1709
+ }
1710
+ echo " /> " . $cat->cat_name . "<br />\r\n";
1711
+ }
1712
+ $i++;
1713
+ }
1714
+ echo "</td></tr>\r\n";
1715
+ echo "<tr><td align=\"left\">\r\n";
1716
+ echo "<input type=\"checkbox\" name=\"checkall\" onclick=\"setAll(this)\" /> " . __('Select / Unselect All' ,'subscribe2') . "\r\n";
1717
+ echo "</td></tr>\r\n";
1718
+ echo "</table>\r\n";
1719
+ } // end display_category_form()
1720
+
1721
+ /**
1722
+ Display a drop-down form to select subscribers
1723
+ $selected is the option to select
1724
+ $submit is the text to use on the Submit button
1725
+ */
1726
+ function display_subscriber_dropdown ($selected = 'registered', $submit = '', $exclude = array()) {
1727
+ global $wpdb;
1728
+
1729
+ $who = array('all' => __('All Subscribers', 'subscribe2'),
1730
+ 'public' => __('Public Subscribers', 'subscribe2'),
1731
+ 'confirmed' => ' &nbsp;&nbsp;' . __('Confirmed', 'subscribe2'),
1732
+ 'unconfirmed' => ' &nbsp;&nbsp;' . __('Unconfirmed', 'subscribe2'),
1733
+ 'registered' => __('Registered Subscribers', 'subscribe2'));
1734
+
1735
+ $all_cats = get_categories('type=post&hide_empty=1&hierarchical=0');
1736
+
1737
+ // count the number of subscribers
1738
+ $count['confirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='1'");
1739
+ $count['unconfirmed'] = $wpdb->get_var("SELECT COUNT(id) FROM $this->public WHERE active='0'");
1740
+ if (in_array('unconfirmed', $exclude)) {
1741
+ $count['public'] = $count['confirmed'];
1742
+ } elseif (in_array('confirmed', $exclude)) {
1743
+ $count['public'] = $count['unconfirmed'];
1744
+ } else {
1745
+ $count['public'] = ($count['confirmed'] + $count['unconfirmed']);
1746
+ }
1747
+ $count['registered'] = $wpdb->get_var("SELECT COUNT(meta_key) FROM $wpdb->usermeta WHERE meta_key='s2_subscribed'");
1748
+ $count['all'] = ($count['confirmed'] + $count['unconfirmed'] + $count['registered']);
1749
+ foreach ($all_cats as $cat) {
1750
+ $count[$cat->cat_name] = $wpdb->get_var("SELECT COUNT(meta_value) FROM $wpdb->usermeta WHERE meta_key='s2_cat$cat->cat_ID'");
1751
+ }
1752
+
1753
+ // do have actually have some subscribers?
1754
+ if ( (0 == $count['confirmed']) && (0 == $count['unconfirmed']) && (0 == $count['registered']) ) {
1755
+ // no? bail out
1756
+ return;
1757
+ }
1758
+
1759
+ if (false !== $submit) {
1760
+ echo "<form method=\"post\" action=\"\">";
1761
+ }
1762
+ echo "<select name=\"what\">\r\n";
1763
+ foreach ($who as $whom => $display) {
1764
+ if (in_array($whom, $exclude)) { continue; }
1765
+ if (0 == $count[$whom]) { continue; }
1766
+
1767
+ echo "<option value=\"" . $whom . "\"";
1768
+ if ($whom == $selected) { echo " selected=\"selected\" "; }
1769
+ echo ">$display (" . ($count[$whom]) . ")</option>\r\n";
1770
+ }
1771
+
1772
+ if ($count['registered'] > 0) {
1773
+ foreach ($all_cats as $cat) {
1774
+ if (in_array($cat->cat_ID, $exclude)) { continue; }
1775
+ echo "<option value=\"" . $cat->cat_ID . "\"";
1776
+ if ($cat->cat_ID == $selected) { echo " selected=\"selected\" "; }
1777
+ echo "> &nbsp;&nbsp;" . $cat->cat_name . "&nbsp;(" . $count[$cat->cat_name] . ") </option>\r\n";
1778
+ }
1779
+ }
1780
+ echo "</select>";
1781
+ if (false !== $submit) {
1782
+ echo "<span class=\"submit\"><input type=\"submit\" value=\"$submit\" /></span></form>\r\n";
1783
+ }
1784
+ } // end display_subscriber_dropdown()
1785
+
1786
+ function display_digest_choices() {
1787
+ global $wpdb;
1788
+ $schedule = (array)wp_get_schedules();
1789
+ $schedule = array_merge(array('never' => array('interval' => 0, 'display' => __('Per Post Email','subscribe2'))), $schedule);
1790
+ $sort = array();
1791
+ foreach ( (array)$schedule as $key => $value ) $sort[$key] = $value['interval'];
1792
+ asort($sort);
1793
+ $schedule_sorted = array();
1794
+ foreach ($sort as $key => $value) {
1795
+ $schedule_sorted[$key] = $schedule[$key];
1796
+ }
1797
+ foreach ($schedule_sorted as $key => $value) {
1798
+ echo "<input type=\"radio\" name=\"email_freq\" value=\"" . $key . "\"";
1799
+ if ($key == $this->subscribe2_options['email_freq']) {
1800
+ echo " checked=\"checked\" ";
1801
+ }
1802
+ echo " /> " . $value['display'] . "<br />\r\n";
1803
+ }
1804
+ if (wp_next_scheduled('s2_digest_cron')) {
1805
+ $datetime = get_option('date_format') . ' @ ' . get_option('time_format');
1806
+ echo "<p>" . __('Next email notification will be sent', 'subscribe2') . ": \r\n";
1807
+ echo "<strong>" . gmdate($datetime, wp_next_scheduled('s2_digest_cron') + (get_option('gmt_offset') * 3600)) . "</strong></p>\r\n";
1808
+ }
1809
+ } // end display_digest_choices()
1810
+
1811
+ /* ===== template and filter functions ===== */
1812
+ /**
1813
+ Display our form; also handles (un)subscribe requests
1814
+ */
1815
+ function filter($content = '') {
1816
+ if ( ('' == $content) || (! preg_match('|<!--subscribe2-->|', $content)) ) { return $content; }
1817
+ $this->s2form = $this->form;
1818
+
1819
+ global $user_ID;
1820
+ get_currentuserinfo();
1821
+ if ($user_ID) {
1822
+ if (current_user_can('manage_options')) {
1823
+ $this->s2form = $this->use_profile_admin;
1824
+ } else {
1825
+ $this->s2form = $this->use_profile_users;
1826
+ }
1827
+ }
1828
+ if (isset($_POST['s2_action'])) {
1829
+ global $wpdb, $user_email;
1830
+ if (!is_email($_POST['email'])) {
1831
+ $this->s2form = $this->form . $this->not_an_email;
1832
+ } elseif ($this->is_barred($_POST['email'])) {
1833
+ $this->s2form = $this->form . $this->barred_domain;
1834
+ } else {
1835
+ $this->email = $_POST['email'];
1836
+ // does the supplied email belong to a registered user?
1837
+ $check = $wpdb->get_var("SELECT user_email FROM $wpdb->users WHERE user_email = '$this->email'");
1838
+ if ('' != $check) {
1839
+ // this is a registered email
1840
+ $this->s2form = $this->please_log_in;
1841
+ } else {
1842
+ // this is not a registered email
1843
+ // what should we do?
1844
+ if ('subscribe' == $_POST['s2_action']) {
1845
+ // someone is trying to subscribe
1846
+ // lets see if they've tried to subscribe previously
1847
+ if ('1' !== $this->is_public($this->email)) {
1848
+ // the user is unknown or inactive
1849
+ $this->add();
1850
+ $this->send_confirm('add');
1851
+ // set a variable to denote that we've already run, and shouldn't run again
1852
+ $this->filtered = 1; //set this to not send duplicate emails
1853
+ $this->s2form = $this->confirmation_sent;
1854
+ } else {
1855
+ // they're already subscribed
1856
+ $this->s2form = $this->already_subscribed;
1857
+ }
1858
+ $this->action = 'subscribe';
1859
+ } elseif ('unsubscribe' == $_POST['s2_action']) {
1860
+ // is this email a subscriber?
1861
+ if (false == $this->is_public($this->email)) {
1862
+ $this->s2form = $this->form . $this->not_subscribed;
1863
+ } else {
1864
+ $this->send_confirm('del');
1865
+ // set a variable to denote that we've already run, and shouldn't run again
1866
+ $this->filtered = 1;
1867
+ $this->s2form = $this->confirmation_sent;
1868
+ }
1869
+ $this->action='unsubscribe';
1870
+ }
1871
+ }
1872
+ }
1873
+ }
1874
+ return preg_replace('|(<p>)(\n)*<!--subscribe2-->(\n)*(</p>)|', $this->s2form, $content);
1875
+ } // end filter()
1876
+
1877
+ /**
1878
+ Overrides the default query when handling a (un)subscription confirmation
1879
+ This is basically a trick: if the s2 variable is in the query string, just grab the first static page
1880
+ and override it's contents later with title_filter() and template_filter()
1881
+ */
1882
+ function query_filter() {
1883
+ // don't interfere if we've already done our thing
1884
+ if (1 == $this->filtered) { return; }
1885
+
1886
+ global $wpdb;
1887
+
1888
+ if ( (defined('S2PAGE')) && (0 !== S2PAGE) ) {
1889
+ return "page_id=" . S2PAGE;
1890
+ } else {
1891
+ $id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_status='static' LIMIT 1");
1892
+ if ($id) {
1893
+ return "page_id=$id";
1894
+ } else {
1895
+ return "showposts=1";
1896
+ }
1897
+ }
1898
+ } // end query_filter()
1899
+
1900
+ /**
1901
+ Overrides the page title
1902
+ */
1903
+ function title_filter() {
1904
+ // don't interfere if we've already done our thing
1905
+ if (1 == $this->filtered) { return; }
1906
+ return __('Subscription Confirmation', 'subscribe2');
1907
+ } // end title_filter()
1908
+
1909
+ /**
1910
+ Override the template filter to make sure a special template is not used
1911
+ */
1912
+ function template_filter() {
1913
+ // don't interfere if we've already done our thing
1914
+ if (1 == $this->filtered) { return; }
1915
+ return;
1916
+ } // end template_filter()
1917
+
1918
+ /* ===== wp-cron functions ===== */
1919
+ /**
1920
+ Send a daily digest of today's new posts
1921
+ */
1922
+ function subscribe2_cron() {
1923
+ global $wpdb;
1924
+
1925
+ // collect posts
1926
+ $now = date('Y-m-d H:i:s', time());
1927
+ $prev = $this->subscribe2_options['last_s2cron'];
1928
+ $posts = $wpdb->get_results("SELECT ID, post_title, post_excerpt, post_content FROM $wpdb->posts WHERE post_date >= '$prev' AND post_date < '$now' AND post_status='publish' AND post_type='post'");
1929
+
1930
+ // update last_s2cron execution time before completing or bailing
1931
+ $this->subscribe2_options['last_s2cron'] = $now;
1932
+ update_option('subscribe2_options', $this->subscribe2_options);
1933
+
1934
+ // do we have any posts?
1935
+ if (empty($posts)) { return; }
1936
+
1937
+ // if we have posts, let's prepare the digest
1938
+ foreach ($posts as $post) {
1939
+ $post_cats = wp_get_post_cats('1', $post->ID);
1940
+ $post_cats_string = implode(',', $post_cats);
1941
+ $check = false;
1942
+ // is the current post assigned to any categories
1943
+ // which should not generate a notification email?
1944
+ foreach (explode(',', $this->get_excluded_cats()) as $cat) {
1945
+ if (in_array($cat, $post_cats)) {
1946
+ $check = true;
1947
+ }
1948
+ }
1949
+ // if this post is in an excluded category,
1950
+ // don't include it in the digest
1951
+ if ($check) {
1952
+ continue;
1953
+ }
1954
+ $message .= $post->post_title . "\r\n";
1955
+ $message .= get_permalink($post->ID) . "\r\n";
1956
+ $excerpt = $post->post_excerpt;
1957
+ if ('' == $excerpt) {
1958
+ // no excerpt, is there a <!--more--> ?
1959
+ if (false !== strpos($post->post_content, '<!--more-->')) {
1960
+ list($excerpt, $more) = explode('<!--more-->', $plaintext, 2);
1961
+ // strip leading and trailing whitespace
1962
+ $excerpt = trim($excerpt);
1963
+ } else {
1964
+ $excerpt = strip_tags($post->post_content);
1965
+ $words = explode(' ', $excerpt, 56);
1966
+ if (count($words) > 55) {
1967
+ array_pop($words);
1968
+ array_push($words, '[...]');
1969
+ $excerpt = implode(' ', $words);
1970
+ }
1971
+ }
1972
+ }
1973
+ $message .= $excerpt . "\r\n\r\n";
1974
+ }
1975
+
1976
+ $author = get_userdata($post->post_author);
1977
+
1978
+ // do we send as admin, or post author?
1979
+ if ('author' == $this->subscribe2_options['sender']) {
1980
+ // get author details
1981
+ $user =& $author;
1982
+ } else {
1983
+ // get admin detailts
1984
+ $user = get_userdata(1);
1985
+ }
1986
+ $this->myemail = $user->user_email;
1987
+ $this->myname = $user->display_name;
1988
+
1989
+ $scheds = (array) wp_get_schedules();
1990
+ $email_freq = $this->subscribe2_options['email_freq'];
1991
+ $display = $scheds[$email_freq]['display'];
1992
+ $subject = '[' . stripslashes(get_settings('blogname')) . '] ' . $display . ' ' . __('Digest Email', 'subscribe2');
1993
+ $public = $this->get_public();
1994
+ $registered = $this->get_registered();
1995
+ $recipients = array_merge((array)$public, (array)$registered);
1996
+ $mailtext = $this->substitute(stripslashes($this->subscribe2_options['mailtext']));
1997
+ $body = str_replace('POST', $message, $mailtext);
1998
+ $this->mail($recipients, $subject, $body);
1999
+ } // end subscribe2_cron
2000
+
2001
+ /* ===== Our constructor ===== */
2002
+ /**
2003
+ Subscribe2 constructor
2004
+ */
2005
+ function subscribe2() {
2006
+ global $table_prefix;
2007
+
2008
+ load_plugin_textdomain('subscribe2', 'wp-content/plugins/subscribe2');
2009
+
2010
+ // load the options
2011
+ $this->subscribe2_options = array();
2012
+ $this->subscribe2_options = get_option('subscribe2_options');
2013
+
2014
+ // do we need to install anything?
2015
+ $this->public = $table_prefix . "subscribe2";
2016
+ if(mysql_query("SELECT COUNT(*) FROM ".$this->public)==FALSE) { $this->install(); }
2017
+ //do we need to upgrade anything?
2018
+ if ($this->subscribe2_options['version'] !== S2VERSION) {
2019
+ $this->upgrade();
2020
+ }
2021
+
2022
+ if (isset($_GET['s2'])) {
2023
+ // someone is confirming a request
2024
+ add_filter('query_string', array(&$this, 'query_filter'));
2025
+ add_filter('the_title', array(&$this, 'title_filter'));
2026
+ add_filter('the_content', array(&$this, 'confirm'));
2027
+ }
2028
+
2029
+ add_action('admin_head', array(&$this, 'admin_head'));
2030
+ add_action('admin_menu', array(&$this, 'admin_menu'));
2031
+ add_action('user_register', array(&$this, 'register'));
2032
+ add_action('create_category', array(&$this, 'autosub_new_category'));
2033
+ add_filter('the_content', array(&$this, 'filter'));
2034
+ add_filter('cron_schedules', array(&$this, 'add_weekly_sched'));
2035
+
2036
+ if ($this->subscribe2_options['email_freq'] != 'never') {
2037
+ add_action('s2_digest_cron', array(&$this, 'subscribe2_cron'));
2038
+ } else {
2039
+ add_action('publish_post', array(&$this, 'publish'));
2040
+ add_action('edit_post', array(&$this, 'edit'));
2041
+ add_action('private_to_published', array(&$this, 'private2publish'));
2042
+ }
2043
+
2044
+ // load our strings
2045
+ $this->load_strings();
2046
+ } // end subscribe2()
2047
+
2048
+ /* ===== our variables ===== */
2049
+ // cache variables
2050
+ var $version = '';
2051
+ var $all_public = '';
2052
+ var $all_unconfirmed = '';
2053
+ var $excluded_cats = '';
2054
+ var $post_title = '';
2055
+ var $permalink = '';
2056
+ var $myname = '';
2057
+ var $myemail = '';
2058
+ var $s2_subject = '[BLOGNAME] TITLE';
2059
+ var $signup_dates = array();
2060
+ var $private = false;
2061
+ var $filtered = 0;
2062
+
2063
+ // state variables used to affect processing
2064
+ var $action = '';
2065
+ var $email = '';
2066
+ var $message = '';
2067
+ var $error = '';
2068
+
2069
+ // some messages
2070
+ var $please_log_in = '';
2071
+ var $use_profile = '';
2072
+ var $confirmation_sent = '';
2073
+ var $already_subscribed = '';
2074
+ var $not_subscribed ='';
2075
+ var $not_an_email = '';
2076
+ var $barred_domain = '';
2077
+ var $mail_sent = '';
2078
+ var $form = '';
2079
+ var $no_such_email = '';
2080
+ var $added = '';
2081
+ var $deleted = '';
2082
+ var $confirm_subject = '';
2083
+ var $options_saved = '';
2084
+ var $options_reset = '';
2085
+ } // end class subscribe2
2086
+ ?>
subscribe2/subscribe2.pot ADDED
@@ -0,0 +1,464 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: \n"
11
+ "POT-Creation-Date: 2007-03-19 19:24+0000\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: subscribe2.php:103
20
+ msgid "To manage your subscription options please "
21
+ msgstr ""
22
+
23
+ #: subscribe2.php:105 subscribe2.php:107
24
+ msgid "You may manage your subscription options from your "
25
+ msgstr ""
26
+
27
+ #: subscribe2.php:109
28
+ msgid "A confirmation message is on its way!"
29
+ msgstr ""
30
+
31
+ #: subscribe2.php:111
32
+ msgid "That email address is already subscribed."
33
+ msgstr ""
34
+
35
+ #: subscribe2.php:113
36
+ msgid "That email address is not subscribed."
37
+ msgstr ""
38
+
39
+ #: subscribe2.php:115
40
+ msgid "Sorry, but that does not look like an email address to me."
41
+ msgstr ""
42
+
43
+ #: subscribe2.php:117
44
+ msgid ""
45
+ "Sorry, email addresses at that domain are currently barred due to spam, "
46
+ "please use an alternative email address."
47
+ msgstr ""
48
+
49
+ #: subscribe2.php:119
50
+ msgid "Message sent!"
51
+ msgstr ""
52
+
53
+ #: subscribe2.php:121
54
+ msgid "Your email:"
55
+ msgstr ""
56
+
57
+ #: subscribe2.php:121 subscribe2.php:1185 subscribe2.php:1277
58
+ msgid "Subscribe"
59
+ msgstr ""
60
+
61
+ #: subscribe2.php:121 subscribe2.php:1278
62
+ msgid "Unsubscribe"
63
+ msgstr ""
64
+
65
+ #: subscribe2.php:121 subscribe2.php:1659
66
+ msgid "Send"
67
+ msgstr ""
68
+
69
+ #: subscribe2.php:124
70
+ msgid "No such email address is registered."
71
+ msgstr ""
72
+
73
+ #: subscribe2.php:126
74
+ msgid "You have successfully subscribed!"
75
+ msgstr ""
76
+
77
+ #: subscribe2.php:128
78
+ msgid "You have successfully unsubscribed."
79
+ msgstr ""
80
+
81
+ #: subscribe2.php:130
82
+ msgid "Please confirm your request"
83
+ msgstr ""
84
+
85
+ #: subscribe2.php:132
86
+ msgid "Subscription Reminder"
87
+ msgstr ""
88
+
89
+ #: subscribe2.php:134
90
+ msgid "subscribe"
91
+ msgstr ""
92
+
93
+ #: subscribe2.php:136
94
+ msgid "unsubscribe"
95
+ msgstr ""
96
+
97
+ #: subscribe2.php:139
98
+ msgid "Options saved!"
99
+ msgstr ""
100
+
101
+ #: subscribe2.php:140
102
+ msgid "Options reset!"
103
+ msgstr ""
104
+
105
+ #: subscribe2.php:148 subscribe2.php:1190
106
+ msgid "Subscribers"
107
+ msgstr ""
108
+
109
+ #: subscribe2.php:149
110
+ msgid "Subscribe2 Options"
111
+ msgstr ""
112
+
113
+ #: subscribe2.php:149
114
+ msgid "Subscribe2"
115
+ msgstr ""
116
+
117
+ #: subscribe2.php:151 subscribe2.php:153
118
+ msgid "Subscriptions"
119
+ msgstr ""
120
+
121
+ #: subscribe2.php:155
122
+ msgid "Mail Subscribers"
123
+ msgstr ""
124
+
125
+ #: subscribe2.php:178
126
+ msgid "Once Weekly"
127
+ msgstr ""
128
+
129
+ #: subscribe2.php:780
130
+ msgid "New subscriber"
131
+ msgstr ""
132
+
133
+ #: subscribe2.php:781
134
+ msgid "subscribed to email notifications!"
135
+ msgstr ""
136
+
137
+ #: subscribe2.php:1098
138
+ msgid "Address(es) subscribed!"
139
+ msgstr ""
140
+
141
+ #: subscribe2.php:1101
142
+ msgid "deleted!"
143
+ msgstr ""
144
+
145
+ #: subscribe2.php:1104
146
+ msgid "status changed!"
147
+ msgstr ""
148
+
149
+ #: subscribe2.php:1107
150
+ msgid "Reminder Email(s) Sent!"
151
+ msgstr ""
152
+
153
+ #: subscribe2.php:1110
154
+ msgid "CSV File Created in wp-content"
155
+ msgstr ""
156
+
157
+ #: subscribe2.php:1113
158
+ msgid "Registered Users Subscribed!"
159
+ msgstr ""
160
+
161
+ #: subscribe2.php:1116
162
+ msgid "Registered Users Unsubscribed!"
163
+ msgstr ""
164
+
165
+ #: subscribe2.php:1178
166
+ msgid "Subscribe Addresses"
167
+ msgstr ""
168
+
169
+ #: subscribe2.php:1183
170
+ msgid "Enter addresses, one per line or comma-seperated"
171
+ msgstr ""
172
+
173
+ #: subscribe2.php:1192
174
+ msgid "Filter"
175
+ msgstr ""
176
+
177
+ #: subscribe2.php:1196
178
+ msgid ""
179
+ "Registered on the left, confirmed in the middle, unconfirmed on the right"
180
+ msgstr ""
181
+
182
+ #: subscribe2.php:1205
183
+ msgid "Save Emails to CSV File"
184
+ msgstr ""
185
+
186
+ #: subscribe2.php:1251
187
+ msgid "NONE"
188
+ msgstr ""
189
+
190
+ #: subscribe2.php:1261
191
+ msgid "Send Reminder Email"
192
+ msgstr ""
193
+
194
+ #: subscribe2.php:1268
195
+ msgid "Categories"
196
+ msgstr ""
197
+
198
+ #: subscribe2.php:1269
199
+ msgid ""
200
+ "Existing Registered Users can be automatically (un)subscribed to categories "
201
+ "using this section."
202
+ msgstr ""
203
+
204
+ #: subscribe2.php:1270
205
+ msgid "Consider User Privacy as changes cannot be undone"
206
+ msgstr ""
207
+
208
+ #: subscribe2.php:1369
209
+ msgid "Delivery Options"
210
+ msgstr ""
211
+
212
+ #: subscribe2.php:1370
213
+ msgid "Send Email From"
214
+ msgstr ""
215
+
216
+ #: subscribe2.php:1375
217
+ msgid "Author of the post"
218
+ msgstr ""
219
+
220
+ #: subscribe2.php:1380
221
+ msgid "Blog Admin"
222
+ msgstr ""
223
+
224
+ #: subscribe2.php:1382
225
+ msgid "Send Email as Digest"
226
+ msgstr ""
227
+
228
+ #: subscribe2.php:1386
229
+ msgid "Email Templates"
230
+ msgstr ""
231
+
232
+ #: subscribe2.php:1389
233
+ msgid "New Post email (must not be empty)"
234
+ msgstr ""
235
+
236
+ #: subscribe2.php:1393
237
+ msgid "Message substitions"
238
+ msgstr ""
239
+
240
+ #: subscribe2.php:1397
241
+ msgid "the post's title"
242
+ msgstr ""
243
+
244
+ #: subscribe2.php:1398
245
+ msgid ""
246
+ "the excerpt or the entire post<br />(<i>based on the subscriber's "
247
+ "preferences</i>)"
248
+ msgstr ""
249
+
250
+ #: subscribe2.php:1399
251
+ msgid "the post's permalink"
252
+ msgstr ""
253
+
254
+ #: subscribe2.php:1400
255
+ msgid "the admin or post author's name"
256
+ msgstr ""
257
+
258
+ #: subscribe2.php:1401
259
+ msgid "the admin or post author's email"
260
+ msgstr ""
261
+
262
+ #: subscribe2.php:1402
263
+ msgid "the post author's name"
264
+ msgstr ""
265
+
266
+ #: subscribe2.php:1403
267
+ msgid ""
268
+ "the generated link to confirm a request<br />(<i>only used in the "
269
+ "confirmation email template</i>)"
270
+ msgstr ""
271
+
272
+ #: subscribe2.php:1404
273
+ msgid ""
274
+ "Action performed by LINK in confirmation email<br />(<i>only used in the "
275
+ "confirmation email template</i>)"
276
+ msgstr ""
277
+
278
+ #: subscribe2.php:1406
279
+ msgid "Subscribe / Unsubscribe confirmation email"
280
+ msgstr ""
281
+
282
+ #: subscribe2.php:1409
283
+ msgid "Reminder email to Unconfirmed Subscribers"
284
+ msgstr ""
285
+
286
+ #: subscribe2.php:1414
287
+ msgid "Excluded Categories"
288
+ msgstr ""
289
+
290
+ #: subscribe2.php:1420
291
+ msgid "Allow registered users to subscribe to excluded categories?"
292
+ msgstr ""
293
+
294
+ #: subscribe2.php:1421
295
+ msgid "Writing Options"
296
+ msgstr ""
297
+
298
+ #: subscribe2.php:1426
299
+ msgid "Show the Subscribe2 button on the Write toolbar?"
300
+ msgstr ""
301
+
302
+ #: subscribe2.php:1429
303
+ msgid "Auto Subscribe"
304
+ msgstr ""
305
+
306
+ #: subscribe2.php:1430
307
+ msgid "Automatically subscribe new users registering with your blog."
308
+ msgstr ""
309
+
310
+ #: subscribe2.php:1435
311
+ msgid "Yes"
312
+ msgstr ""
313
+
314
+ #: subscribe2.php:1440
315
+ msgid "No"
316
+ msgstr ""
317
+
318
+ #: subscribe2.php:1441
319
+ msgid "Auto-subscribe users to receive email as"
320
+ msgstr ""
321
+
322
+ #: subscribe2.php:1446 subscribe2.php:1556
323
+ msgid "HTML"
324
+ msgstr ""
325
+
326
+ #: subscribe2.php:1451
327
+ msgid "Plain Text - Full"
328
+ msgstr ""
329
+
330
+ #: subscribe2.php:1456
331
+ msgid "Plain Text - Excerpt"
332
+ msgstr ""
333
+
334
+ #: subscribe2.php:1459
335
+ msgid "Barred Domains"
336
+ msgstr ""
337
+
338
+ #: subscribe2.php:1460
339
+ msgid ""
340
+ "Enter domains to bar from public subscriptions: <br /> (Use a new line for "
341
+ "each entry and omit the \"@\" symbol, for example email.com)"
342
+ msgstr ""
343
+
344
+ #: subscribe2.php:1464
345
+ msgid "Submit"
346
+ msgstr ""
347
+
348
+ #: subscribe2.php:1469
349
+ msgid "Reset Default"
350
+ msgstr ""
351
+
352
+ #: subscribe2.php:1470
353
+ msgid ""
354
+ "Use this to reset all options to their defaults. This <strong><em>will not</"
355
+ "em></strong> modify your list of subscribers."
356
+ msgstr ""
357
+
358
+ #: subscribe2.php:1477
359
+ msgid "RESET"
360
+ msgstr ""
361
+
362
+ #: subscribe2.php:1497
363
+ msgid "Subscription preferences updated."
364
+ msgstr ""
365
+
366
+ #: subscribe2.php:1544
367
+ msgid "Notification Settings"
368
+ msgstr ""
369
+
370
+ #: subscribe2.php:1551
371
+ msgid "Receive email as"
372
+ msgstr ""
373
+
374
+ #: subscribe2.php:1561
375
+ msgid "Plain Text"
376
+ msgstr ""
377
+
378
+ #: subscribe2.php:1563
379
+ msgid "Email contains"
380
+ msgstr ""
381
+
382
+ #: subscribe2.php:1564
383
+ msgid "Excerpt Only"
384
+ msgstr ""
385
+
386
+ #: subscribe2.php:1564
387
+ msgid "Full Post"
388
+ msgstr ""
389
+
390
+ #: subscribe2.php:1572
391
+ msgid "Note: HTML format will always deliver the full post."
392
+ msgstr ""
393
+
394
+ #: subscribe2.php:1573
395
+ msgid "Automatically subscribe me to newly created categories"
396
+ msgstr ""
397
+
398
+ #: subscribe2.php:1585
399
+ msgid "Subscribed Categories"
400
+ msgstr ""
401
+
402
+ #: subscribe2.php:1590
403
+ msgid "Receive daily summary of new posts?"
404
+ msgstr ""
405
+
406
+ #: subscribe2.php:1603
407
+ msgid "Update Preferences &raquo;"
408
+ msgstr ""
409
+
410
+ #: subscribe2.php:1648
411
+ msgid "Send email to all subscribers"
412
+ msgstr ""
413
+
414
+ #: subscribe2.php:1653
415
+ msgid "Subject"
416
+ msgstr ""
417
+
418
+ #: subscribe2.php:1653
419
+ msgid "A message from "
420
+ msgstr ""
421
+
422
+ #: subscribe2.php:1656
423
+ msgid "Recipients: "
424
+ msgstr ""
425
+
426
+ #: subscribe2.php:1716
427
+ msgid "Select / Unselect All"
428
+ msgstr ""
429
+
430
+ #: subscribe2.php:1729
431
+ msgid "All Subscribers"
432
+ msgstr ""
433
+
434
+ #: subscribe2.php:1730
435
+ msgid "Public Subscribers"
436
+ msgstr ""
437
+
438
+ #: subscribe2.php:1731
439
+ msgid "Confirmed"
440
+ msgstr ""
441
+
442
+ #: subscribe2.php:1732
443
+ msgid "Unconfirmed"
444
+ msgstr ""
445
+
446
+ #: subscribe2.php:1733
447
+ msgid "Registered Subscribers"
448
+ msgstr ""
449
+
450
+ #: subscribe2.php:1789
451
+ msgid "Per Post Email"
452
+ msgstr ""
453
+
454
+ #: subscribe2.php:1806
455
+ msgid "Next email notification will be sent"
456
+ msgstr ""
457
+
458
+ #: subscribe2.php:1906
459
+ msgid "Subscription Confirmation"
460
+ msgstr ""
461
+
462
+ #: subscribe2.php:1992
463
+ msgid "Digest Email"
464
+ msgstr ""
wp-content/plugins/subscribe2.php DELETED
@@ -1,782 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Subscribe2
4
- Plugin URI: http://www.skippy.net/blog/plugins
5
- Description: Notifies an email list when new entries are posted.
6
- Version: 2.1.7
7
- Author: Scott Merrill
8
- Author URI: http://www.skippy.net/
9
- */
10
-
11
- // ****************************************
12
- // CHANGE THIS TO 1 IF YOU ARE ON DREAMHOST
13
- // ****************************************
14
- $dreamhost = 0;
15
-
16
- /////////////////////
17
- // main program block
18
- $s2_version = "2.1.7";
19
- add_action ('admin_menu', 'subscribe2_menu');
20
- add_action ('publish_post', 'subscribe2', 8);
21
- //////////// END MAIN PROGRAM /////////////
22
-
23
- //////////// BEGIN FUNCTIONS //////////////
24
- function subscribe2_menu() {
25
- global $s2_version;
26
- if ($s2_version != get_option('s2_version')) {
27
- s2_db_upgrade();
28
- }
29
- add_management_page(__('Subscribers', 'subscribe2'), __('Subscribers', 'subscribe2'), 9, __FILE__, 's2_manage');
30
- add_options_page(__('Subscribe2 Options', 'subscribe2'), __('Subscribe2', 'subscribe2'), 9, __FILE__, 's2_options');
31
- }
32
-
33
- //////////////////////////////////
34
- if (! function_exists('subscribe2')) {
35
- function subscribe2 ($post_ID = 0) {
36
- global $dreamhost, $table_prefix, $wpdb;
37
-
38
- $s2_table = $table_prefix . "subscribe2";
39
-
40
- // gets the name of your blog
41
- $blogname = get_settings('blogname');
42
-
43
- // we do this to work around a bug with drafts in WP 1.5.1.3 and below
44
- $postdata = $wpdb->get_row("SELECT * FROM $wpdb->posts WHERE ID = '$post_ID'");
45
- global $post_cache;
46
- $post_cache[$post_ID] = $postdata;
47
-
48
- // gets the link to the new post
49
- $postlink = get_permalink($post_ID);
50
-
51
- $cats = wp_get_post_cats('1', $post_ID);
52
-
53
- // is this post's date set in the future?
54
- if ($postdata->post_date > current_time('mysql')) {
55
- // if so, let's not tell anyone about this
56
- return $post_ID;
57
- }
58
-
59
- // get our options
60
- $s2 = get_option('s2_options');
61
-
62
- // should we bypass the email notice on this post?
63
- $skip = explode(',', $s2['s2_cats_to_skip']);
64
- $bypass = '0';
65
- foreach ($skip as $skippy) {
66
- if ('1' == $bypass) { break; }
67
- if (in_array($skippy, $cats)) {
68
- $bypass = '1';
69
- }
70
- }
71
- if ('1' == $bypass) { return $post_ID; }
72
-
73
- // do we send as admin, or post author?
74
- if ('author' == $s2['s2_sender']) {
75
- // get author details
76
- $user = get_userdata($postdata->post_author);
77
- } else {
78
- // get admin detailts
79
- $user = get_userdata(1);
80
- }
81
- $myemailadd = $user->user_email;
82
- $idmode = $userdata->user_idmode;
83
- if ($idmode == 'nickname') $myname = $user->user_nickname;
84
- if ($idmode == 'login') $myname = $user->user_login;
85
- if ($idmode == 'firstname') $myname = $user->user_firstname;
86
- if ($idmode == 'lastname') $myname = $user->user_lastname;
87
- if ($idmode == 'namefl') $myname = $user->user_firstname.' '.$user->user_lastname;
88
- if ($idmode == 'namelf') $myname = $user->user_lastname.' '.$user->user_firstname;
89
- if (!$idmode) $myname = $user->user_nickname;
90
-
91
-
92
- // gets the path to your blog directory
93
- $s2_link = get_settings('siteurl') . "/subscribe.php";
94
-
95
- // get the list of active recipients from the database
96
- $sql = "SELECT email FROM " . $s2_table . " WHERE active='1'";
97
- $recipients = $wpdb->get_col($sql);
98
- if (count($recipients) == 0) {
99
- // no one to send to!
100
- return $post_ID;
101
- }
102
-
103
- // Set email subject
104
- $subject = stripslashes($s2['s2_subject']);
105
- // do any substitutions that are necessary
106
- $subject = str_replace('BLOGNAME', $blogname, $subject);
107
- $subject = str_replace('TITLE', $postdata->post_title, $subject);
108
- $subject = str_replace('MYNAME', $myname, $subject);
109
- $subject = str_replace('EMAIL', $myemailadd, $subject);
110
-
111
- // Set sender details
112
- $headers = "From: \"$myname\" <" . $myemailadd . ">\n";
113
-
114
- // BCC all recipients
115
- // with batching for Dreamhost
116
- if (1 == $dreamhost) {
117
- $count = 1;
118
- $bcc = '';
119
- $batch = array();
120
- foreach ($recipients as $recipient) {
121
- $recipient = trim($recipient);
122
- if (! empty($recipient)) {
123
- $bcc .= "Bcc: " . $recipient . "\n";
124
- }
125
- if (30 == $count) {
126
- $count = 1;
127
- $batch[] = $bcc;
128
- $bcc = '';
129
- } else {
130
- $count++;
131
- }
132
- }
133
- if (0 == count($batch)) {
134
- // we have less than 30 subscribers, so let's skip batching
135
- $headers .= $bcc;
136
- unset($batch);
137
- }
138
- } else {
139
- // we're not on dreamhost, so do it normal
140
- foreach ($recipients as $recipient) {
141
- $recipient = trim($recipient);
142
- if (! empty($recipient)) {
143
- $headers .= "Bcc: " . $recipient . "\n";
144
- }
145
- }
146
- }
147
-
148
- // prepare the message template
149
- $mailtext = stripslashes($s2['s2_mailtext']);
150
- $mailtext = str_replace('BLOGNAME', $blogname, $mailtext);
151
- $mailtext = str_replace('BLOGLINK', get_bloginfo('url'), $mailtext);
152
- $mailtext = str_replace('TITLE', $postdata->post_title, $mailtext);
153
- $mailtext = str_replace('PERMALINK', $postlink, $mailtext);
154
- $mailtext = str_replace('S2LINK', $s2_link, $mailtext);
155
- $mailtext = str_replace('MYNAME', $myname, $mailtext);
156
- $mailtext = str_replace('EMAIL', $myemailadd, $mailtext);
157
- if ('post' == $s2['s2_excerpt']) {
158
- $content = $postdata->post_content;
159
- } elseif ('excerpt' == $s2['s2_excerpt']) {
160
- $content = $postdata->post_excerpt;
161
-
162
- if ('' == $content) {
163
- // no excerpt
164
- // let's see if a <!--more--> tag exists in the body
165
- if (false !== strpos($postdata->post_content, '<!--more-->')) {
166
- list($content, $more) = explode('<!--more-->',$postdata->post_content, 2);
167
- // strip leading and trailing whitespace
168
- $content = preg_replace('/^[\s]*(.*)[\s]*$/','\\1',$content);
169
- }
170
- }
171
- } else {
172
- $content = '';
173
- }
174
- $mailtext = str_replace('EXCERPT', $content, $mailtext);
175
-
176
- if ('html' == $s2['s2_html']) {
177
- // To send HTML mail, the Content-type header must be set
178
- $headers .= "MIME-Version: 1.0\n";
179
- $headers .= "Content-type: " . get_bloginfo('html_type') . "; charset=\"". get_bloginfo('charset') . "\"\n";
180
- $mailtext = apply_filters('the_content', $mailtext);
181
- $mailtext = str_replace(']]>', ']]&gt;', $mailtext);
182
- $mailtext = "<html><head><title>$subject</title></head><body>" . $mailtext . "</body></html>";
183
- } else {
184
- $headers .= "MIME-Version: 1.0\n";
185
- $headers .= "Content-type: text/plain; charset=\"". get_bloginfo('charset') . "\"\n";
186
- $mailtext = strip_tags($mailtext);
187
- }
188
-
189
- // And away we go...
190
- if (isset($_POST['publish'])) { // we only want to send on publish
191
- // handle batches for Dreamhost
192
- if ( (1 == $dreamhost) && (isset($batch)) ) {
193
- foreach ($batch as $bcc) {
194
- $newheaders = $headers . $bcc;
195
- @wp_mail($myemailadd, $subject, $mailtext, $newheaders);
196
- }
197
- } else {
198
- @wp_mail($myemailadd, $subject, $mailtext, $headers);
199
- }
200
- }
201
- return $post_ID;
202
- } // end subscribe2
203
- }
204
-
205
- ///////////////////////
206
- function s2_install() {
207
- // include upgrade-functions for maybe_create_table;
208
- if (! function_exists('maybe_create_table')) {
209
- require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
210
- }
211
-
212
- global $table_prefix;
213
- $s2_table = $table_prefix . "subscribe2";
214
- $s2_table_sql = "CREATE TABLE " . $s2_table . "( id int(11) NOT NULL auto_increment, email varchar(64) NOT NULL default '', active tinyint(1) default 0, PRIMARY KEY (id) )";
215
-
216
- // create the table, as needed
217
- maybe_create_table($s2_table, $s2_table_sql);
218
-
219
- s2_reset();
220
- } // s2_install
221
-
222
- ///////////////////////
223
- function s2_db_upgrade() {
224
- // include upgrade-functions for maybe_create_table;
225
- if (! function_exists('maybe_create_table')) {
226
- require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
227
- }
228
- global $wpdb, $table_prefix, $s2_version;
229
- $s2_table = $table_prefix . "subscribe2";
230
-
231
- $date = date('Y-m-d');
232
- maybe_add_column($s2_table, "date", "ALTER TABLE `$s2_table` ADD `date` DATE DEFAULT '$date' NOT NULL AFTER `active` ;");
233
- update_option('s2_version', $s2_version);
234
- }// s2_db_upgrade
235
-
236
- ///////////////////
237
- function s2_reset() {
238
- $s2 = array ('s2_html' => 'text',
239
- 's2_sender' => 'author',
240
- 's2_excerpt' => 'excerpt',
241
- 's2_subject' => 'BLOGNAME has been updated!',
242
- 's2_mailtext' => "BLOGNAME has posted a new item, 'TITLE'\r\nEXCERPT\r\nYou may view the latest post at\r\nPERMALINK\r\nYou received this e-mail because you asked to be notified when new updates are posted.\r\nIf you no longer wish to receive notifications of new posts then please visit:\r\nS2LINK\r\nBest regards,\r\nMYNAME\r\nEMAIL",
243
- 's2_welcome' => 'By subscribing to this service you will be notified every time a new post is added.',
244
- 's2_confirm_subject' => 'Confirmation Request from BLOGNAME',
245
- 's2_confirm_email' => "In order to confirm your request for BLOGNAME, please click on the link below:\n\nLINK\n\nIf you did not request this, please feel free to disregard this notice!\n\nThank you,\nMYNAME.",
246
- 's2_invalid' => 'Sorry, but that does not look like an email address to me!',
247
- 's2_self' => "Thanks, but I'll make my own decisions about my email!",
248
- 's2_already_there' => 'I already know about that email address.',
249
- 's2_not_there' => "That email address wasn't in the system.",
250
- 's2_add_confirm' => 'Thank you for subscribing, a confirmation email is on its way!',
251
- 's2_delete_confirm' => 'An email has been sent to you with further instructions.',
252
- 's2_added' => 'Your email address has been successfully subscribed. Thank you!',
253
- 's2_deleted' => 'Your email has been removed from the list.',
254
- 's2_subscribed_admin_subject' => 'New subscriber!',
255
- 's2_unsubscribed_admin_subject' => 'Subscriber removed.',
256
- 's2_cats_to_skip' => ''
257
- );
258
-
259
- update_option('s2_options', $s2, '', 'no');
260
-
261
- } // end s2_reset
262
-
263
- ////////////////////
264
- function s2_options() {
265
- global $wpdb, $table_prefix, $cache_categories;
266
-
267
- $s2_table = $table_prefix . "subscribe2";
268
-
269
- // check if we need to install the table
270
- $sql = "SELECT COUNT(id) FROM " . $s2_table;
271
- // turn errors off, for the momemnt
272
- $errors = $wpdb->hide_errors();
273
- $foo = $wpdb->get_var($sql);
274
- // turn errors back on
275
- $errors = $wpdb->show_errors();
276
- if ('' == $foo) { s2_install(); }
277
-
278
- // now try to figure out what we're supposed to do
279
- if (isset($_POST['s2_admin'])) {
280
- $admin = $_POST['s2_admin'];
281
- }
282
- if ('options' == $admin) {
283
- s2_options_update();
284
- } elseif ('RESET' == $admin) {
285
- s2_reset();
286
- }
287
-
288
- $s2 = get_option('s2_options');
289
-
290
- load_plugin_textdomain('subscribe2');
291
-
292
- echo '<div class="wrap">';
293
- echo '<h2>' . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
294
- echo '<form method="POST">';
295
- echo '<input type="hidden" name="s2_admin" value="options" />';
296
- echo '<fieldset class="options"><legend>' . __('Email Options', 'subscribe2') . ':</legend>';
297
- echo __('Send email as', 'subscribe2') . ': &nbsp;&nbsp;';
298
- echo '<input type="radio" name="s2_html" value="html"';
299
- if ('html' == $s2['s2_html']) {
300
- echo 'checked="checked" ';
301
- }
302
- echo '/> ' . __('HTML', 'subscribe2') .' &nbsp;&nbsp;';
303
- echo '<input type="radio" name="s2_html" value="text" ';
304
- if ('text' == $s2['s2_html']) {
305
- echo 'checked="checked" ';
306
- }
307
- echo '/> ' . __('Plain Text', 'subscribe2') . "<br /><br />\r\n";
308
- echo __('Send Email From', 'subscribe2') . ':&nbsp;&nbsp;';
309
- echo '<input type="radio" name="s2_sender" value="author" ';
310
- if ('author' == $s2['s2_sender']) {
311
- echo 'checked="checked" ';
312
- }
313
- echo ' /> ' . __('Author of the post', 'subscribe2') . ' &nbsp;&nbsp;';
314
- echo '<input type="radio" name="s2_sender" value="admin" ';
315
- if ('admin' == $s2['s2_sender']) {
316
- echo 'checked="checked" ';
317
- }
318
- echo ' /> ' . __('Blog Admin', 'subscribe2') . "<br /><br />\r\n";
319
- echo __('Amount of post to deliver', 'subscribe2') . ':&nbsp;&nbsp;';
320
-
321
- $foo = array ('none' => __('None', 'subscribe2'), 'excerpt' => __('Excerpt Only', 'subscribe2'), 'post' => __('Full Post', 'subscribe2'));
322
- foreach ($foo as $value => $key) {
323
- echo '<input type="radio" name="s2_excerpt" value="' . $value . '"';
324
- if (strtolower($value) == strtolower($s2['s2_excerpt'])) {
325
- echo ' checked="checked"';
326
- }
327
- echo ' /> ' . $key . '&nbsp;&nbsp;';
328
- }
329
- echo '</fieldset>';
330
-
331
- echo '<fieldset class="options"><legend>' . __('Email Template', 'subscribe2') . "</legend>\r\n";
332
- echo __('Subject', 'subscribe2') . ': (' . __('must not be empty', 'subscribe2') . ')';
333
- echo "<br />\r\n";
334
- echo '<input type="text" name="s2_subject" size="60" value="' . stripslashes($s2['s2_subject']) . '" />';
335
- echo "<br /><br />\r\n";
336
- echo __('Message', 'subscribe2') . ': (' . __('must not be empty', 'subscribe2') . ')';
337
- echo "<br />\r\n";
338
- echo '<textarea rows="15" cols="90" name="s2_mailtext">' . stripslashes($s2['s2_mailtext']) . "</textarea>\r\n";
339
-
340
- echo '<fieldset class="options"><legend>' . __('Message substitions', 'subscribe2') . ":</legend>\r\n";
341
- echo '<table width="100%">';
342
- echo '<tr><td width="50%">';
343
- echo '<ul>';
344
- echo '<li><b>BLOGNAME</b>: ' . __('replaced with', 'subscribe2') . ' ' . get_bloginfo('name') . "</li>\r\n";
345
- echo '<li><b>BLOGLINK</b>: ' . __('replaced with', 'subscribe2') . ' ' . get_bloginfo('url') . "</li>\r\n";
346
- echo '<li><b>TITLE</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post's title", 'subscribe2') . "</li>\r\n";
347
- echo '<li><b>EXCERPT</b>: ' . __('replaced with', 'subscribe2') . ' ' . __('blank, the excerpt, or the entire post, based on the option set above', 'subscribe2') . "</li>\r\n";
348
- echo '</ul>';
349
- echo "</td><td>\r\n";
350
- echo '<ul>';
351
- echo '<li><b>PERMALINK</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post's permalink", 'subscribe2') . "</li>\r\n";
352
- echo '<li><b>S2LINK</b>: ' . __('replaced with', 'subscribe2') . ' ' . __('a link to your subscribe.php file', 'subscribe2') . "</li>\r\n";
353
- echo '<li><b>MYNAME</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post author's name", 'subscribe2') . "</li>\r\n";
354
- echo '<li><b>EMAIL</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post author's email", 'subscribe2') . "</li>\r\n";
355
- echo '</ul>';
356
- echo '</td></tr>';
357
- echo "</table>\r\n";
358
- echo "</fieldset>\r\n";
359
- echo "</fieldset>\r\n";
360
-
361
- echo '<h2>' . __('Subscription Messages', 'subscribe2') . "</h2>\r\n";
362
- echo '<fieldset class="options"><legend>' . __('Website messages', 'subscribe2') . ":</legend>\r\n";
363
- echo '<table width="100%" cellspacing="2" cellpadding="5" class="editform">';
364
- echo '<tr><td colspan="2" align="center">';
365
- echo __('Welcome message', 'subscribe2') . ":<br />\r\n";
366
- echo '<input type="text" size="90" name="s2_welcome" value="' . stripslashes($s2['s2_welcome']) . '" />';
367
- echo "</td></tr>\r\n";
368
- echo "<tr><td>\r\n";
369
- echo __('Invalid email was supplied', 'subscribe2') . ":<br />\r\n";
370
- echo '<input type="text" size="53" name="s2_invalid" value="' . stripslashes($s2['s2_invalid']) . '" />';
371
- echo "</td><td>\r\n";
372
- echo __('Your email was supplied', 'subscribe2') . ":<br />\r\n";
373
- echo '<input type="text" size="53" name="s2_self" value="' . stripslashes($s2['s2_self']) . '" />';
374
- echo "<td></tr>\r\n";
375
- echo "<tr><td>\r\n";
376
- echo __('Known email was supplied', 'subscribe2') . ":<br />\r\n";
377
- echo '<input type="text" size="53" name="s2_already_there" value="' . stripslashes($s2['s2_already_there']) . '" />';
378
- echo "</td><td>\r\n";
379
- echo __('Non-existant email supplied', 'subscribe2') . ":<br />\r\n";
380
- echo '<input type="text" size="53" name="s2_not_there" value="' . stripslashes($s2['s2_not_there']) . '" />';
381
- echo "<td></tr>\r\n";
382
- echo "<tr><td>\r\n";
383
- echo __('Subscribe confirmation email dispatched', 'subscribe2') . ":<br />\r\n";
384
- echo '<textarea cols="50" rows="3" name="s2_add_confirm">' . stripslashes($s2['s2_add_confirm']) . '</textarea>';
385
- echo "</td><td>\r\n";
386
- echo __('Unsubscribe confirmation email dispatched', 'subscribe2') . ":<br />\r\n";
387
- echo '<textarea cols="50" rows="3" name="s2_delete_confirm">' . stripslashes($s2['s2_delete_confirm']) . '</textarea>';
388
- echo "</td><tr>\r\n";
389
- echo "<tr><td>\r\n";
390
- echo __('Successful subscription message', 'subscribe2') . ":<br />\r\n";
391
- echo '<input type="text" size="53" name="s2_added" value="' . stripslashes($s2['s2_added']) . '" />';
392
- echo "</td><td>\r\n";
393
- echo __('Successful deletion message', 'subscribe2') . ":<br />\r\n";
394
- echo '<input type="text" size="53" name="s2_deleted" value="' . stripslashes($s2['s2_deleted']) . '" />';
395
- echo "</td></tr>\r\n";
396
- echo '</table>';
397
- echo "</fieldset>\r\n";
398
-
399
- echo '<fieldset class="options"><legend>' . __('Email messages', 'subscribe2') . ":</legend>\r\n";
400
- echo '<table width="100%" cellspacing="2" cellpadding="5" class="editform">';
401
- echo '<tr><td colspan="2">';
402
- echo __('Subject line for all confirmation emails', 'subscribe2') . ":<br />\r\n";
403
- echo '<input type="text" size="50" name="s2_confirm_subject" value="' . stripslashes($s2['s2_confirm_subject']) . '" />';
404
- echo "</td></tr>\r\n";
405
- echo '<tr><td colspan="2">';
406
- echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
407
- echo '<textarea cols="80" rows="5" name="s2_confirm_email">' . stripslashes($s2['s2_confirm_email']) . '</textarea>';
408
- echo "</td></tr>\r\n";
409
- echo "<tr><td>\r\n";
410
- echo __('Subscribe notification subject sent to admin', 'subscribe2') . ":<br />\r\n";
411
- echo '<input type="text" size="50" name="s2_subscribed_admin_subject" value="' . stripslashes($s2['s2_subscribed_admin_subject']) . '" />';
412
- echo "</td><td>\r\n";
413
- echo __('Unsubscribe notification subject sent to admin', 'subscribe2') . ":<br />\r\n";
414
- echo '<input type="text" size="50" name="s2_unsubscribed_admin_subject" value="' . stripslashes($s2['s2_unsubscribed_admin_subject']) . '" />';
415
- echo "</td></tr>\r\n";
416
- echo "</table>\r\n";
417
-
418
- echo '<fieldset class="options"><legend>' . __('Message substitions', 'subscribe2') . ":</legend>\r\n";
419
- echo '<ul>';
420
- echo '<li><b>BLOGNAME</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the blog's name", 'subscribe2') . "</li>\r\n";
421
- echo '<li><b>LINK</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the confirmation link for the user's request", 'subscribe2') . "</li>\r\n";
422
- echo '<li><b>MYNAME</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post author's name", 'subscribe2') . "</li>\r\n";
423
- echo '<li><b>EMAIL</b>: ' . __('replaced with', 'subscribe2') . ' ' . __("the post author's email", 'subscribe2') . "</li>\r\n";
424
- echo "</ul></fieldset></fieldset>\r\n";
425
-
426
- echo '<h2>' . __('Categories to Exclude', 'subscribe2') . "</h2>\r\n";
427
- echo '<table width="50%" cellspacing="2" cellpadding="5" class="editform" align="center">';
428
- echo '<tr><td width="50%" align="left">';
429
-
430
- // let's collect all of our excluded categories
431
- $excluded = array();
432
- $excluded = explode(',', $s2['s2_cats_to_skip']);
433
-
434
- // let's get an array of all the categories
435
- if (count($cache_categories) == 0) {
436
- update_category_cache();
437
- }
438
- $half = (count($cache_categories) / 2);
439
- $i = 0;
440
- $j = 0;
441
- foreach ($cache_categories as $cat) {
442
- if ( ($i > $half) && (0 == $j) ){
443
- echo '</td><td width="50%" align="right">';
444
- $j++;
445
- }
446
- if (0 == $j) {
447
- echo '<input type="checkbox" name="' . $cat->cat_ID . '" ';
448
- if (in_array($cat->cat_ID, $excluded)) {
449
- echo 'checked="checked" ';
450
- }
451
- echo '/>' . $cat->cat_name . "<br />\r\n";
452
- } else {
453
- echo $cat->cat_name . ' <input type="checkbox" name="' . $cat->cat_ID . '" ';
454
- if (in_array($cat->cat_ID, $excluded)) {
455
- echo 'checked="checked" ';
456
- }
457
- echo "/><br />\r\n";
458
- }
459
- $i++;
460
- }
461
- echo "</td></tr></table>\r\n";
462
- echo '<p align="center"><input type="submit" name="submit" value=' . __('submit', 'subscribe2') . ' /></p>';
463
- echo "</form>\r\n";
464
-
465
- echo '<h2>' . __('Reset Default', 'subscribe2') . "</h2>\r\n";
466
- echo '<fieldset class="options">';
467
- echo '<p>';
468
- _e('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2');
469
- echo "</p>";
470
- echo '<form method="POST">';
471
- echo '<p align="center">';
472
- echo '<input type="hidden" name="s2_admin" value="RESET" />';
473
- echo '<input type="submit" name="submit" value="' . __('RESET', 'subscribe2') . '" />';
474
- echo "</p></form></fieldset>\r\n";
475
-
476
- include(ABSPATH . '/wp-admin/admin-footer.php');
477
- // just to be sure
478
- die;
479
-
480
- } // s2_options
481
-
482
- ////////////////////
483
- function s2_manage() {
484
- global $admin_sent, $table_prefix, $wpdb;
485
-
486
- $s2_table = $table_prefix . "subscribe2";
487
-
488
- // check if we need to install the table
489
- $sql = "SELECT COUNT(id) FROM " . $s2_table;
490
- // turn errors off, for the momemnt
491
- $errors = $wpdb->hide_errors();
492
- $foo = $wpdb->get_var($sql);
493
- // turn errors back on
494
- $errors = $wpdb->show_errors();
495
- if ('' == $foo) { s2_install(); }
496
-
497
- // now try to figure out what we're supposed to do
498
- if (isset($_POST['s2_admin'])) {
499
- $admin = $_POST['s2_admin'];
500
- }
501
-
502
- if ('delete' == $admin) {
503
- s2_admin_delete();
504
- } elseif ('send' == $admin) {
505
- s2_admin_send();
506
- } elseif ('subscribe' == $admin) {
507
- s2_admin_subscribe();
508
- } elseif ('toggle' == $admin) {
509
- s2_admin_toggle();
510
- }
511
-
512
- load_plugin_textdomain('subscribe2');
513
-
514
- // get the list of confirmed subscribers
515
- $sql = "SELECT email FROM " . $s2_table . " WHERE active='1' ORDER BY email ASC";
516
- $confirmed = $wpdb->get_col($sql);
517
-
518
- // get unconfirmed subscribers
519
- $sql = "SELECT email,date FROM " . $s2_table . " WHERE active='0' ORDER BY email ASC";
520
- $unconfirmed = $wpdb->get_results($sql);
521
- if ('admin_sent' == $admin_sent) {
522
- echo '<div class="updated"><p align="center">' . __('Message delivered!', 'subscribe2') . "</p></div>\r\n";
523
- }
524
-
525
- echo '<div class="wrap">';
526
- echo '<h2>' . __('Admin Tools', 'subscribe2') . "</h2>\r\n";
527
- echo '<table width="100%"><tr><td align="left">';
528
- echo "<form method='POST'>\r\n";
529
- echo __('Subscribe Addresses', 'subscribe2') . ': (' . __('one per line, or comma-seperated', 'subscribe2') . ")<br />\r\n";
530
- echo '<textarea rows="10" cols="55" name="addresses"></textarea>';
531
- echo "<br />\r\n";
532
- echo '<input type="hidden" name="s2_admin" value="subscribe" />';
533
- echo '<input type="submit" name="submit" value="' . __('Subscribe', 'subscribe2') . '" />';
534
- echo '</form></td><td align="right">';
535
- echo "<form method='POST'>\r\n";
536
- echo __('Send email to all subscribers', 'subscribe2') . ':';
537
- echo '<input type="text" size="30" name="s2_subject" value="' . __('A message from ', 'subscribe2') . get_settings('blogname') . '" /> <br />';
538
- echo '<textarea rows="10" cols="55" name="message"></textarea>';
539
- echo "<br />\r\n";
540
- echo '<input type="hidden" name="s2_admin" value="send">';
541
- echo '<input type="submit" name="submit" value="' . __('Send', 'subscribe2') . '">&nbsp;';
542
- echo "</form></td></tr></table>\r\n";
543
- echo '<div style="clear: both;"><p>&nbsp;</p></div>';
544
- echo '<h2>' . __('Subscribers', 'subscribe2') . "</h2>\r\n";
545
- echo '<table width="45%" cellpadding="3" cellspacing="3" align="left">';
546
- echo '<tr><th colspan="3"><strong>' . __('Confirmed Subscribers', 'subscribe2') . ':</strong></th></tr>';
547
-
548
- if (is_array($confirmed)) {
549
- $alternate = 'alternate';
550
- foreach ($confirmed as $subscriber) {
551
- echo '<tr class="' . $alternate . '">';
552
- echo '<td width="5%" align="center"><form method="POST"><input type="hidden" name="email" value="' . $subscriber . '" /><input type="hidden" name="s2_admin" value="delete" /><input type="submit" name="submit" value=" X " /></form></td>';
553
- echo '<td align="center"><a href="mailto:' . $subscriber . '">' . $subscriber . "</a></td>\r\n";
554
- echo '<td width="5%" align="center"><form method="POST"><input type="hidden" name="email" value="' . $subscriber .'" /><input type="hidden" name="s2_admin" value="toggle" /><input type="submit" name="submit" value="-&gt;" /></form></td>';
555
- echo "</tr>\r\n";
556
- ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
557
- }
558
- } else {
559
- echo '<tr><td width="100%" align="center" colspan="3"><strong>' . __('NONE', 'subscribe2') . "</strong></td></tr>\r\n";
560
- }
561
- echo "</table>\r\n";
562
- echo '<table width="45%" cellpadding="3" cellspacing="3" align="right">';
563
- echo '<tr><th colspan="3"><strong>' . __('Uncomfirmed Subscribers', 'subscribe2') . ":</strong></th></tr>\r\n";
564
-
565
- if (is_array($unconfirmed)) {
566
- $alternate = 'alternate';
567
- foreach ($unconfirmed as $subscriber) {
568
- echo '<tr class="' . $alternate . '">';
569
- echo '<td width="5%" align="center"><form method="POST"><input type="hidden" name="email" value="' . $subscriber->email . '" /><input type="hidden" name="s2_admin" value="toggle" /><input type="submit" name="submit" value="&lt;-" /></form></td>';
570
- echo '<td align="center"><a href="mailto:' . $subscriber->email . '">' . $subscriber->email . "</a> (" . $subscriber->date . ")</td>\r\n";
571
- echo '<td width="5%" align="center"><form method="POST"><input type="hidden" name="email" value="' . $subscriber->email . '" /><input type="hidden" name="s2_admin" value="delete" /><input type="submit" name="submit" value=" X " /></form></td>';
572
- echo "</tr>\r\n";
573
- ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
574
- }
575
- } else {
576
- echo '<tr><td width="100%" align="center" colspan="3"><strong>' . __('NONE', 'subscribe2') . "</strong></td></tr>\r\n";
577
- }
578
-
579
- echo "</table>\r\n";
580
- echo '<div style="clear: both;"><p>&nbsp;</p></div>';
581
- echo "</div>\r\n";
582
-
583
- include(ABSPATH . '/wp-admin/admin-footer.php');
584
- // just to be sure
585
- die;
586
- } // end s2_manage
587
-
588
- /////////////////////////////
589
- function s2_admin_subscribe() {
590
- global $wpdb, $table_prefix;
591
-
592
- $s2_table = $table_prefix . "subscribe2";
593
-
594
- foreach (preg_split ("/[\s,]+/", $_POST['addresses']) as $email) {
595
- if (is_email($email)) {
596
- if (! $wpdb->get_var("SELECT id FROM $s2_table WHERE email='$email'")) {
597
- $wpdb->query("INSERT INTO $s2_table (email, active) VALUES ('$email', '1')");
598
- }
599
- }
600
- } // foreach...
601
-
602
- $_POST['s2_admin'] = '';
603
- s2_manage();
604
- die; // just to be sure
605
- } // s2_admin_subscribe
606
-
607
- //////////////////////////
608
- function s2_admin_delete() {
609
- global $wpdb, $table_prefix;
610
-
611
- $s2_table = $table_prefix . "subscribe2";
612
-
613
- if ( (isset($_POST['email'])) && ('' != $_POST['email']) && ( is_email($_POST['email'])) ) {
614
- $email = $_POST['email'];
615
- if ($wpdb->get_var("SELECT id FROM $s2_table WHERE email = '$email'")) {
616
- $result = $wpdb->query("DELETE FROM $s2_table WHERE email = '$email'");
617
- }
618
- }
619
- $_POST['s2_admin'] = '';
620
- s2_manage();
621
- die; // just to be sure
622
- } // s2_admin_delete;
623
-
624
- //////////////////////////
625
- function s2_admin_toggle() {
626
- global $wpdb, $table_prefix;
627
-
628
- $s2_table = $table_prefix . "subscribe2";
629
-
630
- if ( (isset($_POST['email'])) && ('' != $_POST['email']) && ( is_email($_POST['email'])) ) {
631
- $email = $_POST['email'];
632
- $sql = "SELECT active FROM $s2_table WHERE email='$email'";
633
- $active = $wpdb->get_var($sql);
634
- if ('0' === $active) {
635
- $foo = '1';
636
- } elseif ('1' == $active) {
637
- $foo = '0';
638
- }
639
- if (isset($foo)) {
640
- $sql = "UPDATE $s2_table SET active='$foo' where email='$email'";
641
- $result = $wpdb->query($sql);
642
- }
643
- }
644
- $_POST['s2_admin'] = '';
645
- s2_manage();
646
- die();
647
- } // end s2_admin_toggle
648
-
649
- ///////////////////////
650
- function s2_admin_send() {
651
- global $dreamhost, $wpdb, $table_prefix, $user_identity, $user_email;
652
-
653
- if ( (! isset($_POST['message'])) || ('' == $_POST['message'])) {
654
- s2_manage();
655
- }
656
-
657
- get_currentuserinfo();
658
- $subject = $_POST['s2_subject'];
659
- $mailtext = stripslashes($_POST['message']);
660
-
661
- $s2_table = $table_prefix . "subscribe2";
662
-
663
- // Set sender details
664
- $headers = "From: \"$user_identity\" <" . $user_email . ">\n";
665
-
666
- // get the list of active recipients from the database
667
- $sql = "SELECT email FROM $s2_table WHERE active='1'";
668
- $recipients = $wpdb->get_col($sql);
669
- if (count($recipients) == 0) {
670
- // <admiral ackbar> it's a trap!! </ackbar>
671
- s2_manage();
672
- }
673
-
674
- // BCC all recipients
675
- // with batching for Dreamhost
676
- if (1 == $dreamhost) {
677
- $count = 1;
678
- $bcc = '';
679
- $batch = array();
680
- foreach ($recipients as $recipient) {
681
- $recipient = trim($recipient);
682
- if (! empty($recipient)) {
683
- $bcc .= "BCC: " . $recipient . "\n";
684
- }
685
- if (30 == $count) {
686
- $batch[] = $bcc;
687
- $count = 1;
688
- $bcc = '';
689
- } else {
690
- $count++;
691
- }
692
- }
693
- if (0 == count($batch)) {
694
- // we have less than 30 subscribers, so let's skip batching
695
- $headers .= $bcc;
696
- unset($batch);
697
- }
698
- } else {
699
- foreach ($recipients as $recipient) {
700
- $recipient = trim($recipient);
701
- if (! empty($recipient)) {
702
- $headers .= "BCC: " . $recipient . "\n";
703
- }
704
- }
705
- }
706
-
707
- $s2 = get_option('s2_options');
708
- if ('html' == $s2['s2_html']) {
709
- $mailtext = "<html><head><title>$subject</title></head><body>$mailtext</body></html>";
710
- $headers .= "MIME-Version: 1.0\n";
711
- $headers .= "Content-type: " . get_bloginfo('html_type') . "; charset=\"". get_bloginfo('charset') . "\"\n";
712
- } else {
713
- $headers .= "MIME-Version: 1.0\n";
714
- $headers .= "Content-type: text/plain; charset=\"" . get_bloginfo('charset') . "\"\n" ;
715
- }
716
-
717
- if ( (1 == $dreamhost) && (isset($batch)) ) {
718
- foreach ($batch as $bcc) {
719
- $newheaders = $headers . $bcc;
720
- @wp_mail($myemailadd, $subject, $mailtext, $newheaders);
721
- }
722
- } else {
723
- @wp_mail($user_email, $subject, $mailtext, $headers);
724
- }
725
-
726
- $_POST['s2_admin'] = '';
727
- global $admin_sent;
728
- $admin_sent = 'admin_sent';
729
- s2_manage();
730
- die();
731
- } // s2_admin_send()
732
-
733
- ///////////////////////////
734
- function s2_options_update() {
735
- global $cache_categories;
736
-
737
- if (0 == count($cache_categories)) {
738
- update_categories_cache();
739
- }
740
-
741
- $exclude_list = '';
742
-
743
- foreach ($cache_categories as $cat) {
744
- if (isset($_POST[$cat->cat_ID])) {
745
- if ('' == $exclude_list) {
746
- $exclude_list = "$cat->cat_ID";
747
- } else {
748
- $exclude_list .= ",$cat->cat_ID";
749
- }
750
- }
751
- }
752
-
753
- $s2 = array ('s2_html' => $_POST['s2_html'],
754
- 's2_sender' => $_POST['s2_sender'],
755
- 's2_excerpt' => $_POST['s2_excerpt'],
756
- 's2_subject' => $_POST['s2_subject'],
757
- 's2_mailtext' => $_POST['s2_mailtext'],
758
- 's2_welcome' => $_POST['s2_welcome'],
759
- 's2_confirm_subject' => $_POST['s2_confirm_subject'],
760
- 's2_confirm_email' => $_POST['s2_confirm_email'],
761
- 's2_invalid' => $_POST['s2_invalid'],
762
- 's2_self' => $_POST['s2_self'],
763
- 's2_already_there' => $_POST['s2_already_there'],
764
- 's2_not_there' => $_POST['s2_not_there'],
765
- 's2_add_confirm' => $_POST['s2_add_confirm'],
766
- 's2_delete_confirm' => $_POST['s2_delete_confirm'],
767
- 's2_added' => $_POST['s2_added'],
768
- 's2_deleted' => $_POST['s2_deleted'],
769
- 's2_subscribed_admin_subject' => $_POST['s2_subscribed_admin_subject'],
770
- 's2_unsubscribed_admin_subject' => $_POST['s2_unsubscribed_admin_subject'],
771
- 's2_cats_to_skip' => $exclude_list
772
- );
773
-
774
- update_option('s2_options', $s2);
775
-
776
- $_POST['s2_admin'] = "";
777
- s2_options();
778
- die;
779
- } // s2_options_update
780
-
781
-
782
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wp-content/subscribe2/subscribe2.mo DELETED
Binary file
wp-content/subscribe2/subscribe2.pot DELETED
@@ -1,318 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: subscribe2\n"
4
- "POT-Creation-Date: \n"
5
- "PO-Revision-Date: 2005-07-29 23:16-0500\n"
6
- "Last-Translator: skippy <skippy@skippy.net>\n"
7
- "Language-Team: skippy <skippy@skippy.net>\n"
8
- "MIME-Version: 1.0\n"
9
- "Content-Type: text/plain; charset=utf-8\n"
10
- "Content-Transfer-Encoding: 8bit\n"
11
- "X-Poedit-Language: English\n"
12
- "X-Poedit-Country: United States\n"
13
- "X-Poedit-KeywordsList: __;_e\n"
14
- "X-Poedit-Basepath: .\n"
15
- "X-Poedit-SearchPath-0: .\n"
16
-
17
- #: subscribe2.php:25
18
- #: subscribe2.php:516
19
- msgid "Subscribers"
20
- msgstr ""
21
-
22
- #: subscribe2.php:26
23
- msgid "Subscribe2 Options"
24
- msgstr ""
25
-
26
- #: subscribe2.php:26
27
- msgid "Subscribe2"
28
- msgstr ""
29
-
30
- #: subscribe2.php:265
31
- msgid "Notification Settings"
32
- msgstr ""
33
-
34
- #: subscribe2.php:268
35
- msgid "Email Options"
36
- msgstr ""
37
-
38
- #: subscribe2.php:269
39
- msgid "Send email as"
40
- msgstr ""
41
-
42
- #: subscribe2.php:274
43
- msgid "HTML"
44
- msgstr ""
45
-
46
- #: subscribe2.php:279
47
- msgid "Plain Text"
48
- msgstr ""
49
-
50
- #: subscribe2.php:280
51
- msgid "Send Email From"
52
- msgstr ""
53
-
54
- #: subscribe2.php:285
55
- msgid "Author of the post"
56
- msgstr ""
57
-
58
- #: subscribe2.php:290
59
- msgid "Blog Admin"
60
- msgstr ""
61
-
62
- #: subscribe2.php:291
63
- msgid "Amount of post to deliver"
64
- msgstr ""
65
-
66
- #: subscribe2.php:293
67
- msgid "None"
68
- msgstr ""
69
-
70
- #: subscribe2.php:293
71
- msgid "Excerpt Only"
72
- msgstr ""
73
-
74
- #: subscribe2.php:293
75
- msgid "Full Post"
76
- msgstr ""
77
-
78
- #: subscribe2.php:303
79
- msgid "Email Template"
80
- msgstr ""
81
-
82
- #: subscribe2.php:304
83
- msgid "Subject"
84
- msgstr ""
85
-
86
- #: subscribe2.php:304
87
- #: subscribe2.php:308
88
- msgid "must not be empty"
89
- msgstr ""
90
-
91
- #: subscribe2.php:308
92
- msgid "Message"
93
- msgstr ""
94
-
95
- #: subscribe2.php:312
96
- #: subscribe2.php:390
97
- msgid "Message substitions"
98
- msgstr ""
99
-
100
- #: subscribe2.php:316
101
- #: subscribe2.php:317
102
- #: subscribe2.php:318
103
- #: subscribe2.php:319
104
- #: subscribe2.php:323
105
- #: subscribe2.php:324
106
- #: subscribe2.php:325
107
- #: subscribe2.php:326
108
- #: subscribe2.php:392
109
- #: subscribe2.php:393
110
- #: subscribe2.php:394
111
- #: subscribe2.php:395
112
- msgid "replaced with"
113
- msgstr ""
114
-
115
- #: subscribe2.php:318
116
- msgid "the post's title"
117
- msgstr ""
118
-
119
- #: subscribe2.php:319
120
- msgid "blank, the excerpt, or the entire post, based on the option set above"
121
- msgstr ""
122
-
123
- #: subscribe2.php:323
124
- msgid "the post's permalink"
125
- msgstr ""
126
-
127
- #: subscribe2.php:324
128
- msgid "a link to your subscribe.php file"
129
- msgstr ""
130
-
131
- #: subscribe2.php:325
132
- #: subscribe2.php:394
133
- msgid "the post author's name"
134
- msgstr ""
135
-
136
- #: subscribe2.php:326
137
- #: subscribe2.php:395
138
- msgid "the post author's email"
139
- msgstr ""
140
-
141
- #: subscribe2.php:333
142
- msgid "Subscription Messages"
143
- msgstr ""
144
-
145
- #: subscribe2.php:334
146
- msgid "Website messages"
147
- msgstr ""
148
-
149
- #: subscribe2.php:337
150
- msgid "Welcome message"
151
- msgstr ""
152
-
153
- #: subscribe2.php:341
154
- msgid "Invalid email was supplied"
155
- msgstr ""
156
-
157
- #: subscribe2.php:344
158
- msgid "Your email was supplied"
159
- msgstr ""
160
-
161
- #: subscribe2.php:348
162
- msgid "Known email was supplied"
163
- msgstr ""
164
-
165
- #: subscribe2.php:351
166
- msgid "Non-existant email supplied"
167
- msgstr ""
168
-
169
- #: subscribe2.php:355
170
- msgid "Subscribe confirmation email dispatched"
171
- msgstr ""
172
-
173
- #: subscribe2.php:358
174
- msgid "Unsubscribe confirmation email dispatched"
175
- msgstr ""
176
-
177
- #: subscribe2.php:362
178
- msgid "Successful subscription message"
179
- msgstr ""
180
-
181
- #: subscribe2.php:365
182
- msgid "Successful deletion message"
183
- msgstr ""
184
-
185
- #: subscribe2.php:371
186
- msgid "Email messages"
187
- msgstr ""
188
-
189
- #: subscribe2.php:374
190
- msgid "Subject line for all confirmation emails"
191
- msgstr ""
192
-
193
- #: subscribe2.php:378
194
- msgid "Subscribe / Unsubscribe confirmation email"
195
- msgstr ""
196
-
197
- #: subscribe2.php:382
198
- msgid "Subscribe notification subject sent to admin"
199
- msgstr ""
200
-
201
- #: subscribe2.php:385
202
- msgid "Unsubscribe notification subject sent to admin"
203
- msgstr ""
204
-
205
- #: subscribe2.php:392
206
- msgid "the blog's name"
207
- msgstr ""
208
-
209
- #: subscribe2.php:393
210
- msgid "the confirmation link for the user's request"
211
- msgstr ""
212
-
213
- #: subscribe2.php:398
214
- msgid "Categories to Exclude"
215
- msgstr ""
216
-
217
- #: subscribe2.php:434
218
- msgid "submit"
219
- msgstr ""
220
-
221
- #: subscribe2.php:437
222
- msgid "Reset Default"
223
- msgstr ""
224
-
225
- #: subscribe2.php:440
226
- msgid "Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers."
227
- msgstr ""
228
-
229
- #: subscribe2.php:445
230
- msgid "RESET"
231
- msgstr ""
232
-
233
- #: subscribe2.php:494
234
- msgid "Message delivered!"
235
- msgstr ""
236
-
237
- #: subscribe2.php:498
238
- msgid "Admin Tools"
239
- msgstr ""
240
-
241
- #: subscribe2.php:501
242
- msgid "Subscribe Addresses"
243
- msgstr ""
244
-
245
- #: subscribe2.php:501
246
- msgid "one per line, or comma-seperated"
247
- msgstr ""
248
-
249
- #: subscribe2.php:505
250
- msgid "Subscribe"
251
- msgstr ""
252
-
253
- #: subscribe2.php:508
254
- msgid "Send email to all subscribers"
255
- msgstr ""
256
-
257
- #: subscribe2.php:509
258
- msgid "A message from "
259
- msgstr ""
260
-
261
- #: subscribe2.php:513
262
- #: subscribe.php:95
263
- msgid "Send"
264
- msgstr ""
265
-
266
- #: subscribe2.php:518
267
- msgid "Confirmed Subscribers"
268
- msgstr ""
269
-
270
- #: subscribe2.php:531
271
- #: subscribe2.php:548
272
- msgid "NONE"
273
- msgstr ""
274
-
275
- #: subscribe2.php:535
276
- msgid "Uncomfirmed Subscribers"
277
- msgstr ""
278
-
279
- #: subscribe.php:92
280
- msgid "Your email"
281
- msgstr ""
282
-
283
- #: subscribe.php:93
284
- msgid "subscribe"
285
- msgstr ""
286
-
287
- #: subscribe.php:94
288
- msgid "unsubscribe"
289
- msgstr ""
290
-
291
- #: subscribe.php:98
292
- msgid "Note"
293
- msgstr ""
294
-
295
- #: subscribe.php:98
296
- msgid "values personal privacy"
297
- msgstr ""
298
-
299
- #: subscribe.php:99
300
- msgid "This list is used solely to inform you when new posts are added."
301
- msgstr ""
302
-
303
- #: subscribe.php:101
304
- msgid "Your email address will not be shared with any other party"
305
- msgstr ""
306
-
307
- #: subscribe.php:103
308
- msgid "Return to "
309
- msgstr ""
310
-
311
- #: subscribe.php:173
312
- msgid "The following email address has successfully subscribed to your blog"
313
- msgstr ""
314
-
315
- #: subscribe.php:199
316
- msgid "The following email address has successfully unsubscribed from your blog"
317
- msgstr ""
318
-